Commit 4d912616bf4ad6241252952ba4be247705e7957e

Authored by tfmoraes
1 parent 25192bff

STYLE: Removed exceeding white spaces

Showing 1 changed file with 182 additions and 201 deletions   Show diff stats
invesalius/data/viewer_volume.py
... ... @@ -74,9 +74,51 @@ class Viewer(wx.Panel):
74 74  
75 75 self.__bind_events()
76 76 self.__bind_events_wx()
77   -
  77 +
78 78 self.mouse_pressed = 0
79   -
  79 +
  80 + def __bind_events(self):
  81 + ps.Publisher().subscribe(self.LoadActor,
  82 + 'Load surface actor into viewer')
  83 + ps.Publisher().subscribe(self.UpdateRender,
  84 + 'Render volume viewer')
  85 + ps.Publisher().subscribe(self.ChangeBackgroundColour,
  86 + 'Change volume viewer background colour')
  87 + # Raycating - related
  88 + ps.Publisher().subscribe(self.LoadVolume,
  89 + 'Load volume into viewer')
  90 + ps.Publisher().subscribe(self.OnSetWindowLevelText,
  91 + 'Set volume window and level text')
  92 + ps.Publisher().subscribe(self.OnHideRaycasting,
  93 + 'Hide raycasting volume')
  94 + ps.Publisher().subscribe(self.OnShowRaycasting,
  95 + 'Update raycasting preset')
  96 + ###
  97 + ps.Publisher().subscribe(self.AppendActor,'AppendActor')
  98 + ps.Publisher().subscribe(self.SetWidgetInteractor,
  99 + 'Set Widget Interactor')
  100 + ps.Publisher().subscribe(self.OnSetViewAngle,
  101 + 'Set volume view angle')
  102 +
  103 + ps.Publisher().subscribe(self.SetNewMode,
  104 + ('Set interaction mode', const.MODE_WW_WL))
  105 + ps.Publisher().subscribe(self.OnDisableBrightContrast,
  106 + ('Set interaction mode',
  107 + const.MODE_SLICE_EDITOR))
  108 +
  109 + ps.Publisher().subscribe(self.OnExportSurface, 'Export surface to file')
  110 +
  111 + ps.Publisher().subscribe(self.LoadSlicePlane, 'Load slice plane')
  112 +
  113 + ps.Publisher().subscribe(self.ResetCamClippingRange, 'Reset cam clipping range')
  114 +
  115 + ps.Publisher().subscribe(self.OnEnableStyle, 'Enable style')
  116 + ps.Publisher().subscribe(self.OnDisableStyle, 'Disable style')
  117 +
  118 + def __bind_events_wx(self):
  119 + #self.Bind(wx.EVT_SIZE, self.OnSize)
  120 + pass
  121 +
80 122 def SetInteractorStyle(self, state):
81 123 action = {
82 124 const.STATE_PAN:
... ... @@ -110,7 +152,7 @@ class Viewer(wx.Panel):
110 152 {
111 153 }
112 154 }
113   -
  155 +
114 156 if (state == const.STATE_ZOOM_SL):
115 157 style = vtk.vtkInteractorStyleRubberBandZoom()
116 158 self.interactor.SetInteractorStyle(style)
... ... @@ -119,12 +161,41 @@ class Viewer(wx.Panel):
119 161 style = vtk.vtkInteractorStyleTrackballCamera()
120 162 self.interactor.SetInteractorStyle(style)
121 163 self.style = style
122   -
  164 +
