[vtk-developers] Image multiple input filters, VTK 5 vs VTK 4

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed Apr 5 16:59:43 EDT 2006


> I had a chat with Brad about this. We don't think you should do this.
>>From the documentation of vtkAlgorithm:
> 
>   // Replace the Nth connection on the given input port.  For use only
>   // by this class and subclasses.  If this is used to store a NULL
>   // input then the subclass must be able to handle NULL inputs in its
>   // ProcessRequest method.
>   virtual void SetNthInputConnection(int port, int index,
>                                      vtkAlgorithmOutput* input);
> 
> It is clearly not intended to be public. The reason behind this is the
> fact that it is NOT allowed to have NULL connections unless the
> algorithm has special code to handle them. Making this function public
> would allow everybody to create empty connections and potentially
> introduce bugs. AddInputConnection does not. If a filter has multiple
> input connections, the order things are added should not matter. If
> the order matters, the filter should have multiple input ports
> instead. Therefore, AddInputConnection() is the only method that is
> necessary to add connections.
> 
> Maybe we should introduce a RemoveInputConnection() method instead?
> Obviously, this would have to move things around so that there is no
> NULL input connection. Would this help David? You could simply remove
> a connection and replace it with AddConnection.

As David says all I need is a way to set *either* connection. You don't 
always have access to the other input.

So maybe something like -in python ;)-

blend = vtk.vtkImageBlend()
blend.GetInputConnection(0).Set(0 ,background)
blend.GetInputConnection(0).Set(1, foreground)


2 cents
Mathieu



More information about the vtk-developers mailing list