Commit 09ea10ae5b856b54b628f116d68e829ee2b8667d
Committed by
GitHub
1 parent
c3593caa
Exists in
master
Remove ball when coil is projected (#333)
* WIP * MODIFY red ball visibility when peel is loaded, read ball disappears when projection hits the peel * MODIFY visibility of x_actor, y_actor, z_actor to not be visible. object_orientation_torus_actor and obj_projection_arrow_actor are not visible when loading the obj_actor(coil) * Add commented line for setting visibility when obj_actor is loaded
Showing
2 changed files
with
24 additions
and
9 deletions
Show diff stats
invesalius/data/coordinates.py
... | ... | @@ -93,7 +93,6 @@ def OptitrackCoord(trck_init, trck_id, ref_mode): |
93 | 93 | coord3 = np.array([float(trck.PositionCoilZ1) * scale[0], float(trck.PositionCoilX1) * scale[1], |
94 | 94 | float(trck.PositionCoilY1) * scale[2]]) |
95 | 95 | coord3 = np.hstack((coord3, angles_coil)) |
96 | - | |
97 | 96 | coord = np.vstack([coord1, coord2, coord3]) |
98 | 97 | return coord |
99 | 98 | ... | ... |
invesalius/data/viewer_volume.py
... | ... | @@ -343,18 +343,23 @@ class Viewer(wx.Panel): |
343 | 343 | if style == const.SLICE_STATE_CROSS: |
344 | 344 | self._mode_cross = True |
345 | 345 | # self._check_and_set_ball_visibility() |
346 | + #if not self.actor_peel: | |
346 | 347 | self._ball_ref_visibility = True |
348 | + #else: | |
349 | + # self._ball_ref_visibility = False | |
347 | 350 | # if self._to_show_ball: |
348 | - if not self.ball_actor: | |
351 | + if not self.ball_actor: #and not self.actor_peel: | |
349 | 352 | self.CreateBallReference() |
350 | - | |
353 | + #self.ball_actor.SetVisibility(1) | |
354 | + #else: | |
355 | + # self.ball_actor.SetVisibility(0) | |
351 | 356 | self.interactor.Render() |
352 | 357 | |
353 | 358 | def _uncheck_ball_reference(self, style): |
354 | 359 | if style == const.SLICE_STATE_CROSS: |
355 | 360 | self._mode_cross = False |
356 | 361 | # self.RemoveBallReference() |
357 | - self._ball_ref_visibility = False | |
362 | + self._ball_ref_visibility = True | |
358 | 363 | if self.ball_actor: |
359 | 364 | self.ren.RemoveActor(self.ball_actor) |
360 | 365 | self.ball_actor = None |
... | ... | @@ -1236,6 +1241,7 @@ class Viewer(wx.Panel): |
1236 | 1241 | # self.UpdateCameraBallPosition(None, position) |
1237 | 1242 | |
1238 | 1243 | def UpdateCameraBallPosition(self, position): |
1244 | + #if not self.actor_peel: | |
1239 | 1245 | coord_flip = list(position[:3]) |
1240 | 1246 | coord_flip[1] = -coord_flip[1] |
1241 | 1247 | self.ball_actor.SetPosition(coord_flip) |
... | ... | @@ -1326,6 +1332,9 @@ class Viewer(wx.Panel): |
1326 | 1332 | self.ren.AddActor(self.x_actor) |
1327 | 1333 | self.ren.AddActor(self.y_actor) |
1328 | 1334 | self.ren.AddActor(self.z_actor) |
1335 | + self.x_actor.SetVisibility(0) | |
1336 | + self.y_actor.SetVisibility(0) | |
1337 | + self.z_actor.SetVisibility(0) | |
1329 | 1338 | #self.ren.AddActor(self.obj_projection_arrow_actor) |
1330 | 1339 | #self.ren.AddActor(self.object_orientation_torus_actor) |
1331 | 1340 | # self.obj_axes = vtk.vtkAxesActor() |
... | ... | @@ -1440,6 +1449,8 @@ class Viewer(wx.Panel): |
1440 | 1449 | self.ren.RemoveActor(self.object_orientation_torus_actor) |
1441 | 1450 | self.ren.RemoveActor(self.obj_projection_arrow_actor) |
1442 | 1451 | self.actor_peel = None |
1452 | + self.ball_actor.SetVisibility(1) | |
1453 | + | |
1443 | 1454 | if flag and actor: |
1444 | 1455 | self.ren.AddActor(actor) |
1445 | 1456 | self.actor_peel = actor |
... | ... | @@ -1497,7 +1508,7 @@ class Viewer(wx.Panel): |
1497 | 1508 | |
1498 | 1509 | self.ren.AddActor(self.obj_projection_arrow_actor) |
1499 | 1510 | self.ren.AddActor(self.object_orientation_torus_actor) |
1500 | - | |
1511 | + self.ball_actor.SetVisibility(0) | |
1501 | 1512 | self.obj_projection_arrow_actor.SetPosition(closestPoint) |
1502 | 1513 | self.obj_projection_arrow_actor.SetOrientation(coil_dir) |
1503 | 1514 | |
... | ... | @@ -1518,6 +1529,8 @@ class Viewer(wx.Panel): |
1518 | 1529 | self.ren.RemoveActor(self.obj_projection_arrow_actor) |
1519 | 1530 | self.ren.RemoveActor(self.object_orientation_torus_actor) |
1520 | 1531 | self.ren.RemoveActor(self.x_actor) |
1532 | + self.ball_actor.SetVisibility(1) | |
1533 | + | |
1521 | 1534 | #self.ren.RemoveActor(self.y_actor) |
1522 | 1535 | self.Refresh() |
1523 | 1536 | |
... | ... | @@ -1529,9 +1542,9 @@ class Viewer(wx.Panel): |
1529 | 1542 | self.pTarget = self.CenterOfMass() |
1530 | 1543 | if self.obj_actor: |
1531 | 1544 | self.obj_actor.SetVisibility(self.obj_state) |
1532 | - self.x_actor.SetVisibility(self.obj_state) | |
1533 | - self.y_actor.SetVisibility(self.obj_state) | |
1534 | - self.z_actor.SetVisibility(self.obj_state) | |
1545 | + #self.x_actor.SetVisibility(self.obj_state) | |
1546 | + #self.y_actor.SetVisibility(self.obj_state) | |
1547 | + #self.z_actor.SetVisibility(self.obj_state) | |
1535 | 1548 | #self.object_orientation_torus_actor.SetVisibility(self.obj_state) |
1536 | 1549 | #self.obj_projection_arrow_actor.SetVisibility(self.obj_state) |
1537 | 1550 | self.Refresh() |
... | ... | @@ -1628,7 +1641,10 @@ class Viewer(wx.Panel): |
1628 | 1641 | self.x_actor.SetVisibility(self.obj_state) |
1629 | 1642 | self.y_actor.SetVisibility(self.obj_state) |
1630 | 1643 | self.z_actor.SetVisibility(self.obj_state) |
1631 | - | |
1644 | + #if self.actor_peel: | |
1645 | + # self.ball_actor.SetVisibility(0) | |
1646 | + #else: | |
1647 | + # self.ball_actor.SetVisibility(1) | |
1632 | 1648 | self.Refresh() |
1633 | 1649 | |
1634 | 1650 | def OnUpdateTracts(self, root=None, affine_vtk=None, coord_offset=None): | ... | ... |