Skip to content

Commit

Permalink
Issue #68 change order of return array from get_smooth_frame to match…
Browse files Browse the repository at this point in the history
… nditracker
  • Loading branch information
thompson318 committed Oct 5, 2023
1 parent 0d1a0a4 commit 706a423
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions sksurgerycore/baseclasses/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def get_smooth_frame(self, port_handles):
smth_qual.append(self.qualities[my_index].getmean()[0])

if self.use_quaternions:
output_matrix = np.full((7,1), np.nan)
output_matrix[0:4,0] = mean_quat
output_matrix[4:7,0] = mean_tvec
output_matrix = np.full((1,7), np.nan)
output_matrix[0,0:4] = mean_quat
output_matrix[0,4:7] = mean_tvec
smth_tracking.append(output_matrix)

else:
Expand Down
22 changes: 11 additions & 11 deletions tests/baseclasses/test_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ def test_tracker_quaternions():
test_index = port_handles_out.index("test rb")
assert time_stamps[test_index] == 1.3
assert frame_numbers[test_index] == 0
transform = np.full((7,1), np.nan)
transform = np.full((1,7), np.nan)
rotation = _rvec_to_quaternion([1.0, 0.0, 0.0])
transform[0:4,0] = rotation
transform[4:7,0] = [0.0, 100.0, 200.0]
transform[0,0:4] = rotation
transform[0,4:7] = [0.0, 100.0, 200.0]
assert np.allclose(tracking[test_index], transform)
assert tracking_quality[test_index] == 0.5

Expand Down Expand Up @@ -244,8 +244,8 @@ def test_tracker_quaternions():
assert frame_numbers[test_index] == 1

rotation = _rvec_to_quaternion([0.6, 0.0, 0.0])
transform[0:4,0] = rotation
transform[4:7,0] = [5.0, 75.0, 200.0]
transform[0,0:4] = rotation
transform[0,4:7] = [5.0, 75.0, 200.0]
assert np.allclose(tracking[test_index], transform)
assert tracking_quality[test_index] == 0.65

Expand All @@ -254,8 +254,8 @@ def test_tracker_quaternions():
assert frame_numbers[test_index] == 0

rotation = _rvec_to_quaternion([0.0, 0.0, 0.0])
transform[0:4,0] = rotation
transform[4:7,0] = [50.0, -100.0, 70.0]
transform[0,0:4] = rotation
transform[0,4:7] = [50.0, -100.0, 70.0]
assert np.allclose(tracking[test_index], transform)
assert tracking_quality[test_index] == 1.0

Expand Down Expand Up @@ -284,8 +284,8 @@ def test_tracker_quaternions():
assert time_stamps[test_index] == 1.4
assert frame_numbers[test_index] == 2
rotation = _rvec_to_quaternion([0.0, 0.45, 0.0])
transform[4:7,0] = [50.0, -100.0, 70.0]
transform[0:4,0] = rotation
transform[0,4:7] = [50.0, -100.0, 70.0]
transform[0,0:4] = rotation
assert np.allclose(tracking[test_index], transform)
assert tracking_quality[test_index] == 1.0

Expand All @@ -300,7 +300,7 @@ def test_tracker_quaternions():
assert math.isclose(time_stamps[test_index],1.4)
assert frame_numbers[test_index] == 2
rotation = _rvec_to_quaternion([0.6, 0.00, 0.0])
transform[0:4,0] = rotation
transform[4:7,0] = [3.333333, 83.33333, 166.666667]
transform[0,0:4] = rotation
transform[0,4:7] = [3.333333, 83.33333, 166.666667]
assert np.allclose(tracking[test_index], transform)
assert tracking_quality[test_index] == 0.6

0 comments on commit 706a423

Please sign in to comment.