[vtkusers] Flipping an image with vtkCamera

Jesús Spí­nola jspinola at gmail.com
Thu Feb 1 06:17:51 EST 2007


I tried to manipulate the camera's position but with no success. If in axial
initially the position is 0,0,1 and the view up 0,1,0 it is suposed to
change position to 0,0,-1 to get an horizontal flip, but I get no change.
Maybe I'm missing another stuff with the camera, like clipping range,
parallel scale...? Does anybody know?

2007/1/26, Amy Squillacote <amy.squillacote at kitware.com>:
>
> Hi Jesús,
>
> Why not directly manipulate the camera's position (SetPosition method)
> and view up vector (SetViewUp method)?
>
> - Amy
>
> Jesús Spí­nola wrote:
> > Hi,
> >
> > I'm using vtkImageViewer for a 2D medical image viewer and I want to
> > put flipping functionality. My purpose is to flip, either horizontally
> > or verticaly, the image in axial, sagital or coronal view. I know
> > about vtkImageFlip filter but I want to avoid it because I think I can
> > do the same, manipulating directly the camera and it would be faster.
> >
> > My question is that I don't know exactly which is the proper method to
> > achieve the flipping with vtkCamera. For rotations on the image I used
> > the SetRoll method, it seems I'll need one of this ones Yaw, Azimuth,
> > Elevation, Pitch, etc to flip, but I don't obtain the results that i
> > like.
> > If I'm on the axial view, Yaw(180) is ok for horizontal flip, but with
> > sagital or coronal view it doesn't behave well.
> >
> > Did someone achieved correct flippings manipulating vtkCamera?
> >
> > Her are some code snippets that tell what I'm doing in each situation:
> >
> > To change to axial view
> >
> > m_imageViewer->SetSliceOrientationToXY();
> > // this is because the vtk default axial orientation is not as the
> > medical axial orientation
> > camera->SetFocalPoint(0,0,0);
> > camera->SetViewUp(0,-1,0);
> > camera->SetPosition(0,0,-1);
> > renderer->ResetCamera();
> > cam->SetRoll( -m_rotateFactor*90. + 180. ); // apply the rotation of
> > the camera, it will be always 0,90,180 or 270 degrees
> >
> >
> > To change to sagital view
> >
> > m_imageViewer->SetSliceOrientationToYZ();
> > camera->SetRoll( -m_rotateFactor*90. -90. );
> >
> >
> > To change to coronal view
> >
> > m_imageViewer->SetSliceOrientationToYZ();
> > camera->SetRoll( -m_rotateFactor*90.  );
> >
> > When i update the camera to apply a flip:
> >
> > if( m_applyFlip )
> > {
> >     camera->OrthogonalizeViewUp();
> >     camera->Yaw(180);
> >     renderer()->ResetCamera();
> > }
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070201/183a7752/attachment.htm>


More information about the vtkusers mailing list