[Insight-users] Re: [vtkusers] stretching
Luis Ibanez
luis.ibanez at kitware.com
Thu May 26 15:59:11 EDT 2005
Hi Isabelle,
In order to have more control over the rendering of the image
you should replace the vtkImageViewer class with the individual
components used in ImageSliceViewer, namely:
vtkImageActor * m_Actor;
vtkRenderer * m_Renderer;
vtkCamera * m_Camera;
vtkRenderWindow * m_RenderWindow;
The vtkImageViewer is actually a grouping of
vtkRenderWindow *RenderWindow;
vtkRenderer *Renderer;
vtkImageMapper *ImageMapper;
vtkActor2D *Actor2D;
vtkRenderWindowInteractor *Interactor;
vtkInteractorStyleImage *InteractorStyle;
into a single class, just for convenience of use.
http://www.vtk.org/doc/nightly/html/classvtkImageViewer.html
Regards,
Luis
--------------------------
Renaud Isabelle wrote:
> Thanks, Luis, for your advice. I took a look at the example supplied in
> ImageSliceViewer. And I implement what is inside SetupCamera().
>
> However, where I am going really *crazy* :-D, is that *all lines of code
> that I am implementing is not taken into account*. The result is still
> the same.
>
> Here is what I did:
>
> //(vtkImageViewer*) viewer
> imageInitiale = reader->GetOutput();
> viewer->SetInput(imageInitiale);
>
> //display the image in the frame
> *viewer->SetParentId(this->m_hWnd);*
>
> //to fit the image to the render window,
> float spacing[3] = {imageInitiale->GetSpacing()[0],
> imageInitiale->GetSpacing()[1],
> imageInitiale->GetSpacing()[2]};
> double max = MAX(spacing[0]*width,spacing[1]*height);
>
> vtkCamera* camera = viewer->GetRenderer()->GetActiveCamera();
> viewer->GetRenderer()->ResetCamera();
> *camera->ParallelProjectionOn();
> camera->SetParallelScale(max/2);*
>
> //execute
> viewer->Render();
>
> What`s wrong with that?
>
> Isabelle
>
>
> */Luis Ibanez <luis.ibanez at kitware.com>/* a écrit:
>
>
> Hi Isabelle,
>
>
> Thanks for letting us know that you were using
> VTK for visualization.
>
> ...You should have said that from the beginning :-)
>
>
>
> Please look at the code in the file
>
>
> ImageSliceViewer.cxx
>
>
> in the directory
>
> InsightApplications/
> LiverTumorSegmentation/
>
>
> http://www.itk.org/cgi-bin/viewcvs.cgi/LiverTumorSegmentation/ImageSliceViewer.cxx?rev=1.3&root=InsightApplications&view=log
>
>
> You will see in this class how to manage
> the scale of your image in the method
> SetupCamera(), in lines 118-185.
>
>
>
> BTW, I'm assuming that you want to stretch the
> image *WITHOUT* changing its aspect ratio. You
> probably don't want to change the aspect ratio
> of a Medical Image.
>
>
> Note that *iff* your image has correctly specified
> its pixel size in X and Y. VTK will tak! e this pixel
> size into account at the moment of rendering the
> image.
>
>
>
> Regards,
>
>
> Luis
>
>
>
> ------------------------
> Renaud Isabelle wrote:
> > Hi everybody,
> >
> > My job is to implement an MFC interface for medical image
> segmentation
> > purposes. Before, my lab was working on Matlab to display their
> data.
> > Default behavior of matlab is to display my image in parallel
> mode and
> > stretch the image to fill the best my window. It was a convenient
> way to
> > see our 1552*128 images. That is exactly what I want to reproduce
> in my
> > interface.
> >
> > So, what I am desperately trying to do is to stretch my image
> (different
> > scale factors in x and y) to fit my render window.
> >
> >
> viewer->GetRenderer()->GetActiveCamera()->*ParallelProjectionOn*() is
> > OK, but
> > viewer->GetRenderer()->GetActiveCamera()->*SetParallelScale*() scale
> > not ! stretch my image.
> > There should be a way to stretch.
> >
> > Isabelle
> >
> >
> ------------------------------------------------------------------------
> > Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour
> vos
> > mails, photos et vidéos !
> > Créez votre Yahoo! Mail
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> ------------------------------------------------------------------------
> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos
> mails, photos et vidéos !
> Créez votre Yahoo! Mail
> <http://us.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_1go/default/*http://fr.promotions.yahoo.com/mail/creer28.html>
>
More information about the Insight-users
mailing list