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

Berk Geveci berk.geveci at gmail.com
Wed Apr 5 17:23:06 EDT 2006


> 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)

You can't do this. GetInputConnection() actually returns an algorithm
output that belongs to the output. However, what about
ReplaceInputConnection(idx, newInput)? This would be similar to
SetNthInputConnection() but would fail if the input connection is not
already there (should probably return 0 in this case). It is not ideal
but it would do what you want. I think the problem lies in the fact
that the code you are trying to fix assigns a meaning to the index of
the input when it shouldn't. I think that the best way is to remove
the connection you don't want and add the one you want.



More information about the vtk-developers mailing list