Commit 4811ecf0f4aac5b53ff7c1f777a6e1273d9c2125
1 parent
ecfd1f2e
Exists in
master
and in
68 other branches
ENH: The cursor is always above the slice in all orientations
Showing
1 changed file
with
28 additions
and
29 deletions
Show diff stats
invesalius/data/viewer_slice.py
@@ -550,7 +550,8 @@ class Viewer(wx.Panel): | @@ -550,7 +550,8 @@ class Viewer(wx.Panel): | ||
550 | self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, 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', |
554 | + (self.orientation, coord_cross)) | ||
554 | ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), | 555 | ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), |
555 | coord[0]) | 556 | coord[0]) |
556 | ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), | 557 | ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), |
@@ -564,7 +565,8 @@ class Viewer(wx.Panel): | @@ -564,7 +565,8 @@ class Viewer(wx.Panel): | ||
564 | self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer) | 565 | self.pick.Pick(mouse_x, mouse_y, self.slice_data_list[0].number, renderer) |
565 | coord_cross = self.get_coordinate_cursor() | 566 | coord_cross = self.get_coordinate_cursor() |
566 | coord = self.get_coordinate() | 567 | coord = self.get_coordinate() |
567 | - ps.Publisher().sendMessage('Update cross position', coord_cross) | 568 | + ps.Publisher().sendMessage('Update cross position', |
569 | + (self.orientation, coord_cross)) | ||
568 | ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), | 570 | ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), |
569 | coord[0]) | 571 | coord[0]) |
570 | ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), | 572 | ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), |
@@ -873,7 +875,8 @@ class Viewer(wx.Panel): | @@ -873,7 +875,8 @@ class Viewer(wx.Panel): | ||
873 | renderer.AddActor(cross_actor) | 875 | renderer.AddActor(cross_actor) |
874 | 876 | ||
875 | def __update_cross_position(self, pubsub_evt): | 877 | def __update_cross_position(self, pubsub_evt): |
876 | - x, y, z = pubsub_evt.data | 878 | + x, y, z = pubsub_evt.data[1] |
879 | + orientation = pubsub_evt.data[0] | ||
877 | #xi, yi, zi = self.vline.GetPoint1() | 880 | #xi, yi, zi = self.vline.GetPoint1() |
878 | #xf, yf, zf = self.vline.GetPoint2() | 881 | #xf, yf, zf = self.vline.GetPoint2() |
879 | #self.vline.SetPoint1(x, yi, z) | 882 | #self.vline.SetPoint1(x, yi, z) |
@@ -894,12 +897,10 @@ class Viewer(wx.Panel): | @@ -894,12 +897,10 @@ class Viewer(wx.Panel): | ||
894 | print self.orientation | 897 | print self.orientation |
895 | print x, y, z | 898 | print x, y, z |
896 | print actor_bound | 899 | print actor_bound |
897 | - print extent | ||
898 | |||
899 | 900 | ||
900 | - xy = [x, y, actor_bound[4]] | ||
901 | - yz = [actor_bound[0], y, z] | ||
902 | - xz = [x, actor_bound[2], z] | 901 | + yz = [x + abs(x * 0.001), y, z] |
902 | + xz = [x, y - abs(y * 0.001), z] | ||
903 | + xy = [x, y, z + abs(z * 0.001)] | ||
903 | 904 | ||
904 | proj = project.Project() | 905 | proj = project.Project() |
905 | orig_orien = proj.original_orientation | 906 | orig_orien = proj.original_orientation |
@@ -911,15 +912,16 @@ class Viewer(wx.Panel): | @@ -911,15 +912,16 @@ class Viewer(wx.Panel): | ||
911 | else: | 912 | else: |
912 | coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy} | 913 | coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy} |
913 | 914 | ||
914 | - pos = [x, y, z] | ||
915 | - if self.orientation == "AXIAL": | ||
916 | - pos[2] = pos[2] * 1.001 | ||
917 | - elif self.orientation == "SAGITAL": | ||
918 | - pos[0] = pos[0] * 1.001 | ||
919 | - else: | ||
920 | - pos[1] = pos[1] * 1.001 | ||
921 | - print ">POS", pos | ||
922 | - self.cross.SetFocalPoint(pos) | 915 | + #pos = [x, y, z] |
916 | + #if orientation == "AXIAL": | ||
917 | + # pos[2] += abs(pos[2] * 0.001) | ||
918 | + #elif orientation == "SAGITAL": | ||
919 | + # pos[0] += abs(pos[0] * 0.001) | ||
920 | + #elif orientation == "CORONAL": | ||
921 | + # pos[1] -= abs(pos[1] * 0.001) | ||
922 | + #print ">POS", pos | ||
923 | |||
924 | + self.cross.SetFocalPoint(coordinates[orientation]) | ||
923 | 925 | ||
924 | 926 | ||
925 | #print slice_number | 927 | #print slice_number |
@@ -935,9 +937,14 @@ class Viewer(wx.Panel): | @@ -935,9 +937,14 @@ class Viewer(wx.Panel): | ||
935 | slice_number = slice_data.number | 937 | slice_number = slice_data.number |
936 | actor_bound = slice_data.actor.GetBounds() | 938 | actor_bound = slice_data.actor.GetBounds() |
937 | 939 | ||
938 | - yz = [actor_bound[1] + 1 + slice_number, y, z] | ||
939 | - xz = [x, actor_bound[3] - 1 - slice_number, z] | ||
940 | - xy = [x, y, actor_bound[5] + 1 + slice_number] | 940 | |
941 | + print self.orientation | ||
942 | + print x, y, z | ||
943 | + print actor_bound | ||
944 | + | ||
945 | + yz = [x + abs(x * 0.001), y, z] | ||
946 | + xz = [x, y - abs(y * 0.001), z] | ||
947 | + xy = [x, y, z + abs(z * 0.001)] | ||
941 | 948 | ||
942 | proj = project.Project() | 949 | proj = project.Project() |
943 | orig_orien = proj.original_orientation | 950 | orig_orien = proj.original_orientation |
@@ -949,15 +956,7 @@ class Viewer(wx.Panel): | @@ -949,15 +956,7 @@ class Viewer(wx.Panel): | ||
949 | else: | 956 | else: |
950 | coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy} | 957 | coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy} |
951 | 958 | ||
952 | - pos = [x, y, z] | ||
953 | - if self.orientation == "AXIAL": | ||
954 | - pos[2] = pos[2] * 1.001 | ||
955 | - elif self.orientation == "SAGITAL": | ||
956 | - pos[0] = pos[0] * 1.001 | ||
957 | - else: | ||
958 | - pos[1] = pos[1] * 1.001 | ||
959 | - print ">POS", pos | ||
960 | - slice_data.cursor.SetPosition(pos) | 959 | + slice_data.cursor.SetPosition(coordinates[self.orientation]) |
961 | 960 | ||
962 | def SetOrientation(self, orientation): | 961 | def SetOrientation(self, orientation): |
963 | self.orientation = orientation | 962 | self.orientation = orientation |