<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>No, I'm not. I'm want to display a 2D image. So I presume that I don't have to use <STRONG>SetZSlice</STRONG>(). If so, why should I? </DIV>
<DIV> </DIV>
<DIV>Here is my code:</DIV>
<DIV> </DIV>
<DIV><STRONG>viewer->SetInput(image2D);</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG> //display the image in the frame<BR> viewer->SetParentId(this->m_hWnd);</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG> //to fit the image to the render window, <BR> //parallel camera = parallel projection is used <BR> vtkRenderer* ren1 = viewer->GetRenderer(); <BR> ren1->GetActiveCamera()->ParallelProjectionOn(); <BR> ren1->GetActiveCamera()->SetParallelScale(0.5);</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG> //execute<BR> viewer->Render(); </STRONG></DIV>
<DIV> </DIV>
<DIV>Isabelle</DIV>
<DIV><BR><B><I>Mathieu Malaterre <mathieu.malaterre@kitware.com></I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Salut Isabelle,<BR><BR>Are you using vtkImageViewer2 and:<BR><BR>viewer->SetZSlice( slice );<BR><BR>If so make sure you are resetting the camera clipping range:<BR><BR>viewer->GetRenderer()->ResetCameraClippingRange();<BR><BR><BR>Other than that vtkImageViewer and vtkImageViewer2 works exactly the <BR>same way.<BR><BR>HTH<BR>Mathieu<BR><BR>Renaud Isabelle wrote:<BR>> Hi again,<BR>> <BR>> I'm still locked with my problem of stretch my image in a window I passed.<BR>> <BR>> It seems that *vtkImageViewer* doesn't hav any camera instantiated. <BR>> That's why the code:<BR>> <BR>> *vtkRenderer* ren1 = viewer->GetRenderer();<BR>> ren1->GetActiveCamera()->ParallelProjectionOn(); <BR>> ren1->GetActiveCamera()->SetParallelScale(2.0);*<BR>> ** <BR>> * //execute<BR>> viewer->Render();* <BR>> <BR>> doesn't produce any scaling
of the image.<BR>> <BR>> Then, I tried *vtkImageViewer2 *that seems to have a camera. But this <BR>> class seems to hav another problem since the same code doesn't display <BR>> my image at all but a black image instead.<BR>> <BR>> What is the solution? Do I hav to implement my own vtkImageViewer class <BR>> and incorporate a camera? Or does it already exist a solution to use <BR>> vtkImageViewer2?<BR>> <BR>> I'm confused and really don't know what to do. Please help me<BR>> <BR>> Isabelle<BR>> <BR>> <BR>> */Renaud Isabelle <RENAUISA@YAHOO.FR>/* a écrit :<BR>> <BR>> Hi,<BR>> <BR>> Sorry to bother you again.<BR>> <BR>> I tried what you indicated me to scale my image into a window I passed.<BR>> <BR>> *I have no error at compilation. However, my image is not scaled at<BR>> execution. *<BR>> <BR>> Is there any fault in this code:<BR>> <BR>> viewer->SetInput(reader->GetOutput());<BR>> <BR>>
*vtkRenderer* ren1 = viewer->GetRenderer();<BR>> ren1->GetActiveCamera()->ParallelProjectionOn(); <BR>> ren1->GetActiveCamera()->SetParallelScale(0.5);*<BR>> <BR>> //display the image in the frame<BR>> viewer->SetParentId(this->m_hWnd);<BR>> <BR>> //execute<BR>> viewer->Render(); <BR>> <BR>> thanks in advance,<BR>> <BR>> Isabelle<BR>> <BR>> <BR>> */Goodwin Lawlor <GOODWIN.LAWLOR@UCD.IE>/* a écrit:<BR>> <BR>> Hi Isabelle,<BR>> <BR>> Have a look at this example:<BR>> <BR>> http://www.bioengineering-research.com/vtk/vhpreader.tcl<BR>> <BR>> or<BR>> <BR>> http://www.bioengineering-research.com/vtk/BackgroundImage.tcl<BR>> <BR>> <BR>> here's the bit you need: (app is an image; numCol and numRow are<BR>> the image<BR>> dims)<BR>> <BR>> vtkImageActor ia<BR>> ia SetInput [app GetOutput]<BR>> ia InterpolateOff<BR>> vtkRenderer ren1<BR>> ren1 AddActor ia<BR>>
ren1 SetBackground 1 1 1<BR>> vtkRenderWindow renWin<BR>> renWin AddRenderer ren1<BR>> renWin SetSize [expr $numCol / 4] [expr $numRow / 4]<BR>> vtkInteractorStyleImage istyle<BR>> vtkRenderWindowInteractor iren<BR>> iren SetRenderWindow renWin<BR>> iren SetInteractorStyle istyle<BR>> [ren1 GetActiveCamera] ParallelProjectionOn<BR>> #fit the image to the render window<BR>> [ren1 GetActiveCamera] SetParallelScale [expr $numRow / 2]<BR>> renWin Render<BR>> <BR>> <BR>> hth<BR>> <BR>> Goodwin<BR>> <BR>> <BR>> "Renaud ! Isabelle" wrote in message<BR>> news:20050525115733.8984.qmail@web26108.mail.ukl.yahoo.com...<BR>> Hi everyone,<BR>> <BR>> I made a 2D image displayed in a window by using<BR>> vtkImageViewer->SetParentId(this->m_hWnd). It works well, but my<BR>> image is<BR>> still displayed with its own dimensions. What I would like to do<BR>> is find a<BR>> way to display it in order to fit the
dimensions of my window,<BR>> something<BR>> which could stretch my image.<BR>> <BR>> Could someone suggest me something? I am not sure if it is a VTK<BR>> or ITK<BR>> problem.<BR>> <BR>> By the way, what is the difference between vtkImageViewer and<BR>> vtkImageViewer2?<BR>> <BR>> Thanks in advance,<BR>> <BR>> Isabelle<BR>> <BR>> <BR>> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage<BR>> pour vos mails,<BR>> photos et vidéos !<BR>> Créez votre Yahoo! Mail<BR>> <BR>> <BR>> <BR>> _______________________________________________<BR>> This is the private VTK discussion list.<BR>> Please keep messages on-topic. Check the FAQ at:<BR>> http://www.vtk.org/Wiki/VTK_FAQ<BR>> Follow this link to subscribe/unsubscribe:<BR>> http://www.vtk.org/mailman/listinfo/vtkusers<BR>> <BR>> <BR>> <BR>> _______________________________________________<BR>> This is the private VTK discussion
list.<BR>> Please keep messages on-topic. Check the FAQ at:<BR>> http://www.vtk.org/Wiki/VTK_FAQ<BR>> Follow this link to subscribe/unsubscribe:<BR>> http://www.vtk.org/mailman/listinfo/vtkusers<BR>> <BR>> ------------------------------------------------------------------------<BR>> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour<BR>> vos mails, photos et vidéos !<BR>> Créez votre Yahoo! Mail<BR>> <HTTP: creer28.html mail fr.promotions.yahoo.com *http: default taglines_1go splash mail_campaigns mail_fr us.rd.yahoo.com><BR>> _______________________________________________<BR>> This is the private VTK discussion list.<BR>> Please keep messages on-topic. Check the FAQ at:<BR>> http://www.vtk.org/Wiki/VTK_FAQ<BR>> Follow this link to subscribe/unsubscribe:<BR>> http://www.vtk.org/mailman/listinfo/vtkusers<BR>> <BR>> ------------------------------------------------------------------------<BR>> Découvrez le nouveau
Yahoo! Mail : 1 Go d'espace de stockage pour vos <BR>> mails, photos et vidéos !<BR>> Créez votre Yahoo! Mail <BR>> <HTTP: creer28.html mail fr.promotions.yahoo.com *http: default taglines_1go splash mail_campaigns mail_fr us.rd.yahoo.com><BR>> <BR>> <BR>> <BR>> ------------------------------------------------------------------------<BR>> <BR>> _______________________________________________<BR>> This is the private VTK discussion list. <BR>> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR>> Follow this link to subscribe/unsubscribe:<BR>> http://www.vtk.org/mailman/listinfo/vtkusers<BR><BR></BLOCKQUOTE><p>
                <hr size=1>
Découvrez le nouveau Yahoo! Mail : <font color="red">1 Go d'espace</font> de stockage pour vos mails, photos et vidéos !<br><a href="http://us.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_1go/default/*http://fr.promotions.yahoo.com/mail/creer28.html" target="_blank">Créez votre Yahoo! Mail</a>