[Insight-users] VTKImageImport - Input Components Mayhem

Christian Werner christian.werner at rwth-aachen.de
Mon Feb 15 16:04:23 EST 2010


Hello!

At first I want to thank Arunachalam and Wagner for their responses on 
my last thread, thanks! :-) I finally managed to implement my 
vtk2itk2vtk templated super-class. It works with one little flaw:

I have to SetNumberOfScalarComponents my vtkImageData to 1 before going 
through the whole conversion loop...
(ERROR: VTKImageImport(0x22900f0): Input number of components is 3 but 
should be 1)

This is bad, because the image content is clearly corrupted that way. It 
goes well through my vtk2itk2vtk and I can save a result vtk image, but 
this is distorted, as I fiddled around with these scalar components. 
Also the ITK filters I want to use on my import complain about

ERROR: In /opt/ParaView3/VTK/Filtering/vtkImageData.cxx, line 1473
vtkImageData (0x228afd0): GetScalarPointer: Pixel (0, 0, 0) not in memory.
 Current extent= (0, -1, 0, -1, 0, 0)


This is how my pipelines connect:

template <typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer)
{
  
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
  
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
  importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
  importer->SetSpacingCallback(exporter->GetSpacingCallback());
  importer->SetOriginCallback(exporter->GetOriginCallback());
  importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
  
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
  
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
  importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
  importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
  importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
  importer->SetCallbackUserData(exporter->GetCallbackUserData());
}

I hope this can easily be fixed as I am so happy that after working the 
whole day on that vtk2itk2vtk stuff I finally got a vtk image that goes 
through this conversion jungle. How can it be equipped to survive this 
adventure undistorted?


Best regards,
Christian


More information about the Insight-users mailing list