Skip to content

Commit

Permalink
Fix #856
Browse files Browse the repository at this point in the history
Also fix the color of donut during targeting and fix Navigation() references
  • Loading branch information
Tolonen Luka committed Oct 4, 2024
1 parent 03fe34e commit eb26de0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions invesalius/data/viewer_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,10 @@ def UpdatePointer(self, position):
# Update the pointer sphere.
if self.pointer_actor is None:
self.CreatePointer()

# Hide the pointer during targeting, as it would cover the coil center donut
self.pointer_actor.SetVisibility(not self.target_mode)

self.pointer_actor.SetPosition(position)
# Update the render window manually, as it is not updated automatically when not navigating.
if not self.nav_status:
Expand Down
8 changes: 6 additions & 2 deletions invesalius/data/visualization/coil_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import invesalius.data.polydata_utils as pu
import invesalius.data.vtk_utils as vtku
import invesalius.session as ses
from invesalius.navigation.navigation import Navigation
from invesalius.navigation.tracker import Tracker
from invesalius.pubsub import pub as Publisher

Expand All @@ -24,7 +25,7 @@ class CoilVisualizer:
def __init__(self, renderer, actor_factory, vector_field_visualizer):
self.renderer = renderer
self.tracker = Tracker()

self.navigation = Navigation(None, None) # Navigation is singleton so args dont matter
# Keeps track of whether tracker fiducials have been set.
self.tracker_fiducials_set = self.tracker.AreTrackerFiducialsSet()

Expand Down Expand Up @@ -108,7 +109,9 @@ def SetCoilAtTarget(self, state):

# Set the color of both target coil (representing the target) and the coil center (representing the actual coil).
self.target_coil_actor.GetProperty().SetDiffuseColor(target_coil_color)
# self.coil_center_actor.GetProperty().SetDiffuseColor(target_coil_color) # LUKATODO: use main_coil from navigation?
self.coils[self.navigation.main_coil]["center_actor"].GetProperty().SetDiffuseColor(
target_coil_color
)

def OnNavigationStatus(self, nav_status, vis_status):
self.is_navigating = nav_status
Expand All @@ -120,6 +123,7 @@ def ShowCoil(self, state, coil_name=None):
coil["center_actor"].SetVisibility(True) # Always show the center donut actor
if self.target_coil_actor is not None: # LUKATODO: target mode...
self.target_coil_actor.SetVisibility(True) # Keep target visible for now

elif (coil := self.coils.get(coil_name, None)) is not None:
# Just toggle the visibility when dealing with specific coils
new_state = not coil["actor"].GetVisibility()
Expand Down
2 changes: 1 addition & 1 deletion invesalius/gui/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@ def OnChooseTracker(self, evt, ctrl):
self.ShowParent()

def OnChooseReferenceMode(self, evt, ctrl):
Navigation().SetReferenceMode(evt.GetSelection())
Navigation(None, None).SetReferenceMode(evt.GetSelection())

def HideParent(self): # hide preferences dialog box
self.GetGrandParent().Hide()
Expand Down

0 comments on commit eb26de0

Please sign in to comment.