[Insight-users] Question about filter fanout and object copying?

Luis Ibanez luis.ibanez@kitware.com
Wed, 19 Mar 2003 17:13:28 -0500


Hi Parag,

You already identified the two best options for this task.

I would suggest you to go with creating a new ImageFileReader
for each image. You just need three lines of code for this,
while the deep image copy will take about 20 to 30, will take
computing time, and extra temporary memory.


Hope that helps,


   Luis


-----------------------

Parag Chandra wrote:
> Hello,
>  
> I need to read in about a dozen different images and keep them around 
> in a std::vector<Image*>. To do this, I want to use just a single 
> ImageFileReader and push_back() the output of the reader onto the vector 
> inside of a loop. But I think this will cause a problem because each 
> time the reader is updated to read a new file, every element in the 
> vector will point to this most recent image, so really I will just end 
> up with a bunch of 'copies' of the last image read. So my question is, 
> should I just create a new ImageFileReader for each image that I want to 
> read in, or is there some way that I could perform a deep copy of the 
> Image and effectively break the link between the output of the reader 
> and the pointer stored in my vector? Thanks in advance.
>  
> Best regards,
> -Parag Chandra