[vtkusers] vtkImageImporter

Simon Drouin drouin.simon at gmail.com
Wed Apr 27 10:08:12 EDT 2011


Hi all,

I use vtkImageImporter to import images I'm reading with ITK. After
importing the image, I delete the importer (and whatever is before the
importer in the pipeline). Something like this:

vtkImageImporter * importer = vtkImageImporter::New();
...
// setup importer
...
importer->Update();
vtkImageData * image = importer->GetOutput();
image->Register(0);

importer->Delete();

This approach works fine with other VTK readers and filters, but not with
vtkImporter.

When I try to use image after deleting the importer, the program crashes
while trying to update the part of the pipeline that has been deleted.

The only solution I've found so far is to deepcopy the output of
vtkImageImporter to another image and use the copy:

vtkImageData * imCopy;
imCopy->DeepCopy( importer->GetOutput() );
importer->Delete()

Is there any other way? With other filters, images seem to "detach" from the
filter that generated them. How does that happen? Why is it not happening
with vtkImageImporter?

Thanks in advance.

s.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110427/10cb855f/attachment.htm>


More information about the vtkusers mailing list