<div dir="ltr"><div>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<br>
<br> vtkSmartPointer<vtkPNGReader> reader = vtkSmartPointer<vtkPNGReader>::New();<br><br> QString path = QCoreApplication::applicationDirPath();<br> path.append("/icons/logo.png"); <br> reader->SetFileName((path.toStdString()).c_str());<br>
<br> vtkSmartPointer<vtkImageActor> imgactor = vtkSmartPointer<vtkImageActor>::New();<br> imgactor->SetInput(reader->GetOutput());<br><br> vtkSmartPointer<vtkInteractorStyleImage> isi = <br> vtkSmartPointer<vtkInteractorStyleImage>::New();<br>
gUI.qvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(isi);<br><br> // a renderer and render window<br> vtkRenderer *ren1 = vtkRenderer::New();<br> gUI.qvtkWidget->GetRenderWindow()->AddRenderer(ren1);<br>
<br> // add the actor to the scene<br> ren1->AddViewProp(imgactor);<br> ren1->SetBackground(1,1,1); // Background color<br><br> ren1->GetActiveCamera()->Dolly(1.0);<br><br><br>Thank you!<br></div>John<br>
<br></div>