123 165 # Check each event available for each mode
124 166 for event in action[state]:
125 167 # Bind event
126 168 style.AddObserver(event,action[state][event])
127   -
  169 +
  170 + def SetStyle(self, pubsub_evt):
  171 + print "SetStyle"
  172 + mode = pubsub_evt.data
  173 +
  174 + if (mode == const.MODE_ZOOM_SELECTION):
  175 + self.SetMode('ZOOMSELECT')
  176 + elif(mode == const.MODE_MOVE):
  177 + self.SetMode('PAN')
  178 + elif(mode == const.MODE_ZOOM):
  179 + self.SetMode('ZOOM')
  180 + elif(mode == const.MODE_ROTATE):
  181 + self.SetMode('SPIN')
  182 + elif(mode == const.MODE_WW_WL):
  183 + self.SetMode('WINDOWLEVEL')
  184 +
  185 + def SetNewMode(self, pubsub_evt):
  186 + mode = pubsub_evt.topic[1]
  187 +
  188 + if (mode == const.MODE_ZOOM_SELECTION):
  189 + self.SetMode('ZOOMSELECT')
  190 + elif(mode == const.MODE_MOVE):
  191 + self.SetMode('PAN')
  192 + elif(mode == const.MODE_ZOOM):
  193 + self.SetMode('ZOOM')
  194 + elif(mode == const.MODE_ROTATE):
  195 + self.SetMode('SPIN')
  196 + elif(mode == const.MODE_WW_WL):
  197 + self.SetMode('WINDOWLEVEL')
  198 +
128 199 def OnSpinMove(self, evt, obj):
129 200 if (self.mouse_pressed):
130 201 evt.Spin()
... ... @@ -133,11 +204,11 @@ class Viewer(wx.Panel):
133 204 def OnSpinClick(self, evt, obj):
134 205 self.mouse_pressed = 1
135 206 evt.StartSpin()
136   -
  207 +
137 208 def OnReleaseSpinClick(self,evt,obj):
138 209 self.mouse_pressed = 0
139 210 evt.EndSpin()
140   -
  211 +
141 212 def OnZoomMove(self, evt, obj):
142 213 if (self.mouse_pressed):
143 214 evt.Dolly()
... ... @@ -146,12 +217,11 @@ class Viewer(wx.Panel):
146 217 def OnZoomClick(self, evt, obj):
147 218 self.mouse_pressed = 1
148 219 evt.StartDolly()
149   -
  220 +
150 221 def OnReleaseZoomClick(self,evt,obj):
151 222 self.mouse_pressed = 0
152 223 evt.EndDolly()
153   -
154   -
  224 +
155 225 def OnPanMove(self, evt, obj):
156 226 if (self.mouse_pressed):
157 227 evt.Pan()
... ... @@ -160,41 +230,11 @@ class Viewer(wx.Panel):
160 230 def OnPanClick(self, evt, obj):
161 231 self.mouse_pressed = 1
162 232 evt.StartPan()
163   -
  233 +
