Commit ae5620c915ace2d6e58fad7560932f0a09c74c7c

Authored by Paulo Henrique Junqueira Amorim
1 parent 333c4fd4

FIX: Bug window and level initial to dicom study

Showing 1 changed file with 7 additions and 8 deletions   Show diff stats
invesalius/control.py
... ... @@ -80,9 +80,10 @@ class Controller():
80 80 proj.SetAcquisitionModality(acquisition_modality)
81 81 proj.imagedata = imagedata
82 82 proj.original_orientation = orientation
83   - proj.window = window = const.WINDOW_LEVEL['Bone'][0]
84   - proj.level = level = const.WINDOW_LEVEL['Bone'][1]
85   -
  83 + threshold_range = proj.imagedata.GetScalarRange()
  84 + proj.window = window = threshold_range[1] - threshold_range[0]
  85 + proj.level = level = (0.5 * (threshold_range[1] + threshold_range[0]))
  86 +
86 87 ps.Publisher().sendMessage('Update window level value',\
87 88 (proj.window, proj.level))
88 89  
... ... @@ -93,13 +94,11 @@ class Controller():
93 94 proj.SetAcquisitionModality(acquisition_modality)
94 95 proj.imagedata = imagedata
95 96 proj.original_orientation = orientation
96   -
  97 + proj.window = window
  98 + proj.level = level
97 99  
98 100 threshold_range = proj.imagedata.GetScalarRange()
99   -
100   - proj.window = window = threshold_range[1] - threshold_range[0]
101   - proj.level = level = (0.5 * (threshold_range[1] + threshold_range[0]))
102   -
  101 +
103 102 const.WINDOW_LEVEL['Default'] = (window, level)
104 103 const.WINDOW_LEVEL['Other'] = (window, level)
105 104  
... ...