[vtkusers] How to enlarge an image with vtkImageActor and vtkInteractorStyleImage

Bill Lorensen bill.lorensen at gmail.com
Tue Feb 25 09:35:25 EST 2014


This example may help
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/FillWindow
 On Feb 25, 2014 12:09 AM, "John Anaia" <john.anaia at gmail.com> wrote:

> (Sorry for last email without a subject line)
>
> I want to display a PNG image thru vtkImageActor and
> vtkInteractorStyleImage on QVTKWidget. Everything works fine except the
> image appears too small. How do I make the image appears larger when I show
> it the first time without mouse interaction? I tried Dolly but no effect at
> all. Someone please recommend a camera function to enlarge the image? Here
> is my code
>
>   vtkSmartPointer<vtkPNGReader> reader = vtkSmartPointer<vtkPNGReader>:
> :New();
>
>   QString path = QCoreApplication::applicationDirPath();
>   path.append("/icons/logo.png");
>   reader->SetFileName((path.toStdString()).c_str());
>
>   vtkSmartPointer<vtkImageActor> imgactor =
> vtkSmartPointer<vtkImageActor>::New();
>   imgactor->SetInput(reader->GetOutput());
>
>   vtkSmartPointer<vtkInteractorStyleImage> isi =
>     vtkSmartPointer<vtkInteractorStyleImage>::New();
>
> gUI.qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(isi);
>
>   // a renderer and render window
>   vtkRenderer *ren1 = vtkRenderer::New();
>   gUI.qvtkWidget->GetRenderWindow()->AddRenderer(ren1);
>
>   // add the actor to the scene
>   ren1->AddViewProp(imgactor);
>   ren1->SetBackground(1,1,1);     // Background color
>
>   ren1->GetActiveCamera()->Dolly(1.0);
>
>
> Thank you!
>
> John
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140225/4a1c4da6/attachment.html>


More information about the vtkusers mailing list