Commit edd9a1e8896df4fdee38d3afc7d713616956733c

Authored by vhosouza
2 parents 3e651efa 9a71385e
Exists in usp-navegador

Merge remote-tracking branch 'upstream/master'

invesalius/control.py
... ... @@ -204,7 +204,7 @@ class Controller():
204 204 Publisher.sendMessage("Enable state project", False)
205 205 Publisher.sendMessage('Set project name')
206 206 Publisher.sendMessage("Stop Config Recording")
207   - #Publisher.sendMessage("Exit")
  207 + Publisher.sendMessage("Exit")
208 208 elif answer == 1:
209 209 self.ShowDialogSaveProject()
210 210 utils.debug("Save changes and close")
... ... @@ -212,7 +212,7 @@ class Controller():
212 212 Publisher.sendMessage("Enable state project", False)
213 213 Publisher.sendMessage('Set project name')
214 214 Publisher.sendMessage("Stop Config Recording")
215   - #Publisher.sendMessage("Exit")
  215 + Publisher.sendMessage("Exit")
216 216 elif answer == -1:
217 217 utils.debug("Cancel")
218 218 else:
... ... @@ -220,11 +220,11 @@ class Controller():
220 220 Publisher.sendMessage("Enable state project", False)
221 221 Publisher.sendMessage('Set project name')
222 222 Publisher.sendMessage("Stop Config Recording")
223   - #Publisher.sendMessage("Exit")
  223 + Publisher.sendMessage("Exit")
224 224  
225 225 else:
226 226 Publisher.sendMessage('Stop Config Recording')
227   - #Publisher.sendMessage('Exit')
  227 + Publisher.sendMessage('Exit')
228 228  
229 229  
230 230 ###########################
... ... @@ -265,10 +265,6 @@ class Controller():
265 265 self.Slice.window_level = proj.level
266 266 self.Slice.window_width = proj.window
267 267  
268   - mask = msk.Mask()
269   - mask._set_class_index(proj.last_mask_index)
270   - self.mask_dict_copy = proj.mask_dict.copy()
271   -
272 268 Publisher.sendMessage('Update threshold limits list',
273 269 proj.threshold_range)
274 270  
... ... @@ -395,8 +391,7 @@ class Controller():
395 391 self.Slice.spacing = proj.spacing
396 392  
397 393 Publisher.sendMessage('Load slice to viewer',
398   - (proj.imagedata,
399   - proj.mask_dict))
  394 + (proj.mask_dict))
400 395  
401 396  
402 397 Publisher.sendMessage('Load slice plane')
... ...
invesalius/data/slice_.py
... ... @@ -16,7 +16,6 @@
16 16 # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais
17 17 # detalhes.
18 18 #--------------------------------------------------------------------------
19   -import math
20 19 import os
21 20 import tempfile
22 21  
... ... @@ -79,7 +78,6 @@ class Slice(object):
79 78 # Therefore, we use Singleton design pattern for implementing it.
80 79  
81 80 def __init__(self):
82   - self.imagedata = None
83 81 self.current_mask = None
84 82 self.blend_filter = None
85 83 self.histogram = None
... ... @@ -159,9 +157,8 @@ class Slice(object):
159 157  
160 158 Publisher.subscribe(self.UpdateColourTableBackgroundWidget,\
161 159 'Change colour table from background image from widget')
162   - Publisher.subscribe(self._set_projection_type, 'Set projection type')
163 160  
164   - Publisher.subscribe(self.InputImageWidget, 'Input Image in the widget')
  161 + Publisher.subscribe(self._set_projection_type, 'Set projection type')