164 234 def OnReleasePanClick(self,evt,obj):
165 235 self.mouse_pressed = 0
166 236 evt.EndPan()
167   -
168   - def SetStyle(self, pubsub_evt):
169   - print "SetStyle"
170   - mode = pubsub_evt.data
171   -
172   - if (mode == const.MODE_ZOOM_SELECTION):
173   - self.SetMode('ZOOMSELECT')
174   - elif(mode == const.MODE_MOVE):
175   - self.SetMode('PAN')
176   - elif(mode == const.MODE_ZOOM):
177   - self.SetMode('ZOOM')
178   - elif(mode == const.MODE_ROTATE):
179   - self.SetMode('SPIN')
180   - elif(mode == const.MODE_WW_WL):
181   - self.SetMode('WINDOWLEVEL')
182 237  
183   -
184   - def SetNewMode(self, pubsub_evt):
185   - mode = pubsub_evt.topic[1]
186   -
187   - if (mode == const.MODE_ZOOM_SELECTION):
188   - self.SetMode('ZOOMSELECT')
189   - elif(mode == const.MODE_MOVE):
190   - self.SetMode('PAN')
191   - elif(mode == const.MODE_ZOOM):
192   - self.SetMode('ZOOM')
193   - elif(mode == const.MODE_ROTATE):
194   - self.SetMode('SPIN')
195   - elif(mode == const.MODE_WW_WL):
196   - self.SetMode('WINDOWLEVEL')
197   -
198 238 def OnWindowLevelMove(self, obj, evt):
199 239 if self.onclick and self.raycasting_volume:
200 240 mouse_x, mouse_y = self.interactor.GetEventPosition()
... ... @@ -218,83 +258,6 @@ class Viewer(wx.Panel):
218 258 if const.RAYCASTING_WWWL_BLUR:
219 259 self.style.EndZoom()
220 260  
221   - def ShowOrientationCube(self):
222   - print "ORIENTATION CUBE!"
223   - cube = vtk.vtkAnnotatedCubeActor()
224   - cube.GetXMinusFaceProperty().SetColor(1,0,0)
225   - cube.GetXPlusFaceProperty().SetColor(1,0,0)
226   - cube.GetYMinusFaceProperty().SetColor(0,1,0)
227   - cube.GetYPlusFaceProperty().SetColor(0,1,0)
228   - cube.GetZMinusFaceProperty().SetColor(0,0,1)
229   - cube.GetZPlusFaceProperty().SetColor(0,0,1)
230   - cube.GetTextEdgesProperty().SetColor(0,0,0)
231   -
232   - # anatomic labelling
233   - cube.SetXPlusFaceText ("A")
234   - cube.SetXMinusFaceText("P")
235   - cube.SetYPlusFaceText ("L")
236   - cube.SetYMinusFaceText("R")
237   - cube.SetZPlusFaceText ("S")
238   - cube.SetZMinusFaceText("I")
239   -
240   - axes = vtk.vtkAxesActor()
241   - axes.SetShaftTypeToCylinder()
242   - axes.SetTipTypeToCone()
243   - axes.SetXAxisLabelText("X")
244   - axes.SetYAxisLabelText("Y")
245   - axes.SetZAxisLabelText("Z")
246   - #axes.SetNormalizedLabelPosition(.5, .5, .5)
247   -
248   - orientation_widget = vtk.vtkOrientationMarkerWidget()
249   - orientation_widget.SetOrientationMarker(cube)
250   - orientation_widget.SetViewport(0.85,0.85,1.0,1.0)
251   - #orientation_widget.SetOrientationMarker(axes)
252   - orientation_widget.SetInteractor(self.interactor)
253   - orientation_widget.SetEnabled(1)
254   - orientation_widget.On()
255   - orientation_widget.InteractiveOff()
256   -
257   -
258   - def __bind_events(self):
259   - ps.Publisher().subscribe(self.LoadActor,
260   - 'Load surface actor into viewer')
261   - ps.Publisher().subscribe(self.UpdateRender,
262   - 'Render volume viewer')
263   - ps.Publisher().subscribe(self.ChangeBackgroundColour,
264   - 'Change volume viewer background colour')
265   - # Raycating - related
266   - ps.Publisher().subscribe(self.LoadVolume,
267   - 'Load volume into viewer')
268   - ps.Publisher().subscribe(self.OnSetWindowLevelText,
269   - 'Set volume window and level text')
270   - ps.Publisher().subscribe(self.OnHideRaycasting,
271   - 'Hide raycasting volume')
272   - ps.Publisher().subscribe(self.OnShowRaycasting,
273   - 'Update raycasting preset')
274   - ###
275   - ps.Publisher().subscribe(self.AppendActor,'AppendActor')
276   - ps.Publisher().subscribe(self.SetWidgetInteractor,
277   - 'Set Widget Interactor')
278   - ps.Publisher().subscribe(self.OnSetViewAngle,
279   - 'Set volume view angle')
280   -
281   - ps.Publisher().subscribe(self.SetNewMode,
282   - ('Set interaction mode', const.MODE_WW_WL))
283   - ps.Publisher().subscribe(self.OnDisableBrightContrast,
284   - ('Set interaction mode',
285   - const.MODE_SLICE_EDITOR))
286   -
287   - ps.Publisher().subscribe(self.OnExportSurface, 'Export surface to file')
288   -
289   - ps.Publisher().subscribe(self.LoadSlicePlane, 'Load slice plane')
290   -
291   - ps.Publisher().subscribe(self.ResetCamClippingRange, 'Reset cam clipping range')
292   -
293   -
294   - ps.Publisher().subscribe(self.OnEnableStyle, 'Enable style')
295   - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable style')
296   -
297   -
298 261 def OnEnableStyle(self, pubsub_evt):
299 262 state = pubsub_evt.data
300 263 if (state in const.VOLUME_STYLES):
... ... @@ -310,11 +273,9 @@ class Viewer(wx.Panel):
310 273 new_state = self.interaction_style.RemoveState(state)
311 274 self.SetInteractorStyle(new_state)
312 275  
313   -
314 276 def ResetCamClippingRange(self, pubsub_evt):
315 277 self.ren.ResetCamera()
316 278 self.ren.ResetCameraClippingRange()
317   -
318 279  
319 280 def OnExportSurface(self, pubsub_evt):
320 281 filename, filetype = pubsub_evt.data
... ... @@ -338,32 +299,17 @@ class Viewer(wx.Panel):
338 299 writer.SetInput(renwin)
339 300 writer.Write()
340 301  
341   -
342   -
343   - def __bind_events_wx(self):
344   - #self.Bind(wx.EVT_SIZE, self.OnSize)
345   - pass
346   -
347 302 def OnEnableBrightContrast(self, pubsub_evt):
348 303 style = self.style
349 304 style.AddObserver("MouseMoveEvent", self.OnMove)
350 305 style.AddObserver("LeftButtonPressEvent", self.OnClick)
351 306 style.AddObserver("LeftButtonReleaseEvent", self.OnRelease)
352 307  
353   -
354 308 def OnDisableBrightContrast(self, pubsub_evt):
355 309 style = vtk.vtkInteractorStyleTrackballCamera()
356 310 self.interactor.SetInteractorStyle(style)
357 311 self.style = style
358   -
359 312  
360   - def OnSize(self, evt):
361   - self.UpdateRender()
362   - self.Refresh()
363   - self.interactor.UpdateWindowUI()
364   - self.interactor.Update()
365   - evt.Skip()
366   -
367 313 def OnSetWindowLevelText(self, pubsub_evt):
368 314 if self.raycasting_volume:
369 315 ww, wl = pubsub_evt.data
... ... @@ -377,30 +323,12 @@ class Viewer(wx.Panel):
377 323 self.raycasting_volume = False
378 324 self.text.Hide()
379 325  
380   - def LoadVolume(self, pubsub_evt):
381   - self.raycasting_volume = True
382   -
383   - volume = pubsub_evt.data[0]
384   - colour = pubsub_evt.data[1]
385   - ww, wl = pubsub_evt.data[2]
386   -
387   - self.light = self.ren.GetLights().GetNextItem()
388   -
389   - self.ren.AddVolume(volume)
390   - self.text.SetValue("WL: %d WW: %d"%(wl, ww))
391   - self.ren.AddActor(self.text.actor)
392   - self.ren.SetBackground(colour)
393   -
394   - if not (self.view_angle):
395   - self.SetViewAngle(const.VOL_FRONT)
396   - else:
397   - self.ren.ResetCamera()
398   - self.ren.ResetCameraClippingRange()
399   -
  326 + def OnSize(self, evt):
