Commit 10ed1e320d854819a1723fff16487a9b5e66a96c

Authored by Thiago Franco de Moraes
1 parent 87ab4cc4
Exists in master

verifying if there is an mask visible when setting threshold

Showing 1 changed file with 4 additions and 0 deletions   Show diff stats
invesalius/data/slice_.py
@@ -350,6 +350,8 @@ class Slice(metaclass=utils.Singleton): @@ -350,6 +350,8 @@ class Slice(metaclass=utils.Singleton):
350 self.SetMaskEditionThreshold(index, threshold_range) 350 self.SetMaskEditionThreshold(index, threshold_range)
351 351
352 def __set_current_mask_threshold(self, threshold_range): 352 def __set_current_mask_threshold(self, threshold_range):
  353 + if self.current_mask is None:
  354 + return
353 index = self.current_mask.index 355 index = self.current_mask.index
354 self.num_gradient += 1 356 self.num_gradient += 1
355 self.current_mask.matrix[:] = 0 357 self.current_mask.matrix[:] = 0
@@ -390,6 +392,8 @@ class Slice(metaclass=utils.Singleton): @@ -390,6 +392,8 @@ class Slice(metaclass=utils.Singleton):
390 Publisher.sendMessage("Reload actual slice") 392 Publisher.sendMessage("Reload actual slice")
391 393
392 def __set_current_mask_threshold_actual_slice(self, threshold_range): 394 def __set_current_mask_threshold_actual_slice(self, threshold_range):
  395 + if self.current_mask is None:
  396 + return
393 index = self.current_mask.index 397 index = self.current_mask.index
394 for orientation in self.buffer_slices: 398 for orientation in self.buffer_slices:
395 self.buffer_slices[orientation].discard_vtk_mask() 399 self.buffer_slices[orientation].discard_vtk_mask()