[Insight-users] VTKImageToImageFilter causes seg faults

Markus Mehrwald mehrwald at ira.uka.de
Wed Jan 23 04:54:57 EST 2008


Hello,

I try to use a vtk image in itk via the VTKImageToImageFilter but for 
some reasons I always get a segmentation fault. I tried several code 
snippets but none of them works. It is always the same problem.
I need two images so I created two connectors but only one works no 
matter if I create two instances or only one new for every image. The 
code for both images is the same. Below I have some of my snippets. The 
image type in vtk is structured points.

1)
typedef VTKImageToImageFilter<Image3DType> ConnectorType;
connector = ConnectorType::New();
connector->SetInput(vtkimage);
connector->GetImporter()->Update();
fixed = connector->GetOutput();
//using "fixed" in other filter pipelines causes the seg fault on update

2)
connector = ConnectorType::New();
connector->SetInput(vtkimage);
connector->GetImporter()->Update();
itk::ImageDuplicator<Image3DType>::Pointer dup = 
itk::ImageDuplicator<Image3DType>::New();
dup->SetInputImage(connector->GetOutput());
dup->Update();  //causes the seg fault on calling memcpy
fixed = dup->GetOutput();

The second example fails for every image and the first on only after the 
second image.
Can anyone please help me finding the problem?

Thanks
Markus



More information about the Insight-users mailing list