[Insight-users] VTKImageToImageFilter / SmartPointers

Marta Kersten kersten at cs.queensu.ca
Fri Feb 17 07:30:23 EST 2006


Hello,

I'm trying to read in an SLC file to a vtkImageData object and then  
convert this to an itk::Image. I am using the itk::VTKImageToImageFilter  
but my problem is that the filter returns a constant and I need it to not  
be constant -- can someone help me out?

Thanks,
Marta

//THE CODE

	// read SLC file
  	vtkSLCReader *slcReader = vtkSLCReader::New();
	slcReader->SetFileName(filename);
	slcReader->Update();
	
	vtkImageData *volume = slcReader->GetOutput();

	typedef  itk::Image<short,3>  ImageType;
	typedef  itk::VTKImageToImageFilter<ImageType>    VtkToItkConnectorType;
  	
	VtkToItkConnectorType *filter = VtkToItkConnectorType::New();
	filter->SetInput(volume);

	ImageType::ConstPointer itkImage = filter->GetOutput();

/************this doesn't work**********************/
	if(fixed == FIXED)
		my_fixedImage = itkImage;
	else
		my_movingImage = itkImage;
/************************************************/

-- 
http://www.kerstens.org/marta/


More information about the Insight-users mailing list