[vtkusers] Re: problem with fitting image into viewport

Thomas Lambertz thomas at hexerei-software.de
Tue May 30 11:17:56 EDT 2006


Hi Goodwin,

thx for your answer. The link is unfortuantly one of the ones i based my 
code on. They used a vtkActor which seemes to work fine.

I am still not sure wether it has to do with vtkActor2D or the 
vtkImageMapper i used - or better the way i used them. The bug is 
certanly in my code.
Any suggestions ?

Kind regards,
Tom

Goodwin Lawlor Wrote:

> 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
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list