Commit 1b21bd9ec9395d9e21c23fafb003fc7ce6aa3720
1 parent
1d51895e
Exists in
watershed
Watershed 3D
Showing
2 changed files
with
8 additions
and
3 deletions
Show diff stats
invesalius/data/slice_.py
@@ -84,6 +84,7 @@ class Slice(object): | @@ -84,6 +84,7 @@ class Slice(object): | ||
84 | self.blend_filter = None | 84 | self.blend_filter = None |
85 | self.histogram = None | 85 | self.histogram = None |
86 | self._matrix = None | 86 | self._matrix = None |
87 | + self.aux_matrices = {} | ||
87 | 88 | ||
88 | self._type_projection = const.PROJECTION_NORMAL | 89 | self._type_projection = const.PROJECTION_NORMAL |
89 | self.n_border = const.PROJECTION_BORDER_SIZE | 90 | self.n_border = const.PROJECTION_BORDER_SIZE |
invesalius/data/styles.py
@@ -665,6 +665,7 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): | @@ -665,6 +665,7 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): | ||
665 | 665 | ||
666 | self.viewer = viewer | 666 | self.viewer = viewer |
667 | self.orientation = self.viewer.orientation | 667 | self.orientation = self.viewer.orientation |
668 | + self.matrix = None | ||
668 | 669 | ||
669 | self.foreground = False | 670 | self.foreground = False |
670 | self.background = False | 671 | self.background = False |
@@ -694,13 +695,16 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): | @@ -694,13 +695,16 @@ class WaterShedInteractorStyle(DefaultInteractorStyle): | ||
694 | self._create_mask() | 695 | self._create_mask() |
695 | 696 | ||
696 | def CleanUp(self): | 697 | def CleanUp(self): |
697 | - self._remove_mask() | 698 | + #self._remove_mask() |
698 | self.viewer.slice_.qblend[self.orientation] = {} | 699 | self.viewer.slice_.qblend[self.orientation] = {} |
699 | 700 | ||
700 | def _create_mask(self): | 701 | def _create_mask(self): |
701 | if self.matrix is None: | 702 | if self.matrix is None: |
702 | - self.temp_file, self.matrix = self.viewer.slice_.create_temp_mask() | ||
703 | - print "created", self.temp_file | 703 | + try: |
704 | + self.matrix = self.viewer.slice_.aux_matrices['watershed'] | ||
705 | + except KeyError: | ||
706 | + self.temp_file, self.matrix = self.viewer.slice_.create_temp_mask() | ||
707 | + self.viewer.slice_.aux_matrices['watershed'] = self.matrix | ||
704 | 708 | ||
705 | def _remove_mask(self): | 709 | def _remove_mask(self): |
706 | if self.matrix is not None: | 710 | if self.matrix is not None: |