[vtkusers] Re: stretch an image to fit in a window
Mathieu Malaterre
mathieu.malaterre at kitware.com
Wed May 25 14:48:19 EDT 2005
Salut Isabelle,
Are you using vtkImageViewer2 and:
viewer->SetZSlice( slice );
If so make sure you are resetting the camera clipping range:
viewer->GetRenderer()->ResetCameraClippingRange();
Other than that vtkImageViewer and vtkImageViewer2 works exactly the
same way.
HTH
Mathieu
Renaud Isabelle wrote:
> Hi again,
>
> I'm still locked with my problem of stretch my image in a window I passed.
>
> It seems that *vtkImageViewer* doesn't hav any camera instantiated.
> That's why the code:
>
> *vtkRenderer* ren1 = viewer->GetRenderer();
> ren1->GetActiveCamera()->ParallelProjectionOn();
> ren1->GetActiveCamera()->SetParallelScale(2.0);*
> **
> * //execute
> viewer->Render();*
>
> doesn't produce any scaling of the image.
>
> Then, I tried *vtkImageViewer2 *that seems to have a camera. But this
> class seems to hav another problem since the same code doesn't display
> my image at all but a black image instead.
>
> What is the solution? Do I hav to implement my own vtkImageViewer class
> and incorporate a camera? Or does it already exist a solution to use
> vtkImageViewer2?
>
> I'm confused and really don't know what to do. Please help me
>
> Isabelle
>
>
> */Renaud Isabelle <renauisa at yahoo.fr>/* a écrit :
>
> Hi,
>
> Sorry to bother you again.
>
> I tried what you indicated me to scale my image into a window I passed.
>
> *I have no error at compilation. However, my image is not scaled at
> execution. *
>
> Is there any fault in this code:
>
> viewer->SetInput(reader->GetOutput());
>
> *vtkRenderer* ren1 = viewer->GetRenderer();
> ren1->GetActiveCamera()->ParallelProjectionOn();
> ren1->GetActiveCamera()->SetParallelScale(0.5);*
>
> //display the image in the frame
> viewer->SetParentId(this->m_hWnd);
>
> //execute
> viewer->Render();
>
> thanks in advance,
>
> Isabelle
>
>
> */Goodwin Lawlor <goodwin.lawlor at ucd.ie>/* a écrit:
>
> Hi Isabelle,
>
> Have a look at this example:
>
> http://www.bioengineering-research.com/vtk/vhpreader.tcl
>
> or
>
> http://www.bioengineering-research.com/vtk/BackgroundImage.tcl
>
>
> here's the bit you need: (app is an image; numCol and numRow are
> the image
> dims)
>
> vtkImageActor ia
> ia SetInput [app GetOutput]
> ia InterpolateOff
> vtkRenderer ren1
> ren1 AddActor ia
> ren1 SetBackground 1 1 1
> vtkRenderWindow renWin
> renWin AddRenderer ren1
> renWin SetSize [expr $numCol / 4] [expr $numRow / 4]
> vtkInteractorStyleImage istyle
> vtkRenderWindowInteractor iren
> iren SetRenderWindow renWin
> iren SetInteractorStyle istyle
> [ren1 GetActiveCamera] ParallelProjectionOn
> #fit the image to the render window
> [ren1 GetActiveCamera] SetParallelScale [expr $numRow / 2]
> renWin Render
>
>
> hth
>
> Goodwin
>
>
> "Renaud ! Isabelle" wrote in message
> news:20050525115733.8984.qmail at web26108.mail.ukl.yahoo.com...
> Hi everyone,
>
> I made a 2D image displayed in a window by using
> vtkImageViewer->SetParentId(this->m_hWnd). It works well, but my
> image is
> still displayed with its own dimensions. What I would like to do
> is find a
> way to display it in order to fit the dimensions of my window,
> something
> which could stretch my image.
>
> Could someone suggest me something? I am not sure if it is a VTK
> or ITK
> problem.
>
> By the way, what is the difference between vtkImageViewer and
> vtkImageViewer2?
>
> Thanks in advance,
>
> 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
>
>
>
> _______________________________________________
> 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>
> _______________________________________________
> 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>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
More information about the vtkusers
mailing list