Commit c614e7ac2be8e21980c95fe606f1b35f64231a79
1 parent
a167122e
Exists in
threshold_history
Added support undo/redo mask without generating a new history
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
invesalius/data/slice_.py
@@ -109,6 +109,8 @@ class Slice(object): | @@ -109,6 +109,8 @@ class Slice(object): | ||
109 | 'Set edition threshold values') | 109 | 'Set edition threshold values') |
110 | Publisher.subscribe(self.__set_current_mask_threshold, | 110 | Publisher.subscribe(self.__set_current_mask_threshold, |
111 | 'Set threshold values') | 111 | 'Set threshold values') |
112 | + Publisher.subscribe(self.__set_current_mask_threshold_no_history, | ||
113 | + 'Set threshold values no history') | ||
112 | Publisher.subscribe(self.__set_current_mask_threshold_actual_slice, | 114 | Publisher.subscribe(self.__set_current_mask_threshold_actual_slice, |
113 | 'Changing threshold values') | 115 | 'Changing threshold values') |
114 | Publisher.subscribe(self.__set_current_mask_colour, | 116 | Publisher.subscribe(self.__set_current_mask_colour, |
@@ -278,6 +280,12 @@ class Slice(object): | @@ -278,6 +280,12 @@ class Slice(object): | ||
278 | 280 | ||
279 | self.current_mask.save_threshold_history(threshold_range) | 281 | self.current_mask.save_threshold_history(threshold_range) |
280 | 282 | ||
283 | + def __set_current_mask_threshold_no_history(self, evt_pubsub): | ||
284 | + threshold_range = evt_pubsub.data | ||
285 | + index = self.current_mask.index | ||
286 | + self.num_gradient += 1 | ||
287 | + self.current_mask.matrix[:] = 0 | ||
288 | + | ||
281 | def __set_current_mask_threshold_actual_slice(self, evt_pubsub): | 289 | def __set_current_mask_threshold_actual_slice(self, evt_pubsub): |
282 | threshold_range = evt_pubsub.data | 290 | threshold_range = evt_pubsub.data |
283 | index = self.current_mask.index | 291 | index = self.current_mask.index |