Commit e35fada3bd304f3187a709dc26180fa9b65b944c

Authored by Renan
1 parent 87bb8b91
Exists in master

FIX: transformation_matrix_to_coordinates replaced by tr.decompose_matrix

-dco.transformation_matrix_to_coordinates was not working. I tried 'sxyz', 'szyx', 'rxyz', 'rzyx'. All are returning the same values.
invesalius/data/bases.py
... ... @@ -284,8 +284,8 @@ class transform_tracker_to_robot(object):
284 284 )
285 285 M_tracker_in_robot = transform_tracker_to_robot.M_tracker_to_robot @ M_tracker
286 286  
287   - angles_as_deg, translate = dco.transformation_matrix_to_coordinates(M_tracker_in_robot, axes='rxyz')
288   - #TODO: check this with robot
289   - tracker_in_robot = list(translate) + list(angles_as_deg)
  287 + _, _, angles, translate, _ = tr.decompose_matrix(M_tracker_in_robot)
  288 + tracker_in_robot = [translate[0], translate[1], translate[2], \
  289 + np.degrees(angles[2]), np.degrees(angles[1]), np.degrees(angles[0])]
290 290  
291 291 return tracker_in_robot
... ...
invesalius/data/elfin_processing.py
... ... @@ -20,6 +20,7 @@ import numpy as np
20 20 import cv2
21 21 from time import time
22 22  
  23 +import invesalius.data.transformations as tr
23 24 import invesalius.data.coregistration as dcr
24 25 import invesalius.data.coordinates as dco
25 26 import invesalius.constants as const
... ... @@ -174,9 +175,11 @@ class TrackerProcessing:
174 175 axes='rzyx',
175 176 )
176 177 m_robot_new = M_current_head @ m_change_robot_to_head
177   - angles_as_deg, translate = dco.transformation_matrix_to_coordinates(m_robot_new, axes='rzyx')
178   - #TODO: check this with robot
179   - return list(translate) + list(angles_as_deg)
  178 + _, _, angles, translate, _ = tr.decompose_matrix(m_robot_new)
  179 + angles = np.degrees(angles)
  180 +
  181 + return m_robot_new[0, -1], m_robot_new[1, -1], m_robot_new[2, -1], angles[0], angles[1], \
  182 + angles[2]
180 183  
181 184 def estimate_head_center(self, tracker, current_head):
182 185 """
... ...