[vtkusers] vtkImageActor and a vtkActor added to renderer - Size issues

Hari Menon harik87 at gmail.com
Wed Jan 4 02:12:45 EST 2012


Hi vtk users,
   I want to add a vtkImageActor and a 3d volume to a single renderer. When
I simply add both into a renderer, the image actor gets sized to occupy
most of the region in window and the 3d actor is getting very small.
I guess I should define a space for both the actors in the window and add
accordingly.
How it can be done and also if both actors are placing in predefined area,
how the image will be resized? Will it be resized to fit in the space
provided?
Code snippet is given below

        vtkSmartPointer<vtkJPEGReader> jPEGReader
= vtkSmartPointer<vtkJPEGReader>::New();
jPEGReader->SetFileName("D:\\test1.jpg");
jPEGReader->Update();
// Create an actor
vtkSmartPointer<vtkImageActor> actor =
 vtkSmartPointer<vtkImageActor>::New();
actor->SetInput(jPEGReader->GetOutput());

        vtkSmartPointer<vtkSphereSource> sphereSource1
= vtkSmartPointer<vtkSphereSource>::New();
sphereSource1->SetCenter(0.0, 0.0, 0.0);
sphereSource1->SetRadius(4.0);
sphereSource1->Update();

vtkSmartPointer<vtkPolyDataMapper> mapper1
= vtkSmartPointer<vtkPolyDataMapper>::New();
mapper1->SetInput(sphereSource1->GetOutput());

vtkSmartPointer<vtkActor> actor1 = vtkSmartPointer<vtkActor>::New();
actor1->SetMapper(mapper1);

        vtkSmartPointer<vtkRenderer> renderer
= vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow
= vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);

        renderer->AddActor(actor1);
        renderer->AddActor(actor);


Please help...Thanks in advance..
    Hari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120104/3ba89201/attachment.htm>


More information about the vtkusers mailing list