165 162  
166 163 Publisher.subscribe(self.OnExportMask,'Export mask to file')
167 164  
... ... @@ -249,7 +246,6 @@ class Slice(object):
249 246 self.CloseProject()
250 247  
251 248 def CloseProject(self):
252   - self.imagedata = None
253 249 f = self._matrix.filename
254 250 self._matrix._mmap.close()
255 251 self._matrix = None
... ... @@ -276,10 +272,6 @@ class Slice(object):
276 272  
277 273 Publisher.sendMessage('Select first item from slice menu')
278 274  
279   - #self.blend_filter = None
280   - #self.blend_filter = None
281   - #self.num_gradient = 0
282   -
283 275 def __set_current_mask_threshold_limits(self, pubsub_evt):
284 276 thresh_min = pubsub_evt.data[0]
285 277 thresh_max = pubsub_evt.data[1]
... ... @@ -287,10 +279,6 @@ class Slice(object):
287 279 index = self.current_mask.index
288 280 self.SetMaskEditionThreshold(index, (thresh_min, thresh_max))
289 281  
290   - #---------------------------------------------------------------------------
291   - # BEGIN PUBSUB_EVT METHODS
292   - #---------------------------------------------------------------------------
293   -
294 282 def __add_mask(self, pubsub_evt):
295 283 mask_name = pubsub_evt.data
296 284 self.CreateMask(name=mask_name)
... ... @@ -308,7 +296,7 @@ class Slice(object):
308 296 def __select_current_mask(self, pubsub_evt):
309 297 mask_index = pubsub_evt.data
310 298 self.SelectCurrentMask(mask_index)
311   - #---------------------------------------------------------------------------
  299 +
