[vtkusers] xxxxxSPAMxxxxx xxxxxSPAMxxxxx Putting 2D image to the center of window, how to do it?
David Doria
daviddoria+vtk at gmail.com
Wed Feb 10 07:33:04 EST 2010
On Wed, Feb 10, 2010 at 6:10 AM, HanJongChul <madness78 at pusan.ac.kr> wrote:
> Hello, vtkusers,
>
> I have question.
>
> When displaying the 2D image, how to Putt 2D image to the center of window.
>
> Is there any function? I couldn’t find it.
>
> Please help me.
>
>
>
> this->pvtkImageMagnify = vtkImageMagnify::New();
>
> this->pvtkImageMagnify->SetInputConnection(this
> ->pvtkImageReader1->GetOutputPort());
>
> this->pvtkImageMagnify->SetMagnificationFactors(2,2,2);
>
>
>
>
>
> this->pvtkImageMapper=vtkImageMapper::New();
>
> this->pvtkImageMapper->SetInput(this
> ->pvtkImageMagnify->GetOutput());
>
>
>
>
>
> this->pvtkActor2D=vtkActor2D::New();
>
> this->pvtkActor2D->SetMapper(this->pvtkImageMapper);
>
> this
> ->pvtkActor2D->GetPosition2Coordinate()->SetCoordinateSystemToViewport();
>
> this->pvtkActor2D->SetPosition(0,0);
>
> this->pvtkActor2D->SetPosition2(512,512);
>
>
>
> pVOXA_Ver10View->GetRenderer()->SetBackground(1,1,1);
>
> pVOXA_Ver10View->GetRenderer()->AddActor2D(this->pvtkActor2D);
>
> pVOXA_Ver10View->GetRenderer()->ResetCamera();
>
>
>
>
> I'm not sure which part of your question you were most interested in, so
take a look at this:
http://www.vtk.org/Wiki/VTK/Examples/InteractWithImage
It shows how to display and interact (zoom, pan) with a 2D image. Is this
what you were trying to do?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100210/c72cbb09/attachment.htm>
More information about the vtkusers
mailing list