[Insight-users] Grabbing output from the middle of a pipeline

Miller, James V (Research) millerjv at crd.ge.com
Thu Jun 2 08:04:14 EDT 2005


Zachary. 

Your code snippets are pretty close.  The calls to ResetPipeline() is not 
necessary.  ResetPipeline() is really only needed when a pipeline execution
has been aborted and the pipeline needs to be rerun.  ResetPipeline() just
clears some internal state about what filters are currently executing.

To grab B's output, you are correct that after disconnecting the 
current output, you need to connect the "new" output of B to the input 
of C.

....

There is another mechanism that could be used for doing this (basically
stealing the PixelContainer from the output of B and giving B a new empty
PixelContainer).  We do this internally in some filters that use mini-pipelines.
This would be a very low-level approach.  It's only real benefit is that you
would not need to call C->SetInput(B->GetOutput()) since the DataObject is never
removed from the pipeline. This is a technique we use when we need to maintain
the DataObject connection between two filters. There is a related function
called GraftOutput that we use in mini-piplines. The complexity of this 
approach is that you have to construct an image with the appropriate metadata 
(regions, spacing, origin) and set the PixelContainer to be the one you stole
AND give B's output a new empty PixelContainer. 

So the bottom line, is that for simple pipelines, your approaches listed in 
your original message are the best approach.

Jim


-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Zachary Pincus
Sent: Thursday, June 02, 2005 1:16 AM
To: ITK mailing
Subject: [Insight-users] Grabbing output from the middle of a pipeline


Hello,

I'm wondering what the right way to grab an image from the middle or 
end of a pipeline is, in such a way that re-running the pipeline 
doesn't stomp on the image.

Say I have a pipeline of A->B->C. I'm pretty sure that the procedure to 
get C's output so that subsequent pipeline updates don't write over it 
is:

out = C->GetOutput();
out->DisconnectPipeline();
C->ResetPipeline();

Though I am not sure if the last line is necessary. (Is it?)

Now, what if I want to grab and save B's output? Is it:

out = B->GetOutput();
out->DisconnectPipeline();
B->ResetPipeline();
C->SetInput(B->GetOutput());

or am I missing something?

Thanks,

Zach

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list