Commit 5fe4b34c8a941aa567cf1fd095a52552a7c829cf

Authored by tatiana
1 parent 34b0e1c1

FIX: Mask visibility consistency when opening a project (fix #128)

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