Commit e33eeb5d940f5a5b98b7a4d02e29cc2b74621440
1 parent
3b9c6b57
Exists in
master
ENH: changed the robot target computation to marker creation
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
invesalius/data/bases.py
@@ -245,13 +245,14 @@ def object_registration(fiducials, orients, coord_raw, m_change): | @@ -245,13 +245,14 @@ def object_registration(fiducials, orients, coord_raw, m_change): | ||
245 | 245 | ||
246 | return t_obj_raw, s0_raw, r_s0_raw, s0_dyn, m_obj_raw, r_obj_img | 246 | return t_obj_raw, s0_raw, r_s0_raw, s0_dyn, m_obj_raw, r_obj_img |
247 | 247 | ||
248 | -def compute_robot_target_matrix(head, robot): | 248 | +def compute_robot_target_matrix(raw_target_robot): |
249 | """ | 249 | """ |
250 | :param head: nx6 array of head coordinates from tracking device in robot space | 250 | :param head: nx6 array of head coordinates from tracking device in robot space |
251 | :param robot: nx6 array of robot coordinates | 251 | :param robot: nx6 array of robot coordinates |
252 | 252 | ||
253 | :return: target_robot_matrix: 3x3 array representing change of basis from robot to head in robot system | 253 | :return: target_robot_matrix: 3x3 array representing change of basis from robot to head in robot system |
254 | """ | 254 | """ |
255 | + head, robot = raw_target_robot | ||
255 | # compute head target matrix | 256 | # compute head target matrix |
256 | m_head_target = dco.coordinates_to_transformation_matrix( | 257 | m_head_target = dco.coordinates_to_transformation_matrix( |
257 | position=head[:3], | 258 | position=head[:3], |
invesalius/gui/task_navigator.py
@@ -1237,6 +1237,7 @@ class MarkersPanel(wx.Panel): | @@ -1237,6 +1237,7 @@ class MarkersPanel(wx.Panel): | ||
1237 | self.markers = [] | 1237 | self.markers = [] |
1238 | self.robot_markers = [] | 1238 | self.robot_markers = [] |
1239 | self.nav_status = False | 1239 | self.nav_status = False |
1240 | + self.raw_target_robot = None, None | ||
1240 | 1241 | ||
1241 | self.marker_colour = const.MARKER_COLOUR | 1242 | self.marker_colour = const.MARKER_COLOUR |
1242 | self.marker_size = const.MARKER_SIZE | 1243 | self.marker_size = const.MARKER_SIZE |
@@ -1412,9 +1413,7 @@ class MarkersPanel(wx.Panel): | @@ -1412,9 +1413,7 @@ class MarkersPanel(wx.Panel): | ||
1412 | self.current_seed = coord_offset | 1413 | self.current_seed = coord_offset |
1413 | 1414 | ||
1414 | def UpdateRobotCoordinates(self, coordinates_raw, markers_flag): | 1415 | def UpdateRobotCoordinates(self, coordinates_raw, markers_flag): |
1415 | - head = coordinates_raw[1] | ||
1416 | - robot = coordinates_raw[2] | ||
1417 | - self.current_robot_target_matrix = db.compute_robot_target_matrix(head, robot) | 1416 | + self.raw_target_robot = coordinates_raw[1], coordinates_raw[2] |
1418 | 1417 | ||
1419 | def OnMouseRightDown(self, evt): | 1418 | def OnMouseRightDown(self, evt): |
1420 | # TODO: Enable the "Set as target" only when target is created with registered object | 1419 | # TODO: Enable the "Set as target" only when target is created with registered object |
@@ -1641,7 +1640,9 @@ class MarkersPanel(wx.Panel): | @@ -1641,7 +1640,9 @@ class MarkersPanel(wx.Panel): | ||
1641 | new_marker.seed = seed or self.current_seed | 1640 | new_marker.seed = seed or self.current_seed |
1642 | new_marker.session_id = session_id or self.current_session | 1641 | new_marker.session_id = session_id or self.current_session |
1643 | 1642 | ||
1644 | - if not self.tracker.tracker_id == const.ROBOT or not self.nav_status: | 1643 | + if self.tracker.tracker_id == const.ROBOT and self.nav_status: |
1644 | + self.current_robot_target_matrix = db.compute_robot_target_matrix(self.raw_target_robot) | ||
1645 | + else: | ||
1645 | self.current_robot_target_matrix = [None] * 9 | 1646 | self.current_robot_target_matrix = [None] * 9 |
1646 | 1647 | ||
1647 | new_robot_marker = self.Robot_Marker() | 1648 | new_robot_marker = self.Robot_Marker() |