Commit d996d5828e6aa367f6f91ab3c28a3a855c8f3612

Authored by Paulo Henrique Junqueira Amorim
1 parent 3e51ce95

ADD: Pseudo colors

Showing 1 changed file with 20 additions and 3 deletions   Show diff stats
invesalius/data/slice_.py
... ... @@ -55,6 +55,9 @@ class Slice(object):
55 55  
56 56 ps.Publisher().subscribe(self.UpdateWindowLevelBackground,\
57 57 'Bright and contrast adjustment image')
  58 +
  59 + ps.Publisher().subscribe(self.UpdateColorTableBackground,\
  60 + 'Change color table from background image')
58 61  
59 62 def __set_current_mask_threshold_limits(self, pubsub_evt):
60 63 thresh_min = pubsub_evt.data[0]
... ... @@ -395,12 +398,13 @@ class Slice(object):
395 398 return img_colours_bg.GetOutput()
396 399  
397 400 def UpdateWindowLevelBackground(self, pubsub_evt):
  401 +
398 402 window, level = pubsub_evt.data
399 403 window_level = self.window_level
400   -
  404 +
401 405 if not((window == window_level.GetWindow()) and\
402 406 (level == window_level.GetLevel())):
403   -
  407 +
404 408 window_level.SetWindow(window)
405 409 window_level.SetLevel(level)
406 410 window_level.SetOutputFormatToLuminance()
... ... @@ -410,7 +414,20 @@ class Slice(object):
410 414 self.lut_bg.SetTableRange(thresh_min, thresh_max)
411 415 self.img_colours_bg.SetInput(window_level.GetOutput())
412 416  
413   -
  417 + def UpdateColorTableBackground(self, pubsub_evt):
  418 + values = pubsub_evt.data
  419 +
  420 + if (values[0]):
  421 + self.lut_bg.SetNumberOfColors(values[0])
  422 +
  423 + self.lut_bg.SetSaturationRange(values[1])
  424 + self.lut_bg.SetHueRange(values[2])
  425 + self.lut_bg.SetValueRange(values[3])
  426 +
  427 + thresh_min, thresh_max = self.window_level.GetOutput().GetScalarRange()
  428 + self.lut_bg.SetTableRange(thresh_min, thresh_max)
  429 +
  430 +
414 431 def CreateMask(self, imagedata=None, name=None):
415 432  
416 433 future_mask = Mask()
... ...