[vtkusers] SetCutPlane not working in vtkImageResliceMapper

Debjit Ghosh dghosh at chla.usc.edu
Thu Mar 28 15:29:34 EDT 2013


Thanks David.

Do you find anything grossly incorrect with this? Because based on my
understanding of the solution to rotate the viewup vector based on the
orientation of the vtkImageSlice, I created a 3x3 matrix out of the X, Y, Z
values and rotated the default view up.
----------------------------------------------------------------------------------------------

double default_norm[] = {0,0,-1};
double viewup_derived[] = {0,0,-1};
double *orientation = this->imageslice->GetOrientation();
vtkSmartPointer<vtkMatrix3x3> matrix = vtkSmartPointer<vtkMatrix3x3>::New();
double azimuth = orientation[0];
double elevation = orientation[1];
double roll = orientation[2];

//Set the 1st col
matrix->SetElement(0, 0, cos(Deg_to_Rad(azimuth)) *
cos(Deg_to_Rad(elevation)));
matrix->SetElement(1, 0, sin(Deg_to_Rad(azimuth)) *
cos(Deg_to_Rad(elevation)));
matrix->SetElement(2, 0, -sin(Deg_to_Rad(elevation)));

//Set the 2nd col
matrix->SetElement(0, 1, (cos(Deg_to_Rad(azimuth)) *
sin(Deg_to_Rad(elevation)) * sin(Deg_to_Rad(roll))) -
(sin(Deg_to_Rad(azimuth))*cos(Deg_to_Rad(roll))));
matrix->SetElement(1, 1, (sin(Deg_to_Rad(azimuth)) *
sin(Deg_to_Rad(elevation)) * sin(Deg_to_Rad(roll))) +
(cos(Deg_to_Rad(azimuth))*cos(Deg_to_Rad(roll))));
matrix->SetElement(2, 1, cos(Deg_to_Rad(elevation)) *
sin(Deg_to_Rad(roll)));

//Set the 3rd col
matrix->SetElement(0, 2, (cos(Deg_to_Rad(azimuth)) *
sin(Deg_to_Rad(elevation)) * cos(Deg_to_Rad(roll))) +
(sin(Deg_to_Rad(azimuth)) * sin(Deg_to_Rad(roll))));
matrix->SetElement(1, 2, (sin(Deg_to_Rad(azimuth)) *
sin(Deg_to_Rad(elevation)) * cos(Deg_to_Rad(roll))) -
(cos(Deg_to_Rad(azimuth)) * sin(Deg_to_Rad(roll))));
matrix->SetElement(2, 2, cos(Deg_to_Rad(elevation)) *
cos(Deg_to_Rad(roll)));

matrix->MultiplyPoint(default_norm, viewup_derived);



--
View this message in context: http://vtk.1045678.n5.nabble.com/SetCutPlane-not-working-in-vtkImageResliceMapper-tp5716627p5719704.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list