[Insight-users] VTK to ITK

Iván Macía imacia at vicomtech.es
Thu Mar 2 04:34:38 EST 2006


Hi Marta, 

You need to assign the connector to an smart pointer so it keeps a
reference. Otherwise the newly created object is automatically destroyed

Try

VtkToItkConnectorType::Pointer filter = VtkToItkConnectorType::New();

And then use filter the same way. 
Hope that helps

Iván

 

-----Mensaje original-----
De: insight-users-bounces+imacia=vicomtech.es at itk.org
[mailto:insight-users-bounces+imacia=vicomtech.es at itk.org] En nombre de
Marta Kersten
Enviado el: jueves, 02 de marzo de 2006 10:13
Para: insight-users at itk.org
Asunto: [Insight-users] VTK to ITK 


Hi,

I'm having trouble converting a SLC vtk volume to an itk image. I am using
the itk::VTKImageToImageFilter but whenever I try to set the input to the
filter I get a segmentation fault (the code is below)... would anyone have
any ideas?

Thanks,
Marta


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

vtkImageData *volume = slcReader->GetOutput();
volume->PrintSelf(std::cout, 4);

typedef  itk::Image<short,3>  ImageType;
typedef  itk::VTKImageToImageFilter<ImageType>    VtkToItkConnectorType;

VtkToItkConnectorType *filter = VtkToItkConnectorType::New();
filter->SetInput(volume);  /****************seg faults
here**********************/
filter->Update();

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

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



_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006
 



More information about the Insight-users mailing list