[Insight-users] Problem in writing vector images
Hsieh
M.Hsieh at student.tudelft.nl
Tue Apr 12 06:06:13 EDT 2011
Hi all,
Problem solved. The second argument in "typedef itk::VectorImage< DTIPixelType, 6> DTIOutputImageType;" should be the dimension of the image, which is 3, instead of 6, which I thought it was the vector length.
Best regards,
Meng-Kang Hsieh (Michael)
OpSciTech, Erasmus Mundus
Delft University of Technology
-----Original Message-----
From: David Doria [mailto:daviddoria at gmail.com]
Sent: Monday, April 11, 2011 8:07 PM
To: Hsieh
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Problem in writing vector images
On Mon, Apr 11, 2011 at 9:12 AM, Hsieh <M.Hsieh at student.tudelft.nl> wrote:
> Hi all,
>
>
>
> After extracting scalar components from vector image using
> itkVectorIndexSelectionCastImageFilter.h and some image processing on each
> of them, now I want to put these scalar images back into one vector image by
> using, idea searched from the insight user archive,
> itkImageToVectorImageFilter.h, a type conversion error occurred when I tried
> to write the "VectorImage" image from the output of
> itkImageToVectorImageFilter to the image file writer.
>
> Type definition are shown:
>
> typedef itk::DiffusionTensor3D< PixelType > DTIPixelType;
>
> typedef itk::Image< DTIPixelType, 3 > DTIImageType;
>
> typedef itk::VectorImage< DTIPixelType, 6> DTIOutputImageType;
>
> typedef itk::Image< PixelType, 3 > ScalarImageType;
>
> typedef itk::VectorIndexSelectionCastImageFilter< DTIImageType,
>
> ScalarImageType >
> VectorSelectType;
>
> typedef itk::ImageToVectorImageFilter< ScalarImageType >
> VectorCombineType;
>
>
>
> typedef itk::ImageFileReader< DTIImageType > ReaderType;
>
> typedef itk::ImageFileWriter< ScalarImageType > WriterType;
>
> typedef itk::ImageFileWriter< DTIOutputImageType > DTIWriterType;
>
>
>
> Error:
>
> If I assign a DTIOutputImageType::Pointer for the output of the
> ImageToVectorImageFilter and feed the writer the pointer, I get this
>
> 1>.\ImageReadExportNifti4.cxx(177) : error C2440: 'initializing' : cannot
> convert from 'itk::VectorImage<TPixel,VImageDimension> *' to
> 'itk::SmartPointer<TObjectType>'
>
>
>
> If I put the output of the ImageToVectorImageFilter directly to the writer,
> I get this
>
> 1>.\ImageReadExportNifti4.cxx(178) : error C2664:
> 'itk::ImageFileWriter<TInputImage>::SetInput' : cannot convert parameter 1
> from 'itk::VectorImage<TPixel,VImageDimension> *' to 'const
> itk::VectorImage<TPixel,VImageDimension> *'
>
>
>
> I wonder if the problem is caused by the typedef of the images. I'm confused
> between "Vector" image type and "VectorImage" image type. Is there a
> specific writer for the VectorImage type? Or is there another way to do what
> I intended, combining scalar images to one vector image?
>
>
>
> Thank you in advance for your response.
>
>
>
> Best regards,
>
> Meng-Kang Hsieh (Michael)
>
> OpSciTech, Erasmus Mundus
>
> Delft University of Technology
You can write an itkVectorImage directly as long as the filename ends
in .mhd (or another format that supports vector images).
There is a brief explanation of itkVectorImage here:
http://www.itk.org/Wiki/ITK/Examples/VectorImages/VectorImage
David
More information about the Insight-users
mailing list