Commit 2794a7ed84e0d37cd59cb52f7dd61f57cca70424
1 parent
54986907
Exists in
master
and in
68 other branches
ADD: Volume raycasting cut plane disable
Showing
2 changed files
with
16 additions
and
7 deletions
Show diff stats
invesalius/data/volume.py
... | ... | @@ -75,6 +75,7 @@ class Volume(): |
75 | 75 | self.ww = None |
76 | 76 | self.wl = None |
77 | 77 | self.n = 0 |
78 | + self.plane = None | |
78 | 79 | |
79 | 80 | self.__bind_events() |
80 | 81 | |
... | ... | @@ -467,10 +468,16 @@ class Volume(): |
467 | 468 | def OnEnableTool(self, pubsub_evt): |
468 | 469 | tool_name, enable = pubsub_evt.data |
469 | 470 | if tool_name == "Cut plane": |
470 | - if enable: | |
471 | - plane = CutPlane(self.final_imagedata, self.volume_mapper) | |
471 | + if self.plane: | |
472 | + if enable: | |
473 | + self.plane.EnablePlane() | |
474 | + else: | |
475 | + print "TODO: Desabilitar plano" | |
476 | + self.plane.DisablePlane() | |
472 | 477 | else: |
473 | - print "TODO: Desabilitar plano" | |
478 | + self.plane = CutPlane(self.final_imagedata, | |
479 | + self.volume_mapper) | |
480 | + | |
474 | 481 | |
475 | 482 | def TranslateScale(self, scale, value): |
476 | 483 | #if value < 0: |
... | ... | @@ -548,11 +555,15 @@ class CutPlane: |
548 | 555 | ps.Publisher().sendMessage('Render volume viewer', None) |
549 | 556 | |
550 | 557 | def EnablePlane(self, evt_pubsub=None): |
551 | - self.plane_actor.SetVisibility(1) | |
558 | + self.plane_widget.On() | |
559 | + self.plane_actor.VisibilityOn() | |
560 | + self.volume_mapper.RemoveClippingPlane(self.plane) | |
552 | 561 | ps.Publisher().sendMessage('Render volume viewer', None) |
553 | 562 | |
554 | 563 | def DisablePlane(self,evt_pubsub=None): |
555 | - self.plane_actor.SetVisibility(0) | |
564 | + self.plane_widget.Off() | |
565 | + self.plane_actor.VisibilityOff() | |
566 | + self.volume_mapper.AddClippingPlane(self.plane) | |
556 | 567 | ps.Publisher().sendMessage('Render volume viewer', None) |
557 | 568 | |
558 | 569 | def ResetPlane(self, evt_pubsub=None): | ... | ... |
invesalius/gui/default_viewers.py
... | ... | @@ -267,12 +267,10 @@ class VolumeToolPanel(wx.Panel): |
267 | 267 | |
268 | 268 | |
269 | 269 | def OnButtonRaycasting(self, evt): |
270 | - print "menu ray" | |
271 | 270 | # MENU RELATED TO RAYCASTING TYPES |
272 | 271 | self.button_raycasting.PopupMenu(self.menu_raycasting) |
273 | 272 | |
274 | 273 | def OnButtonView(self, evt): |
275 | - print "menu view" | |
276 | 274 | self.button_view.PopupMenu(self.menu_view) |
277 | 275 | |
278 | 276 | def __init_menus(self, pubsub_evt=None): | ... | ... |