Commit e4353cf48a498b530ee917a423fae39c61b274ef
1 parent
674a7e05
Exists in
master
and in
6 other branches
ENH: Add default window and level in pop-up menu and changed label of the pseudo…
… colors of gray to Default (Gray)
Showing
4 changed files
with
35 additions
and
17 deletions
Show diff stats
invesalius/constants.py
@@ -37,7 +37,7 @@ SLICE_POSITION = {AXIAL:[AXIAL_SLICE_CAM_VIEW_UP, AXIAL_SLICE_CAM_POSITION], | @@ -37,7 +37,7 @@ SLICE_POSITION = {AXIAL:[AXIAL_SLICE_CAM_VIEW_UP, AXIAL_SLICE_CAM_POSITION], | ||
37 | 37 | ||
38 | #Color Table from Slice | 38 | #Color Table from Slice |
39 | #NumberOfColors, SaturationRange, HueRange, ValueRange | 39 | #NumberOfColors, SaturationRange, HueRange, ValueRange |
40 | -SLICE_COLOR_TABLE = {"Gray":(None,(0,0),(0,0),(0,1)), | 40 | +SLICE_COLOR_TABLE = {"Default (Gray)":(None,(0,0),(0,0),(0,1)), |
41 | "Hue":(None,(1,1),(0,1),(1,1)), | 41 | "Hue":(None,(1,1),(0,1),(1,1)), |
42 | "Saturation":(None,(0,1),(0.6,0.6),(1,1)), | 42 | "Saturation":(None,(0,1),(0.6,0.6),(1,1)), |
43 | "Desert":(256, (1,1), (0, 0.1), (1,1)), | 43 | "Desert":(256, (1,1), (0, 0.1), (1,1)), |
@@ -146,6 +146,7 @@ WINDOW_LEVEL = {"Abdomen":(350,50), | @@ -146,6 +146,7 @@ WINDOW_LEVEL = {"Abdomen":(350,50), | ||
146 | "Bone":(2000, 300), | 146 | "Bone":(2000, 300), |
147 | "Brain Posterior Fossa":(120,40), | 147 | "Brain Posterior Fossa":(120,40), |
148 | "Brain":(80,40), | 148 | "Brain":(80,40), |
149 | + "Default":(None, None), #Control class set window and level from DICOM | ||
149 | "Emphysema":(500,-850), | 150 | "Emphysema":(500,-850), |
150 | "Ischemia - Hard Non Contrast":(15,32), | 151 | "Ischemia - Hard Non Contrast":(15,32), |
151 | "Ischemia - Soft Non Contrast":(80,20), | 152 | "Ischemia - Soft Non Contrast":(80,20), |
invesalius/control.py
@@ -91,7 +91,7 @@ class Controller(): | @@ -91,7 +91,7 @@ class Controller(): | ||
91 | proj.original_orientation = orientation | 91 | proj.original_orientation = orientation |
92 | proj.window = window = float(window) | 92 | proj.window = window = float(window) |
93 | proj.level = level = float(level) | 93 | proj.level = level = float(level) |
94 | - | 94 | + const.WINDOW_LEVEL['Default'] = (window, level) |
95 | 95 | ||
96 | threshold_range = proj.imagedata.GetScalarRange() | 96 | threshold_range = proj.imagedata.GetScalarRange() |
97 | const.THRESHOLD_OUTVALUE = threshold_range[0] | 97 | const.THRESHOLD_OUTVALUE = threshold_range[0] |
invesalius/data/viewer_slice.py
@@ -230,8 +230,8 @@ class Viewer(wx.Panel): | @@ -230,8 +230,8 @@ class Viewer(wx.Panel): | ||
230 | (self.acum_achange_window, self.acum_achange_level)) | 230 | (self.acum_achange_window, self.acum_achange_level)) |
231 | 231 | ||
232 | ps.Publisher().sendMessage('Update window and level text',\ | 232 | ps.Publisher().sendMessage('Update window and level text',\ |
233 | - "WL: %d WW: %d"%(self.acum_achange_window,\ | ||
234 | - self.acum_achange_level)) | 233 | + "WL: %d WW: %d"%(self.acum_achange_level,\ |
234 | + self.acum_achange_window)) | ||
235 | self.interactor.Render() | 235 | self.interactor.Render() |
236 | 236 | ||
237 | 237 |
invesalius/gui/widgets/slice_menu.py
@@ -29,23 +29,36 @@ class SliceMenu(wx.Menu): | @@ -29,23 +29,36 @@ class SliceMenu(wx.Menu): | ||
29 | def __init__(self): | 29 | def __init__(self): |
30 | wx.Menu.__init__(self) | 30 | wx.Menu.__init__(self) |
31 | self.ID_TO_TOOL_ITEM = {} | 31 | self.ID_TO_TOOL_ITEM = {} |
32 | - | ||
33 | - | 32 | + |
34 | submenu_wl = wx.Menu() | 33 | submenu_wl = wx.Menu() |
35 | - for name in sorted(const.WINDOW_LEVEL): | ||
36 | - new_id = wx.NewId() | ||
37 | - wl_item = wx.MenuItem(submenu_wl, new_id,\ | ||
38 | - name, kind=wx.ITEM_RADIO) | ||
39 | - submenu_wl.AppendItem(wl_item) | ||
40 | - self.ID_TO_TOOL_ITEM[new_id] = name | ||
41 | 34 | ||
35 | + new_id = wx.NewId() | ||
36 | + wl_item = wx.MenuItem(submenu_wl, new_id,\ | ||
37 | + 'Default', kind=wx.ITEM_RADIO) | ||
38 | + submenu_wl.AppendItem(wl_item) | ||
39 | + self.ID_TO_TOOL_ITEM[new_id] = 'Default' | ||
40 | + for name in sorted(const.WINDOW_LEVEL): | ||
41 | + if not(name == 'Default'): | ||
42 | + new_id = wx.NewId() | ||
43 | + wl_item = wx.MenuItem(submenu_wl, new_id,\ | ||
44 | + name, kind=wx.ITEM_RADIO) | ||
45 | + submenu_wl.AppendItem(wl_item) | ||
46 | + self.ID_TO_TOOL_ITEM[new_id] = name | ||
47 | + | ||
48 | + | ||
42 | submenu_pseudo_colors = wx.Menu() | 49 | submenu_pseudo_colors = wx.Menu() |
50 | + new_id = wx.NewId() | ||
51 | + color_item = wx.MenuItem(submenu_pseudo_colors, new_id,\ | ||
52 | + 'Default (Gray)', kind=wx.ITEM_RADIO) | ||
53 | + submenu_pseudo_colors.AppendItem(color_item) | ||
54 | + self.ID_TO_TOOL_ITEM[new_id] = 'Default (Gray)' | ||
43 | for name in sorted(const.SLICE_COLOR_TABLE): | 55 | for name in sorted(const.SLICE_COLOR_TABLE): |
44 | - new_id = wx.NewId() | ||
45 | - color_item = wx.MenuItem(submenu_wl, new_id,\ | ||
46 | - name, kind=wx.ITEM_RADIO) | ||
47 | - submenu_pseudo_colors.AppendItem(color_item) | ||
48 | - self.ID_TO_TOOL_ITEM[new_id] = name | 56 | + if not(name == 'Default (Gray)'): |
57 | + new_id = wx.NewId() | ||
58 | + color_item = wx.MenuItem(submenu_wl, new_id,\ | ||
59 | + name, kind=wx.ITEM_RADIO) | ||
60 | + submenu_pseudo_colors.AppendItem(color_item) | ||
61 | + self.ID_TO_TOOL_ITEM[new_id] = name | ||
49 | 62 | ||
50 | self.AppendMenu(-1, "Window Width & Level", submenu_wl) | 63 | self.AppendMenu(-1, "Window Width & Level", submenu_wl) |
51 | self.AppendMenu(-1, "Pseudo Colors", submenu_pseudo_colors) | 64 | self.AppendMenu(-1, "Pseudo Colors", submenu_pseudo_colors) |
@@ -66,6 +79,10 @@ class SliceMenu(wx.Menu): | @@ -66,6 +79,10 @@ class SliceMenu(wx.Menu): | ||
66 | window, level = const.WINDOW_LEVEL[key] | 79 | window, level = const.WINDOW_LEVEL[key] |
67 | ps.Publisher().sendMessage('Bright and contrast adjustment image', | 80 | ps.Publisher().sendMessage('Bright and contrast adjustment image', |
68 | (window, level)) | 81 | (window, level)) |
82 | + ps.Publisher().sendMessage('Update window level value',\ | ||
83 | + (window, level)) | ||
84 | + ps.Publisher().sendMessage('Update window and level text',\ | ||
85 | + "WL: %d WW: %d"%(level, window)) | ||
69 | ps.Publisher().sendMessage('Update slice viewer') | 86 | ps.Publisher().sendMessage('Update slice viewer') |
70 | 87 | ||
71 | elif(key in const.SLICE_COLOR_TABLE.keys()): | 88 | elif(key in const.SLICE_COLOR_TABLE.keys()): |