Skip to content

Commit

Permalink
ADD: Using neuronavigation API to communicate if coil at target (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
okahilak committed Apr 12, 2022
1 parent 27f67a6 commit edc9a31
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions invesalius/net/neuronavigation_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ def _hasmethod(self, obj, name):
return hasattr(obj, name) and callable(getattr(obj, name))

def assert_valid(self, connection):
assert self._hasmethod(connection, 'update_coil_at_target')
assert self._hasmethod(connection, 'update_coil_pose')
assert self._hasmethod(connection, 'update_focus')
assert self._hasmethod(connection, 'set_callback__set_markers')

def __bind_events(self):
Publisher.subscribe(self.update_coil_at_target, 'Coil at target')
Publisher.subscribe(self.update_focus, 'Set cross focal point')

# Functions for InVesalius to send updates.
Expand Down Expand Up @@ -110,6 +112,12 @@ def update_coil_mesh(self, polydata):
polygons=polygons,
)

def update_coil_at_target(self, state):
if self.connection is not None:
self.connection.update_coil_at_target(
state=state
)

# Functions for InVesalius to receive updates via callbacks.

def __set_callbacks(self, connection):
Expand Down

0 comments on commit edc9a31

Please sign in to comment.