Skip to content

Commit

Permalink
Issue #95 added keypress to stop/start tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson318 committed Mar 16, 2022
1 parent e10b516 commit a571e5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions sksurgerybard/interaction/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def __call__(self, event, _event_type_not_used):
self._translate_model(key)
if key in '8i9o0p':
self._rotate_model(key)
if key == 'f':
self._bard_widget.tracking = not self._bard_widget.tracking


def _translate_model(self, key):
"""
Expand Down
6 changes: 5 additions & 1 deletion sksurgerybard/widgets/bard_overlay_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def __init__(self, configuration = None, calib_dir = None):

self.tracker, self.transform_manager = setup_tracker(configuration)
self.tracker.start_tracking()
self.tracking = True # A boolean that we can manipulate to start/
# stop tracking

self.transform_manager.add("tracker2camera",
np.eye(4, dtype = np.float64))
Expand Down Expand Up @@ -166,7 +168,9 @@ def update(self):

undistorted = cv2.undistort(image, self.mtx33d, self.dist15d)

self._update_tracking(image)
if self.tracking:
self._update_tracking(image)

self._update_overlay_window()

self.vtk_overlay_window.set_video_image(undistorted)
Expand Down

0 comments on commit a571e5a

Please sign in to comment.