[vtkusers] How to disable a VTK filter that is connected to a VTK pipeline

David Doria daviddoria+vtk at gmail.com
Tue Apr 20 07:43:27 EDT 2010


On Tue, Mar 30, 2010 at 11:34 PM, Allan James <ar.james at qut.edu.au> wrote:

>  Hi all,
>
> Does anyone know if it is possible to disable a VTK filter without removing
> it from the pipeline?
>
> For example, while using vtkImageMask, I would like to allow the user to be
> able to select whether to apply a mask to an image or not - I would like
> to enable/disable the vtkImageMask filter during runtime without having to
> disconnect/reconnect the pipeline everytime.
>
> I am sure there are work-arounds depending on the filter in question (such
> as setting a null mask image perhaps?) - however, generally speaking it
> would be nice to be able to disable a filter and have the input data
> pass through untouched - is this possible in VTK?
>
> Thanks,
>
> Allan James
>

Allan,

This is a really good idea. I find myself constantly having lines like this:

nextFilter->SetInput(reader->GetOutput());
//nextFilter->SetInput(lastFilter->GetOutput());

When I want to test what happens when I skip a filter. It would make a lot
more sense to call lastFilter->Disable(). In cases where the output type is
the same as the input type, we could make Disable() just pass the input
through to the output. In cases where they DONT match, I don't think it
makes sense to disable the filter.

Any comments from the devels?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100420/7e76c87e/attachment.htm>


More information about the vtkusers mailing list