From e33eeb5d940f5a5b98b7a4d02e29cc2b74621440 Mon Sep 17 00:00:00 2001 From: Renan Date: Tue, 12 Oct 2021 13:31:55 +0300 Subject: [PATCH] ENH: changed the robot target computation to marker creation --- invesalius/data/bases.py | 3 ++- invesalius/gui/task_navigator.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/invesalius/data/bases.py b/invesalius/data/bases.py index 6ccc021..91e8f4a 100644 --- a/invesalius/data/bases.py +++ b/invesalius/data/bases.py @@ -245,13 +245,14 @@ def object_registration(fiducials, orients, coord_raw, m_change): return t_obj_raw, s0_raw, r_s0_raw, s0_dyn, m_obj_raw, r_obj_img -def compute_robot_target_matrix(head, robot): +def compute_robot_target_matrix(raw_target_robot): """ :param head: nx6 array of head coordinates from tracking device in robot space :param robot: nx6 array of robot coordinates :return: target_robot_matrix: 3x3 array representing change of basis from robot to head in robot system """ + head, robot = raw_target_robot # compute head target matrix m_head_target = dco.coordinates_to_transformation_matrix( position=head[:3], diff --git a/invesalius/gui/task_navigator.py b/invesalius/gui/task_navigator.py index 0f78c68..0ac13a3 100644 --- a/invesalius/gui/task_navigator.py +++ b/invesalius/gui/task_navigator.py @@ -1237,6 +1237,7 @@ class MarkersPanel(wx.Panel): self.markers = [] self.robot_markers = [] self.nav_status = False + self.raw_target_robot = None, None self.marker_colour = const.MARKER_COLOUR self.marker_size = const.MARKER_SIZE @@ -1412,9 +1413,7 @@ class MarkersPanel(wx.Panel): self.current_seed = coord_offset def UpdateRobotCoordinates(self, coordinates_raw, markers_flag): - head = coordinates_raw[1] - robot = coordinates_raw[2] - self.current_robot_target_matrix = db.compute_robot_target_matrix(head, robot) + self.raw_target_robot = coordinates_raw[1], coordinates_raw[2] def OnMouseRightDown(self, evt): # TODO: Enable the "Set as target" only when target is created with registered object @@ -1641,7 +1640,9 @@ class MarkersPanel(wx.Panel): new_marker.seed = seed or self.current_seed new_marker.session_id = session_id or self.current_session - if not self.tracker.tracker_id == const.ROBOT or not self.nav_status: + if self.tracker.tracker_id == const.ROBOT and self.nav_status: + self.current_robot_target_matrix = db.compute_robot_target_matrix(self.raw_target_robot) + else: self.current_robot_target_matrix = [None] * 9 new_robot_marker = self.Robot_Marker() -- libgit2 0.21.2