400 327 self.UpdateRender()
401   -
402   - def LoadSlicePlane(self, pubsub_evt):
403   - self.slice_plane = SlicePlane()
  328 + self.Refresh()
  329 + self.interactor.UpdateWindowUI()
  330 + self.interactor.Update()
  331 + evt.Skip()
404 332  
405 333 def ChangeBackgroundColour(self, pubsub_evt):
406 334 colour = pubsub_evt.data
... ... @@ -409,10 +337,10 @@ class Viewer(wx.Panel):
409 337  
410 338 def LoadActor(self, pubsub_evt):
411 339 actor = pubsub_evt.data
412   -
  340 +
413 341 ren = self.ren
414 342 ren.AddActor(actor)
415   -
  343 +
416 344 if not (self.view_angle):
417 345 self.SetViewAngle(const.VOL_FRONT)
418 346 self.view_angle = 1
... ... @@ -421,40 +349,100 @@ class Viewer(wx.Panel):
421 349 ren.ResetCameraClippingRange()
422 350  
423 351 #self.ShowOrientationCube()
424   -
425 352 self.interactor.Render()
426 353  
  354 + def LoadSlicePlane(self, pubsub_evt):
  355 + self.slice_plane = SlicePlane()
  356 +
  357 + def LoadVolume(self, pubsub_evt):
  358 + self.raycasting_volume = True
  359 +
  360 + volume = pubsub_evt.data[0]
  361 + colour = pubsub_evt.data[1]
  362 + ww, wl = pubsub_evt.data[2]
  363 +
  364 + self.light = self.ren.GetLights().GetNextItem()
  365 +
  366 + self.ren.AddVolume(volume)
  367 + self.text.SetValue("WL: %d WW: %d"%(wl, ww))
  368 + self.ren.AddActor(self.text.actor)
  369 + self.ren.SetBackground(colour)
  370 +
  371 + if not (self.view_angle):
  372 + self.SetViewAngle(const.VOL_FRONT)
  373 + else:
  374 + self.ren.ResetCamera()
  375 + self.ren.ResetCameraClippingRange()
  376 +
  377 + self.UpdateRender()
  378 +
