[Insight-users] VTK volume to ITK image conversion crash

David Brayford dbrayford at gmail.com
Mon Aug 8 12:11:49 EDT 2011


Hi,

I am trying to convert a VTK volume and use it to generate a DRR.
However, the following code (see below) crashes when the command
VTK_to_ITK_filter->Update();
 is executed. Any suggestions on how I go about fixing this problem?

	typedef itk::Image< InputPixelType,  Dimension >   InputImageType;
	typedef itk::Image< OutputPixelType, Dimension >   OutputImageType;

	InputImageType::ConstPointer imagePtr;

	vtkImageData * vol = data->GetVolume()->getImageData();

	typedef itk::VTKImageToImageFilter<InputImageType> VTKToITKConnector;
    VTKToITKConnector::Pointer VTK_to_ITK_filter = VTKToITKConnector::New();

    VTK_to_ITK_filter->SetInput(vol);
    VTK_to_ITK_filter->Update();

	imagePtr = VTK_to_ITK_filter->GetOutput();

Thanks
David


More information about the Insight-users mailing list