diff --git a/invesalius/data/slice_.py b/invesalius/data/slice_.py index eb9ae4b..fec024c 100644 --- a/invesalius/data/slice_.py +++ b/invesalius/data/slice_.py @@ -84,6 +84,7 @@ class Slice(object): self.blend_filter = None self.histogram = None self._matrix = None + self.aux_matrices = {} self._type_projection = const.PROJECTION_NORMAL self.n_border = const.PROJECTION_BORDER_SIZE diff --git a/invesalius/data/styles.py b/invesalius/data/styles.py index 7536ec4..c202d0c 100644 --- a/invesalius/data/styles.py +++ b/invesalius/data/styles.py @@ -665,6 +665,7 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): self.viewer = viewer self.orientation = self.viewer.orientation + self.matrix = None self.foreground = False self.background = False @@ -694,13 +695,16 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): self._create_mask() def CleanUp(self): - self._remove_mask() + #self._remove_mask() self.viewer.slice_.qblend[self.orientation] = {} def _create_mask(self): if self.matrix is None: - self.temp_file, self.matrix = self.viewer.slice_.create_temp_mask() - print "created", self.temp_file + try: + self.matrix = self.viewer.slice_.aux_matrices['watershed'] + except KeyError: + self.temp_file, self.matrix = self.viewer.slice_.create_temp_mask() + self.viewer.slice_.aux_matrices['watershed'] = self.matrix def _remove_mask(self): if self.matrix is not None: -- libgit2 0.21.2