[vtkusers] problem with fitting image into viewport
    Thomas Lambertz 
    thomas at hexerei-software.de
       
    Mon May 29 20:45:09 EDT 2006
    
    
  
Hi,
it took me some time to realize that not the codesnippet postet below 
was is the problem. I tried with the tutuials in vtk/Examples/Tutorials 
and when adding
ren1->GetActivecamera()->ParallelProjectionOn();
ren1->GetActivecamera()->SetParallelScale(4);
there, all runs well. So copying some code into my project - and to my 
surprise - all is ok WHEN i replace my vtkActor2d with the one from the 
tutorial (which is a vtkActor).
[...] (connector is an itkImageToVTKImage Filter)
connector->UpdateLargestPossibleRegion();
vtkRenderer *ren2= vtkRenderer::New();
*1)
vtkImageMapper *testMapper = vtkImageMapper::New();
testMapper->SetInput( connector->GetOutput() );
testMapper->Update();
vtkActor2D *testActor = vtkActor2D::New();
testActor->SetMapper( testMapper);
ren2->AddActor2D( testActor );
ren2->ResetCamera();
ren2->GetActiveCamera()->ParallelProjectionOn();
ren2->GetActiveCamera()->SetParallelScale(10);
renWin->AddRenderer(ren2);
As the displayed image is correct (except the size) i think all before 
*1) works well.So still vtkImageMapper and vtkActor2D on the list. 
Searching again the web the code here 
http://www.imaging.robarts.ca/coders/content/classes/examples/vtkSliceWidget.html 
makes me believe that it´s not a general problem between vtkActor2D and 
SetParallelScale().
Looks like not being a big problem - but i am just to blind to see the 
solution. Can someone help me out of this misery ?
Thx in advance,
Tom
Thomas Lambertz wrote:
> Hi all,
>
> what went wront with the following code ?
>
> renWin->AddRenderer(sliceRenderer[slice]);
>
> vtkCamera *camera = vtkCamera::New();
> camera->ParallelProjectionOn();
> camera->SetParallelScale(256);
> sliceRenderer[slice]->InteractiveOff();
> sliceRenderer[slice]->SetActiveCamera(camera);
>
> renWin->Render();
>
> I got the image on the screen - but no scaling whatever value given 
> for SetParallelScale (the block in the middle can simply be removed 
> without an effect). Seemes i missed something - but i have no idea 
> what. Any suggestions ?
>
> Kind regards,
> Tom
    
    
More information about the vtkusers
mailing list