Commit 1e7096e6d1687b62317f69c5558017ca0ad82637
1 parent
592ad4b8
Exists in
master
and in
5 other branches
ENH: Automatic reposition from 3d slice plane, reffer ticket #268
Showing
1 changed file
with
29 additions
and
2 deletions
Show diff stats
invesalius/data/viewer_volume.py
... | ... | @@ -104,7 +104,11 @@ class Viewer(wx.Panel): |
104 | 104 | self.measures = [] |
105 | 105 | |
106 | 106 | self._last_state = 0 |
107 | - | |
107 | + | |
108 | + self.repositioned_axial_plan = 0 | |
109 | + self.repositioned_sagital_plan = 0 | |
110 | + self.repositioned_coronal_plan = 0 | |
111 | + self.added_actor = 0 | |
108 | 112 | |
109 | 113 | def __bind_events(self): |
110 | 114 | ps.Publisher().subscribe(self.LoadActor, |
... | ... | @@ -172,6 +176,9 @@ class Viewer(wx.Panel): |
172 | 176 | ps.Publisher().subscribe(self.SetBallReferencePositionBasedOnBound, |
173 | 177 | 'Set ball reference position based on bound') |
174 | 178 | ps.Publisher().subscribe(self.SetStereoMode, 'Set stereo mode') |
179 | + | |
180 | + ps.Publisher().subscribe(self.Reposition3DPlane, 'Reposition 3D Plane') | |
181 | + | |
175 | 182 | |
176 | 183 | def SetStereoMode(self, pubsub_evt): |
177 | 184 | mode = pubsub_evt.data |
... | ... | @@ -615,7 +622,7 @@ class Viewer(wx.Panel): |
615 | 622 | |
616 | 623 | def LoadActor(self, pubsub_evt): |
617 | 624 | actor = pubsub_evt.data |
618 | - | |
625 | + self.added_actor = 1 | |
619 | 626 | ren = self.ren |
620 | 627 | ren.AddActor(actor) |
621 | 628 | |
... | ... | @@ -794,6 +801,23 @@ class Viewer(wx.Panel): |
794 | 801 | ((x, y,z), const.ANGULAR, const.SURFACE)) |
795 | 802 | self.interactor.Render() |
796 | 803 | |
804 | + def Reposition3DPlane(self, evt_pubsub): | |
805 | + position = evt_pubsub.data | |
806 | + if not(self.added_actor) and not(self.raycasting_volume): | |
807 | + if not(self.repositioned_axial_plan) and (position == 'Axial'): | |
808 | + self.SetViewAngle(const.VOL_ISO) | |
809 | + self.repositioned_axial_plan = 1 | |
810 | + | |
811 | + elif not(self.repositioned_sagital_plan) and (position == 'Sagital'): | |
812 | + self.SetViewAngle(const.VOL_ISO) | |
813 | + self.repositioned_sagital_plan = 1 | |
814 | + | |
815 | + elif not(self.repositioned_coronal_plan) and (position == 'Coronal'): | |
816 | + self.SetViewAngle(const.VOL_ISO) | |
817 | + self.repositioned_coronal_plan = 1 | |
818 | + | |
819 | + | |
820 | + | |
797 | 821 | |
798 | 822 | class SlicePlane: |
799 | 823 | def __init__(self): |
... | ... | @@ -881,6 +905,9 @@ class SlicePlane: |
881 | 905 | self.plane_y.On() |
882 | 906 | elif(label == "Sagital"): |
883 | 907 | self.plane_x.On() |
908 | + | |
909 | + ps.Publisher().sendMessage('Reposition 3D Plane', label) | |
910 | + | |
884 | 911 | else: |
885 | 912 | self.plane_z.On() |
886 | 913 | self.plane_x.On() | ... | ... |