Commit 3f59d676bac7fe62b35d03f166ac29ebc5956069

Authored by Thiago Franco de Moraes
1 parent 4e472506
Exists in master

Fixed: cut plane wasn't working when reenabled volume raycasting

Showing 1 changed file with 13 additions and 1 deletions   Show diff stats
invesalius/data/volume.py
@@ -161,18 +161,22 @@ class Volume(): @@ -161,18 +161,22 @@ class Volume():
161 self.LoadVolume() 161 self.LoadVolume()
162 162
163 def OnHideVolume(self, pubsub_evt): 163 def OnHideVolume(self, pubsub_evt):
  164 + print 'Hide Volume'
164 self.volume.SetVisibility(0) 165 self.volume.SetVisibility(0)
165 if (self.plane and self.plane_on): 166 if (self.plane and self.plane_on):
166 self.plane.Disable() 167 self.plane.Disable()
167 Publisher.sendMessage('Render volume viewer') 168 Publisher.sendMessage('Render volume viewer')
168 169
169 def OnShowVolume(self, pubsub_evt = None): 170 def OnShowVolume(self, pubsub_evt = None):
  171 + print 'Show volume'
170 if self.exist: 172 if self.exist:
  173 + print 'Volume exists'
171 self.volume.SetVisibility(1) 174 self.volume.SetVisibility(1)
172 if (self.plane and self.plane_on): 175 if (self.plane and self.plane_on):
173 self.plane.Enable() 176 self.plane.Enable()
174 Publisher.sendMessage('Render volume viewer') 177 Publisher.sendMessage('Render volume viewer')
175 else: 178 else:
  179 + print 'Volume doesnt exit'
176 Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL) 180 Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL)
177 self.LoadConfig() 181 self.LoadConfig()
178 self.LoadVolume() 182 self.LoadVolume()
@@ -655,8 +659,12 @@ class Volume(): @@ -655,8 +659,12 @@ class Volume():
655 659
656 self.exist = 1 660 self.exist = 1
657 661
  662 + if self.plane:
  663 + self.plane.SetVolumeMapper(volume_mapper)
  664 +
658 Publisher.sendMessage('Load volume into viewer', 665 Publisher.sendMessage('Load volume into viewer',
659 (volume, colour, (self.ww, self.wl))) 666 (volume, colour, (self.ww, self.wl)))
  667 +
660 del flip 668 del flip
661 del cast 669 del cast
662 670
@@ -752,7 +760,11 @@ class CutPlane: @@ -752,7 +760,11 @@ class CutPlane:
752 self.p1 = plane_widget.GetPoint1() 760 self.p1 = plane_widget.GetPoint1()
753 self.p2 = plane_widget.GetPoint2() 761 self.p2 = plane_widget.GetPoint2()
754 self.normal = plane_widget.GetNormal() 762 self.normal = plane_widget.GetNormal()
755 - 763 +
  764 + def SetVolumeMapper(self, volume_mapper):
  765 + self.volume_mapper = volume_mapper
  766 + self.volume_mapper.AddClippingPlane(self.plane)
  767 +
756 def Update(self, a, b): 768 def Update(self, a, b):
757 plane_source = self.plane_source 769 plane_source = self.plane_source
758 plane_widget = self.plane_widget 770 plane_widget = self.plane_widget