[Insight-developers] Just checked in: Support for vector images in itk::NiftiImageIO.cxx

Kent Williams kent at psychiatry.uiowa.edu
Wed Apr 5 16:43:32 EDT 2006


This was development driven by local requirements @ U of Iowa, but 
should be of general interest.

I've added support for vector images in itk::NiftiImageIO. I added a 
test to Insight/Testing/Code/IO as well.  I would appreciate any 
feedback from those of you who regularly use vector images.

If you write out a vector image, it sets the intent to 
NIFTI_INTENT_VECTOR.   NIfTI, as it happens, supports a load of 
different intent codes that all boil down to vector types, but coming 
from ITK, you don't know if another intent code would be more 
appropriate.  Unfortunately, given the way ImageIO works internally, 
getting a handle for the itk::NiftiImageIO object from your file writer, 
and setting the intent code won't work, since it will be overwritten in 
WriteImageInformation.

NIfTI also defines a couple of matrix types, which I haven't added 
support for.  That wouldn't be a huge amount of work because the data 
ordering in the file works the same as with vectors.

NIfTI  stores things a little strangely (to my mind) with respect to 
vectors -- for a volume of vectors, it's stored as a series of volumes, 
one per vector component. In other words I have to premute axes when I 
read and write nifti files, basically

ITKVectorArray[t][z][y][x][vec] <=> NIfTIVectorArray[vec][t][z][y][x]

I did the permutation in-line in itkNiftiImageIO.cxx.  I couldn't find 
anything to re-use in ITK to do the permutation, short of creating an 
itk::Image from the image data and using itk::PermuteAxesImageFilter.  
So I use brute force nested loops.  Anyone has a better idea let me know.



More information about the Insight-developers mailing list