[Insight-users] Runtime error while performing update.

Ruby Shamir rubke at cs.huji.ac.il
Thu Jul 15 06:38:34 EDT 2004


Hi all,

I tried to convert vtkImageData to itk::image (using
VTKImageToImageFilter)

, filter it with GradientMagnitudeImageFilter and then 

to convert it back to vtkImageData (using ImageToVTKImageFilter).

When tried to call update() the program terminates and display a
message:

"This application has requested the Runtime to terminate it in an
unusual way.
 Please contact the application's support team for more information"  

(See code below)

My questions are:

1. Why does it happen and how to avoid it?

2. How can I now what image type to define?
   (the data is 3D, but how can I know which pixel type to choose (I
choose unsigned int because for no reason))



vtkImageData * showVolume::cleanImageData (vtkImageData *
originalImageData){
	
	typedef itk::Image<unsigned int, 3>    ImageType;

	typedef itk::ImageToVTKImageFilter<ImageType>
itkToVtkConnectorType;
	typedef itk::VTKImageToImageFilter<ImageType>
vtkToItkConnectorType;
	
	typedef itk::GradientMagnitudeImageFilter<ImageType,ImageType>
gradientFilterType;
	typedef itk::DiscreteGaussianImageFilter<ImageType, ImageType>
gaussianFilterType;

	itkToVtkConnectorType::Pointer itkToVtkConnector =
itkToVtkConnectorType::New();
	vtkToItkConnectorType::Pointer vtkToItkConnector =
vtkToItkConnectorType::New();
	gradientFilterType::Pointer    gradientFilter    =
gradientFilterType::New();
    
	vtkToItkConnector->SetInput(originalImageData);
    
	gradientFilter ->SetInput(vtkToItkConnector->GetOutput());
      gradientFilter ->Update();

      itkToVtkConnector->SetInput(gradientFilter->GetOutput());
 
	return (itkToVtkConnector->GetOutput());

}



More information about the Insight-users mailing list