Commit ef8195bdb712326c3d1c0570b294a3b9278604ca
1 parent
a8563414
Exists in
master
and in
68 other branches
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,7 +547,7 @@ class Viewer(wx.Panel): | ||
547 | if self.mouse_pressed: | 547 | if self.mouse_pressed: |
548 | mouse_x, mouse_y = self.interactor.GetEventPosition() | 548 | mouse_x, mouse_y = self.interactor.GetEventPosition() |
549 | renderer = self.slice_data_list[0].renderer | 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 | coord_cross = self.get_coordinate_cursor() | 551 | coord_cross = self.get_coordinate_cursor() |
552 | coord = self.get_coordinate() | 552 | coord = self.get_coordinate() |
553 | ps.Publisher().sendMessage('Update cross position', coord_cross) | 553 | ps.Publisher().sendMessage('Update cross position', coord_cross) |
@@ -561,7 +561,7 @@ class Viewer(wx.Panel): | @@ -561,7 +561,7 @@ class Viewer(wx.Panel): | ||
561 | def OnCrossMouseClick(self, obj, evt_vtk): | 561 | def OnCrossMouseClick(self, obj, evt_vtk): |
562 | mouse_x, mouse_y = self.interactor.GetEventPosition() | 562 | mouse_x, mouse_y = self.interactor.GetEventPosition() |
563 | renderer = self.slice_data_list[0].renderer | 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 | coord_cross = self.get_coordinate_cursor() | 565 | coord_cross = self.get_coordinate_cursor() |
566 | coord = self.get_coordinate() | 566 | coord = self.get_coordinate() |
567 | ps.Publisher().sendMessage('Update cross position', coord_cross) | 567 | ps.Publisher().sendMessage('Update cross position', coord_cross) |
@@ -888,16 +888,18 @@ class Viewer(wx.Panel): | @@ -888,16 +888,18 @@ class Viewer(wx.Panel): | ||
888 | slice_data = self.slice_data_list[0] | 888 | slice_data = self.slice_data_list[0] |
889 | slice_number = slice_data.number | 889 | slice_number = slice_data.number |
890 | actor_bound = slice_data.actor.GetBounds() | 890 | actor_bound = slice_data.actor.GetBounds() |
891 | + extent = slice_data.actor.GetDisplayExtent() | ||
891 | 892 | ||
892 | 893 | ||
893 | print self.orientation | 894 | print self.orientation |
894 | print x, y, z | 895 | print x, y, z |
895 | print actor_bound | 896 | print actor_bound |
897 | + print extent | ||
896 | 898 | ||
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 | proj = project.Project() | 904 | proj = project.Project() |
903 | orig_orien = proj.original_orientation | 905 | orig_orien = proj.original_orientation |
@@ -909,7 +911,15 @@ class Viewer(wx.Panel): | @@ -909,7 +911,15 @@ class Viewer(wx.Panel): | ||
909 | else: | 911 | else: |
910 | coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy} | 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 | ||
915 | #print slice_number | 925 | #print slice_number |