Hi all,<div><br></div><div>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:<br><div>
<br></div><div><font class="Apple-style-span" face="'courier new', monospace">vtkImageImporter * importer = vtkImageImporter::New();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">... </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">// setup importer</font></div><div><font class="Apple-style-span" face="'courier new', monospace">...</font></div><div><font class="Apple-style-span" face="'courier new', monospace">importer->Update();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">vtkImageData * image = importer->GetOutput();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">image->Register(0);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">importer->Delete(); </font></div><div><br></div><div>
This approach works fine with other VTK readers and filters, but not with vtkImporter. </div><div><br></div><div>When I try to use <font class="Apple-style-span" face="'courier new', monospace">image</font> after deleting the importer, the program crashes while trying to update the part of the pipeline that has been deleted. </div>
<div><br></div><div>The only solution I've found so far is to deepcopy the output of vtkImageImporter to another image and use the copy:</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">vtkImageData * imCopy;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">imCopy->DeepCopy( importer->GetOutput() );</font></div><div><font class="Apple-style-span" face="'courier new', monospace">importer->Delete()</font></div>
<div><br></div><div>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?</div><div><br></div>
<div>Thanks in advance.</div><div><br></div><div>s. </div><div><br></div></div>