points_virtual_tem = transpose_pc(arch_ct.get_tooth(i).points, arch_ct.get_tooth(i).local_ICP_transformation) tooth_feature_rigid_tem = fe.ToothFeature(points_rigid_tem, i, 'CT', 'IOS') tooth_feature_virtual_tem = fe.ToothFeature(points_virtual_tem, i, 'CT', 'IOS') arch_ct_to_ios.add_tooth(i, tooth_feature_rigid_tem) arch_ct_in_ios.add_tooth(i, tooth_feature_virtual_tem) del points_rigid_tem, tooth_feature_rigid_tem, points_virtual_tem, tooth_feature_virtual_tem # Update spline points arch_ct_in_ios.update_spline(fine_flag=True) arch_ct_to_ios.update_spline(fine_flag=True) print('displacement check', arch_ct_to_ios.spline_points - arch_ct_in_ios.spline_points) print('original spline is', arch_ct_in_ios.spline_points) print('target spline is', arch_ct_to_ios.spline_points) displacement = arch_ct_to_ios.spline_points_fine - arch_ct_in_ios.spline_points_fine corrected_spline = sc.displacement(arch_ct_in_ios.spline_points, arch_ct_in_ios.spline_points_cylindrical, arch_ct_in_ios.spline_points_fine_cylindrical_mid_points, displacement) print('corrected spline is', corrected_spline) for i in arch_ct_to_ios.tooth_list: candidate_tooth = arch_ct_in_ios.get_tooth(i).points candidate_tooth_cylindrical = coordinates.convert_cylindrical(candidate_tooth, arch_ct_in_ios.spline_points_cylindrical_center) corrected_tooth = sc.displacement(candidate_tooth, candidate_tooth_cylindrical,arch_ct_in_ios.spline_points_fine_cylindrical_mid_points, displacement) corrected_tooth_feature = fe.ToothFeature(corrected_tooth, i, 'CT', 'IOS') arch_ct_in_ios_curvilinear_correction.add_tooth(i, corrected_tooth_feature) candidate2_tooth = arch_ios.get_tooth(i).points candidate2_tooth_cylindrical = coordinates.convert_cylindrical(candidate2_tooth, arch_ct_in_ios.spline_points_cylindrical_center) corrected2_tooth = sc.displacement(candidate2_tooth, candidate2_tooth_cylindrical,arch_ct_in_ios.spline_points_fine_cylindrical_mid_points, displacement) corrected2_tooth_feature = fe.ToothFeature(corrected2_tooth, i, 'IOS', 'IOS') arch_ios_curvilinear_correction.add_tooth(i, corrected2_tooth_feature)
splint_ground.update_spline(fine_flag=True) splint_ios.update_spline(fine_flag=True) #fig = plt.figure() #plt.scatter(splint_ground.spline_points_fine[:, 0], splint_ground.spline_points_fine[:, 1], label='ground') #plt.scatter(splint_ios.spline_points_fine[:, 0], splint_ios.spline_points_fine[:, 1], label='ios') #plt.legend() #plt.show() # perform splint correction displacement_splint = np.asarray(splint_ground.spline_points_fine) - np.asarray(splint_ios.spline_points_fine) for i in arch_ios.existing_tooth_list: points_tem = arch_ios.get_tooth(i).points points_tem_transformed = transpose_pc(points_tem, modify_matrix) points_tem_transformed_cylindrical = coordinates.convert_cylindrical(points_tem_transformed, splint_ground.spline_points_fine_cylindrical_mid_points) points_tem_corrected_transformed = sc.displacement(points_tem_transformed, points_tem_transformed_cylindrical, splint_ground.spline_points_fine_cylindrical_mid_points, displacement_splint) #points_tem_corrected = transpose_pc(points_tem_corrected_transformed, np.linalg.inv(modify_matrix)) points_tem_corrected = transpose_pc(points_tem_corrected_transformed, modify_matrix2) tooth_feature_splint_correction = fe.ToothFeature(points_tem_corrected, i, 'IOS', 'IOS') arch_ios_splint_correction.add_tooth(i, tooth_feature_splint_correction) #target_points_transfromed = transpose_pc(arch_ios.target_points, modify_matrix) target_points_transfromed = transpose_pc(splint_fiducial_ios[20:, :], modify_matrix) target_points_transfromed_cylindrical = coordinates.convert_cylindrical(target_points_transfromed, splint_ground.spline_points_fine_cylindrical_mid_points) target_points_corrected_transformed = sc.displacement(target_points_transfromed, target_points_transfromed_cylindrical, splint_ground.spline_points_fine_cylindrical_mid_points, displacement_splint) #target_points_corrected = transpose_pc(target_points_corrected_transformed, np.linalg.inv(modify_matrix)) target_points_corrected = transpose_pc(target_points_corrected_transformed, modify_matrix2) arch_ios_splint_correction.add_target(target_points_corrected) print('original target points are', splint_fiducial_ios[20:, :]) print('target_points corrected are', target_points_corrected) print('target_points corrected check are', arch_ios_splint_correction.target_points)
arch_ct_to_ios_fxt.add_tooth(i, tooth_feature_rigid_tem) arch_ct_in_ios_fxt.add_tooth(i, tooth_feature_virtual_tem) del points_rigid_tem, tooth_feature_rigid_tem, points_virtual_tem, tooth_feature_virtual_tem # Update spline points arch_ct_in_ios_fxt.update_spline(fine_flag=True) arch_ct_to_ios_fxt.update_spline(fine_flag=True) displacement = arch_ct_to_ios_fxt.spline_points_fine - arch_ct_in_ios_fxt.spline_points_fine for i in arch_ct_to_ios_fxt.tooth_list: # for tooth in target candidate_tooth = arch_ct_in_ios_fxt.get_tooth(i).points candidate_tooth_cylindrical = coordinates.convert_cylindrical( candidate_tooth, arch_ct_in_ios_fxt.spline_points_cylindrical_center) corrected_tooth = sc.displacement( candidate_tooth, candidate_tooth_cylindrical, arch_ct_in_ios_fxt.spline_points_fine_cylindrical_mid_points, displacement) corrected_tooth_feature = fe.ToothFeature(corrected_tooth, i, 'CT', 'IOS') arch_ct_in_ios_fxt_curvilinear_correction.add_tooth( i, corrected_tooth_feature) candidate2_tooth = arch_ios.get_tooth(i).points candidate2_tooth_cylindrical = coordinates.convert_cylindrical( candidate2_tooth, arch_ct_in_ios_fxt.spline_points_cylindrical_center) corrected2_tooth = sc.displacement( candidate2_tooth, candidate2_tooth_cylindrical, arch_ct_in_ios_fxt.spline_points_fine_cylindrical_mid_points, displacement) corrected2_tooth_feature = fe.ToothFeature(corrected2_tooth, i, 'IOS',