[vtkusers] Flipping an image with vtkCamera
Jesús Spínola
jspinola at gmail.com
Fri Jan 26 09:44:09 EST 2007
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();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070126/6d615982/attachment.htm>
More information about the vtkusers
mailing list