[vtkusers] How to enlarge an image with vtkImageActor and vtkInteractorStyleImage
John Anaia
john.anaia at gmail.com
Tue Feb 25 00:08:55 EST 2014
(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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140224/b6b001d8/attachment.html>
More information about the vtkusers
mailing list