[Insight-users] Problem in reading nifti image

Hsieh M.Hsieh at student.tudelft.nl
Mon Feb 21 13:36:13 EST 2011


Hi,

 

Now I send it to Insight-Users mailing list.

My purpose is to extract elements from the tensor image to analyze and
register the tensor channels. With your help now I can do so with vector
image adaptor, which extracts one of the element of the vector. However,
in the example of ImageAdaptor3.cxx, the adaptor itself cannot directly
be fed into the writer to create a scalar image. It is shown that a
filter, such as rescaling the intensity, has to be done and therefore
the rescaler->GetOutput() can be set as the input image for writer. Is
there a way not to modify the intensity of the image? Is there an
identity filter or something like that?

 

Best regards,

Michael

 

 

 

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>
Date: Fri, 18 Feb 2011 16:35:07 +0100
To: ITK <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

 

 

Best regards,

Meng-Kang Hsieh (Michael)

OpSciTech, Erasmus Mundus

Delft University of Technology

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110221/e33e49ae/attachment.htm>


More information about the Insight-users mailing list