[vtkusers] Re: problem with fitting image into viewport
Goodwin Lawlor
goodwin.lawlor at ucd.ie
Tue May 30 09:29:00 EDT 2006
Thomas Lambertz wrote:
> 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
Hi Tom,
Have a look at the tcl code here:
http://www.bioengineering-research.com/vtk/BackgroundImage.tcl
where an image is set as a background in the viewport.
hth
Goodwin
More information about the vtkusers
mailing list