Commit 2794a7ed84e0d37cd59cb52f7dd61f57cca70424

Authored by tatiana
1 parent 54986907

ADD: Volume raycasting cut plane disable

invesalius/data/volume.py
@@ -75,6 +75,7 @@ class Volume(): @@ -75,6 +75,7 @@ class Volume():
75 self.ww = None 75 self.ww = None
76 self.wl = None 76 self.wl = None
77 self.n = 0 77 self.n = 0
  78 + self.plane = None
78 79
79 self.__bind_events() 80 self.__bind_events()
80 81
@@ -467,10 +468,16 @@ class Volume(): @@ -467,10 +468,16 @@ class Volume():
467 def OnEnableTool(self, pubsub_evt): 468 def OnEnableTool(self, pubsub_evt):
468 tool_name, enable = pubsub_evt.data 469 tool_name, enable = pubsub_evt.data
469 if tool_name == "Cut plane": 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 else: 477 else:
473 - print "TODO: Desabilitar plano" 478 + self.plane = CutPlane(self.final_imagedata,
  479 + self.volume_mapper)
  480 +
474 481
475 def TranslateScale(self, scale, value): 482 def TranslateScale(self, scale, value):
476 #if value < 0: 483 #if value < 0:
@@ -548,11 +555,15 @@ class CutPlane: @@ -548,11 +555,15 @@ class CutPlane:
548 ps.Publisher().sendMessage('Render volume viewer', None) 555 ps.Publisher().sendMessage('Render volume viewer', None)
549 556
550 def EnablePlane(self, evt_pubsub=None): 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 ps.Publisher().sendMessage('Render volume viewer', None) 561 ps.Publisher().sendMessage('Render volume viewer', None)
553 562
554 def DisablePlane(self,evt_pubsub=None): 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 ps.Publisher().sendMessage('Render volume viewer', None) 567 ps.Publisher().sendMessage('Render volume viewer', None)
557 568
558 def ResetPlane(self, evt_pubsub=None): 569 def ResetPlane(self, evt_pubsub=None):
invesalius/gui/default_viewers.py
@@ -267,12 +267,10 @@ class VolumeToolPanel(wx.Panel): @@ -267,12 +267,10 @@ class VolumeToolPanel(wx.Panel):
267 267
268 268
269 def OnButtonRaycasting(self, evt): 269 def OnButtonRaycasting(self, evt):
270 - print "menu ray"  
271 # MENU RELATED TO RAYCASTING TYPES 270 # MENU RELATED TO RAYCASTING TYPES
272 self.button_raycasting.PopupMenu(self.menu_raycasting) 271 self.button_raycasting.PopupMenu(self.menu_raycasting)
273 272
274 def OnButtonView(self, evt): 273 def OnButtonView(self, evt):
275 - print "menu view"  
276 self.button_view.PopupMenu(self.menu_view) 274 self.button_view.PopupMenu(self.menu_view)
277 275
278 def __init_menus(self, pubsub_evt=None): 276 def __init_menus(self, pubsub_evt=None):