Commit f4e362c5eb0e9892e3e9bda1e31b8def01ed39c4

Authored by Paulo Henrique Junqueira Amorim
1 parent 6fdc80c1

FIX: Open inv3, edited case's

Showing 1 changed file with 10 additions and 6 deletions   Show diff stats
invesalius/data/slice_.py
@@ -39,6 +39,7 @@ class Slice(object): @@ -39,6 +39,7 @@ class Slice(object):
39 self.current_mask = None 39 self.current_mask = None
40 self.blend_filter = None 40 self.blend_filter = None
41 self.__bind_events() 41 self.__bind_events()
  42 + self.num_gradient = 0
42 43
43 def __bind_events(self): 44 def __bind_events(self):
44 # Slice properties 45 # Slice properties
@@ -113,12 +114,15 @@ class Slice(object): @@ -113,12 +114,15 @@ class Slice(object):
113 self.SetMaskEditionThreshold(index, threshold_range) 114 self.SetMaskEditionThreshold(index, threshold_range)
114 115
115 def __set_current_mask_threshold(self, evt_pubsub): 116 def __set_current_mask_threshold(self, evt_pubsub):
116 - threshold_range = evt_pubsub.data  
117 - index = self.current_mask.index  
118 - self.SetMaskThreshold(index, threshold_range)  
119 - #Clear edited points  
120 - self.current_mask.edited_points = {}  
121 - 117 + #FIXME: find a better way to implement this
  118 + if (self.num_gradient >= 2):
  119 + threshold_range = evt_pubsub.data
  120 + index = self.current_mask.index
  121 + self.SetMaskThreshold(index, threshold_range)
  122 + #Clear edited points
  123 + self.current_mask.edited_points = {}
  124 + self.num_gradient += 1
  125 +
122 def __set_current_mask_colour(self, pubsub_evt): 126 def __set_current_mask_colour(self, pubsub_evt):
123 # "if" is necessary because wx events are calling this before any mask 127 # "if" is necessary because wx events are calling this before any mask
124 # has been created 128 # has been created