[vtkusers] problem of class vtkImageAppendComponents

Brad King brad.king at kitware.com
Fri May 23 11:33:31 EDT 2008


Mark Jefferson wrote:
>   I still don't know why. and I still have many questions.
> 1, how can I know the different type of inputs? if I use the 
> vtkBMPReader, of course, its input is vtkAlgorithmOutput, if another one 
> is vtkImageData, so they are different?

The word "type" is not quite right here.  Each input port is associated with 
one logical input to an algorithm.  In the "glyph" example, the algorithm 
does something fundamentally different with each input and therefore has two 
input ports.  In the "append" case all inputs are treated equally and serve 
the same purpose (and therefore connect to only one input port).

> 2, the type of vtkImageAppendComponents's output is vtkImageData, but 
> all the output getting from vtkImageAppendComponents is always the first 
> input when I write its output into a .vti or .vtk file, even though 
> there are multi-inputs. could you tell me why?

This is something to figure out, see below.

> 3, as you said, "one input determines the position of the glyphs; 
> another input determines the geometry to place at those positions, then 
> multiple input ports are used". that is, if one input is the actor, 
> another one is the actor's position, isn't it?

Yes, and these are two logically different purposes so they get different 
input ports.

> 4, if I want to take two image reader as the inputs of 
> vtkImageAppendComponents, they should use input port 0, the same input 
> port, isn't it? but why there is only one image in its output?
>   for example:
> append->AddInput((vtkDataObject *)reader1->GetOuput()); 
> append->AddInput((vtkDataObject *)reader2->GetOuput());
>   is there anything wrong? if no, why there is only reader1's output? 
> where it the reader2's output? is there 2 components or 1?

Try using the modern interface to make the connections:

   append->AddInputConnection(reader1->GetOutputPort());
   append->AddInputConnection(reader2->GetOutputPort());

(this is mentioned by the documentation of the AddInput method).

Meanwhile, there are other ways that one input could be ignored.

Do you know that both readers are getting images with the scalars attached 
to the points (as against the cells)?  The vtkImageAppendComponents filter 
takes the active point scalar array from each input.  A quick glance at the 
implementation of the filter looks like it will ignore inputs that do not 
have an active scalars array.

-Brad



More information about the vtkusers mailing list