[vtkusers] Marking a pixel with a filled circle

David Doria daviddoria+vtk at gmail.com
Mon Dec 7 11:38:11 EST 2009


On Mon, Dec 7, 2009 at 11:23 AM, David Gobbi <david.gobbi at gmail.com> wrote:
> On Mon, Dec 7, 2009 at 8:23 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>
>> I was expecting vtkImageBlend to simply take two vtkImageData's (as
>> David G. was thinking as well) and produce a third vtkImageData.
>>
>> Based on what you said, there are now no errors, but the two images do
>> not seem to be combined in the display, I simply see the first image:
>> http://www.vtk.org/Wiki/VTK_Examples_Combine_Images
>
> The vtkImageBlend can take any number of inputs images, but all of
> them go onto the first input port.
>
> blend->SetInputConnection(a->GetOutputPort());
> blend->AddInputConnection(b->GetOutputPort());
> blend->AddInputConnection(c->GetOutputPort());  etc etc
>
> All of these are added to the first port (port number 0) of the
> blender.  The "0" is implicit, equivalently you could use
> blend->AddInputConnection(0, b->GetOutputPort()).
>
> I know that it's confusing, but the above is not the same as the
> following, which uses input port 0 for the first and input port 1 for
> the second:
>
> blend->SetInputConnection(0, a->GetOutputPort());
> blend->SetInputConnection(1, stencil->GetOutputPort());
>
> You see, the first port of vtkImageBlend is a "multiple input" port,
> and it can take any number of inputs on the same port.  The second
> port is an "optional input" port which can take a stencil, or not.
>
>    David

Yep, you got it, this was definitely the issue, thanks. I've never
used this multiple input before. So the terminology is "the 0th input
port can take multiple connections"?

For anyone else looking at this, it seems to work if you just call
AddInputConnection for each of them, without calling
SetInputConnection on the first one:
blend->AddInputConnection(a->GetOutputPort());
blend->AddInputConnection(b->GetOutputPort());

I'm glad we got this straightened out!

Thanks,

David



More information about the vtkusers mailing list