Commit e532ca4ee14b5e26f8f667af7a79d8bc0f60cbbc

Authored by Thiago Franco de Moraes
1 parent a890c988

Markin the project as changed when edited mask, watershed, clean mask, redo and undo mask

invesalius/data/mask.py
@@ -28,6 +28,7 @@ import vtk @@ -28,6 +28,7 @@ import vtk
28 28
29 import constants as const 29 import constants as const
30 import imagedata_utils as iu 30 import imagedata_utils as iu
  31 +import session as ses
31 32
32 from wx.lib.pubsub import pub as Publisher 33 from wx.lib.pubsub import pub as Publisher
33 34
@@ -197,9 +198,17 @@ class Mask(): @@ -197,9 +198,17 @@ class Mask():
197 def undo_history(self, actual_slices): 198 def undo_history(self, actual_slices):
198 self.history.undo(self.matrix, actual_slices) 199 self.history.undo(self.matrix, actual_slices)
199 200
  201 + # Marking the project as changed
  202 + session = ses.Session()
  203 + session.ChangeProject()
  204 +
200 def redo_history(self, actual_slices): 205 def redo_history(self, actual_slices):
201 self.history.redo(self.matrix, actual_slices) 206 self.history.redo(self.matrix, actual_slices)
202 207
  208 + # Marking the project as changed
  209 + session = ses.Session()
  210 + session.ChangeProject()
  211 +
203 def on_show(self): 212 def on_show(self):
204 self.history._config_undo_redo(self.is_shown) 213 self.history._config_undo_redo(self.is_shown)
205 214
invesalius/data/slice_.py
@@ -396,6 +396,10 @@ class Slice(object): @@ -396,6 +396,10 @@ class Slice(object):
396 self.current_mask.clear_history() 396 self.current_mask.clear_history()
397 self.current_mask.was_edited = True 397 self.current_mask.was_edited = True
398 398
  399 + # Marking the project as changed
  400 + session = ses.Session()
  401 + session.ChangeProject()
  402 +
399 def create_temp_mask(self): 403 def create_temp_mask(self):
400 temp_file = tempfile.mktemp() 404 temp_file = tempfile.mktemp()
401 shape = self.matrix.shape 405 shape = self.matrix.shape
@@ -486,6 +490,10 @@ class Slice(object): @@ -486,6 +490,10 @@ class Slice(object):
486 roi_m[index] = 1 490 roi_m[index] = 1
487 self.buffer_slices[orientation].discard_vtk_mask() 491 self.buffer_slices[orientation].discard_vtk_mask()
488 492
  493 + # Marking the project as changed
  494 + session = ses.Session()
  495 + session.ChangeProject()
  496 +
489 497
490 def GetSlices(self, orientation, slice_number, number_slices, 498 def GetSlices(self, orientation, slice_number, number_slices,
491 inverted=False, border_size=1.0): 499 inverted=False, border_size=1.0):
invesalius/data/styles.py
@@ -30,6 +30,8 @@ from wx.lib.pubsub import pub as Publisher @@ -30,6 +30,8 @@ from wx.lib.pubsub import pub as Publisher
30 import constants as const 30 import constants as const
31 import converters 31 import converters
32 import cursor_actors as ca 32 import cursor_actors as ca
  33 +import session as ses
  34 +
33 import numpy as np 35 import numpy as np
34 36
35 from scipy import ndimage 37 from scipy import ndimage
@@ -1219,6 +1221,11 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): @@ -1219,6 +1221,11 @@ class WaterShedInteractorStyle(DefaultInteractorStyle):
1219 1221
1220 self.viewer.slice_.current_mask.was_edited = True 1222 self.viewer.slice_.current_mask.was_edited = True
1221 self.viewer.slice_.current_mask.clear_history() 1223 self.viewer.slice_.current_mask.clear_history()
  1224 +
  1225 + # Marking the project as changed
  1226 + session = ses.Session()
  1227 + session.ChangeProject()
  1228 +
1222 Publisher.sendMessage('Reload actual slice') 1229 Publisher.sendMessage('Reload actual slice')
1223 1230
1224 def get_coordinate_cursor(self): 1231 def get_coordinate_cursor(self):
@@ -1380,9 +1387,9 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): @@ -1380,9 +1387,9 @@ class WaterShedInteractorStyle(DefaultInteractorStyle):
1380 self.viewer.slice_.current_mask.clear_history() 1387 self.viewer.slice_.current_mask.clear_history()
1381 Publisher.sendMessage('Reload actual slice') 1388 Publisher.sendMessage('Reload actual slice')
1382 1389
1383 -  
1384 -  
1385 - 1390 + # Marking the project as changed
  1391 + session = ses.Session()
  1392 + session.ChangeProject()
1386 1393
1387 1394
1388 def get_style(style): 1395 def get_style(style):