[vtk-developers] VTK-5 - Filter with multiple outputs

Brad King brad.king at kitware.com
Mon Oct 17 14:22:31 EDT 2005


Ovidiu Toader wrote:
> The actual filter has more than 3 outputs and is designed to compute only the 
> outputs that are needed by the pipeline. I believe that in principle it 
> should be possible to achieve this selective computation based only on logic 
> that is internal to $A but the ability to interact with the pipeline would 
> offer the cleanest possible design. My hope is that this feature is present 
> in the new pipeline but haven't yet been able to discover it myself.

The new pipeline is extremely flexible and was designed to support 
custom execution rules, so you should certainly be able to achieve this. 
  I don't have time to write out the entire solution for you but I can 
get you started.

Your filter will need to override the ProcessRequest method and look for 
a REQUEST_DATA_NOT_GENERATED.  It will come just before the REQUEST_DATA 
request.  The request will include the output port that made the update 
request (FROM_OUTPUT_PORT key) so you can tell which output to generate. 
  Respond to the request by putting an instance of the key 
DATA_NOT_GENERATED in the output information for each port that will not 
be generated.

If you have multiple filter parameters that each affect the generation 
of a different output then you probably want to have multiple MTime 
objects in your filter.  When each parameter changes call Modified on 
the corresponding MTime object.  Override the ComputePipelineMTime 
method and look at the request object for the output port that made the 
request.  Return the MTime from the object corresponding to that output 
port.

-Brad



More information about the vtk-developers mailing list