[Insight-developers] Problem in reading 5D nifti image

Williams, Norman K norman-k-williams at uiowa.edu
Fri Feb 18 12:47:01 EST 2011


This is more of a question for the Insight-Users mailing list.

That being said, you don't show your work, so I can't say exactly what you're doing wrong.

I wrote the NIfTI image reader, and as I remember there's some strange things that go on with respect to  Images with dimension > 3.

If I recall correctly, in a NIfTI image dimensions of [ 128 128 64 1 6 ] would not correspond to an 5D scalar image at all.  It would be a 3D image where each voxel is a 6-element vector.  The 4th dimension is ALWAYS interpreted as a time dimension, and the sixth and subsequent dimensions are interpreted according to what the image modality actually was.  Most often, and what's implemented in the reader, is to interpret it as an Image of Vector voxels. So NiftiImageIO reads in 6 3D volumes, and then constructs vector pixels by pulling one pixel from each of the volumes.

In other words if you used

typedef itk::Image< itk::Vector<float, 6>, 3 > ImageType;
typedef itk::ImageFileReader<Imagetype> ImageReaderType;

You would get all the data.  If you use

typedef itk::Image<float, 3> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;

the ImageFileReader will think that it's a vector image and try to convert the vector voxels to a scalar voxel, probably by taking the first value of each voxel's vector.  It will then report the image size as you reported.

From: Hsieh <M.Hsieh at student.tudelft.nl<mailto:M.Hsieh at student.tudelft.nl>>
Date: Fri, 18 Feb 2011 16:35:07 +0100
To: ITK <insight-developers at itk.org<mailto:insight-developers at itk.org>>
Subject: [Insight-developers] Problem in reading 5D nifti image

Hi,

I am trying to read a diffusion tensor image in nifti(.nii) format, which has dimension of [128 128 64 1 6]. However, the image I got after read by the itkImageFileReader.h had dimension only [128 128 64 1 1]. The last two dimension are suppressed by the reader. When I looked into the class (.h) and the .txx file, I found out that the numberOfDimensionsIO, which is 3, is smaller than TOutputImage::ImageDimension, which is set manually to 5, so that the 4th and the 5th dimension are set to 1 later. Why does that happen? numberOfDimensionsIO should be 5 in this case.

Best regards,
Meng-Kang Hsieh (Michael)
OpSciTech, Erasmus Mundus
Delft University of Technology


_______________________________________________ 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.html 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

________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110218/fb0958af/attachment.htm>


More information about the Insight-developers mailing list