[Insight-users] How to disconnect a pipeline

Miller, James V (Research) millerjv@crd.ge.com
Fri, 25 Oct 2002 11:48:34 -0400


Your original proposal should be pretty close

ImageOutB = filterB->GetOutput();
ImageOutB->DisconnectPipeline();

This is assuming that ImageOutB is a smart pointer.



> -----Original Message-----
> From: Martin Styner [mailto:martin_styner@ieee.org]
> Sent: Friday, October 25, 2002 3:23 AM
> To: Luis Ibanez
> Cc: insight-users
> Subject: Re: [Insight-users] How to disconnect a pipeline
> 
> 
> Hi Luis
> Yes, that worked ! Thanks, much 'nicer' than my solution. 
> Nevertheless, 
> for curiosity sake, what would be the best way to disconnect an image 
> fully from the pipeline and free the whole pipeline before the image, 
> e.g. to be processed by a routine from a different libary (THERE, I 
> dared to say the taboo-word... ;) ).
> 
> Best regads
> Martin
> 
> Luis Ibanez wrote:
> > 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
> >>
> >>
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-users
> 
> -- 
> Martin Styner, PhD. Ing. ETH
> Group Head Medical Image Analysis for Orthopaedics
> M.E. Mueller Institute for Biomechanics
> Center for Computed Assisted Surgery
> University of Bern
> Murtenstrasse 35
> P.O.Box 30
> CH - 3010 Bern
> Switzerland
> Tel office: ++41-31-632-0940 , FAX: ++41-31-632-4951
> email: Martin.Styner@memot.unibe.ch, martin_styner@ieee.org
> WWW: http://cranium.unibe.ch/~mstyner
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>