[vtkusers] automatically adapting the size of an image to the size of a render window

Steffen Oeltze Steffen.Oeltze at Student.Uni-Magdeburg.DE
Fri Sep 27 07:20:06 EDT 2002


Dear VTK-users,

I would like to compute a slice viewer. Therefore, I need a render 
window that
shows a slice as a 2D image. I would like the image to adapt its size to 
the size
of the render window whenever this is resized. How can I manage this ?
Here is what I programmed so far:

> this->imgMapper = vtkImageMapper::New();
>         imgMapper->SetInput(imgReslice->GetOutput());
>         imgMapper->SetZSlice(0);
>         imgMapper->RenderToRectangleOn();
>
>     this->imgActor = vtkActor2D::New();
>         imgActor->SetPosition(0.0,0.0);
>         imgActor->SetPosition2(1.0,1.0);
>         imgActor->SetMapper(imgMapper);
>         
>     this->imgRen = vtkRenderer::New();
>         imgRen->AddActor2D(imgActor);
>     
>     this->imgWin = new vtkQtRenderWindow();
>         imgWin->AddRenderer(imgRen);
>         imgWin->show();






More information about the vtkusers mailing list