[vtkusers] SetCutPlane not working in vtkImageResliceMapper
Debjit Ghosh
dghosh at chla.usc.edu
Tue Apr 2 15:26:24 EDT 2013
Hi David,
I understand that this is an open forum and I would like to know if there is
anything I or our division at the Children's Hospital Los Angeles could do
in return for your much needed help.
After spending a few days on the problem and your suggested solution, I have
observed and realized that it isn't just a matter of rotating the viewup
vector based on the orientation of the volume pinned to the vtkImageSlice
object. That is incorrect.
I request you to go over the following setup one more time:
Initial Setting:
{
vtkImageSlice->SliceFacesCameraOn();
vtkImageSlice->SliceAtFocalPointOn();
vtkImageSlice->SetOrigin(dimX/2, dimY/2, 0); //so that rotation of volume is
applied around "tip" of cone
vtkImageSlice->RotateX(angle_x);
vtkImageSlice->RotateY(angle_y);
vtkImageSlice->RotateZ(angle_z);
viewup = {0, 0, 1};
default_norm = {0, 0, 1};
//I have tried using rotation matrices to convert angle_x, angle_y, angle_z
and multiplying it with the //viewup but that isn't the solution and I feel
it has to do with more camera settings that just the view up. //Please NOTE
that the origin is not {0,0,0} but the tip of the cone
}
Execute on timer using 6DOF sensor input:
{
vtkSmartPointer<vtkMatrix3x3> matrix = vtkSmartPointer<vtkMatrix3x3>::New();
GetSensorOrientation(matrix);
vtkSmartPointer<vtkCamera> cam = renderer->GetActiveCamera();
matrix->MultiplyPoint(default_norm, normal);
//Calculate the focal point
double focalPt[3];
double centerofvol[] = {dimX/2, dimY/2, dimZ/2};
vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
plane->SetOrigin(dimX/2, dimY/2, 0);
plane->SetNormal(normal);
plane->ProjectPoint( centerofvol, focalPt );
position[0] = focalPt[0] + distfromcam * this->normal[0];
position[1] = focalPt[1] + distfromcam * this->normal[1];
position[2] = focalPt[2] + distfromcam * this->normal[2];
cam->SetPosition(position); //Orientation of the slice plane
cam->SetFocalPoint(focalPt); //Point at which my plane is fixed
cam->SetViewUp(viewup);
}
--
View this message in context: http://vtk.1045678.n5.nabble.com/SetCutPlane-not-working-in-vtkImageResliceMapper-tp5716627p5719776.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list