Commit 3f59d676bac7fe62b35d03f166ac29ebc5956069
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 | 161 | self.LoadVolume() |
| 162 | 162 | |
| 163 | 163 | def OnHideVolume(self, pubsub_evt): |
| 164 | + print 'Hide Volume' | |
| 164 | 165 | self.volume.SetVisibility(0) |
| 165 | 166 | if (self.plane and self.plane_on): |
| 166 | 167 | self.plane.Disable() |
| 167 | 168 | Publisher.sendMessage('Render volume viewer') |
| 168 | 169 | |
| 169 | 170 | def OnShowVolume(self, pubsub_evt = None): |
| 171 | + print 'Show volume' | |
| 170 | 172 | if self.exist: |
| 173 | + print 'Volume exists' | |
| 171 | 174 | self.volume.SetVisibility(1) |
| 172 | 175 | if (self.plane and self.plane_on): |
| 173 | 176 | self.plane.Enable() |
| 174 | 177 | Publisher.sendMessage('Render volume viewer') |
| 175 | 178 | else: |
| 179 | + print 'Volume doesnt exit' | |
| 176 | 180 | Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL) |
| 177 | 181 | self.LoadConfig() |
| 178 | 182 | self.LoadVolume() |
| ... | ... | @@ -655,8 +659,12 @@ class Volume(): |
| 655 | 659 | |
| 656 | 660 | self.exist = 1 |
| 657 | 661 | |
| 662 | + if self.plane: | |
| 663 | + self.plane.SetVolumeMapper(volume_mapper) | |
| 664 | + | |
| 658 | 665 | Publisher.sendMessage('Load volume into viewer', |
| 659 | 666 | (volume, colour, (self.ww, self.wl))) |
| 667 | + | |
| 660 | 668 | del flip |
| 661 | 669 | del cast |
| 662 | 670 | |
| ... | ... | @@ -752,7 +760,11 @@ class CutPlane: |
| 752 | 760 | self.p1 = plane_widget.GetPoint1() |
| 753 | 761 | self.p2 = plane_widget.GetPoint2() |
| 754 | 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 | 768 | def Update(self, a, b): |
| 757 | 769 | plane_source = self.plane_source |
| 758 | 770 | plane_widget = self.plane_widget | ... | ... |