java - how to calculate plane equation using three points and two vectors? -
i trying calculate 2 plane equations data of 2 dicom images , intersection line these 2 plane equations. dicom tag imagepositionpatient has 3 coordinates x,y,z , tag imageorientationpatient has 2 vectors each 3 components. how equation of plane can calculated using these 3 coordinates , 2 vectors?
this code:
public void showlocalizerline(view v) { //getting values infooffirst(); //this gets img position , orientation of src img infoofsecond(); //this gets img position , orientation of dst img string[] src_position_array = new string[3]; src_position_array = firstimg_position.split("\\\\"); src_position_xo = float.parsefloat(src_position_array[0]); src_position_yo = float.parsefloat(src_position_array[1]); src_position_zo = float.parsefloat(src_position_array[2]); string[] src_orientation_array = new string[6]; src_orientation_array = firstimg_orientation.split("\\\\"); src_orientation_vector1_a = float.parsefloat(src_orientation_array[0]); src_orientation_vector1_b = float.parsefloat(src_orientation_array[1]); src_orientation_vector1_c = float.parsefloat(src_orientation_array[2]); src_orientation_vector2_d = float.parsefloat(src_orientation_array[3]); src_orientation_vector2_e = float.parsefloat(src_orientation_array[4]); src_orientation_vector2_f = float.parsefloat(src_orientation_array[5]); string[] dst_position_array = new string[3]; dst_position_array = secimg_position.split("\\\\"); dst_position_xo = float.parsefloat(dst_position_array[0]); dst_position_yo = float.parsefloat(dst_position_array[1]); dst_position_zo = float.parsefloat(dst_position_array[2]); string[] dst_orientation_array = new string[6]; dst_orientation_array = secimg_orientation.split("\\\\"); dst_orientation_vector1_a = float.parsefloat(dst_orientation_array[0]); dst_orientation_vector1_b = float.parsefloat(dst_orientation_array[1]); dst_orientation_vector1_c = float.parsefloat(dst_orientation_array[2]); dst_orientation_vector2_d = float.parsefloat(dst_orientation_array[3]); dst_orientation_vector2_e = float.parsefloat(dst_orientation_array[4]); dst_orientation_vector2_f = float.parsefloat(dst_orientation_array[5]); //calculations float dst_nrm_dircos_x = dst_orientation_vector1_b*dst_orientation_vector2_f - dst_orientation_vector1_c*dst_orientation_vector2_e; float dst_nrm_dircos_y = dst_orientation_vector1_c*dst_orientation_vector2_d - dst_orientation_vector1_a*dst_orientation_vector2_f; float dst_nrm_dircos_z = dst_orientation_vector1_a*dst_orientation_vector2_e - dst_orientation_vector1_b*dst_orientation_vector2_d; float src_pos_x = src_position_xo - dst_position_xo; float src_pos_y = src_position_yo - dst_position_yo; float src_pos_z = src_position_zo - dst_position_zo; float dst_pos_x = dst_orientation_vector1_a*src_pos_x + dst_orientation_vector1_b*src_pos_y + dst_orientation_vector1_c*src_pos_z; float dst_pos_y = dst_orientation_vector2_d*src_pos_x + dst_orientation_vector2_e*src_pos_y + dst_orientation_vector2_f*src_pos_z; float dst_pos_z = dst_nrm_dircos_x*src_pos_x + dst_nrm_dircos_y*src_pos_y + dst_nrm_dircos_z*src_pos_z; }
from class names guess imagepositionpatient
gives point (say a) on plane , imageorientationpatient
(say n) gives normal. (i wouldn't know correct since told me 3d vectors have in mind).
then plane equation given dot(n, a) = dot(n, x)
, x position variable , n normalized. gives ax + + cz = d
cartesian equation.
Comments
Post a Comment