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

David Gobbi dgobbi at atamai.com
Wed Apr 5 14:42:26 EDT 2006


Thanks, Berk.

I actually like the SetNthInputConnection() method, it
makes it much easier to set e.g. change the 2nd connection
and leave the rest of the inputs alone. I use this feature
all the time. 

If every time I wanted to change a single input connection,
I always had to call RemoveAllInputs() and then rebuild
the whole input list with AddInputConnection(), there are
so many places this pops up in my applications that it would
really add up to a lot of extra code.

The NULL inputs thing is certainly a potential source of
errors, though.  You could wean people off of them by
adding an extra check immediately before RequestData
and sending a deprecation warning if there are any
NULL inputs.

 - David


Berk Geveci wrote:
> I have no objection to your changes since they provide backwards
> compatibility. However, I think that having a SetInput with an index
> on filters that have take variable number of inputs is wrong. It
> allows the user/programmer to specify NULL inputs, thus requiring the
> filter to check in RequestData. For example, the following:
> vtkImageAppend append
> append SetInput 10 foo
>
> will cause the append filter to have 10 NULL input connections. Making
> only the AppendInput(Connection) method public would prevent this
> problem.
>
> -Berk
>
>
> On 4/5/06, David Gobbi <dgobbi at atamai.com> wrote:
>   
>> Hi All,
>>
>> When the VTK multiple-input imaging filters were
>> moved to the new pipeline, some backwards
>> incompatibilities crept in. I've already fixed
>> in vtkImageBlend but want to get some comments
>> before I do the rest.
>>
>> The issue is that in VTK 4, the basic interface
>> was as follows:
>>
>>  void AddInput(vtkImageData *);
>>  void SetInput(int idx, vtkImageData *);
>>
>> In VTK 5, the multiple-input imaging filters take
>> all of their inputs on the first input port.
>> The AddInput() method works as before, since it
>> appends inputs to the first port, but SetInput()
>> works different in VTK 5:
>>
>>  // set input for specified port
>>  void SetInput(int port, vtkDataObject *)
>>
>> If anyone has old VTK 4 code that calls
>> SetInput(1, data), that code will break because
>> the filter expects all inputs to go on the first
>> port, not on successive ports.  You would think
>> that regression testing would have caught this,
>> except that the tests were all changed at the
>> same time that VTK was changed (!!!).
>>
>> In brief, what I want to do is change the
>> following filters so that SetInput() will work
>> the same way as in VTK 4:
>>
>>  vtkImageAppend
>>  vtkImageAppendComponents
>>  vtkImageBlend (already done)
>>
>> Take a look at my recent three cvs changes to
>> vtkImageBlend if you want to see exactly what
>> the changes will be.
>>
>> If anyone thinks there will be any issues with
>> this change, or if there are other VTK classes
>> that need this change, please email me.
>>
>> Cheers,
>>  - David
>> _______________________________________________
>> 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