[vtk-developers] Usage of filters inside filters

David E DeMarle dave.demarle at kitware.com
Tue Feb 28 08:31:08 EST 2012


It is fine to do so.

In the outer filter, create the internal filters as ivars. You can
New() into those pointers in your constructor and Delete() them in
your destructor to keep it simple.

In your RequestData method, set up the internal connections of the
internal pipeline with SetInputConnection(GetOutputPort) like you
would anywhere else. The only real trick is that you have have to
ShallowCopy the outer filter's input into the first filter in the
internal pipeline and ShallowCopy the last filter's output into the
outer filter's output. Otherwise the Executives get confused about
what is connected to what and how to schedule updates.

If the internal filters are visible and controlled outside of the
outer filter, you probably want to override the outer filter's
ModififiedTime to take into account the MTimes of the internal ones
too.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



On Tue, Feb 28, 2012 at 8:10 AM, Francisco Caraballo
<francisco.caraballo at gmail.com> wrote:
> Hello everyone.
>
> I'm developing a filter for image segmentation and i'm rather new to
> the VTK workflow and would like to ask you guys for some help.
> It would help me a lot if I could call several other filters from
> within my own filter (i.e Image Mathematics, Gaussian, Gradient). I
> have searched in the mailing list archives and found some old messages
> where some people was against doing it and other people was for it.
> What is the current position of the community on this subject,
> considering I'm using VTK 5.8? Is it an accepted practice? If
> positive, could you give me some advice as to how to do it? I'm
> particularly confused about the pipeline calls and how to go around
> calling the filters outside of the "main" pipeline.
>
> Thanks a lot in advance.
>
> Francisco Caraballo
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list