[vtkusers] problem of class vtkImageAppendComponents

Mark Jefferson mark.jefferson at qq.com
Fri May 23 23:08:43 EDT 2008


Thank you, Brad,
   and I have use vtkImageBlend to test the output of vtkImageAppendComponents, I am sure that all the inputs have been gotten by vtkImageAppendComponents, because the result shown from the vtkImageAppendComponents's output is two different images.
   that is, I set the output of vtkImageAppendComponents to the input of vtkImageBlend directly, and then render it, there are two different images.
   however, I would only get the first input image of vtkImageAppendComponents when I write its output to be a .vti file and then use two vtkImageViewer2 to display the two "different" images. the images in the render windows of vtkImageViewer2 are all the same, the first input port's image.
   so I guess there are two possibility that I could not get the right result.
   1) write the output of vtkImageAppendComponents to be a .vti file;
   2) read the .vti file and then render the images by vtkImageViewre2.
   and they are the key problem now. I think maybe the problem comes from the first possibility. in other words, when I use class vtkXMLImageDataWriter, although the output of class vtkImageAppendComponents is vtkImageData, vtkXMLImageDataWriter only take its first input as input, so the output is only one image. and then there is another question: how to write the output of vtkImageAppendComponents to be a .vti file? I have tried write the output of vtkImageAppendComponents to be a .vti file directly, it is failed. so, are there some other transforms?
   and if it is not so, then the problem comes from the second possibility, but I don't think there is something wrong with my image render codes. because I have tested them using two different images directly without using vtkImageAppendComponents, it is ok.
   could you tell me what I should do? thank you!
   M. J.
  
 PS. I have used function AddInputConnection(),  there is no change. and I have use one input of vtkXMLImageDataWriter, and another is vtkDICOMImageReader, there is no change, too.
  
  
  
 ------------------------------------------------------------------------------------------------------------------------------------------------
  
 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080524/86449613/attachment.htm>


More information about the vtkusers mailing list