Commit 2311d40cf91328e2323e9858ee9648871ae0159e
1 parent
ddacc346
Exists in
master
and in
68 other branches
TEST: Orientation cube on raycasting volume
Showing
1 changed file
with
46 additions
and
3 deletions
Show diff stats
invesalius/data/viewer_volume.py
... | ... | @@ -38,6 +38,7 @@ class Viewer(wx.Panel): |
38 | 38 | |
39 | 39 | interactor = wxVTKRenderWindowInteractor(self, -1, size = self.GetSize()) |
40 | 40 | interactor.SetInteractorStyle(style) |
41 | + self.interactor = interactor | |
41 | 42 | |
42 | 43 | sizer = wx.BoxSizer(wx.VERTICAL) |
43 | 44 | sizer.Add(interactor, 1, wx.EXPAND) |
... | ... | @@ -56,8 +57,6 @@ class Viewer(wx.Panel): |
56 | 57 | |
57 | 58 | ren = vtk.vtkRenderer() |
58 | 59 | interactor.GetRenderWindow().AddRenderer(ren) |
59 | - | |
60 | - self.interactor = interactor | |
61 | 60 | self.ren = ren |
62 | 61 | |
63 | 62 | self.raycasting_volume = False |
... | ... | @@ -90,6 +89,44 @@ class Viewer(wx.Panel): |
90 | 89 | def OnRelease(self, obj, evt): |
91 | 90 | self.onclick = False |
92 | 91 | |
92 | + | |
93 | + def ShowOrientationCube(self): | |
94 | + print "ORIENTATION CUBE!" | |
95 | + cube = vtk.vtkAnnotatedCubeActor() | |
96 | + cube.GetXMinusFaceProperty().SetColor(1,0,0) | |
97 | + cube.GetXPlusFaceProperty().SetColor(1,0,0) | |
98 | + cube.GetYMinusFaceProperty().SetColor(0,1,0) | |
99 | + cube.GetYPlusFaceProperty().SetColor(0,1,0) | |
100 | + cube.GetZMinusFaceProperty().SetColor(0,0,1) | |
101 | + cube.GetZPlusFaceProperty().SetColor(0,0,1) | |
102 | + cube.GetTextEdgesProperty().SetColor(0,0,0) | |
103 | + | |
104 | + # anatomic labelling | |
105 | + cube.SetXPlusFaceText ("A") | |
106 | + cube.SetXMinusFaceText("P") | |
107 | + cube.SetYPlusFaceText ("L") | |
108 | + cube.SetYMinusFaceText("R") | |
109 | + cube.SetZPlusFaceText ("S") | |
110 | + cube.SetZMinusFaceText("I") | |
111 | + | |
112 | + axes = vtk.vtkAxesActor() | |
113 | + axes.SetShaftTypeToCylinder() | |
114 | + axes.SetTipTypeToCone() | |
115 | + axes.SetXAxisLabelText("X") | |
116 | + axes.SetYAxisLabelText("Y") | |
117 | + axes.SetZAxisLabelText("Z") | |
118 | + #axes.SetNormalizedLabelPosition(.5, .5, .5) | |
119 | + | |
120 | + orientation_widget = vtk.vtkOrientationMarkerWidget() | |
121 | + orientation_widget.SetOrientationMarker(cube) | |
122 | + orientation_widget.SetViewport(0.85,0.85,1.0,1.0) | |
123 | + #orientation_widget.SetOrientationMarker(axes) | |
124 | + orientation_widget.SetInteractor(self.interactor) | |
125 | + orientation_widget.SetEnabled(1) | |
126 | + orientation_widget.On() | |
127 | + orientation_widget.InteractiveOff() | |
128 | + | |
129 | + | |
93 | 130 | def __bind_events(self): |
94 | 131 | ps.Publisher().subscribe(self.LoadActor, |
95 | 132 | 'Load surface actor into viewer') |
... | ... | @@ -176,7 +213,10 @@ class Viewer(wx.Panel): |
176 | 213 | self.SetViewAngle(const.VOL_FRONT) |
177 | 214 | else: |
178 | 215 | self.ren.ResetCamera() |
179 | - self.ren.ResetCameraClippingRange() | |
216 | + self.ren.ResetCameraClippingRange() | |
217 | + | |
218 | + #self.ShowOrientationCube() | |
219 | + | |
180 | 220 | self.UpdateRender() |
181 | 221 | |
182 | 222 | def ChangeBackgroundColour(self, pubsub_evt): |
... | ... | @@ -197,6 +237,9 @@ class Viewer(wx.Panel): |
197 | 237 | ren.ResetCamera() |
198 | 238 | ren.ResetCameraClippingRange() |
199 | 239 | |
240 | + | |
241 | + self.ShowOrientationCube() | |
242 | + | |
200 | 243 | self.interactor.Render() |
201 | 244 | |
202 | 245 | def OnSetViewAngle(self, evt_pubsub): | ... | ... |