<DIV>Thank you for your help, Cory,</DIV>
<DIV>&nbsp; I have test the data output of vtkImageAppendComponents, and I write its output into a .vti file. </DIV>
<DIV>&nbsp; I use VolView to test this .vti data, I find there really are two "different" components in the .vti data, but the component 0(default) and component 1 are always the same. or in&nbsp;other words, the two components are the same, and the components are all the first one, that is the default component. </DIV>
<DIV>&nbsp; but&nbsp;from the vtk document, we could know the output's number of components are the&nbsp;summation&nbsp;of the&nbsp;two inputs' number of components, so the .vti data should have two components.&nbsp;what's more, my data is different, they come from&nbsp;the same&nbsp;large&nbsp;CT dataset, which&nbsp;are the first one and the last one.&nbsp;</DIV>
<DIV>&nbsp; in my .vti data, another component is lost. and here&nbsp;are my codes:</DIV>
<DIV>&nbsp; <FONT color=#0000ff>vtkImageAppendComponents * append = vtkImageAppendComponents::New();</FONT></DIV>
<DIV><FONT color=#0000ff>&nbsp; append-&gt;AddInputConnection(0, reader1-&gt;GetOutputPort());</FONT></DIV>
<DIV><FONT color=#0000ff>&nbsp; append-&gt;AddInputConnection(1, reader2-&gt;GetOutputPrort());</FONT></DIV>
<DIV><FONT color=#0000ff>&nbsp; append-&gt;Update();</FONT></DIV>
<DIV><FONT color=#0000ff>&nbsp; // wirte the append's output into a .vti file</FONT></DIV>
<DIV><FONT color=#0000ff>&nbsp; ... ...</FONT></DIV>
<DIV>&nbsp;&nbsp;and then I get one warning, not error:</DIV>
<DIV>&nbsp; <FONT color=#ff0000>vtkImageAppendComponents (0x02C3DC50): Attempt to connect input port index 1 for an algorithm with 1 input ports.</FONT></DIV>
<DIV>&nbsp; it seems there is something wrong with input port index 1. and maybe this is the key why there is only one component in .vti data.</DIV>
<DIV>&nbsp; could you tell me why? what's&nbsp;wrong with my codes?&nbsp;thank you!</DIV>
<DIV>&nbsp; M. J.</DIV>
<DIV>&nbsp;</DIV>
<DIV style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 12px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px; FONT-FAMILY: Arial Narrow">------------------------------------------------------------------------------------------------------------------------------------------------</DIV>
<DIV style="FONT-WEIGHT: normal">Hi Mark,<BR><BR>It sounds like you are having trouble showing your chosen image<BR>component in the vtkImageViewer2. You might try something like this:<BR><BR>vtkImageViewer *viewer = ...;<BR>vtkImageMapToWindowLevelColors *windowLevelMap = viewer-&gt;GetWindowLevel();<BR>// X below is an index 0 through the number of components you stuffed<BR>into your image<BR>windowLevelMap-&gt;SetActiveComponent(X);<BR><BR>Hope that helps,<BR>Cory<BR><BR>On Mon, May 19, 2008 at 8:10 AM, Mark Jefferson &lt;mark.jefferson@qq.com&gt; wrote:<BR>&gt; Thank you for your help, Cory,<BR>&gt;&nbsp;&nbsp; but I still don't know what's wrong with it. of course I have used class<BR>&gt; vtkImageAppendComponents, however, it doesn't work, and the image that shown<BR>&gt; by using class vtkImageViewer2 is always the last one or the first one.<BR>&gt;&nbsp;&nbsp; could you help me to see what's wrong with my codes here:<BR>&gt;&nbsp;&nbsp; vtkImageAppendComponents * imageAppend = vtkImageAppendComponents::New();<BR>&gt;&nbsp;&nbsp; vtkImageStencil * temp1 = FinishImageStencil();<BR>&gt;&nbsp;&nbsp; imageAppend-&gt;AddInput(temp1-&gt;GetOutput());<BR>&gt;&nbsp;&nbsp; vtkImageStencil * temp2 = FinishImageStencil();<BR>&gt;&nbsp;&nbsp; imageAppend-&gt;AddInput(temp2-&gt;GetOutput());<BR>&gt;&nbsp;&nbsp; vtkXMLImageDataWriter * writer = vtkXMLImageDataWriter::New();<BR>&gt;&nbsp;&nbsp; writer-&gt;SetInputConnection(imageAppend-&gt;GetOutputPort());<BR>&gt;&nbsp;&nbsp; writer-&gt;SetFileName("image.vti");<BR>&gt;&nbsp;&nbsp; writer-&gt;SetDataModeToBinary();<BR>&gt;&nbsp;&nbsp; writer-&gt;Update();<BR>&gt;&nbsp;&nbsp; writer-&gt;Write();<BR>&gt;&nbsp;&nbsp; vtkXMLImageDataReader * reader = vtkXMLImageDataReader::New();<BR>&gt;&nbsp;&nbsp; reader-&gt;SetFileName("image.vti");<BR>&gt;&nbsp;&nbsp; reader-&gt;Update();<BR>&gt;&nbsp;&nbsp; vtkImageData * xmlImageData = vtkImageData::New();<BR>&gt;&nbsp;&nbsp; xmlImageData-&gt;DeepCopy(reader-&gt;GetOutput());<BR>&gt;&nbsp;&nbsp; // display the images in image.vti using class vtkImageViewer2<BR>&gt;&nbsp;&nbsp; ... ...<BR>&gt;&nbsp;&nbsp; // FinishImageStencil() is a function returning a object of class<BR>&gt; vtkImageStencil.<BR>&gt;&nbsp;&nbsp; here I just save two stenciled images, at the same time, I use class<BR>&gt; vtkBMPWriter to save the stenciled images, too. but the result is : the<BR>&gt; result is not right if I use vtkXMLImageDataWriter. and I doubt there is<BR>&gt; only one image in the image.vti.<BR>&gt;&nbsp;&nbsp; could you help me? thank you!<BR>&gt;&nbsp;&nbsp; M. J.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; -----------------------------------------------------------------------------------------------------------------------------------------------------------<BR>&gt; Mark,<BR>&gt; The closest you can probably come is to jam all the stencil images<BR>&gt; together into one image with vtkImageAppendComponents and then save<BR>&gt; the whole thing into a single .vti file. I don't believe you can save<BR>&gt; more than one image in a single .vti file (someone on list correct me<BR>&gt; if I am wrong). You might be able to exploit VTK's relatively new time<BR>&gt; support and treat your images as though they were time-series data,<BR>&gt; but I am not familiar enough with that to give you advice (you might<BR>&gt; find some hints for time-series data in the documentation for<BR>&gt; vtkXMLWriter: http://www.vtk.org/doc/nightly/html/classvtkXMLWriter.html).<BR>&gt;<BR>&gt; Hope that helps,<BR>&gt; Cory<BR>&gt;<BR>&gt; --<BR>&gt; Cory Quammen<BR>&gt; Department of Computer Science<BR>&gt; University of North Carolina at Chapel Hill<BR>&gt; http://www.cs.unc.edu/~cquammen<BR>&gt;<BR>&gt; _______________________________________________<BR>&gt; This is the private VTK discussion list.<BR>&gt; Please keep messages on-topic. Check the FAQ at:<BR>&gt; http://www.vtk.org/Wiki/VTK_FAQ<BR>&gt; Follow this link to subscribe/unsubscribe:<BR>&gt; http://www.vtk.org/mailman/listinfo/vtkusers<BR>&gt;<BR>&gt;<BR><BR><BR><BR>-- <BR>Cory Quammen<BR>Department of Computer Science<BR>University of North Carolina at Chapel Hill<BR>http://www.cs.unc.edu/~cquammen<BR></DIV>