hello all,<br>I really need your help on the following issue:<br>I have a certain set of data that I want to ALWAYS fit into<br>the rendering window no matter how the window is resized. <br><br>VTKs default seems to be the following:<br>
if width > height, then the data is zoomed such that<br>it fits the window.<br>If only the width changes and width < height, the data<br>is not zoomed in / out to fit into the window.<br>At least this is the behavior of the program of which <br>
the code is shown below.<br><br>Does anybody know how to force the camera to <br>zoom in / out such that the data always fits into the window,<br>no matter how its proportions are ?<br>On a note,I am using parallel projection in my project.<br>
<br>Here is the code:<br>----------------------------------------------------------------<br>vtkRenderer * renderer = vtkRenderer::New();<br> vtkRenderWindow * renWin = vtkRenderWindow::New();<br> vtkTIFFReader* l_reader = vtkTIFFReader::New();<br>
vtkImageActor* l_actor = vtkImageActor::New();<br> vtkImageMapToColors* l_mapper = vtkImageMapToColors::New(); <br> vtkImageCast* l_cast = vtkImageCast::New();<br><br> renderer->SetInteractive(1);<br> renWin->SetSize(500, 500);<br>
//vtkPolyData* l_dat = vtkPolyData::New();<br> renWin->AddRenderer(renderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(renWin);<br> vtkInteractorStyleImage* style = vtkInteractorStyleImage::New();<br>
iren->SetInteractorStyle( style );<br> renderer->AddActor(l_actor);<br><br> l_reader->SetFileName("D:\\data\\imgs\\plan.tif");<br> l_cast->SetInput(l_reader->GetOutput());<br> l_cast->SetOutputScalarTypeToUnsignedChar();<br>
l_mapper->SetInput(l_cast->GetOutput());<br> l_actor->SetInput(l_mapper->GetOutput());<br> renWin->Render(); <br> iren->Initialize();<br> iren->Start();<br>------------------------------------------------------------------------------<br>
<br>best regards, Oliver<br>