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) local_ICP.do_local_registration(TRANS_INIT, THRESHOLD_ICP, RMS_LOCAL_REGISTRATION, arch_ios_splint_correction, arch_ct, DEBUG=0) # check local registration quality (rms of local ICP of each tooth) for i in arch_ios_splint_correction.existing_tooth_list: # used for algorithm verification (count missing tooth as well) # for i in arch_ios.existing_tooth_list: # used for real 3 images processing print('tooth ' + np.str(i) + ' ICP rms is ' + np.str(arch_ios_splint_correction.get_tooth(i).ICP.inlier_rmse)) # ---- Step 2 Arch correction # Transform ct features to ios space using ICP transformation for i in arch_ct_in_ios.existing_tooth_list: print('transform tooth ', i) points_ICP_tem = transpose_pc(arch_ct.get_tooth(i).points, arch_ct.get_tooth(i).local_ICP_transformation) tooth_feature_ICP_tem = fe.ToothFeature(points_ICP_tem, i, 'CT', 'IOS') arch_ct_in_ios.add_tooth(i, tooth_feature_ICP_tem) # generate virtual landmarks ctl_target = []
print('reading tooth ', i) new_dicom_path = target_dicom_base + dicom_file_name + np.str(i) + '.csv' new_stl_path = source_stl_base + stl_file_name + np.str(i) + '.csv' stl_tem = Yomiread.read_csv(new_stl_path, 3, -1) dicom_tem = Yomiread.read_csv(new_dicom_path, 3, -1) tooth_stl_tem = fe.ToothFeature(stl_tem, i, 'IOS', 'IOS') arch_ios.add_tooth(i, tooth_stl_tem) tooth_dicom_tem = fe.ToothFeature(dicom_tem, i, 'CT', 'CT') arch_ct.add_tooth(i, tooth_dicom_tem) del stl_tem, dicom_tem # ---- Perform Local ICP local_ICP.do_local_registration(TRANS_INIT,THRESHOLD_ICP,RMS_LOCAL_REGISTRATION, arch_ios, arch_ct) # check local registration quality (rms of local ICP of each tooth) for i in arch_ios.tooth_list: # used for algorithm verification (count missing tooth as well) #for i in arch_ios.existing_tooth_list: # used for real 3 images processing print('tooth ' + np.str(i) + ' ICP rms is ' + np.str(arch_ios.get_tooth(i).ICP.inlier_rmse)) # Update spline points arch_ios.update_spline() arch_ct.update_spline() arch_ct_original.update_spline() # ---- Perform initial alignment trans_init = arch_ct.get_tooth(NEIGHBOUR_TOOTH).local_ICP_transformation # Transform ct features to ios space for i in arch_ct.tooth_list: print('transform tooth ', i)