[Insight-developers] how to reuse a filter correctly

Ivan Macia imacia at vicomtech.org
Mon Feb 23 16:26:01 EST 2009


Hi Leila,

You should do something like this (just an example):

std::vector<ImageType::Pointer> outputs;

for( ... ) // your loop
{
   filter->SetInput( newInput ); // new input or parameters every time, in
any case this will call Modify() for the filter internally
   filter->Update();

   ImageType::Pointer newOutput = filter->GetOutput();
   newOutput->DisconnectPipeline();

   outputs.push_back( newOutput );
}


Hope that helps

Iván


2009/2/23 Leila Baghdadi <baghdadi at phenogenomics.ca>

> I use ITK-3.10
>
> I know reusing filters somehow void the concept of filters but I have no
> choice.
> I am segmenting multiple mouse embryos and need to be able to reuse
> various filters.
>
> Leila
>
> On Mon, 2009-02-23 at 16:06 -0500, Bradley Lowekamp wrote:
> > What version of ITK are you using?
> >
> > On Feb 23, 2009, at 2:19 PM, Leila Baghdadi wrote:
> >
> > > Hi guys
> > >
> > > I want to be able to use my filter in a loop,
> > > i.e, change the input and get a different output at every iteration.
> > >
> > > The problem is my filter seem to be stuck to the first input somehow
> > >
> > > I tried calling Update() within the loop and no luck,
> > > I tried calling New() and Delete()  within the loop and no luck
> > >
> > > any thoughts
> > >
> > > Leila
> > >
> > > _______________________________________________
> > > Powered by www.kitware.com
> > >
> > > Visit other Kitware open-source projects at
> > > http://www.kitware.com/opensource/opensource.html
> > >
> > > Please keep messages on-topic and check the ITK FAQ at:
> > > http://www.itk.org/Wiki/ITK_FAQ
> > >
> > > Follow this link to subscribe/unsubscribe:
> > > http://www.itk.org/mailman/listinfo/insight-developers
> > >
> >
> > ========================================================
> >
> > Bradley Lowekamp
> >
> > Lockheed Martin Contractor for
> >
> > Office of High Performance Computing and Communications
> >
> > National Library of Medicine
> >
> > blowekamp at mail.nih.gov
> >
> >
> >
> >
> >
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090223/381cd92d/attachment.htm>


More information about the Insight-developers mailing list