<DIV>Thank you for your help, Cory, </DIV>
<DIV style="FONT-WEIGHT: normal">
<DIV> but I still don't know what's wrong with it. of course I have used class vtkImageAppendComponents, however, it doesn't work, and the image that shown by using class vtkImageViewer2 is always the last one or the first one.</DIV>
<DIV> could you help me to see what's wrong with my codes here:</DIV>
<DIV> <FONT color=#0000ff>vtkImageAppendComponents * imageAppend = vtkImageAppendComponents::New();</FONT></DIV>
<DIV><FONT color=#0000ff> vtkImageStencil * temp1 = </FONT><FONT color=#ff0000>FinishImageStencil();</FONT></DIV>
<DIV><FONT color=#0000ff> imageAppend->AddInput(temp1->GetOutput()); </FONT></DIV>
<DIV><FONT color=#0000ff> vtkImageStencil * temp2 = </FONT><FONT color=#ff0000>FinishImageStencil();</FONT></DIV>
<DIV><FONT color=#0000ff> imageAppend->AddInput(temp2->GetOutput());</FONT></DIV>
<DIV><FONT color=#0000ff> vtkXMLImageDataWriter * writer = vtkXMLImageDataWriter::New();</FONT></DIV>
<DIV><FONT color=#0000ff> writer->SetInputConnection(imageAppend->GetOutputPort());</FONT></DIV>
<DIV><FONT color=#0000ff> writer->SetFileName("image.vti");</FONT></DIV>
<DIV><FONT color=#0000ff> writer->SetDataModeToBinary();</FONT></DIV>
<DIV><FONT color=#0000ff> writer->Update();</FONT></DIV>
<DIV><FONT color=#0000ff> writer->Write();</FONT></DIV>
<DIV><FONT color=#0000ff> vtkXMLImageDataReader * reader = vtkXMLImageDataReader::New();</FONT></DIV>
<DIV><FONT color=#0000ff> reader->SetFileName("image.vti");</FONT></DIV>
<DIV><FONT color=#0000ff> reader->Update();</FONT></DIV>
<DIV><FONT color=#0000ff> vtkImageData * xmlImageData = vtkImageData::New();</FONT></DIV>
<DIV><FONT color=#0000ff> xmlImageData->DeepCopy(reader->GetOutput());</FONT></DIV>
<DIV><FONT color=#0000ff> // display the images in image.vti using class vtkImageViewer2</FONT></DIV>
<DIV><FONT color=#0000ff> ... ...</FONT></DIV>
<DIV><FONT color=#0000ff> // </FONT><FONT color=#ff0000>FinishImageStencil() is a function returning a object of class vtkImageStencil.</FONT></DIV>
<DIV> here I just save two stenciled images, at the same time, I use class vtkBMPWriter to save the stenciled images, too. but the result is : the result is not right if I use vtkXMLImageDataWriter. and I doubt there is only one image in the image.vti.</DIV>
<DIV> could you help me? thank you!</DIV>
<DIV> M. J.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </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">Mark,<BR>The closest you can probably come is to jam all the stencil images<BR>together into one image with vtkImageAppendComponents and then save<BR>the whole thing into a single .vti file. I don't believe you can save<BR>more than one image in a single .vti file (someone on list correct me<BR>if I am wrong). You might be able to exploit VTK's relatively new time<BR>support and treat your images as though they were time-series data,<BR>but I am not familiar enough with that to give you advice (you might<BR>find some hints for time-series data in the documentation for<BR>vtkXMLWriter: http://www.vtk.org/doc/nightly/html/classvtkXMLWriter.html).<BR><BR>Hope that helps,<BR>Cory<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></DIV>