312 300 def __set_current_mask_edition_threshold(self, evt_pubsub):
313 301 if self.current_mask:
314 302 threshold_range = evt_pubsub.data
... ... @@ -324,7 +312,6 @@ class Slice(object):
324 312  
325 313 to_reload = False
326 314 if threshold_range != self.current_mask.threshold_range:
327   - print "<<<<<<<<<<<<<<<< DIFERENT >>>>>>>>>>>>>>>>>>>>>>>"
328 315 to_reload = True
329 316 for orientation in self.buffer_slices:
330 317 self.buffer_slices[orientation].discard_vtk_mask()
... ... @@ -482,7 +469,6 @@ class Slice(object):
482 469  
483 470 def GetSlices(self, orientation, slice_number, number_slices,
484 471 inverted=False, border_size=1.0):
485   - print "min max ->", self.matrix.min(), self.matrix.max()
486 472 if self.buffer_slices[orientation].index == slice_number and \
487 473 self._type_projection == const.PROJECTION_NORMAL:
488 474 if self.buffer_slices[orientation].vtk_image:
... ... @@ -837,19 +823,12 @@ class Slice(object):
837 823  
838 824 def SelectCurrentMask(self, index):
839 825 "Insert mask data, based on given index, into pipeline."
840   - # This condition is not necessary in Linux, only under mac and windows
841   - # because combobox event is binded when the same item is selected again.
842   - #if index != self.current_mask.index:
843   - print "SelectCurrentMask"
844   - print "index:", index
845 826 proj = Project()
846 827 future_mask = proj.GetMask(index)
847 828 future_mask.is_shown = True
848 829 self.current_mask = future_mask
849 830  
850 831 colour = future_mask.colour
851   - #index = future_mask.index
852   - print index
853 832 self.SetMaskColour(index, colour, update=False)
854 833  
855 834 self.buffer_slices = {"AXIAL": SliceBuffer(),
... ... @@ -872,18 +851,9 @@ class Slice(object):
872 851 proj = Project()
873 852 mask = proj.mask_dict[surface_parameters['options']['index']]
874 853  
875   - # This is very important. Do not use masks' imagedata. It would mess up
876   - # surface quality event when using contour
877   - #self.SetMaskThreshold(mask.index, threshold)
878   - for n in xrange(1, mask.matrix.shape[0]):
879   - if mask.matrix[n, 0, 0] == 0:
880   - m = mask.matrix[n, 1:, 1:]
881   - mask.matrix[n, 1:, 1:] = self.do_threshold_to_a_slice(self.matrix[n-1], m)
882   -
883   - mask.matrix.flush()
  854 + self.do_threshold_to_all_slices(mask)
  855 + Publisher.sendMessage('Create surface', (self, mask, surface_parameters))
884 856  
885   - Publisher.sendMessage('Create surface', (self, mask,
886   - surface_parameters))
887 857 def GetOutput(self):
888 858 return self.blend_filter.GetOutput()
889 859  
... ... @@ -907,59 +877,6 @@ class Slice(object):
907 877  
908 878 Publisher.sendMessage('Check projection menu', tprojection)
909 879  
910   - def SetInput(self, imagedata, mask_dict):
911   - print "SETINPUT!"
912   - self.imagedata = imagedata
913   - self.extent = imagedata.GetExtent()
914   -
915   - imagedata_bg = self.__create_background(imagedata)
916   -
917   - if not mask_dict:
918   - imagedata_mask = self.__build_mask(imagedata, create=True)
919   - else:
920   - self.__load_masks(imagedata, mask_dict)
921   - imagedata_mask = self.img_colours_mask.GetOutput()
922   -
923   - mask_opacity = self.current_mask.opacity
924   -
925   - # blend both imagedatas, so it can be inserted into viewer
926   - blend_filter = vtk.vtkImageBlend()
927   - blend_filter.SetBlendModeToNormal()
928   - blend_filter.SetOpacity(0, 1)
929   - if self.current_mask.is_shown:
930   - blend_filter.SetOpacity(1, mask_opacity)
931   - else:
932   - blend_filter.SetOpacity(1, 0)
933   - blend_filter.SetInput(0, imagedata_bg)
934   - blend_filter.SetInput(1, imagedata_mask)
935   - blend_filter.SetBlendModeToNormal()
936   - blend_filter.GetOutput().ReleaseDataFlagOn()
937   - self.blend_filter = blend_filter
938   -
939   - self.window_level = vtk.vtkImageMapToWindowLevelColors()
940   - self.window_level.SetInput(self.imagedata)
941   -
942   - def __create_background(self, imagedata):
943   - thresh_min, thresh_max = imagedata.GetScalarRange()
944   - Publisher.sendMessage('Update threshold limits list', (thresh_min,
945   - thresh_max))
946   -
947   - # map scalar values into colors
948   - lut_bg = self.lut_bg = vtk.vtkLookupTable()
949   - lut_bg.SetTableRange(thresh_min, thresh_max)
950   - lut_bg.SetSaturationRange(0, 0)
951   - lut_bg.SetHueRange(0, 0)
952   - lut_bg.SetValueRange(0, 1)
953   - lut_bg.Build()
954   -
955   - # map the input image through a lookup table
956   - img_colours_bg = self.img_colours_bg = vtk.vtkImageMapToColors()
957   - img_colours_bg.SetOutputFormatToRGBA()
958   - img_colours_bg.SetLookupTable(lut_bg)
959   - img_colours_bg.SetInput(imagedata)
960   -
961   - return img_colours_bg.GetOutput()
962   -
963 880 def UpdateWindowLevelBackground(self, pubsub_evt):
964 881 window, level = pubsub_evt.data
965 882 self.window_width = window
... ... @@ -1018,29 +935,6 @@ class Slice(object):
1018 935  
1019 936 Publisher.sendMessage('Reload actual slice')
1020 937  
1021   - def InputImageWidget(self, pubsub_evt):
1022   - widget, orientation = pubsub_evt.data
1023   -
1024   - original_orientation = Project().original_orientation
1025   -
1026   - img = self.buffer_slices[orientation].vtk_image
1027   -
1028   - cast = vtk.vtkImageCast()
1029   - cast.SetInput(img)
1030   - cast.SetOutputScalarTypeToDouble()
1031   - cast.ClampOverflowOn()
1032   - cast.Update()
1033   -
1034   - #if (original_orientation == const.AXIAL):
1035   - flip = vtk.vtkImageFlip()
1036   - flip.SetInput(cast.GetOutput())
1037   - flip.SetFilteredAxis(1)
1038   - flip.FlipAboutOriginOn()
1039   - flip.Update()
1040   - widget.SetInput(flip.GetOutput())
1041   - #else:
1042   - #widget.SetInput(cast.GetOutput())
1043   -
1044 938 def UpdateSlice3D(self, pubsub_evt):
1045 939 widget, orientation = pubsub_evt.data
1046 940 img = self.buffer_slices[orientation].vtk_image
... ... @@ -1112,27 +1006,6 @@ class Slice(object):
1112 1006 Publisher.sendMessage('Change mask selected', mask.index)
1113 1007 Publisher.sendMessage('Update slice viewer')
1114 1008  
1115   - def __load_masks(self, imagedata, mask_dict):
1116   - keys = mask_dict.keys()
1117   - keys.sort()
1118   - for key in keys:
1119   - mask = mask_dict[key]
1120   -
1121   - # update gui related to mask
1122   - utils.debug("__load_masks")
1123   - utils.debug('THRESHOLD_RANGE %s'% mask.threshold_range)
1124   - Publisher.sendMessage('Add mask',
1125   - (mask.index,
1126   - mask.name,
1127   - mask.threshold_range,
1128   - mask.colour))
1129   -
1130   - self.current_mask = mask
1131   - self.__build_mask(imagedata, False)
1132   -
1133   - Publisher.sendMessage('Change mask selected', mask.index)
1134   - Publisher.sendMessage('Update slice viewer')
1135   -
1136 1009 def do_ww_wl(self, image):
1137 1010 if self.from_ == PLIST:
1138 1011 lut = vtk.vtkWindowLevelLookupTable()
... ... @@ -1213,12 +1086,16 @@ class Slice(object):
1213 1086 m[mask == 254] = 254
1214 1087 return m.astype('uint8')
1215 1088  
1216   - def do_threshold_to_all_slices(self):
1217   - mask = self.current_mask
  1089 + def do_threshold_to_all_slices(self, mask=None):
  1090 + """
  1091 + Apply threshold to all slices.
1218 1092  
1219   - # This is very important. Do not use masks' imagedata. It would mess up
1220   - # surface quality event when using contour
1221   - #self.SetMaskThreshold(mask.index, threshold)
  1093 + Params:
  1094 + - mask: the mask where result of the threshold will be stored.If
  1095 + None, it'll be the current mask.
  1096 + """
  1097 + if mask is None:
  1098 + mask = self.current_mask
1222 1099 for n in xrange(1, mask.matrix.shape[0]):
1223 1100 if mask.matrix[n, 0, 0] == 0:
1224 1101 m = mask.matrix[n, 1:, 1:]
... ... @@ -1391,76 +1268,9 @@ class Slice(object):
1391 1268 self.buffer_slices[o].discard_vtk_mask()
1392 1269 Publisher.sendMessage('Reload actual slice')
1393 1270  
1394   - def __build_mask(self, imagedata, create=True):
1395   - # create new mask instance and insert it into project
1396   - if create:
1397   - self.CreateMask(imagedata=imagedata)
1398   - current_mask = self.current_mask
1399   -
1400   - # properties to be inserted into pipeline
1401   - scalar_range = int(imagedata.GetScalarRange()[1])
1402   - r,g,b = current_mask.colour
1403   -
1404   - # map scalar values into colors
1405   - lut_mask = vtk.vtkLookupTable()
1406   - lut_mask.SetNumberOfTableValues(1)
1407   - lut_mask.SetNumberOfColors(1)
1408   - lut_mask.SetHueRange(const.THRESHOLD_HUE_RANGE)
1409   - lut_mask.SetSaturationRange(1, 1)
1410   - lut_mask.SetValueRange(1, 1)
1411   - lut_mask.SetNumberOfTableValues(scalar_range)
1412   - lut_mask.SetTableValue(1, r, g, b, 1.0)
1413   - lut_mask.SetTableValue(scalar_range - 1, r, g, b, 1.0)
1414   - lut_mask.SetRampToLinear()
1415   - lut_mask.Build()
1416   - self.lut_mask = lut_mask
1417   -
1418   - mask_thresh_imagedata = self.__create_mask_threshold(imagedata)
1419   -
1420   - if create:
1421   - # threshold pipeline
1422   - current_mask.imagedata.DeepCopy(mask_thresh_imagedata)
1423   - else:
1424   - mask_thresh_imagedata = self.current_mask.imagedata
1425   -
1426   - # map the input image through a lookup table
1427   - img_colours_mask = vtk.vtkImageMapToColors()
1428   - img_colours_mask.SetOutputFormatToRGBA()
1429   - img_colours_mask.SetLookupTable(lut_mask)
1430   -
1431   - img_colours_mask.SetInput(mask_thresh_imagedata)
1432   -
1433   - self.img_colours_mask = img_colours_mask
1434   -
1435   - return img_colours_mask.GetOutput()
1436   -
1437   - def __create_mask_threshold(self, imagedata, threshold_range=None):
1438   - if not threshold_range:
1439   - thresh_min, thresh_max = self.current_mask.threshold_range
1440   - else:
1441   - thresh_min, thresh_max = threshold_range
1442   -
1443   - # flexible threshold
1444   - img_thresh_mask = vtk.vtkImageThreshold()
1445   - img_thresh_mask.SetInValue(const.THRESHOLD_INVALUE)
1446   - img_thresh_mask.SetInput(imagedata)
1447   - img_thresh_mask.SetOutValue(const.THRESHOLD_OUTVALUE)
1448   - img_thresh_mask.ThresholdBetween(float(thresh_min), float(thresh_max))
1449   - img_thresh_mask.Update()
1450   - self.img_thresh_mask = img_thresh_mask
1451   -
1452   - # copy of threshold output
1453   - imagedata_mask = vtk.vtkImageData()
1454   - imagedata_mask.DeepCopy(img_thresh_mask.GetOutput())
1455   - imagedata_mask.Update()
1456   -
1457   - return imagedata_mask
1458   -
1459 1271 def _open_image_matrix(self, filename, shape, dtype):
1460 1272 self.matrix_filename = filename
1461   - print ">>>", filename
1462   - self.matrix = numpy.memmap(filename, shape=shape, dtype=dtype,
1463   - mode='r+')
  1273 + self.matrix = numpy.memmap(filename, shape=shape, dtype=dtype, mode='r+')
1464 1274  
1465 1275 def OnFlipVolume(self, pubsub_evt):
1466 1276 axis = pubsub_evt.data
... ... @@ -1490,8 +1300,9 @@ class Slice(object):
1490 1300 print type(self.matrix)
1491 1301  
1492 1302 def OnExportMask(self, pubsub_evt):
1493   - #imagedata = self.current_mask.imagedata
1494   - imagedata = self.imagedata
1495   - filename, filetype = pubsub_evt.data
1496   - if (filetype == const.FILETYPE_IMAGEDATA):
1497   - iu.Export(imagedata, filename)
  1303 + pass
  1304 + ##imagedata = self.current_mask.imagedata
  1305 + #imagedata = self.imagedata
  1306 + #filename, filetype = pubsub_evt.data
  1307 + #if (filetype == const.FILETYPE_IMAGEDATA):
  1308 + #iu.Export(imagedata, filename)
... ...
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
... ... @@ -849,7 +841,6 @@ class Viewer(wx.Panel):
849 841 for slice_data in self.slice_data_list:
850 842 del slice_data
851 843  
852   - self.modes = []#['DEFAULT']
853 844 self.slice_data_list = []
854 845 self.layout = (1, 1)
855 846 self.orientation_texts = []
... ... @@ -877,8 +868,8 @@ class Viewer(wx.Panel):
877 868 self.interactor.Bind(wx.EVT_SIZE, self.OnSize)
878 869  
879 870 def LoadImagedata(self, pubsub_evt):
880   - imagedata, mask_dict = pubsub_evt.data
881   - self.SetInput(imagedata, mask_dict)
  871 + mask_dict = pubsub_evt.data
  872 + self.SetInput(mask_dict)
882 873  
883 874 def LoadRenderers(self, imagedata):
884 875 number_renderers = self.layout[0] * self.layout[1]
... ... @@ -943,7 +934,7 @@ class Viewer(wx.Panel):
943 934 self.cursor_ = cursor
944 935 return cursor
945 936  
946   - def SetInput(self, imagedata, mask_dict):
  937 + def SetInput(self, mask_dict):
947 938 self.slice_ = sl.Slice()
948 939  
949 940 max_slice_number = sl.Slice().GetNumberOfSlices(self.orientation)
... ... @@ -951,11 +942,9 @@ class Viewer(wx.Panel):
951 942 max_slice_number)
952 943  
953 944 self.slice_data = self.create_slice_window()
954   - #self.slice_data.actor.SetInput(imagedata)
955 945 self.slice_data.SetCursor(self.__create_cursor())
956 946 self.cam = self.slice_data.renderer.GetActiveCamera()
957   - self.__build_cross_lines(imagedata)
958   - #self.set_slice_number(0)
  947 + self.__build_cross_lines()
