Commit edc9a312498693d5ceba12a4ded59a7f97ad741e
Committed by
GitHub
1 parent
27f67a6f
Exists in
master
ADD: Using neuronavigation API to communicate if coil at target (#443)
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
invesalius/net/neuronavigation_api.py
@@ -56,11 +56,13 @@ class NeuronavigationApi(metaclass=Singleton): | @@ -56,11 +56,13 @@ class NeuronavigationApi(metaclass=Singleton): | ||
56 | return hasattr(obj, name) and callable(getattr(obj, name)) | 56 | return hasattr(obj, name) and callable(getattr(obj, name)) |
57 | 57 | ||
58 | def assert_valid(self, connection): | 58 | def assert_valid(self, connection): |
59 | + assert self._hasmethod(connection, 'update_coil_at_target') | ||
59 | assert self._hasmethod(connection, 'update_coil_pose') | 60 | assert self._hasmethod(connection, 'update_coil_pose') |
60 | assert self._hasmethod(connection, 'update_focus') | 61 | assert self._hasmethod(connection, 'update_focus') |
61 | assert self._hasmethod(connection, 'set_callback__set_markers') | 62 | assert self._hasmethod(connection, 'set_callback__set_markers') |
62 | 63 | ||
63 | def __bind_events(self): | 64 | def __bind_events(self): |
65 | + Publisher.subscribe(self.update_coil_at_target, 'Coil at target') | ||
64 | Publisher.subscribe(self.update_focus, 'Set cross focal point') | 66 | Publisher.subscribe(self.update_focus, 'Set cross focal point') |
65 | 67 | ||
66 | # Functions for InVesalius to send updates. | 68 | # Functions for InVesalius to send updates. |
@@ -110,6 +112,12 @@ class NeuronavigationApi(metaclass=Singleton): | @@ -110,6 +112,12 @@ class NeuronavigationApi(metaclass=Singleton): | ||
110 | polygons=polygons, | 112 | polygons=polygons, |
111 | ) | 113 | ) |
112 | 114 | ||
115 | + def update_coil_at_target(self, state): | ||
116 | + if self.connection is not None: | ||
117 | + self.connection.update_coil_at_target( | ||
118 | + state=state | ||
119 | + ) | ||
120 | + | ||
113 | # Functions for InVesalius to receive updates via callbacks. | 121 | # Functions for InVesalius to receive updates via callbacks. |
114 | 122 | ||
115 | def __set_callbacks(self, connection): | 123 | def __set_callbacks(self, connection): |