Commit 4546652613b6ffbedd1fdcea2772fa4c203a8d4f
1 parent
60b7adb2
Exists in
master
and in
68 other branches
FIX: Bright and contrast adjustment in volume
Showing
5 changed files
with
72 additions
and
44 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -93,13 +93,17 @@ class Controller(): |
93 | 93 | # TODO: where to insert!!! |
94 | 94 | self.LoadImagedataInfo() |
95 | 95 | |
96 | - # Call frame so it shows slice and volume related panels | |
97 | - ps.Publisher().sendMessage('Show content panel') | |
98 | - | |
99 | 96 | #Initial Window and Level |
100 | 97 | ps.Publisher().sendMessage('Bright and contrast adjustment image',\ |
101 | 98 | (proj.window, proj.level)) |
102 | 99 | |
100 | + # Call frame so it shows slice and volume related panels | |
101 | + ps.Publisher().sendMessage('Show content panel') | |
102 | + | |
103 | + ps.Publisher().sendMessage('Update AUI') | |
104 | + | |
105 | + ps.Publisher().sendMessage('TESTE TATI') | |
106 | + | |
103 | 107 | |
104 | 108 | def LoadImagedataInfo(self): |
105 | 109 | proj = prj.Project() | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -225,6 +225,7 @@ class Viewer(wx.Panel): |
225 | 225 | ps.Publisher().sendMessage('Update window and level text',\ |
226 | 226 | "WL: %d WW: %d"%(proj.level, proj.window)) |
227 | 227 | self.interactor.Render() |
228 | + #ps.Publisher().sendMessage("Update slice viewer") | |
228 | 229 | |
229 | 230 | |
230 | 231 | def OnWindowLevelClick(self, evt, obj): | ... | ... |
invesalius/data/viewer_volume.py
... | ... | @@ -86,23 +86,27 @@ class Viewer(wx.Panel): |
86 | 86 | self.onclick = False |
87 | 87 | |
88 | 88 | def __bind_events(self): |
89 | - ps.Publisher().subscribe(self.LoadActor, 'Load surface actor into viewer') | |
90 | - ps.Publisher().subscribe(self.UpdateRender, 'Render volume viewer') | |
89 | + ps.Publisher().subscribe(self.LoadActor, | |
90 | + 'Load surface actor into viewer') | |
91 | + ps.Publisher().subscribe(self.UpdateRender, | |
92 | + 'Render volume viewer') | |
91 | 93 | ps.Publisher().subscribe(self.ChangeBackgroundColour, |
92 | - 'Change volume viewer background colour') | |
93 | - ps.Publisher().subscribe(self.LoadVolume, 'Load volume into viewer') | |
94 | + 'Change volume viewer background colour') | |
95 | + ps.Publisher().subscribe(self.LoadVolume, | |
96 | + 'Load volume into viewer') | |
94 | 97 | ps.Publisher().subscribe(self.AppendActor,'AppendActor') |
95 | 98 | ps.Publisher().subscribe(self.SetWidgetInteractor, |
96 | 99 | 'Set Widget Interactor') |
97 | 100 | ps.Publisher().subscribe(self.OnSetViewAngle, |
98 | 101 | 'Set volume view angle') |
99 | 102 | ps.Publisher().subscribe(self.OnSetWindowLevelText, |
100 | - 'Set volume window and level text') | |
103 | + 'Set volume window and level text') | |
101 | 104 | ps.Publisher().subscribe(self.OnEnableBrightContrast, |
102 | - 'Bright and contrast adjustment') | |
105 | + ('Set interaction mode', const.MODE_WW_WL)) | |
103 | 106 | ps.Publisher().subscribe(self.OnDisableBrightContrast, |
104 | - 'Set Editor Mode') | |
105 | - | |
107 | + ('Set interaction mode', | |
108 | + const.MODE_SLICE_EDITOR)) | |
109 | + | |
106 | 110 | def __bind_events_wx(self): |
107 | 111 | #self.Bind(wx.EVT_SIZE, self.OnSize) |
108 | 112 | pass | ... | ... |
invesalius/gui/default_viewers.py
... | ... | @@ -20,6 +20,8 @@ import sys |
20 | 20 | |
21 | 21 | import wx |
22 | 22 | import wx.lib.agw.fourwaysplitter as fws |
23 | +import wx.lib.pubsub as ps | |
24 | + | |
23 | 25 | import data.viewer_slice as slice_viewer |
24 | 26 | import data.viewer_volume as volume_viewer |
25 | 27 | |
... | ... | @@ -80,6 +82,7 @@ class Panel(wx.Panel): |
80 | 82 | MaximizeButton(True).CloseButton(False) |
81 | 83 | |
82 | 84 | p4 = VolumeViewerCover(self) |
85 | + #p4 = volume_viewer.Viewer(self) | |
83 | 86 | s4 = wx.aui.AuiPaneInfo().Row(1).Name("Volume").\ |
84 | 87 | Bottom().Centre().Caption("Volume").\ |
85 | 88 | MaximizeButton(True).CloseButton(False) |
... | ... | @@ -209,6 +212,46 @@ class VolumeToolPanel(wx.Panel): |
209 | 212 | BMP_RAYCASTING = wx.Bitmap("../icons/volume_raycasting.png", |
210 | 213 | wx.BITMAP_TYPE_PNG) |
211 | 214 | |
215 | + | |
216 | + button_raycasting = pbtn.PlateButton(self, BUTTON_RAYCASTING,"", | |
217 | + BMP_RAYCASTING, style=pbtn.PB_STYLE_SQUARE, | |
218 | + size=(24,24)) | |
219 | + self.button_raycasting = button_raycasting | |
220 | + | |
221 | + # VOLUME VIEW ANGLE BUTTON | |
222 | + BMP_FRONT = wx.Bitmap(ID_TO_BMP[const.VOL_FRONT][1], | |
223 | + wx.BITMAP_TYPE_PNG) | |
224 | + button_view = pbtn.PlateButton(self, BUTTON_VIEW, "", | |
225 | + BMP_FRONT, size=(24,24), | |
226 | + style=pbtn.PB_STYLE_SQUARE) | |
227 | + self.button_view = button_view | |
228 | + | |
229 | + # VOLUME COLOUR BUTTON | |
230 | + button_colour= csel.ColourSelect(self, 111,colour=(0,0,0), | |
231 | + size=(24,24)) | |
232 | + button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | |
233 | + self.button_colour = button_colour | |
234 | + | |
235 | + self.__bind_events() | |
236 | + | |
237 | + # SIZER TO ORGANIZE ALL | |
238 | + sizer = wx.BoxSizer(wx.VERTICAL) | |
239 | + sizer.Add(button_colour, 0, wx.ALL, 1) | |
240 | + sizer.Add(button_raycasting, 0, wx.ALL, 1) | |
241 | + sizer.Add(button_view, 0, wx.ALL, 1) | |
242 | + self.SetSizer(sizer) | |
243 | + sizer.Fit(self) | |
244 | + | |
245 | + self.__bind_events() | |
246 | + | |
247 | + def __bind_events(self): | |
248 | + ps.Publisher().subscribe(self.ChangeButtonColour, | |
249 | + 'Change volume viewer gui colour') | |
250 | + ps.Publisher().subscribe(self.__init_menus, 'TESTE TATI') | |
251 | + | |
252 | + def __init_menus(self, pubsub_evt=None): | |
253 | + print "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" | |
254 | + print "__init_menus" | |
212 | 255 | # MENU RELATED TO RAYCASTING TYPES |
213 | 256 | menu = wx.Menu() |
214 | 257 | for name in const.RAYCASTING_TYPES: |
... | ... | @@ -235,13 +278,7 @@ class VolumeToolPanel(wx.Panel): |
235 | 278 | |
236 | 279 | self.menu_raycasting = menu |
237 | 280 | menu.Bind(wx.EVT_MENU, self.OnMenuRaycasting) |
238 | - | |
239 | - button_raycasting = pbtn.PlateButton(self, BUTTON_RAYCASTING,"", | |
240 | - BMP_RAYCASTING, style=pbtn.PB_STYLE_SQUARE, | |
241 | - size=(24,24)) | |
242 | - button_raycasting.SetMenu(menu) | |
243 | - | |
244 | - self.button_raycasting = button_raycasting | |
281 | + self.button_raycasting.SetMenu(menu) | |
245 | 282 | |
246 | 283 | # VOLUME VIEW ANGLE BUTTON |
247 | 284 | menu = wx.Menu() |
... | ... | @@ -252,33 +289,10 @@ class VolumeToolPanel(wx.Panel): |
252 | 289 | menu.AppendItem(item) |
253 | 290 | menu.Bind(wx.EVT_MENU, self.OnMenuView) |
254 | 291 | self.menu_view = menu |
292 | + self.button_view.SetMenu(menu) | |
255 | 293 | |
256 | - BMP_FRONT = wx.Bitmap(ID_TO_BMP[const.VOL_FRONT][1], | |
257 | - wx.BITMAP_TYPE_PNG) | |
258 | - button_view = pbtn.PlateButton(self, BUTTON_VIEW, "", | |
259 | - BMP_FRONT, size=(24,24), | |
260 | - style=pbtn.PB_STYLE_SQUARE) | |
261 | - button_view.SetMenu(menu) | |
262 | - self.button_view = button_view | |
263 | - | |
264 | - # VOLUME COLOUR BUTTOM | |
265 | - button_colour= csel.ColourSelect(self, 111,colour=(0,0,0), | |
266 | - size=(24,24)) | |
267 | - button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | |
268 | - self.button_colour = button_colour | |
269 | - | |
270 | - self.__bind_events() | |
271 | - # SIZER TO ORGANIZE ALL | |
272 | - sizer = wx.BoxSizer(wx.VERTICAL) | |
273 | - sizer.Add(button_colour, 0, wx.ALL, 1) | |
274 | - sizer.Add(button_raycasting, 0, wx.ALL, 1) | |
275 | - sizer.Add(button_view, 0, wx.ALL, 1) | |
276 | - self.SetSizer(sizer) | |
277 | - sizer.Fit(self) | |
278 | - | |
279 | - def __bind_events(self): | |
280 | - ps.Publisher().subscribe(self.ChangeButtonColour, | |
281 | - 'Change volume viewer gui colour') | |
294 | + self.Update() | |
295 | + self.Refresh() | |
282 | 296 | |
283 | 297 | def ChangeButtonColour(self, pubsub_evt): |
284 | 298 | colour = [i*255 for i in pubsub_evt.data] | ... | ... |
invesalius/gui/frame.py
... | ... | @@ -77,6 +77,11 @@ class Frame(wx.Frame): |
77 | 77 | def __bind_events(self): |
78 | 78 | ps.Publisher().subscribe(self.ShowContentPanel, 'Show content panel') |
79 | 79 | ps.Publisher().subscribe(self.ShowImportPanel, "Show import panel") |
80 | + ps.Publisher().subscribe(self.UpdateAui, "Update AUI") | |
81 | + | |
82 | + | |
83 | + def UpdateAui(self, pubsub_evt): | |
84 | + self.aui_manager.Update() | |
80 | 85 | |
81 | 86 | def __bind_events_wx(self): |
82 | 87 | self.Bind(wx.EVT_SIZE, self.OnSize) | ... | ... |