Commit b7d73f1ce003f8e9c43fb0abfe09589583598b39

Authored by tatiana
1 parent eaf2b14b

ENC: Cross behaviour equal to comercial software

invesalius/data/slice_.py
@@ -25,6 +25,8 @@ class Slice(object): @@ -25,6 +25,8 @@ class Slice(object):
25 # Slice properties 25 # Slice properties
26 ps.Publisher().subscribe(self.UpdateCursorPosition, 26 ps.Publisher().subscribe(self.UpdateCursorPosition,
27 'Update cursor position in slice') 27 'Update cursor position in slice')
  28 + ps.Publisher().subscribe(self.UpdateCursorPositionSingleAxis,
  29 + 'Update cursor single position in slice')
28 # General slice control 30 # General slice control
29 ps.Publisher().subscribe(self.CreateSurfaceFromIndex, 31 ps.Publisher().subscribe(self.CreateSurfaceFromIndex,
30 'Create surface from index') 32 'Create surface from index')
@@ -336,6 +338,19 @@ class Slice(object): @@ -336,6 +338,19 @@ class Slice(object):
336 self.cast_filter.Update() 338 self.cast_filter.Update()
337 ps.Publisher().sendMessage('Update slice viewer') 339 ps.Publisher().sendMessage('Update slice viewer')
338 340
  341 +
  342 + def UpdateCursorPositionSingleAxis(self, pubsub_evt):
  343 + axis_pos = pubsub_evt.data
  344 + x, y, z = self.cross.GetCursorPosition()
  345 + new_pos = [x,y,z]
  346 + for key in axis_pos:
  347 + new_pos[key] = axis_pos[key]
  348 + self.cross.SetCursorPosition(new_pos)
  349 + self.cross.Modified()
  350 + self.cast_filter.Update()
  351 + ps.Publisher().sendMessage('Update slice viewer')
  352 +
  353 +
339 def __create_background(self, imagedata): 354 def __create_background(self, imagedata):
340 355
341 thresh_min, thresh_max = imagedata.GetScalarRange() 356 thresh_min, thresh_max = imagedata.GetScalarRange()
invesalius/data/viewer_slice.py
@@ -463,7 +463,13 @@ class Viewer(wx.Panel): @@ -463,7 +463,13 @@ class Viewer(wx.Panel):
463 self.text_actor.SetInput(str(index)) 463 self.text_actor.SetInput(str(index))
464 self.slice_number = index 464 self.slice_number = index
465 self.__update_display_extent() 465 self.__update_display_extent()
466 - actor_bound = self.actor.GetBounds() 466 +
  467 + position = {"SAGITAL": {0: self.slice_number},
  468 + "CORONAL": {1: self.slice_number},
  469 + "AXIAL": {2: self.slice_number}}
  470 +
  471 + ps.Publisher().sendMessage('Update cursor single position in slice',
  472 + position[self.orientation])
467 473
468 def ChangeSliceNumber(self, pubsub_evt): 474 def ChangeSliceNumber(self, pubsub_evt):
469 index = pubsub_evt.data 475 index = pubsub_evt.data