Commit 991ffa8b4e72e5d223efda2c2779b6b8ce48fe5d

Authored by Thiago Franco de Moraes
1 parent 25c692a7

Cleaning viewer_slice

invesalius/data/styles.py
... ... @@ -427,7 +427,6 @@ class SpinInteractorStyle(DefaultInteractorStyle):
427 427 cam = ren.GetActiveCamera()
428 428 if (self.left_pressed):
429 429 self.viewer.UpdateTextDirection(cam)
430   - self.spined_image = True
431 430 obj.Spin()
432 431 obj.OnRightButtonDown()
433 432  
... ...
invesalius/data/viewer_slice.py
... ... @@ -152,16 +152,10 @@ class Viewer(wx.Panel):
152 152 #self.SetBackgroundColour(colour)
153 153  
154 154 # Interactor additional style
155   - #self.modes = []#['DEFAULT']
156   - self.left_pressed = 0
157   - self.right_pressed = 0
158 155  
159 156 self._number_slices = const.PROJECTION_MIP_SIZE
160 157 self._mip_inverted = False
161 158  
162   - self.spined_image = False #Use to control to spin
163   - self.paned_image = False
164   -
165 159 self.style = None
166 160 self.last_position_mouse_move = ()
167 161 self.state = const.STATE_DEFAULT
... ... @@ -200,7 +194,6 @@ class Viewer(wx.Panel):
200 194 self.__bind_events()
201 195 self.__bind_events_wx()
202 196  
203   - self._warped = False
204 197 self._flush_buffer = False
205 198  
206 199 def __init_gui(self):
... ... @@ -230,7 +223,6 @@ class Viewer(wx.Panel):
230 223 self.interactor.SetPicker(self.pick)
231 224  
232 225 def OnContextMenu(self, evt):
233   - self.right_pressed = 0
234 226 if (self.last_position_mouse_move ==\
235 227 self.interactor.GetLastEventPosition()):
236 228 self.menu.caller = self
... ... @@ -826,7 +818,6 @@ class Viewer(wx.Panel):
826 818 for slice_data in self.slice_data_list:
827 819 del slice_data
828 820  
829   - self.modes = []#['DEFAULT']
830 821 self.slice_data_list = []
831 822 self.layout = (1, 1)
832 823 self.orientation_texts = []
... ... @@ -928,11 +919,9 @@ class Viewer(wx.Panel):
928 919 max_slice_number)
929 920  
930 921 self.slice_data = self.create_slice_window()
931   - #self.slice_data.actor.SetInput(imagedata)
932 922 self.slice_data.SetCursor(self.__create_cursor())
933 923 self.cam = self.slice_data.renderer.GetActiveCamera()
934 924 self.__build_cross_lines(imagedata)
935   - #self.set_slice_number(0)
936 925  
937 926 # Set the slice number to the last slice to ensure the camera if far
938 927 # enough to show all slices.
... ... @@ -940,30 +929,6 @@ class Viewer(wx.Panel):
940 929 self.__update_camera()
941 930 self.slice_data.renderer.ResetCamera()
942 931 self.interactor.GetRenderWindow().AddRenderer(self.slice_data.renderer)
943   - #if slice_.imagedata is None:
944   - #slice_.SetInput(imagedata, mask_dict)
945   -
946   - ##actor.SetInput(slice_.GetOutput())
947   - #self.LoadRenderers(slice_.GetOutput())
948   - #self.__configure_renderers()
949   - #ren = self.slice_data_list[0].renderer
950   - #actor = self.slice_data_list[0].actor
951   - #actor_bound = actor.GetBounds()
952   - #self.cam = ren.GetActiveCamera()
953   -
954   - #for slice_data in self.slice_data_list:
955   - #self.__update_camera(slice_data)
956   - #self.Reposition(slice_data)
957   -
958   - #number_of_slices = self.layout[0] * self.layout[1]
959   - #max_slice_number = actor.GetSliceNumberMax() + 1/ \
960   - #number_of_slices
961   -
962   - #if actor.GetSliceNumberMax() % number_of_slices:
963   - #max_slice_number += 1
964   - #self.set_scroll_position(0)
965   -
966   - #actor_bound = actor.GetBounds()
967 932 self.interactor.Render()
968 933  
969 934 self.EnableText()
... ... @@ -1010,28 +975,6 @@ class Viewer(wx.Panel):
1010 975 for slice_data in self.slice_data_list:
1011 976 slice_data.cursor.actor.SetVisibility(visibility)
1012 977  
1013   - def __update_cursor_position(self, slice_data, position):
1014   - x, y, z = position
1015   - if (slice_data.cursor):
1016   - slice_number = slice_data.number
1017   - actor_bound = slice_data.actor.GetBounds()
1018   -
1019   - yz = [x + abs(x * 0.001), y, z]
1020   - xz = [x, y - abs(y * 0.001), z]
1021   - xy = [x, y, z + abs(z * 0.001)]
1022   -
1023   - proj = project.Project()
1024   - orig_orien = proj.original_orientation
1025   -
1026   - if (orig_orien == const.SAGITAL):
1027   - coordinates = {"SAGITAL": xy, "CORONAL": yz, "AXIAL": xz}
1028   - elif(orig_orien == const.CORONAL):
1029   - coordinates = {"SAGITAL": yz, "CORONAL": xy, "AXIAL": xz}
1030   - else:
1031   - coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy}
1032   -
1033   - slice_data.cursor.SetPosition(coordinates[self.orientation])
1034   -
1035 978 def SetOrientation(self, orientation):
1036 979 self.orientation = orientation
1037 980 for slice_data in self.slice_data_list:
... ... @@ -1047,7 +990,6 @@ class Viewer(wx.Panel):
1047 990 overlay_renderer.SetActiveCamera(cam)
1048 991 overlay_renderer.SetInteractive(0)
1049 992  
1050   -
1051 993 self.interactor.GetRenderWindow().SetNumberOfLayers(2)
1052 994 self.interactor.GetRenderWindow().AddRenderer(overlay_renderer)
1053 995 self.interactor.GetRenderWindow().AddRenderer(renderer)
... ... @@ -1286,30 +1228,6 @@ class Viewer(wx.Panel):
1286 1228 self.set_slice_number(pos)
1287 1229 self.interactor.Render()
1288 1230  
1289   - def test_operation_position(self, coord):
1290   - """
1291   - Test if coord is into the imagedata limits.
1292   - """
1293   - x, y, z = coord
1294   - xi, yi, zi = 0, 0, 0
1295   - xf, yf, zf = self.imagedata.GetDimensions()
1296   - if xi <= x <= xf \
1297   - and yi <= y <= yf\
1298   - and zi <= z <= zf:
1299   - return True
1300   - return False
1301   -
1302   - def _assert_coord_into_image(self, coord):
1303   - extent = self.imagedata.GetWholeExtent()
1304   - extent_min = extent[0], extent[2], extent[4]
1305   - extent_max = extent[1], extent[3], extent[5]
1306   - for index in xrange(3):
1307   - if coord[index] > extent_max[index]:
1308   - coord[index] = extent_max[index]
1309   - elif coord[index] < extent_min[index]:
1310   - coord[index] = extent_min[index]
1311   - return coord
1312   -
1313 1231 def ReloadActualSlice(self, pubsub_evt=None):
1314 1232 pos = self.scroll.GetThumbPosition()
1315 1233 self.set_slice_number(pos)
... ...