Skip to content

Commit

Permalink
Merge pull request #857 from lukatolo/donut-fix
Browse files Browse the repository at this point in the history
Fix #856
  • Loading branch information
rmatsuda authored Oct 6, 2024
2 parents 03fe34e + a6c4435 commit 1a92b61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 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
12 changes: 9 additions & 3 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 Down Expand Up @@ -108,7 +109,11 @@ 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?

# Multicoil mode will have a different GUI for targeting, so this is irrelevant for multicoil
# In single coil mode, just get the single coil
coil = next(iter(self.coils.values()), None)
coil["center_actor"].GetProperty().SetDiffuseColor(target_coil_color)

def OnNavigationStatus(self, nav_status, vis_status):
self.is_navigating = nav_status
Expand All @@ -118,8 +123,7 @@ def ShowCoil(self, state, coil_name=None):
for coil in self.coils.values():
coil["actor"].SetVisibility(state)
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 All @@ -133,6 +137,8 @@ def ShowCoil(self, state, coil_name=None):
elif all(coils_visible): # all coils are shown
Publisher.sendMessage("Press show-coil button", pressed=True)

if self.target_coil_actor is not None:
self.target_coil_actor.SetVisibility(state)
# self.vector_field_assembly.SetVisibility(state) # LUKATODO: Keep this hidden for now

if not self.is_navigating:
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 1a92b61

Please sign in to comment.