Commit 5fe4b34c8a941aa567cf1fd095a52552a7c829cf
1 parent
34b0e1c1
Exists in
master
and in
6 other branches
FIX: Mask visibility consistency when opening a project (fix #128)
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
invesalius/control.py
@@ -317,6 +317,8 @@ class Controller(): | @@ -317,6 +317,8 @@ class Controller(): | ||
317 | def LoadProject(self): | 317 | def LoadProject(self): |
318 | proj = prj.Project() | 318 | proj = prj.Project() |
319 | 319 | ||
320 | + mask_index = len(proj.mask_dict) -1 | ||
321 | + | ||
320 | const.THRESHOLD_OUTVALUE = proj.threshold_range[0] | 322 | const.THRESHOLD_OUTVALUE = proj.threshold_range[0] |
321 | const.THRESHOLD_INVALUE = proj.threshold_range[1] | 323 | const.THRESHOLD_INVALUE = proj.threshold_range[1] |
322 | const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) | 324 | const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) |
@@ -337,6 +339,7 @@ class Controller(): | @@ -337,6 +339,7 @@ class Controller(): | ||
337 | ps.Publisher().sendMessage('Show content panel') | 339 | ps.Publisher().sendMessage('Show content panel') |
338 | ps.Publisher().sendMessage('Update AUI') | 340 | ps.Publisher().sendMessage('Update AUI') |
339 | ps.Publisher().sendMessage('Load slice plane') | 341 | ps.Publisher().sendMessage('Load slice plane') |
342 | + ps.Publisher().sendMessage('Change mask selected', mask_index) | ||
340 | ps.Publisher().sendMessage('End busy cursor') | 343 | ps.Publisher().sendMessage('End busy cursor') |
341 | 344 | ||
342 | def CreateAnalyzeProject(self, imagedata): | 345 | def CreateAnalyzeProject(self, imagedata): |
invesalius/data/slice_.py
@@ -335,16 +335,15 @@ class Slice(object): | @@ -335,16 +335,15 @@ class Slice(object): | ||
335 | #--------------------------------------------------------------------------- | 335 | #--------------------------------------------------------------------------- |
336 | def SelectCurrentMask(self, index): | 336 | def SelectCurrentMask(self, index): |
337 | "Insert mask data, based on given index, into pipeline." | 337 | "Insert mask data, based on given index, into pipeline." |
338 | - | ||
339 | # This condition is not necessary in Linux, only under mac and windows | 338 | # This condition is not necessary in Linux, only under mac and windows |
340 | # because combobox event is binded when the same item is selected again. | 339 | # because combobox event is binded when the same item is selected again. |
341 | #if index != self.current_mask.index: | 340 | #if index != self.current_mask.index: |
342 | if self.current_mask and self.blend_filter: | 341 | if self.current_mask and self.blend_filter: |
343 | proj = Project() | 342 | proj = Project() |
344 | future_mask = proj.GetMask(index) | 343 | future_mask = proj.GetMask(index) |
345 | - | 344 | + future_mask.is_shown = True |
346 | self.current_mask = future_mask | 345 | self.current_mask = future_mask |
347 | - | 346 | + |
348 | colour = future_mask.colour | 347 | colour = future_mask.colour |
349 | index = future_mask.index | 348 | index = future_mask.index |
350 | self.SetMaskColour(index, colour, update=False) | 349 | self.SetMaskColour(index, colour, update=False) |
@@ -353,9 +352,10 @@ class Slice(object): | @@ -353,9 +352,10 @@ class Slice(object): | ||
353 | self.img_colours_mask.SetInput(imagedata) | 352 | self.img_colours_mask.SetInput(imagedata) |
354 | 353 | ||
355 | if self.current_mask.is_shown: | 354 | if self.current_mask.is_shown: |
355 | + print 1 | ||
356 | self.blend_filter.SetOpacity(1, self.current_mask.opacity) | 356 | self.blend_filter.SetOpacity(1, self.current_mask.opacity) |
357 | else: | 357 | else: |
358 | - | 358 | + print 2 |
359 | self.blend_filter.SetOpacity(1, 0) | 359 | self.blend_filter.SetOpacity(1, 0) |
360 | self.blend_filter.Update() | 360 | self.blend_filter.Update() |
361 | 361 |