def load(self): patient = get_patient() rw, rh = self.reference.get_image_size() ww, wh = self.workspace.get_image_size() embed = tk.Frame(self.root, width=rw, height=wh) embed.grid(row=0, column=0) name_static_label = tk.Label(embed, text=ms.get("patient_info") + ":") name_static_label.grid(sticky=tk.W, padx=10) name_label_text = tk.StringVar() name_label_text.set(patient.name) name_label = tk.Label(embed, textvariable=name_label_text) name_label.grid(sticky=tk.W, padx=10) next_point_static_label = tk.Label(embed, text=ms.get("next_point") + ":") next_point_static_label.grid(sticky=tk.W, padx=10) next_point_label_text = tk.StringVar() next_point_label = tk.Label(embed, textvariable=next_point_label_text) next_point_label.grid(sticky=tk.W, padx=10) refscreen = tk.Canvas(embed, width=rw, height=rh) refscreen.grid(sticky=tk.N + tk.W) screen = self.load_ui_wokspace(embed, self.root, wh, ww) self.reference.load_screen(refscreen, 0, 0, rw, rh, next_point_label_text) self.workspace.load_screen(screen, 0, 0, ww, wh) screen.bind("<Button-1>", self.mouse_up) screen.bind("<Motion>", self.mouse_move) refscreen.bind("<Button-1>", self.print_ref_point) self.root.protocol("WM_DELETE_WINDOW", self.on_closing) self.root.title("Facial Symmetry Analysis")
def add_main_measurement_table(self, table_frame): main_angle = SymmetryAngleProportionValue(self.a.malar_middle) angle_label = tk.Label(table_frame, text=ms.get("main_measurement")) angle_label.grid(sticky=tk.W, padx=10) tm = Treeview(table_frame, height=1) tm.column("#0", width=1100) tm.insert("", 1100, text=ms.get("main_measurement_text").format(main_angle.get_orientation(), main_angle.get_differential())) tm.grid()
def get_orientation(self): p = self.angle.get_displacement_x() if p > 0: # code left return ms.get("right") if p < 0: # code right return ms.get("left") if p == 0: return ""
def get_orientation(self): # L / R p = self.angle.get_proportion() if p > 1: #code left return ms.get("right") elif p < 1: #code right return ms.get("left") else: return ""
def add_chin_angle_table(self, table_frame): angle_label = tk.Label(table_frame, text=ms.get("chin_angles")) angle_label.grid(sticky=tk.W, padx=10) tm = Treeview(table_frame, height=3) tm["columns"] = "left", "right", "differential", "orientation" tm.heading("left", text=ms.get("right")) tm.heading("right", text=ms.get("left")) tm.heading("differential", text=ms.get("differential")) tm.heading("orientation", text=ms.get("orientation")) tm.column("#0", width=300) self.add_row(tm, SymmetryAngleProportionValue(self.a.cheek_chin), "{cheek} - {chin}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.mouth_chin), "{mouth} - {chin}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.cheekbone_chin), "{cheekbone} - {chin}".format_map(ms)) tm.grid()
def add_breaking_point_table(self, table_frame): angle_label = tk.Label(table_frame, text=ms.get("break_point")) angle_label.grid(sticky=tk.W, padx=10) tm = Treeview(table_frame, height=1) tm["columns"] = "angle", "deviation", "", "" tm.heading("angle", text=ms.get("angle")) tm.heading("deviation", text=ms.get("deviation")) tm.heading("", text="") tm.heading("", text="") tm.column("#0", width=300) break_point_row = DisplacementAngleProportionValue(self.a.break_point_nose_point) tm.insert("", 0, text="{break_point}".format_map(ms), values=break_point_row.get_value()) tm.grid()
def add_angle_table(self, table_frame): angle_label = tk.Label(table_frame, text=ms.get("angles")) angle_label.grid(sticky=tk.W, padx=10) tm = Treeview(table_frame, height=3) tm["columns"] = "left", "right", "differential", "orientation" tm.heading("left", text=ms.get("right")) tm.heading("right", text=ms.get("left")) tm.heading("differential", text=ms.get("differential")) tm.heading("orientation", text=ms.get("orientation")) tm.column("#0", width=300) central_point_wall_row = SymmetryAngleProportionValue(self.a.central_point_wall) tm.insert("", 0, text="{walls} - {central_point}".format_map(ms), values=central_point_wall_row.get_value()) nose_point_wall_row = SymmetryAngleProportionValue(self.a.nose_point_wall) tm.insert("", 0, text="{walls} - {nose_point}".format_map(ms), values=nose_point_wall_row.get_value()) nose_point_maxilar_row = SymmetryAngleProportionValue(self.a.nose_point_maxilar) tm.insert("", 0, text="{maxilars} - {nose_point}".format_map(ms), values=nose_point_maxilar_row.get_value()) tm.grid()
def addMalarTable(self, table_frame): angle_label = tk.Label(table_frame, text=ms.get("malar_angles")) angle_label.grid(sticky=tk.W, padx=10) tm = Treeview(table_frame, height=4) tm["columns"] = "left", "right", "differential", "orientation" tm.heading("left", text=ms.get("right")) tm.heading("right", text=ms.get("left")) tm.heading("differential", text=ms.get("differential")) tm.heading("orientation", text=ms.get("orientation")) tm.column("#0", width=300) self.add_row(tm, SymmetryAngleProportionValue(self.a.malar_middle), "{malar} - {middle}".format_map(ms), tags=('main_row',)) self.add_row(tm, SymmetryAngleProportionValue(self.a.malar_internal_cant), "{malar} - {eye_inner}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.malar_nose_point), "{malar} - {nose_point}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.malar_nose), "{malar} - {nose}".format_map(ms)) # tm.tag_configure('main_row', background='red') tm.grid()
def add_interocular_angle_table(self, table_frame): angle_label = tk.Label(table_frame, text=ms.get("interoculares_angles")) angle_label.grid(sticky=tk.W, padx=10) tm = Treeview(table_frame, height=9) tm["columns"] = "left", "right", "differential", "orientation" tm.heading("left", text=ms.get("right")) tm.heading("right", text=ms.get("left")) tm.heading("differential", text=ms.get("differential")) tm.heading("orientation", text=ms.get("orientation")) tm.column("#0", width=300) self.add_row(tm, SymmetryAngleProportionValue(self.a.outer_eye_middle), "{eye_outer} - {middle}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.inner_eye_middle), "{eye_inner} - {middle}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.nose_middle), "{nose} - {middle}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.cheekbone_middle), "{cheekbone} - {middle}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.cheek_middle), "{cheek} - {middle}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.mouth_middle), "{mouth} - {middle}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.nose_nose_point), "{nose} - {nose_point}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.nose_eye_outer), "{eye_outer} - {nose}".format_map(ms)) self.add_row(tm, SymmetryAngleProportionValue(self.a.nose_eye_inner), "{eye_inner} - {nose}".format_map(ms)) tm.grid()