<DIV>Hi Luis,</DIV>
<DIV> </DIV>
<DIV>It's me again. </DIV>
<DIV> </DIV>
<DIV>- I didn't find the solution of my problem of camera. </DIV>
<DIV> </DIV>
<DIV> <STRONG>m_Camera->SetPosition(Cx,Cy,1); <BR> m_Camera->SetFocalPoint(Cx,Cy,0); <BR> m_Camera->SetViewUp (0, 1, 0);</STRONG></DIV>
<DIV><STRONG> m_Camera->ParallelProjectionOn(); </STRONG></DIV>
<DIV><STRONG> m_Renderer->SetActiveCamera(m_Camera);<BR> m_Renderer->ResetCamera();<BR></STRONG></DIV>
<DIV><STRONG> m_RenderWindow->SetSize(dimension[0], dimension[1]); <BR> m_Camera->SetParallelScale( dimension[0]/2 ); <BR> m_RenderWindow->Render();</STRONG></DIV>
<DIV> </DIV>
<DIV>My camera is well positionned in space I think. However, <STRONG>my image is like kilometers far away of my camera</STRONG>: I can see my image's borders only after stretching my render window: it's like a small point so far away. </DIV>
<DIV> </DIV>
<DIV>I know where my camera is positionned. But <STRONG>what i don't know is where my volume or my slice is in space</STRONG>. Maybe it depends on <STRONG>SetClippingRange</STRONG>() that I don't use for the moment..</DIV>
<DIV> </DIV>
<DIV>- By the way, I am wondering if buying <STRONG>VTK's user's guide</STRONG> would be a good idea. Indeed, I'm working in medical image processing and I am sure that I will use ITK VTK for a long time. Or maybe do you have another suggestion of what I should get as guide.</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Isabelle <BR><BR><B><I>Luis Ibanez <luis.ibanez@kitware.com></I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Hi Isabelle,<BR><BR><BR>You are pointing the camera to the origin of coordinates<BR><BR>m_Camera->SetFocalPoint(0,0,0);<BR><BR>That's usually located in the *corner* of the image.<BR><BR><BR>You probably want to change that to be pointing to the<BR>middle of the image, so the image gets centered in the<BR>render window.<BR><BR>Typically if your image has<BR><BR>(Nx,Ny) pixels and<BR>(Sx,Sy) millimeter of pixel size<BR>(Ox,Oy) origin in millimeters<BR><BR>then you want to set up your camera in front of the middle<BR>of the image, and point to the center of the image:<BR><BR><BR>Cx = Nx * Sx / 2.0 + Ox<BR>Cy = Ny * Sy / 2.0 + Oy<BR><BR><BR>m_Camera->SetPosition(Cx,Cy,F);<BR>m_Camera->SetFocalPoint(Cx,Cy,0);<BR><BR><BR>F is actually irrelevant here<BR>since you are using ParallelProjection.<BR><BR>You don't want to put your "view up" to<BR><BR>m_Camera->SetViewUp (0, 0,
-1);<BR><BR>because the "up" of the image is actually along the Y axis.<BR><BR><BR>A better choice for you might be:<BR><BR><BR>m_Camera->SetViewUp (0, 1, 0);<BR><BR><BR><BR>Note that, there is nothing misterious about positioning the<BR>camera. Just think of your image as a 2D plane segment<BR>floating in 3D space, and think of your camera as a<BR>photograpic camera that must be placed in such a way that<BR>you look at the middle of the image.<BR><BR><BR><BR>Regards,<BR><BR><BR><BR>Luis<BR><BR><BR>---------------------------<BR>Renaud Isabelle wrote:<BR><BR>> Hi Luis,<BR>> <BR>> I followed your advice and tried to create my own class to display my <BR>> image with VTK.<BR>> <BR>> However, as Ì'm still new to VTK, I'm not familiar with all this notions <BR>> of camera, actor, mapper and so on. I tried to set up my own parameters <BR>> of a camera. However, I succed to view only a part of my image 1552*128.<BR>> <BR>> Here is what I did: <BR>>
<BR>> * m_Camera = vtkCamera::New();<BR>> m_Actor = vtkImageActor::New();<BR>> m_Renderer = vtkRenderer::New();<BR>> m_RenderWindow = vtkRenderWindow::New();*<BR>> ** <BR>> * //setup the pipeline<BR>> m_Renderer->AddActor( m_Actor );<BR>> m_RenderWindow->AddRenderer( m_Renderer ); *<BR>> * *<BR>> * // The usual rendering stuff<BR>> m_Camera->ComputeViewPlaneNormal();<BR>> m_Camera->SetViewUp (0, 0, -1);<BR>> m_Camera->SetPosition(0,0,1);<BR>> m_Camera->SetFocalPoint(0,0,0);<BR>> m_Camera->ParallelProjectionOn(); *<BR>> ** <BR>> * m_Renderer->SetActiveCamera(m_Camera);<BR>> m_Renderer->ResetCamera();<BR>> m_Renderer->SetBackground(0,0,0); //set a background color *<BR>> ** <BR>> * m_Actor->SetInput( image)<BR>> m_Camera->SetClippingRange( 0.1, 1000.);<BR>> m_RenderWindow->Render();*<BR>> <BR>> Do you think one or several parameters are not correct and explain my <BR>>
result, If so, could you tell me which one.<BR>> <BR>> Isabelle<BR>> <BR>> */Luis Ibanez <LUIS.IBANEZ@KITWARE.COM>/* a écrit :<BR>> <BR>> <BR>> Hi Isabelle,<BR>> <BR>> In order to have more control over the rendering of the image<BR>> you should replace the vtkImageViewer class with the individual<BR>> components used in ImageSliceViewer, namely:<BR>> <BR>> <BR>> vtkImageActor * m_Actor;<BR>> vtkRenderer * m_Renderer;<BR>> vtkCamera * m_Camera;<BR>> vtkRenderWindow * m_RenderWindow;<BR>> <BR>> <BR>> <BR>> The vtkImageViewer is actually a grouping of<BR>> <BR>> vtkRenderWindow *RenderWindow;<BR>> vtkRenderer *Renderer;<BR>> vtkImageMapper *ImageMapper;<BR>> vtkActor2D *Actor2D;<BR>> vtkRenderWindowInteractor *Interactor;<BR>> vtkInteractorStyleImage *InteractorStyle;<BR>> <BR>> <BR>> into a single class, just for convenience of use.<BR>>
http://www.vtk.org/doc/nightly/html/classvtkImageViewer.html<BR>> <BR>> Regards,<BR>> <BR>> Luis<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></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>