[ITK] Reading 4D Nifti into a 3D Vector Image

Matt McCormick matt.mccormick at kitware.com
Mon Jan 12 17:27:42 EST 2015


Hi Tobias,

This may be the case -- I am not an NIFTI expert.  Another alternative
may then be to use a 4D vector image type, then use ExtractImageFilter
to remove the fourth dimension.

HTH,
Matt

On Mon, Jan 12, 2015 at 4:51 PM, Wood, Tobias <tobias.wood at kcl.ac.uk> wrote:
> Dear Matt and Brad,
> Thanks for the quick response. The approach you suggested sounds good, so I gave it a try using itk::VectorImage<float, 3> and itk::ImageFileReader. However, this appears to read 4D niftis as only having 1 component (using the GetNumberOfComponentsPerPixel() method). I confirmed this by compiling the example at http://www.itk.org/Wiki/ITK/Examples/IO/ReadVectorImage and running it with multiple files that I have - it reported each one as having only 1 component.
>
> Is this to do with the choice of nifti format? Technically, vector images are supposed to use the 5th dimension as the vector length in nifti, not the 4th.
>
> Thanks,
> Tobias
>
> ________________________________________
> From: Matt McCormick <matt.mccormick at kitware.com>
> Sent: 12 January 2015 17:24
> To: Wood, Tobias
> Cc: community at itk.org
> Subject: Re: [ITK] Reading 4D Nifti into a 3D Vector Image
>
> Hi Tobias,
>
> For this case, it may be better to read in the image as an
>
>   itk::Image< itk::Vector< float, NumberOfComponents >, 3 >
>
> or
>
>   itk::VectorImage< float, 3 >
>
> HTH,
> Matt
>
> On Mon, Jan 12, 2015 at 11:33 AM, Wood, Tobias <tobias.wood at kcl.ac.uk> wrote:
>> Hello,
>>
>> I am new to ITK and am working with datasets that are stored as 4D niftis of
>> variable length in the 4th dimension. The algorithm I need to write takes
>> the "vector" stored in the 4th dimension as input at each voxel, and
>> produces some scalar values as output. I would like to write a filter to
>> contain this algorithm, but I am struggling to work out how to specify the
>> input and iterate efficiently over it.
>>
>>
>> My output image type is itk::Image<float, 3>. I assume that my input image
>> type should be itk::Image<float, 4>. Inside the filter, I was planning on
>> using ImageRegionIterator with GetLargestPossibleRegion() to iterate over
>> the output voxels.
>>
>>
>> Is there a suitable iterator and region to obtain the vector of values for
>> each input voxel efficiently? Or, alternatively, is there another approach
>> that I should be taking? Perhaps using another filter to convert the input
>> data first?
>>
>>
>> Thanks in advance and I hope my question is clear,
>>
>> Tobias Wood
>>
>>
>> _______________________________________________
>> Community mailing list
>> Community at itk.org
>> http://public.kitware.com/mailman/listinfo/community
>>


More information about the Community mailing list