[Insight-users] Image data persistence

Tim Rudge tjr34 at cam . ac . uk
Fri, 30 May 2003 15:35:23 +0100


I have got ITK working with Amira for visualisation. So I get an Amira 
image, use ImportImageFilter to wrap the buffer as an ITK image. Then I 
apply some filter pipeline, and use Image::GetBufferPointer() to wrap the 
result data back as an Amira image. My code then exits and I pass on the 
amira image to the amira workspace.
The problem is that the ITK Image destroys the data when the code exits and 
deletes the smartpointer. I tried using the new operator to create the 
smart pointer so that it persists and so does the image and image data. 
This works, however the whole itk::Image persists (and cannot be deleted by 
amira) but I just want the data in the image.
Is there a neat way to do this without explicitly copying the data into 
another buffer and then deleting the itk::Image?

Thanks,
Tim

Tim Rudge
---------
Cellular Development Lab
Dept. Plant Sciences
Cambridge University