[Insight-users] How to disconnect a pipeline

Luis Ibanez luis.ibanez@kitware.com
Thu, 24 Oct 2002 13:29:35 -0400


Hi Martin,

I'm wondering if you tried the ReleaseData
flag on the filters.

ProcessObject (superclass of all the filters)
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ProcessObject.html

has methods

   void SetReleaseDataFlag (bool flag)
   bool GetReleaseDataFlag ()
   void ReleaseDataFlagOn ()
   void ReleaseDataFlagOff ()

that should allow to release the memory of the
initial filters once their output is processed
by the following filters.

In the case you cite, probably adding

    FilterA->ReleaseDataFlagOn();
    FilterB->ReleaseDataFlagOn();

before updating the pipeline should produce
the desired effect of releasing memory as the
pipeline progress.


    Luis


=========================================================

Martin Styner wrote:
> Hi everybody
> I have a question in regard to the itk pipeline system.
> In some cases my pipeline has grown too large so that I run out of 
> memory. Now I want to separate as nicely as possible the pipeline into 2 
> separate parts.
> The 'nicest' I could so far come up with is the following:
> 
> Before:
> 
> FilterB->SetInput(FilterA->GetOutput());
> FilterC->SetInput(FilterB->GetOutput());
> 
> After:
> 
> FilterB->SetInput(FilterA->GetOutput());
> FilterB->Update();
> ImageOutB = FilterB->GetOutput();
> ImageOutB->DisconnectPipeline();
> FilterA->Delete();
> // Can't do a FilterB->Delete(), otherwise ImageOutB iscorrupted ?
> FilterC->SetInput(ImageOutB);
> 
> Is there maybe an easy way to create a Duplicate of an image, this would 
> solve the whole business.
> 
> Regards
> Martin
> 
>