Commit 739f5d15b1ee866b24e9da5568d0aa38e8a9adfc

Authored by Thiago Franco de Moraes
1 parent fd0ab6bd

Added a method to hide the current mask

Showing 1 changed file with 11 additions and 1 deletions   Show diff stats
invesalius/data/slice_.py
@@ -85,7 +85,7 @@ class Slice(object): @@ -85,7 +85,7 @@ class Slice(object):
85 self.histogram = None 85 self.histogram = None
86 self._matrix = None 86 self._matrix = None
87 87
88 - self._type_projection = const.PROJECTION_MIDA 88 + self._type_projection = const.PROJECTION_NORMAL
89 self.n_border = 3.0 89 self.n_border = 3.0
90 90
91 self.spacing = (1.0, 1.0, 1.0) 91 self.spacing = (1.0, 1.0, 1.0)
@@ -138,6 +138,7 @@ class Slice(object): @@ -138,6 +138,7 @@ class Slice(object):
138 'Change mask colour') 138 'Change mask colour')
139 Publisher.subscribe(self.__set_mask_name, 'Change mask name') 139 Publisher.subscribe(self.__set_mask_name, 'Change mask name')
140 Publisher.subscribe(self.__show_mask, 'Show mask') 140 Publisher.subscribe(self.__show_mask, 'Show mask')
  141 + Publisher.subscribe(self.__hide_current_mask, 'Hide current mask')
141 142
142 Publisher.subscribe(self.__set_current_mask_threshold_limits, 143 Publisher.subscribe(self.__set_current_mask_threshold_limits,
143 'Update threshold limits') 144 'Update threshold limits')
@@ -351,6 +352,12 @@ class Slice(object): @@ -351,6 +352,12 @@ class Slice(object):
351 if not value: 352 if not value:
352 Publisher.sendMessage('Select mask name in combo', -1) 353 Publisher.sendMessage('Select mask name in combo', -1)
353 354
  355 + def __hide_current_mask(self, pubsub_evt):
  356 + if self.current_mask:
  357 + index = self.current_mask.index
  358 + value = False
  359 + self.ShowMask(index, value)
  360 +
354 def edit_mask_pixel(self, operation, index, position, radius, orientation): 361 def edit_mask_pixel(self, operation, index, position, radius, orientation):
355 mask = self.buffer_slices[orientation].mask 362 mask = self.buffer_slices[orientation].mask
356 image = self.buffer_slices[orientation].image 363 image = self.buffer_slices[orientation].image
@@ -815,6 +822,9 @@ class Slice(object): @@ -815,6 +822,9 @@ class Slice(object):
815 822
816 def SetTypeProjection(self, tprojection): 823 def SetTypeProjection(self, tprojection):
817 if self._type_projection != tprojection: 824 if self._type_projection != tprojection:
  825 + if self._type_projection == const.PROJECTION_NORMAL:
  826 + self.__hide_current_mask(None)
  827 +
818 self._type_projection = tprojection 828 self._type_projection = tprojection
819 for buffer_ in self.buffer_slices.values(): 829 for buffer_ in self.buffer_slices.values():
820 buffer_.discard_buffer() 830 buffer_.discard_buffer()