[vtkusers] Flipping an image with vtkCamera
Amy Squillacote
amy.squillacote at kitware.com
Fri Jan 26 09:50:23 EST 2007
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
>
More information about the vtkusers
mailing list