[Insight-developers] *.nii Endianness

Kevin H. Hobbs hobbsk at ohio.edu
Wed Jul 3 13:35:08 EDT 2013


On 07/03/2013 12:06 PM, Williams, Norman K wrote:
> Hey, I wrote the original NIFTIImageIO.

Awesome! Thank you.

> 
> Looking at the source, NIFTIImageIO doesn't mess with byte swapping at
> all; it expects niftilib to handle that byte order issues.

I may have tricked myself into seeing the bug in the first place.
What's the opposite of a schroedinbug?

ParaView certainly has this bug. I hope I just confused files I
converted with PV with the files I converted with ITK.

> 
> And niftilib's documentation indicates that byte swapping is handled
> internally:
> 
> nifti_image_read http://bit.ly/14NLSeb
> nifti_image_load http://bit.ly/1b7KoQt

I dutifully searched the ITK source for every nifti_image_read where I
found that we never did the read, and for every nifti_read_header where
we always ignore the swap variable. I didn't look for nifti_image_load.

> 
> As for your patch I can't see in ITK where it ever does anything with the
> m_ByteOrder flag.  Are you saying that setting this flag magically makes
> ITK reading of your NIfTI files work?
> 

A lot of ITK, and C++ for that matter, looks like magic to me.

Since I only found places where we read the image information I assumed
some other class that knows about m_ByteOrder but not
m_NiftiImage->byteorder did the raw read... It was stupid.

I'll check again with the ADNI data as soon as ITK rebuilds without my
patch.

Thank you for looking into this.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 255 bytes
Desc: OpenPGP digital signature
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130703/e1af96ee/attachment.pgp>


More information about the Insight-developers mailing list