959 948  
960 949 # Set the slice number to the last slice to ensure the camera is far
961 950 # enough to show all slices.
... ... @@ -963,30 +952,6 @@ class Viewer(wx.Panel):
963 952 self.__update_camera()
964 953 self.slice_data.renderer.ResetCamera()
965 954 self.interactor.GetRenderWindow().AddRenderer(self.slice_data.renderer)
966   - #if slice_.imagedata is None:
967   - #slice_.SetInput(imagedata, mask_dict)
968   -
969   - ##actor.SetInput(slice_.GetOutput())
970   - #self.LoadRenderers(slice_.GetOutput())
971   - #self.__configure_renderers()
972   - #ren = self.slice_data_list[0].renderer
973   - #actor = self.slice_data_list[0].actor
974   - #actor_bound = actor.GetBounds()
975   - #self.cam = ren.GetActiveCamera()
976   -
977   - #for slice_data in self.slice_data_list:
978   - #self.__update_camera(slice_data)
979   - #self.Reposition(slice_data)
980   -
981   - #number_of_slices = self.layout[0] * self.layout[1]
982   - #max_slice_number = actor.GetSliceNumberMax() + 1/ \
983   - #number_of_slices
984   -
985   - #if actor.GetSliceNumberMax() % number_of_slices:
986   - #max_slice_number += 1
987   - #self.set_scroll_position(0)
988   -
989   - #actor_bound = actor.GetBounds()
990 955 self.interactor.Render()
991 956  
992 957 self.EnableText()
... ... @@ -994,7 +959,7 @@ class Viewer(wx.Panel):
994 959 ## Insert cursor
995 960 self.SetInteractorStyle(const.STATE_DEFAULT)
996 961  
997   - def __build_cross_lines(self, imagedata):
  962 + def __build_cross_lines(self):
