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

Miller, James V (Research) millerjv@crd.ge.com
Thu, 20 Mar 2003 10:21:01 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2EEF4.50ED8710
Content-Type: text/plain;
	charset="iso-8859-1"

Parag, 
 
After the reader executes, put is output image into your STL vector (but use
a vector of SmartPointers not a vector of pointers).  Then call
DisconnectPipeline on the output data object.  This will force the reader to
create a new output data object.
 
SomeImageType::Pointer tPtr;
tPtr = reader->GetOutput();
myVector.push_back( tPtr );
tPtr->DisconnectPipeline();
 
 

-----Original Message-----
From: Parag Chandra [mailto:pchandra@radonc.unc.edu]
Sent: Wednesday, March 19, 2003 2:58 PM
To: ITK Mailing List
Subject: [Insight-users] Question about filter fanout and object copying?


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


------_=_NextPart_001_01C2EEF4.50ED8710
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2715.400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff size=2>Parag, 
</FONT></SPAN></DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff size=2>After the reader 
executes, put is output image into your STL vector (but use a vector of 
SmartPointers not a vector of pointers).&nbsp; Then call DisconnectPipeline on 
the output data object.&nbsp; This will force the reader to create a new output 
data object.</FONT></SPAN></DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff 
size=2>SomeImageType::Pointer tPtr;</FONT></SPAN></DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff size=2>tPtr = 
reader-&gt;GetOutput();</FONT></SPAN></DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff 
size=2>myVector.push_back( tPtr );</FONT></SPAN></DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff 
size=2>tPtr-&gt;DisconnectPipeline();</FONT></SPAN></DIV>
<DIV><SPAN class=971061815-20032003><FONT color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=971061815-20032003></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Parag Chandra 
  [mailto:pchandra@radonc.unc.edu]<BR><B>Sent:</B> Wednesday, March 19, 2003 
  2:58 PM<BR><B>To:</B> ITK Mailing List<BR><B>Subject:</B> [Insight-users] 
  Question about filter fanout and object copying?<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I need to read in about a dozen different images 
  and keep them around in&nbsp;a std::vector&lt;Image*&gt;. To do this, 
  I&nbsp;want to use just&nbsp;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&nbsp;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.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Best regards,</FONT></DIV>
  <DIV><FONT face=Arial size=2>-Parag 
Chandra</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C2EEF4.50ED8710--