[Insight-users] VTK to ITK convesion error

Abayiz abayiz at yahoo.com
Fri Apr 1 07:56:48 EDT 2011


Hello,

I am trying to use a VTK based loader to load data, then convert it to ITK format to perform registration. But after the conversion, I found that the original data and the result data are not the same, I mean it seems like loses some kind of data information when converting.
The data types I used are as follows:

***********************************************
const unsigned int Dimension = 3;
typedef float InternalPixelType;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
typedef itk::VTKImageToImageFilter < InternalImageType >  VTK2ITKConnectorFilterType;

vtkImageCast* VtkCasterFixed = vtkImageCast::New(); // Casting to float in VTK is needed
VtkCasterFixed->SetInput(VTKreader->GetOutput());
VtkCasterFixed->SetOutputScalarTypeToFloat();
   
VTK2ITKConnectorFilterType::Pointer VTK2ITKconnectorFixed = VTKImageToImageType::New();
VTK2ITKconnectorFixed->SetInput( VtkCasterFixed->GetOutput());
VTK2ITKconnectorFixed->GetImporter()->Update();
**********************************************

I used VTK to visualize the output of "VtkCasterFixed", and it was correct. So, the error should happened when I connect it to the "VTK2ITKConnectorFixed". The visualization result of "VTK2ITKConnectorFixed" is not the same as the original one. How can I fix this?

Hope to receive your helpful suggestions. Thank you in advance!


      



More information about the Insight-users mailing list