[vtkusers] [Insight-users] Convert vtkImageData to itk Image
David Doria
daviddoria at gmail.com
Wed Sep 7 12:32:11 EDT 2011
On Wed, Sep 7, 2011 at 12:27 PM, Jothy <jothybasu at gmail.com> wrote:
> Hi all,
>
> I am trying to convert a vtkImageData into a itk image. I tried the
> following as given in the itk examples wiki.
>
> typedef itk::Image<float, 2> ImageType;
>
> typedef itk::VTKImageToImageFilter<ImageType> VTKImageToImageType;
>
> VTKImageToImageType::Pointer vtkImageToImageFilter =
> VTKImageToImageType::New();
>
> vtkImageToImageFilter->SetInput(inputVTKImage);
>
> vtkImageToImageFilter->Update();
>
> But the program crashes. I found in the users list that
> VTKImageToImageFilter is not supposed to be used directly. I am new to itk
> and it seems to be highly templated.
>
> I am a novice new c++ user to decipher the itk templates fully. Is there any
> easy to follow example on this?
>
> Thanks
>
> Jothy
Is this the example you were looking at
http://www.itk.org/Wiki/ITK/Examples/Broken/Images/VTKImageToImageFilter
?
The problem with itkVTKImageToImageFilter is that it expects a single
channel (grayscale) input. What kind of image are you trying to
convert?
David
More information about the vtkusers
mailing list