Hi Kevin, Thanks for the report. I have created an issue [1] in the issue tracker to keep track of the issue.
Thanks, Matt [1] https://issues.itk.org/jira/browse/ITK-3165 On Tue, Jul 2, 2013 at 5:53 PM, Kevin H. Hobbs <[email protected]> wrote: > I'm working on a set of files from ADNI with the extension ".nii". > > I don't really know the differences between NIFTI and Analyze formats. > > The values in the images differ when I read them with ITK or Paraview > from the values I get when I read them with Freesurfer or nifti_tool. > > I believe this is an endianness issue and I believe that ITK is ignoring > the endianness of the data. > > My machine runs Fedora 17 on x86_64 and I use ITK from a nightly > dashboard build. > > When I read a particular image of pixel type short, with freesurfer or > nifti_tool I see values in { 20, 21 }. > > When I read that same image in ITK or ParaView I see values in { 5120, > 5376 }. > > octave:13> disp(dec2hex ({20,5120,21,5376})) > 0014 > 1400 > 0015 > 1500 > > I looked at the file with hexdump and in the data part I see 0014 and > 0015 which are bigendian 20 and 21. > > I asked google about nifti endianness and the nifti header : > > http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields > > Endianness of the file is determined by looking at dim[0]. > > The dim field is an array of eight shorts beginning at offset 40. > > dim[0] holds the dimension of the image and is restricted to integer > values from 1 to 7. > > dim[1] to dim[7] hold the number of pixels along each dimension. > > According to hexdump the 3 dimensional image has "00 03" at byte offset > 40 so it must have been written on a bigendian machine. > > In my ITK reader I have: > > // Reader > typedef itk::ImageFileReader< SImageType > ReaderType; > ReaderType::Pointer reader = ReaderType::New(); > reader->SetFileName( in_file ); > reader->Update(); > std::cout > << "Read by : " > << reader->GetImageIO()->GetNameOfClass() << std::endl; > std::cout > << "Byte order is : " > << reader->GetImageIO()->GetByteOrderAsString( > reader->GetImageIO()->GetByteOrder() ) << std::endl; > > > and I get : > > Read by : NiftiImageIO > Byte order is : OrderNotApplicable > > ITK correctly interprets the bigendian dimensions "00a6 0100 0100" as > "166 256 256" instead of the rather strangely shaped little endian > interpretation "42496 1 1". > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.itk.org/mailman/listinfo/insight-developers > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://www.itk.org/mailman/listinfo/insight-developers