427 379 def OnSetViewAngle(self, evt_pubsub):
428 380 view = evt_pubsub.data
429 381 self.SetViewAngle(view)
430 382  
431 383 def SetViewAngle(self, view):
432   -
433 384 cam = self.ren.GetActiveCamera()
434 385 cam.SetFocalPoint(0,0,0)
435   -
  386 +
436 387 proj = prj.Project()
437 388 orig_orien = proj.original_orientation
438   -
  389 +
439 390 xv,yv,zv = const.VOLUME_POSITION[orig_orien][0][view]
440 391 xp,yp,zp = const.VOLUME_POSITION[orig_orien][1][view]
441   -
  392 +
442 393 cam.SetViewUp(xv,yv,zv)
443 394 cam.SetPosition(xp,yp,zp)
444   -
  395 +
445 396 self.ren.ResetCameraClippingRange()
446 397 self.ren.ResetCamera()
447 398 self.interactor.Render()
448 399  
  400 + def ShowOrientationCube(self):
  401 + print "ORIENTATION CUBE!"
  402 + cube = vtk.vtkAnnotatedCubeActor()
  403 + cube.GetXMinusFaceProperty().SetColor(1,0,0)
  404 + cube.GetXPlusFaceProperty().SetColor(1,0,0)
  405 + cube.GetYMinusFaceProperty().SetColor(0,1,0)
  406 + cube.GetYPlusFaceProperty().SetColor(0,1,0)
  407 + cube.GetZMinusFaceProperty().SetColor(0,0,1)
  408 + cube.GetZPlusFaceProperty().SetColor(0,0,1)
  409 + cube.GetTextEdgesProperty().SetColor(0,0,0)
  410 +
  411 + # anatomic labelling
  412 + cube.SetXPlusFaceText ("A")
  413 + cube.SetXMinusFaceText("P")
  414 + cube.SetYPlusFaceText ("L")
  415 + cube.SetYMinusFaceText("R")
  416 + cube.SetZPlusFaceText ("S")
  417 + cube.SetZMinusFaceText("I")
  418 +
  419 + axes = vtk.vtkAxesActor()
  420 + axes.SetShaftTypeToCylinder()
  421 + axes.SetTipTypeToCone()
  422 + axes.SetXAxisLabelText("X")
  423 + axes.SetYAxisLabelText("Y")
  424 + axes.SetZAxisLabelText("Z")
  425 + #axes.SetNormalizedLabelPosition(.5, .5, .5)
  426 +
  427 + orientation_widget = vtk.vtkOrientationMarkerWidget()
  428 + orientation_widget.SetOrientationMarker(cube)
  429 + orientation_widget.SetViewport(0.85,0.85,1.0,1.0)
  430 + #orientation_widget.SetOrientationMarker(axes)
  431 + orientation_widget.SetInteractor(self.interactor)
  432 + orientation_widget.SetEnabled(1)
  433 + orientation_widget.On()
  434 + orientation_widget.InteractiveOff()
  435 +
449 436 def UpdateRender(self, evt_pubsub=None):
450 437 self.interactor.Render()
451   -
  438 +
452 439 def SetWidgetInteractor(self, evt_pubsub=None):
453 440 evt_pubsub.data.SetInteractor(self.interactor._Iren)
454 441  
455 442 def AppendActor(self, evt_pubsub=None):
456 443 self.ren.AddActor(evt_pubsub.data)
457 444  
  445 +