998 963 renderer = self.slice_data.overlay_renderer
999 964  
1000 965 cross = vtk.vtkCursor3D()
... ... @@ -1033,28 +998,6 @@ class Viewer(wx.Panel):
1033 998 for slice_data in self.slice_data_list:
1034 999 slice_data.cursor.actor.SetVisibility(visibility)
1035 1000  
1036   - def __update_cursor_position(self, slice_data, position):
1037   - x, y, z = position
1038   - if (slice_data.cursor):
1039   - slice_number = slice_data.number
1040   - actor_bound = slice_data.actor.GetBounds()
1041   -
1042   - yz = [x + abs(x * 0.001), y, z]
1043   - xz = [x, y - abs(y * 0.001), z]
1044   - xy = [x, y, z + abs(z * 0.001)]
1045   -
1046   - proj = project.Project()
1047   - orig_orien = proj.original_orientation
1048   -
1049   - if (orig_orien == const.SAGITAL):
1050   - coordinates = {"SAGITAL": xy, "CORONAL": yz, "AXIAL": xz}
1051   - elif(orig_orien == const.CORONAL):
1052   - coordinates = {"SAGITAL": yz, "CORONAL": xy, "AXIAL": xz}
1053   - else:
1054   - coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy}
1055   -
1056   - slice_data.cursor.SetPosition(coordinates[self.orientation])
1057   -
1058 1001 def SetOrientation(self, orientation):
1059 1002 self.orientation = orientation
1060 1003 for slice_data in self.slice_data_list:
... ... @@ -1070,7 +1013,6 @@ class Viewer(wx.Panel):
1070 1013 overlay_renderer.SetActiveCamera(cam)
1071 1014 overlay_renderer.SetInteractive(0)
1072 1015  
1073   -
1074 1016 self.interactor.GetRenderWindow().SetNumberOfLayers(2)
1075 1017 self.interactor.GetRenderWindow().AddRenderer(overlay_renderer)
1076 1018 self.interactor.GetRenderWindow().AddRenderer(renderer)
... ... @@ -1309,30 +1251,6 @@ class Viewer(wx.Panel):
1309 1251 self.set_slice_number(pos)
1310 1252 self.interactor.Render()
1311 1253  
1312   - def test_operation_position(self, coord):
1313   - """
1314   - Test if coord is into the imagedata limits.
1315   - """
1316   - x, y, z = coord
1317   - xi, yi, zi = 0, 0, 0
1318   - xf, yf, zf = self.imagedata.GetDimensions()
1319   - if xi <= x <= xf \
1320   - and yi <= y <= yf\
1321   - and zi <= z <= zf:
1322   - return True
1323   - return False
1324   -
1325   - def _assert_coord_into_image(self, coord):
1326   - extent = self.imagedata.GetWholeExtent()
1327   - extent_min = extent[0], extent[2], extent[4]
1328   - extent_max = extent[1], extent[3], extent[5]
1329   - for index in xrange(3):
1330   - if coord[index] > extent_max[index]:
1331   - coord[index] = extent_max[index]
1332   - elif coord[index] < extent_min[index]:
1333   - coord[index] = extent_min[index]
1334   - return coord
1335   -
1336 1254 def ReloadActualSlice(self, pubsub_evt=None):
1337 1255 pos = self.scroll.GetThumbPosition()
1338 1256 self.set_slice_number(pos)
... ...
invesalius/gui/frame.py
... ... @@ -348,7 +348,6 @@ class Frame(wx.Frame):
348 348 Close all project data.
349 349 """
350 350 Publisher.sendMessage('Close Project')
351   - Publisher.sendMessage('Exit')
352 351  
353 352 def OnMenuClick(self, evt):
354 353 """
... ...
invesalius/project.py
... ... @@ -22,7 +22,6 @@ import glob
22 22 import os
23 23 import plistlib
24 24 import shutil
25   -import stat
26 25 import tarfile
27 26 import tempfile
28 27  
... ... @@ -35,7 +34,6 @@ import data.mask as msk
35 34 import data.polydata_utils as pu
36 35 import data.surface as srf
37 36 from presets import Presets
38   -from reader import dicom
39 37 from utils import Singleton, debug
40 38 import version
41 39  
... ... @@ -47,18 +45,13 @@ class Project(object):
47 45 def __init__(self):
48 46 # Patient/ acquistion information
49 47 self.name = ''
50   - self.dicom_sample = ''
51 48 self.modality = ''
52 49 self.original_orientation = ''
53 50 self.window = ''
54 51 self.level = ''
55 52  
56   - # Original imagedata (shouldn't be changed)
57   - self.imagedata = ''
58   -
59 53 # Masks (vtkImageData)
60 54 self.mask_dict = {}
61   - self.last_mask_index = 0
62 55  
63 56 # Surfaces are (vtkPolyData)
64 57 self.surface_dict = {}
... ... @@ -107,7 +100,6 @@ class Project(object):
107 100 output
108 101 @ index: index of item that was inserted
109 102 """
110   - #self.last_mask_index = mask.index
111 103 index = len(self.mask_dict)
112 104 self.mask_dict[index] = mask
113 105 return index
... ...