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

David Gobbi dgobbi at atamai.com
Thu Apr 6 17:16:01 EDT 2006


Brad King wrote:
> David Gobbi wrote:
>> I understand the concerns with SetNthInputConnection and
>> think that the best solution would be to make it public only
>> in the few filters that properly check for null inputs.  That
>> would be a 100% solution for me.
>
> That was the intention of the method and the reason it is protected in 
> vtkAlgorithm.  Only filters that care about multiple ordered 
> connections on the same port need this anyway, and they should be able 
> to deal with NULL inputs.
>
> Summary of the solution:
>
> 1.) Add a public version of SetNthInputConnection to vtkImageBlend.
>     It should probably be called something else and not accept the
>     port number argument (since only port 0 supports this).
>     Perhaps "void SetNthBlendImage(int n, vtkAlgorithmOutput*)".
>
> 2.) Override the SetInput methods in vtkImageBlend to map the input
>     numbers the way the old filter treated them.  IIRC at least one
>     was a stencil.

For #1, the chosen name should be similar to AddInputConnection()
since that's the other method that would be used to build up the inputs.
I wouldn't want "Blend" to be part of the method name, since I'd like
the other multiple-input filters to have the same method.  Maybe this:

 ReplaceNthInputConnection(int idx, vtkAlgorithmOutput *)

The connotation here is that you should only "Replace" a connection
that has already been "Added."  It'll make people think twice before
creating null inputs.  Any comments?

 - David




More information about the vtk-developers mailing list