458 446 class SlicePlane:
459 447 def __init__(self):
460 448 project = prj.Project()
... ... @@ -462,22 +450,20 @@ class SlicePlane:
462 450 self.Create()
463 451 self.__bind_evt()
464 452 self.__bind_vtk_evt()
465   -
  453 +
466 454 def __bind_evt(self):
467 455 ps.Publisher().subscribe(self.Enable, 'Enable plane')
468 456 ps.Publisher().subscribe(self.Disable, 'Disable plane')
469 457 ps.Publisher().subscribe(self.ChangeSlice, 'Change slice from slice plane')
470   -
  458 +
471 459 def __bind_vtk_evt(self):
472 460 self.plane_x.AddObserver("InteractionEvent", self.PlaneEvent)
473 461 self.plane_y.AddObserver("InteractionEvent", self.PlaneEvent)
474 462 self.plane_z.AddObserver("InteractionEvent", self.PlaneEvent)
475   -
  463 +
476 464 def PlaneEvent(self, obj, evt):
477   -
478 465 number = obj.GetSliceIndex()
479 466 plane_axis = obj.GetPlaneOrientation()
480   -
481 467 if (self.original_orientation == const.AXIAL):
482 468 if (plane_axis == 0):
483 469 orientation = "SAGITAL"
... ... @@ -487,7 +473,7 @@ class SlicePlane:
487 473 number = abs(dimen[0] - (number + 1))
488 474 else:
489 475 orientation = "AXIAL"
490   -
  476 +
491 477 elif(self.original_orientation == const.SAGITAL):
492 478 if (plane_axis == 0):
493 479 orientation = "CORONAL"
... ... @@ -506,14 +492,12 @@ class SlicePlane:
506 492 number = abs(dimen[0] - (number + 1))
507 493 else:
508 494 orientation = "CORONAL"
509   -
510   -
  495 +
511 496 if (obj.GetSlicePosition() != 0.0):
512 497 ps.Publisher().sendMessage(('Set scroll position', \
513 498 orientation), number)
514   -
515   - def Create(self):
516 499  
  500 + def Create(self):
517 501 plane_x = self.plane_x = vtk.vtkImagePlaneWidget()
518 502 plane_x.DisplayTextOff()
519 503 ps.Publisher().sendMessage('Input Image in the widget', plane_x)
... ... @@ -537,7 +521,7 @@ class SlicePlane:
537 521 prop1.SetColor(0, 1, 0)
538 522 cursor_property = plane_y.GetCursorProperty()
539 523 cursor_property.SetOpacity(0)
540   -
  524 +
541 525 plane_z = self.plane_z = vtk.vtkImagePlaneWidget()
542 526 plane_z.DisplayTextOff()
543 527 ps.Publisher().sendMessage('Input Image in the widget', plane_z)
... ... @@ -556,40 +540,40 @@ class SlicePlane:
556 540  
557 541 prop1 = plane_x.GetPlaneProperty()
558 542 prop1.SetColor(0, 0, 1)
559   -
  543 +
560 544 prop2 = plane_y.GetPlaneProperty()
561 545 prop2.SetColor(0, 1, 0)
562   -
  546 +
563 547 elif(self.original_orientation == const.SAGITAL):
564 548 prop3 = plane_y.GetPlaneProperty()
565 549 prop3.SetColor(1, 0, 0)
566 550  
567 551 prop1 = plane_z.GetPlaneProperty()
568 552 prop1.SetColor(0, 0, 1)
569   -
  553 +
570 554 prop2 = plane_x.GetPlaneProperty()
571 555 prop2.SetColor(0, 1, 0)
572   -
  556 +
573 557 else:
574 558 prop3 = plane_y.GetPlaneProperty()
575 559 prop3.SetColor(1, 0, 0)
576 560  
577 561 prop1 = plane_x.GetPlaneProperty()
578 562 prop1.SetColor(0, 0, 1)
579   -
  563 +
580 564 prop2 = plane_z.GetPlaneProperty()
581 565 prop2.SetColor(0, 1, 0)
582   -
  566 +
583 567 ps.Publisher().sendMessage('Set Widget Interactor', plane_x)
584 568 ps.Publisher().sendMessage('Set Widget Interactor', plane_y)
585 569 ps.Publisher().sendMessage('Set Widget Interactor', plane_z)
586   -
  570 +
