[Insight-users] [vtkusers] itk::VTKImageToImageFilter Questions

David Doria daviddoria at gmail.com
Sat Jan 29 07:35:05 EST 2011


On Fri, Jan 28, 2011 at 8:09 PM, Alexis Cheng <acheng_1221 at hotmail.com>wrote:

>  Hi all,
>
> I'm having a bit of trouble using the itk::VTKImageToImageFilter class. My
> program crashes on runtime. The following is a snippet of my code.
>
> static const unsigned int Dimension = 2;
> typedef  float           PixelType;
> typedef itk::Image< PixelType, Dimension >  FixedImageType;
> typedef itk::VTKImageToImageFilter<FixedImageType> VTKImageToITKImageType;
>
> vtkSmartPointer<vtkImageData> USImage =
> vtkSmartPointer<vtkImageData>::New();
> VTKImageToITKImageType::Pointer VTKToITKConnector =
> VTKImageToITKImageType::New();
>
> vector<FixedImageType::Pointer> *ImagePanorama;
> ImagePanorama = NULL;
> vector<FixedImageType::Pointer>::iterator PanoramaIterator;
> USImage->SetScalarTypeToUnsignedChar();
> USImage->SetDimensions(960,480,1);
> USImage->SetSpacing(1,1,1);
> USImage = sonixGrabber->GetOutput();
> USImage->Update();
>
> VTKToITKConnector->SetInput(USImage);
> VTKToITKConnector->Execute();
>
> FixedImageType::Pointer ITKImagePointer = FixedImageType::New();
> ITKImagePointer = VTKToITKConnector->GetImporter()->GetOutput();
> ITKImagePointer->Update();
>
> I've isolated the error to the usage of VTKImageToImageFilter. I haven't
> had any luck finding examples that used this filter. What is the correct
> pipeline for using this filter? Thank you all in advance.
>
> Regards,
> Alexis Cheng
> University of British Columbia
> Electrical Engineering
>

Alexis,

Please see:
http://www.itk.org/Wiki/ITK/Examples/Broken/Images/VTKImageToImageFilter

We are currently working on improving these classes, but the above example
demonstrates the current capability.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110129/39f3aa56/attachment.htm>


More information about the Insight-users mailing list