I’ve a NifTi file and when I load it values are strangely scattered within scope of int_32. However, when I load the same file via NifTi-Python bindings, the value-range is different and correct. (I know that this is correct, as the producer of the file (FSL), claims only to produce values within that range.) So I want to check if the values are really stored in a different endianness (compared to other files), and if so, interpret those values correctly then.
Share
You can use the first field in the
nifti_1_headerstructure. It’ssizeof_hdrand it contains the size of the header (in my case a single 348 bytes structure rather than three smaller structs).Simply read first 4 bytes of the header, it should be
348(alias0x0000015C), if it has been written in big endian you’ll have0x5C010000(so on disk you’ll read5C 01 00 00for little endian and00 00 01 5Cfor big endian).