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

David Gobbi dgobbi at atamai.com
Fri Apr 7 14:02:14 EDT 2006


Thanks everyone for your help.

I have committed the backwards compatibility fixes and the new
ReplaceNthInputConnection() method with Berk's safety check.

I think that ReplaceNthInputConnection() is safe enough that it
could be moved into vtkAlgorithm, but I'll leave that up to you
guys.

 - David


Berk Geveci wrote:
> I would have a check that compares idx to the number of existing
> connections and reject if idx >= num connections. This way, it would
> be impossible to create null connections.
>
> On 4/6/06, David Gobbi <dgobbi at atamai.com> wrote:
>   
>> 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
>>
>> _______________________________________________
>> vtk-developers mailing list
>> vtk-developers at vtk.org
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>     
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>   




More information about the vtk-developers mailing list