Commit ef8195bdb712326c3d1c0570b294a3b9278604ca

Authored by tfmoraes
1 parent a8563414

ENH: Improvements in the cross

Showing 1 changed file with 16 additions and 6 deletions   Show diff stats
invesalius/data/viewer_slice.py
... ... @@ -547,7 +547,7 @@ class Viewer(wx.Panel):
547 547 if self.mouse_pressed:
548 548 mouse_x, mouse_y = self.interactor.GetEventPosition()
549 549 renderer = self.slice_data_list[0].renderer
550   - self.pick.Pick(mouse_x, mouse_y, 0, renderer)
  550 + self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer)
551 551 coord_cross = self.get_coordinate_cursor()
552 552 coord = self.get_coordinate()
553 553 ps.Publisher().sendMessage('Update cross position', coord_cross)
... ... @@ -561,7 +561,7 @@ class Viewer(wx.Panel):
561 561 def OnCrossMouseClick(self, obj, evt_vtk):
562 562 mouse_x, mouse_y = self.interactor.GetEventPosition()
563 563 renderer = self.slice_data_list[0].renderer
564   - self.pick.Pick(mouse_x, mouse_y, 0, renderer)
  564 + self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer)
565 565 coord_cross = self.get_coordinate_cursor()
566 566 coord = self.get_coordinate()
567 567 ps.Publisher().sendMessage('Update cross position', coord_cross)
... ... @@ -888,16 +888,18 @@ class Viewer(wx.Panel):
888 888 slice_data = self.slice_data_list[0]
889 889 slice_number = slice_data.number
890 890 actor_bound = slice_data.actor.GetBounds()
  891 + extent = slice_data.actor.GetDisplayExtent()
891 892  
892 893 print
893 894 print self.orientation
894 895 print x, y, z
895 896 print actor_bound
  897 + print extent
896 898 print
897 899  
898   - xy = [x, y, actor_bound[0]]
899   - yz = [actor_bound[2], y, z]
900   - xz = [x, actor_bound[4], z]
  900 + xy = [x, y, actor_bound[4]]
  901 + yz = [actor_bound[0], y, z]
  902 + xz = [x, actor_bound[2], z]
901 903  
902 904 proj = project.Project()
903 905 orig_orien = proj.original_orientation
... ... @@ -909,7 +911,15 @@ class Viewer(wx.Panel):
909 911 else:
910 912 coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy}
911 913  
912   - self.cross.SetFocalPoint(x, y, z)
  914 + pos = [x, y, z]
  915 + if self.orientation == "AXIAL":
  916 + pos[2] = pos[2] * 1.0001
  917 + elif self.orientation == "SAGITAL":
  918 + pos[0] = pos[0] * 1.0001
  919 + else:
  920 + pos[1] = pos[1] * 1.0001
  921 + print ">POS", pos
  922 + self.cross.SetFocalPoint(pos)
913 923  
914 924 #print
915 925 #print slice_number
... ...