587 571 self.Render()
588   -
  572 +
589 573 def Enable(self, evt_pubsub=None):
590 574 if (evt_pubsub):
591 575 label = evt_pubsub.data
592   -
  576 +
593 577 if(self.original_orientation == const.AXIAL):
594 578 if(label == "Axial"):
595 579 self.plane_z.On()
... ... @@ -602,7 +586,7 @@ class SlicePlane:
602 586 c = self.plane_x.GetTexture()
603 587 c.SetRestrictPowerOf2ImageSmaller(1)
604 588 #print dir(a)
605   -
  589 +
606 590 elif(self.original_orientation == const.SAGITAL):
607 591 if(label == "Axial"):
608 592 self.plane_y.On()
... ... @@ -617,7 +601,7 @@ class SlicePlane:
617 601 self.plane_z.On()
618 602 elif(label == "Sagital"):
619 603 self.plane_x.On()
620   -
  604 +
621 605 else:
622 606 self.plane_z.On()
623 607 self.plane_x.On()
... ... @@ -628,7 +612,7 @@ class SlicePlane:
628 612 def Disable(self, evt_pubsub=None):
629 613 if (evt_pubsub):
630 614 label = evt_pubsub.data
631   -
  615 +
632 616 if(self.original_orientation == const.AXIAL):
633 617 if(label == "Axial"):
634 618 self.plane_z.Off()
... ... @@ -636,7 +620,7 @@ class SlicePlane:
636 620 self.plane_y.Off()
637 621 elif(label == "Sagital"):
638 622 self.plane_x.Off()
639   -
  623 +
640 624 elif(self.original_orientation == const.SAGITAL):
641 625 if(label == "Axial"):
642 626 self.plane_y.Off()
... ... @@ -658,13 +642,12 @@ class SlicePlane:
658 642  
659 643 self.Render()
660 644  
661   -
662 645 def Render(self):
663 646 ps.Publisher().sendMessage('Render volume viewer')
664   -
  647 +
665 648 def ChangeSlice(self, pubsub_evt = None):
666 649 orientation, number = pubsub_evt.data
667   -
  650 +
668 651 if (self.original_orientation == const.AXIAL):
669 652 if (orientation == "CORONAL"):
670 653 self.SetSliceNumber(number, "Y")
... ... @@ -672,7 +655,7 @@ class SlicePlane:
672 655 self.SetSliceNumber(number, "X")
673 656 else:
674 657 self.SetSliceNumber(number, "Z")
675   -
  658 +
676 659 elif(self.original_orientation == const.SAGITAL):
677 660 if (orientation == "CORONAL"):
678 661 self.SetSliceNumber(number, "X")
... ... @@ -680,7 +663,7 @@ class SlicePlane:
680 663 self.SetSliceNumber(number, "Z")
681 664 else:
682 665 self.SetSliceNumber(number, "Y")
683   -
  666 +
684 667 else:
685 668 if (orientation == "CORONAL"):
686 669 self.SetSliceNumber(number, "Z")
... ... @@ -688,9 +671,9 @@ class SlicePlane:
688 671 self.SetSliceNumber(number, "X")
689 672 else:
690 673 self.SetSliceNumber(number, "Y")
691   -
  674 +
692 675 self.Render()
693   -
  676 +
694 677 def SetSliceNumber(self, number, axis):
695 678 if (axis == "X"):
696 679 self.plane_x.SetPlaneOrientationToXAxes()
... ... @@ -702,14 +685,12 @@ class SlicePlane:
702 685 self.plane_z.SetPlaneOrientationToZAxes()
703 686 self.plane_z.SetSliceIndex(number)
704 687  
705   -
706 688 def PointId(self, evt, obj):
707 689 #TODO: add in the code
708 690 # picker = vtk.vtkPointPicker()
709 691 # interactor.SetPicker(picker)
710 692 # interactor.AddObserver("left...", self.PointId)
711   -
712 693 x,y = evt.GetLastEventPosition()
713 694 self.picker.Pick(x, y, 0, self.ren1)
714 695 point_id = self.picker.GetPointId()
715   -
  696 +
... ...