[vtkusers] Slice a volume

Dingrong Yi dingryi at sten.sunnybrook.utoronto.ca
Thu Jan 30 12:55:00 EST 2003


Hi Chunyan
If you know the angle of the normal to the Z axis (p) and the angle
of the normal to the X axis (q), you can use the following method
to get the axis cosines. However, since one degree of the normal
is still missing (the one rotate along itself) hence the final
slice may somehow rotate along its normal direction.

void GetObliqueSliceCoordinateDirectCosine(double Xi[], double Yi[], 
					   double Zi[], const double 
p_degree,
					   const double q_degree)
{
 float pi = 3.1415926;
 
 float p, q, alpha, beta;
 p = degree_per_arc * p_degree;
 q = degree_per_arc * q_degree;
 
 //normal_Zw = p, normal_Xw = q;
 alpha = p;
 beta = q + 90 * degree_per_arc;
 //alpha is the rotation along Xw axis (Rx(alpha));
 //beta is teh rotation along Zw axis (Rz(beta) = Rz(90+q));
 //normal_Zw = alpha, normal_Xw = beta;

 float R_Composite[3][3]=
  {{cos(beta), -sin(beta)*cos(alpha), sin(beta)*sin(alpha)},
   {sin(beta), cos(beta)*cos(alpha), -cos(beta)*sin(alpha)},
   0,          sin(alpha),           cos(alpha)};
 float Xw[3] = {1, 0, 0};
 float Yw[3] = {0, 1, 0};
 float Zw[3] = {0, 0, 1};
 
 for (int i=0; i<3; i++)
   {
     Xi[i] = R_Composite[i][0];
     Yi[i] = R_Composite[i][1];
     Zi[i] = R_Composite[i][2];
     cout<< Xi[i]<<" "<<Yi[i]<<" "<<Zi[i]<<endl;
   }
 return;
}


Best
Dingrong Yi



On Thu, 30 Jan 2003, Chunyan Jiang wrote:

> Hi, all,
> I want to get a slice from a volume. I consider I should use
> vtkImageReslice. However, I have no example how to use it. I have the cut
> plane. I don't know how to set SetResliceAxesDirectionCosines by the normal
> of the cut plane.
> Could some one give me an example?
> Thank you very much!
> 
> 
> Chunyan
> ***********************************************************************
> Chunyan Jiang, Dipl.-Inform.,
> Institut for Telematic
> Bahnhofstrasse 30-32, D-54292 Trier, Germany
> Phone: (+49) (0)651-97551-34
> Fax: (+49) (0)651-97551-12
> ***********************************************************************
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
> 




More information about the vtkusers mailing list