Commit 903ccf9e00cb740d35dd99217e6de3b9d8e9d792
1 parent
af872b98
Exists in
master
and in
67 other branches
ENH: Changed call of the Pubsub because wxPython 2.8.12.1. "ps.Pusub(). to Pusub…
…." and "import wx.lib.pubsub as ps" to "from wx.lib.pubsub import pub as Publisher", tested in windows and ubuntu 11.10.
Showing
35 changed files
with
623 additions
and
619 deletions
Show diff stats
invesalius/control.py
@@ -21,7 +21,7 @@ import os | @@ -21,7 +21,7 @@ import os | ||
21 | import plistlib | 21 | import plistlib |
22 | 22 | ||
23 | import numpy | 23 | import numpy |
24 | -import wx.lib.pubsub as ps | 24 | +from wx.lib.pubsub import pub as Publisher |
25 | 25 | ||
26 | import constants as const | 26 | import constants as const |
27 | import data.imagedata_utils as utils | 27 | import data.imagedata_utils as utils |
@@ -54,35 +54,35 @@ class Controller(): | @@ -54,35 +54,35 @@ class Controller(): | ||
54 | session = ses.Session() | 54 | session = ses.Session() |
55 | self.measure_manager = data.measures.MeasurementManager() | 55 | self.measure_manager = data.measures.MeasurementManager() |
56 | 56 | ||
57 | - ps.Publisher().sendMessage('Load Preferences') | 57 | + Publisher.sendMessage('Load Preferences') |
58 | 58 | ||
59 | 59 | ||
60 | def __bind_events(self): | 60 | def __bind_events(self): |
61 | - ps.Publisher().subscribe(self.OnImportMedicalImages, 'Import directory') | ||
62 | - ps.Publisher().subscribe(self.OnShowDialogImportDirectory, | 61 | + Publisher.subscribe(self.OnImportMedicalImages, 'Import directory') |
62 | + Publisher.subscribe(self.OnShowDialogImportDirectory, | ||
63 | 'Show import directory dialog') | 63 | 'Show import directory dialog') |
64 | - ps.Publisher().subscribe(self.OnShowDialogOpenProject, | 64 | + Publisher.subscribe(self.OnShowDialogOpenProject, |
65 | 'Show open project dialog') | 65 | 'Show open project dialog') |
66 | 66 | ||
67 | - ps.Publisher().subscribe(self.OnShowDialogSaveProject, 'Show save dialog') | 67 | + Publisher.subscribe(self.OnShowDialogSaveProject, 'Show save dialog') |
68 | 68 | ||
69 | - ps.Publisher().subscribe(self.LoadRaycastingPreset, | 69 | + Publisher.subscribe(self.LoadRaycastingPreset, |
70 | 'Load raycasting preset') | 70 | 'Load raycasting preset') |
71 | - ps.Publisher().subscribe(self.SaveRaycastingPreset, | 71 | + Publisher.subscribe(self.SaveRaycastingPreset, |
72 | 'Save raycasting preset') | 72 | 'Save raycasting preset') |
73 | - ps.Publisher().subscribe(self.OnOpenDicomGroup, | 73 | + Publisher.subscribe(self.OnOpenDicomGroup, |
74 | 'Open DICOM group') | 74 | 'Open DICOM group') |
75 | - ps.Publisher().subscribe(self.Progress, "Update dicom load") | ||
76 | - ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load") | ||
77 | - ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load') | ||
78 | - ps.Publisher().subscribe(self.OnShowDialogCloseProject, 'Close Project') | ||
79 | - ps.Publisher().subscribe(self.OnOpenProject, 'Open project') | ||
80 | - ps.Publisher().subscribe(self.OnOpenRecentProject, 'Open recent project') | ||
81 | - ps.Publisher().subscribe(self.OnShowAnalyzeFile, 'Show analyze dialog') | 75 | + Publisher.subscribe(self.Progress, "Update dicom load") |
76 | + Publisher.subscribe(self.OnLoadImportPanel, "End dicom load") | ||
77 | + Publisher.subscribe(self.OnCancelImport, 'Cancel DICOM load') | ||
78 | + Publisher.subscribe(self.OnShowDialogCloseProject, 'Close Project') | ||
79 | + Publisher.subscribe(self.OnOpenProject, 'Open project') | ||
80 | + Publisher.subscribe(self.OnOpenRecentProject, 'Open recent project') | ||
81 | + Publisher.subscribe(self.OnShowAnalyzeFile, 'Show analyze dialog') | ||
82 | 82 | ||
83 | def OnCancelImport(self, pubsub_evt): | 83 | def OnCancelImport(self, pubsub_evt): |
84 | #self.cancel_import = True | 84 | #self.cancel_import = True |
85 | - ps.Publisher().sendMessage('Hide import panel') | 85 | + Publisher.sendMessage('Hide import panel') |
86 | 86 | ||
87 | 87 | ||
88 | ########################### | 88 | ########################### |
@@ -108,7 +108,7 @@ class Controller(): | @@ -108,7 +108,7 @@ class Controller(): | ||
108 | self.CreateAnalyzeProject(imagedata) | 108 | self.CreateAnalyzeProject(imagedata) |
109 | 109 | ||
110 | self.LoadProject() | 110 | self.LoadProject() |
111 | - ps.Publisher().sendMessage("Enable state project", True) | 111 | + Publisher.sendMessage("Enable state project", True) |
112 | 112 | ||
113 | 113 | ||
114 | ########################### | 114 | ########################### |
@@ -128,7 +128,7 @@ class Controller(): | @@ -128,7 +128,7 @@ class Controller(): | ||
128 | dialog.ImportEmptyDirectory(dirpath) | 128 | dialog.ImportEmptyDirectory(dirpath) |
129 | elif dirpath: | 129 | elif dirpath: |
130 | self.StartImportPanel(dirpath) | 130 | self.StartImportPanel(dirpath) |
131 | - ps.Publisher().sendMessage("Load data to import panel", dirpath) | 131 | + Publisher.sendMessage("Load data to import panel", dirpath) |
132 | 132 | ||
133 | def ShowDialogOpenProject(self): | 133 | def ShowDialogOpenProject(self): |
134 | # Offer to save current project if necessary | 134 | # Offer to save current project if necessary |
@@ -180,30 +180,30 @@ class Controller(): | @@ -180,30 +180,30 @@ class Controller(): | ||
180 | if not answer: | 180 | if not answer: |
181 | debug("Close without changes") | 181 | debug("Close without changes") |
182 | self.CloseProject() | 182 | self.CloseProject() |
183 | - ps.Publisher().sendMessage("Enable state project", False) | ||
184 | - ps.Publisher().sendMessage('Set project name') | ||
185 | - ps.Publisher().sendMessage("Stop Config Recording") | ||
186 | - ps.Publisher().sendMessage("Exit") | 183 | + Publisher.sendMessage("Enable state project", False) |
184 | + Publisher.sendMessage('Set project name') | ||
185 | + Publisher.sendMessage("Stop Config Recording") | ||
186 | + Publisher.sendMessage("Exit") | ||
187 | elif answer == 1: | 187 | elif answer == 1: |
188 | self.ShowDialogSaveProject() | 188 | self.ShowDialogSaveProject() |
189 | debug("Save changes and close") | 189 | debug("Save changes and close") |
190 | self.CloseProject() | 190 | self.CloseProject() |
191 | - ps.Publisher().sendMessage("Enable state project", False) | ||
192 | - ps.Publisher().sendMessage('Set project name') | ||
193 | - ps.Publisher().sendMessage("Stop Config Recording") | ||
194 | - ps.Publisher().sendMessage("Exit") | 191 | + Publisher.sendMessage("Enable state project", False) |
192 | + Publisher.sendMessage('Set project name') | ||
193 | + Publisher.sendMessage("Stop Config Recording") | ||
194 | + Publisher.sendMessage("Exit") | ||
195 | elif answer == -1: | 195 | elif answer == -1: |
196 | debug("Cancel") | 196 | debug("Cancel") |
197 | else: | 197 | else: |
198 | self.CloseProject() | 198 | self.CloseProject() |
199 | - ps.Publisher().sendMessage("Enable state project", False) | ||
200 | - ps.Publisher().sendMessage('Set project name') | ||
201 | - ps.Publisher().sendMessage("Stop Config Recording") | ||
202 | - ps.Publisher().sendMessage("Exit") | 199 | + Publisher.sendMessage("Enable state project", False) |
200 | + Publisher.sendMessage('Set project name') | ||
201 | + Publisher.sendMessage("Stop Config Recording") | ||
202 | + Publisher.sendMessage("Exit") | ||
203 | 203 | ||
204 | else: | 204 | else: |
205 | - ps.Publisher().sendMessage('Stop Config Recording') | ||
206 | - ps.Publisher().sendMessage('Exit') | 205 | + Publisher.sendMessage('Stop Config Recording') |
206 | + Publisher.sendMessage('Exit') | ||
207 | 207 | ||
208 | 208 | ||
209 | ########################### | 209 | ########################### |
@@ -230,7 +230,7 @@ class Controller(): | @@ -230,7 +230,7 @@ class Controller(): | ||
230 | 230 | ||
231 | 231 | ||
232 | def OpenProject(self, filepath): | 232 | def OpenProject(self, filepath): |
233 | - ps.Publisher().sendMessage('Begin busy cursor') | 233 | + Publisher.sendMessage('Begin busy cursor') |
234 | path = os.path.abspath(filepath) | 234 | path = os.path.abspath(filepath) |
235 | 235 | ||
236 | proj = prj.Project() | 236 | proj = prj.Project() |
@@ -253,14 +253,14 @@ class Controller(): | @@ -253,14 +253,14 @@ class Controller(): | ||
253 | 253 | ||
254 | self.LoadProject() | 254 | self.LoadProject() |
255 | 255 | ||
256 | - ps.Publisher().sendMessage('Update threshold limits', | 256 | + Publisher.sendMessage('Update threshold limits', |
257 | proj.threshold_range) | 257 | proj.threshold_range) |
258 | session = ses.Session() | 258 | session = ses.Session() |
259 | session.OpenProject(filepath) | 259 | session.OpenProject(filepath) |
260 | - ps.Publisher().sendMessage("Enable state project", True) | 260 | + Publisher.sendMessage("Enable state project", True) |
261 | 261 | ||
262 | def SaveProject(self, path=None): | 262 | def SaveProject(self, path=None): |
263 | - ps.Publisher().sendMessage('Begin busy cursor') | 263 | + Publisher.sendMessage('Begin busy cursor') |
264 | session = ses.Session() | 264 | session = ses.Session() |
265 | if path: | 265 | if path: |
266 | dirpath, filename = os.path.split(path) | 266 | dirpath, filename = os.path.split(path) |
@@ -272,14 +272,14 @@ class Controller(): | @@ -272,14 +272,14 @@ class Controller(): | ||
272 | prj.Project().SavePlistProject(dirpath, filename) | 272 | prj.Project().SavePlistProject(dirpath, filename) |
273 | 273 | ||
274 | session.SaveProject() | 274 | session.SaveProject() |
275 | - ps.Publisher().sendMessage('End busy cursor') | 275 | + Publisher.sendMessage('End busy cursor') |
276 | 276 | ||
277 | def CloseProject(self): | 277 | def CloseProject(self): |
278 | proj = prj.Project() | 278 | proj = prj.Project() |
279 | proj.Close() | 279 | proj.Close() |
280 | 280 | ||
281 | - ps.Publisher().sendMessage('Hide content panel') | ||
282 | - ps.Publisher().sendMessage('Close project data') | 281 | + Publisher.sendMessage('Hide content panel') |
282 | + Publisher.sendMessage('Close project data') | ||
283 | session = ses.Session() | 283 | session = ses.Session() |
284 | session.CloseProject() | 284 | session.CloseProject() |
285 | 285 | ||
@@ -292,7 +292,7 @@ class Controller(): | @@ -292,7 +292,7 @@ class Controller(): | ||
292 | reader = dcm.ProgressDicomReader() | 292 | reader = dcm.ProgressDicomReader() |
293 | reader.SetWindowEvent(self.frame) | 293 | reader.SetWindowEvent(self.frame) |
294 | reader.SetDirectoryPath(path) | 294 | reader.SetDirectoryPath(path) |
295 | - ps.Publisher().sendMessage('End busy cursor') | 295 | + Publisher.sendMessage('End busy cursor') |
296 | 296 | ||
297 | def Progress(self, evt): | 297 | def Progress(self, evt): |
298 | data = evt.data | 298 | data = evt.data |
@@ -305,7 +305,7 @@ class Controller(): | @@ -305,7 +305,7 @@ class Controller(): | ||
305 | if not(self.progress_dialog.Update(data[0],message)): | 305 | if not(self.progress_dialog.Update(data[0],message)): |
306 | self.progress_dialog.Close() | 306 | self.progress_dialog.Close() |
307 | self.progress_dialog = None | 307 | self.progress_dialog = None |
308 | - ps.Publisher().sendMessage('Begin busy cursor') | 308 | + Publisher.sendMessage('Begin busy cursor') |
309 | else: | 309 | else: |
310 | #Is None if user canceled the load | 310 | #Is None if user canceled the load |
311 | self.progress_dialog.Close() | 311 | self.progress_dialog.Close() |
@@ -315,15 +315,15 @@ class Controller(): | @@ -315,15 +315,15 @@ class Controller(): | ||
315 | patient_series = evt.data | 315 | patient_series = evt.data |
316 | ok = self.LoadImportPanel(patient_series) | 316 | ok = self.LoadImportPanel(patient_series) |
317 | if ok: | 317 | if ok: |
318 | - ps.Publisher().sendMessage('Show import panel') | ||
319 | - ps.Publisher().sendMessage("Show import panel in frame") | 318 | + Publisher.sendMessage('Show import panel') |
319 | + Publisher.sendMessage("Show import panel in frame") | ||
320 | 320 | ||
321 | 321 | ||
322 | def LoadImportPanel(self, patient_series): | 322 | def LoadImportPanel(self, patient_series): |
323 | if patient_series and isinstance(patient_series, list): | 323 | if patient_series and isinstance(patient_series, list): |
324 | - ps.Publisher().sendMessage("Load import panel", patient_series) | 324 | + Publisher.sendMessage("Load import panel", patient_series) |
325 | first_patient = patient_series[0] | 325 | first_patient = patient_series[0] |
326 | - ps.Publisher().sendMessage("Load dicom preview", first_patient) | 326 | + Publisher.sendMessage("Load dicom preview", first_patient) |
327 | return True | 327 | return True |
328 | else: | 328 | else: |
329 | dialog.ImportInvalidFiles() | 329 | dialog.ImportInvalidFiles() |
@@ -350,7 +350,7 @@ class Controller(): | @@ -350,7 +350,7 @@ class Controller(): | ||
350 | debug("No medical images found on given directory") | 350 | debug("No medical images found on given directory") |
351 | return | 351 | return |
352 | self.LoadProject() | 352 | self.LoadProject() |
353 | - ps.Publisher().sendMessage("Enable state project", True) | 353 | + Publisher.sendMessage("Enable state project", True) |
354 | 354 | ||
355 | def LoadProject(self): | 355 | def LoadProject(self): |
356 | proj = prj.Project() | 356 | proj = prj.Project() |
@@ -364,50 +364,50 @@ class Controller(): | @@ -364,50 +364,50 @@ class Controller(): | ||
364 | self.Slice = sl.Slice() | 364 | self.Slice = sl.Slice() |
365 | self.Slice.spacing = proj.spacing | 365 | self.Slice.spacing = proj.spacing |
366 | 366 | ||
367 | - ps.Publisher().sendMessage('Load slice to viewer', | 367 | + Publisher.sendMessage('Load slice to viewer', |
368 | (proj.imagedata, | 368 | (proj.imagedata, |
369 | proj.mask_dict)) | 369 | proj.mask_dict)) |
370 | 370 | ||
371 | 371 | ||
372 | - ps.Publisher().sendMessage('Load slice plane') | 372 | + Publisher.sendMessage('Load slice plane') |
373 | 373 | ||
374 | - ps.Publisher().sendMessage('Bright and contrast adjustment image',\ | 374 | + Publisher.sendMessage('Bright and contrast adjustment image',\ |
375 | (proj.window, proj.level)) | 375 | (proj.window, proj.level)) |
376 | - ps.Publisher().sendMessage('Update window level value',\ | 376 | + Publisher.sendMessage('Update window level value',\ |
377 | (proj.window, proj.level)) | 377 | (proj.window, proj.level)) |
378 | 378 | ||
379 | - ps.Publisher().sendMessage('Set project name', proj.name) | ||
380 | - ps.Publisher().sendMessage('Load surface dict', | 379 | + Publisher.sendMessage('Set project name', proj.name) |
380 | + Publisher.sendMessage('Load surface dict', | ||
381 | proj.surface_dict) | 381 | proj.surface_dict) |
382 | - ps.Publisher().sendMessage('Hide surface items', | 382 | + Publisher.sendMessage('Hide surface items', |
383 | proj.surface_dict) | 383 | proj.surface_dict) |
384 | self.LoadImagedataInfo() # TODO: where do we insert this <<<? | 384 | self.LoadImagedataInfo() # TODO: where do we insert this <<<? |
385 | 385 | ||
386 | - ps.Publisher().sendMessage('Show content panel') | ||
387 | - ps.Publisher().sendMessage('Update AUI') | 386 | + Publisher.sendMessage('Show content panel') |
387 | + Publisher.sendMessage('Update AUI') | ||
388 | 388 | ||
389 | if len(proj.mask_dict): | 389 | if len(proj.mask_dict): |
390 | mask_index = len(proj.mask_dict) -1 | 390 | mask_index = len(proj.mask_dict) -1 |
391 | for m in proj.mask_dict.values(): | 391 | for m in proj.mask_dict.values(): |
392 | - ps.Publisher().sendMessage('Add mask', | 392 | + Publisher.sendMessage('Add mask', |
393 | (m.index, m.name, | 393 | (m.index, m.name, |
394 | m.threshold_range, m.colour)) | 394 | m.threshold_range, m.colour)) |
395 | self.Slice.current_mask = proj.mask_dict[mask_index] | 395 | self.Slice.current_mask = proj.mask_dict[mask_index] |
396 | - ps.Publisher().sendMessage('Show mask', (mask_index, True)) | 396 | + Publisher.sendMessage('Show mask', (mask_index, True)) |
397 | else: | 397 | else: |
398 | mask_name = const.MASK_NAME_PATTERN % (1,) | 398 | mask_name = const.MASK_NAME_PATTERN % (1,) |
399 | thresh = const.THRESHOLD_RANGE | 399 | thresh = const.THRESHOLD_RANGE |
400 | colour = const.MASK_COLOUR[0] | 400 | colour = const.MASK_COLOUR[0] |
401 | 401 | ||
402 | - ps.Publisher().sendMessage('Create new mask', | 402 | + Publisher.sendMessage('Create new mask', |
403 | (mask_name, thresh, colour)) | 403 | (mask_name, thresh, colour)) |
404 | 404 | ||
405 | - ps.Publisher().sendMessage('Load measurement dict', | 405 | + Publisher.sendMessage('Load measurement dict', |
406 | proj.measurement_dict) | 406 | proj.measurement_dict) |
407 | 407 | ||
408 | proj.presets.thresh_ct[_('Custom')] = proj.threshold_range | 408 | proj.presets.thresh_ct[_('Custom')] = proj.threshold_range |
409 | 409 | ||
410 | - ps.Publisher().sendMessage('End busy cursor') | 410 | + Publisher.sendMessage('End busy cursor') |
411 | 411 | ||
412 | def CreateAnalyzeProject(self, imagedata): | 412 | def CreateAnalyzeProject(self, imagedata): |
413 | header = imagedata.get_header() | 413 | header = imagedata.get_header() |
@@ -441,7 +441,7 @@ class Controller(): | @@ -441,7 +441,7 @@ class Controller(): | ||
441 | self.Slice.window_width = proj.window | 441 | self.Slice.window_width = proj.window |
442 | self.Slice.spacing = header.get_zooms()[:3] | 442 | self.Slice.spacing = header.get_zooms()[:3] |
443 | 443 | ||
444 | - ps.Publisher().sendMessage('Update threshold limits', | 444 | + Publisher.sendMessage('Update threshold limits', |
445 | proj.threshold_range) | 445 | proj.threshold_range) |
446 | 446 | ||
447 | def CreateDicomProject(self, dicom, matrix, matrix_filename): | 447 | def CreateDicomProject(self, dicom, matrix, matrix_filename): |
@@ -479,7 +479,7 @@ class Controller(): | @@ -479,7 +479,7 @@ class Controller(): | ||
479 | matrix, matrix_filename, dicom = self.OpenDicomGroup(group, interval, file_range, gui=True) | 479 | matrix, matrix_filename, dicom = self.OpenDicomGroup(group, interval, file_range, gui=True) |
480 | self.CreateDicomProject(dicom, matrix, matrix_filename) | 480 | self.CreateDicomProject(dicom, matrix, matrix_filename) |
481 | self.LoadProject() | 481 | self.LoadProject() |
482 | - ps.Publisher().sendMessage("Enable state project", True) | 482 | + Publisher.sendMessage("Enable state project", True) |
483 | 483 | ||
484 | def OpenDicomGroup(self, dicom_group, interval, file_range, gui=True): | 484 | def OpenDicomGroup(self, dicom_group, interval, file_range, gui=True): |
485 | # Retrieve general DICOM headers | 485 | # Retrieve general DICOM headers |
@@ -544,7 +544,7 @@ class Controller(): | @@ -544,7 +544,7 @@ class Controller(): | ||
544 | self.Slice.window_level = wl | 544 | self.Slice.window_level = wl |
545 | self.Slice.window_width = ww | 545 | self.Slice.window_width = ww |
546 | 546 | ||
547 | - ps.Publisher().sendMessage('Update threshold limits', scalar_range) | 547 | + Publisher.sendMessage('Update threshold limits', scalar_range) |
548 | 548 | ||
549 | return self.matrix, self.filename, dicom | 549 | return self.matrix, self.filename, dicom |
550 | 550 | ||
@@ -567,7 +567,7 @@ class Controller(): | @@ -567,7 +567,7 @@ class Controller(): | ||
567 | default_threshold[1] = max_ | 567 | default_threshold[1] = max_ |
568 | [a,b] = default_threshold | 568 | [a,b] = default_threshold |
569 | default_threshold = (a,b) | 569 | default_threshold = (a,b) |
570 | - ps.Publisher().sendMessage('Set threshold modes', | 570 | + Publisher.sendMessage('Set threshold modes', |
571 | (thresh_modes,default_threshold)) | 571 | (thresh_modes,default_threshold)) |
572 | 572 | ||
573 | def LoadRaycastingPreset(self, pubsub_evt=None): | 573 | def LoadRaycastingPreset(self, pubsub_evt=None): |
@@ -590,11 +590,11 @@ class Controller(): | @@ -590,11 +590,11 @@ class Controller(): | ||
590 | prj.Project().raycasting_preset = preset | 590 | prj.Project().raycasting_preset = preset |
591 | # Notify volume | 591 | # Notify volume |
592 | # TODO: Chamar grafico tb! | 592 | # TODO: Chamar grafico tb! |
593 | - ps.Publisher().sendMessage('Update raycasting preset') | 593 | + Publisher.sendMessage('Update raycasting preset') |
594 | else: | 594 | else: |
595 | prj.Project().raycasting_preset = 0 | 595 | prj.Project().raycasting_preset = 0 |
596 | - ps.Publisher().sendMessage('Update raycasting preset') | ||
597 | - ps.Publisher().sendMessage("Hide raycasting volume") | 596 | + Publisher.sendMessage('Update raycasting preset') |
597 | + Publisher.sendMessage("Hide raycasting volume") | ||
598 | 598 | ||
599 | def SaveRaycastingPreset(self, pubsub_evt): | 599 | def SaveRaycastingPreset(self, pubsub_evt): |
600 | preset_name = pubsub_evt.data | 600 | preset_name = pubsub_evt.data |
invesalius/data/co_registration.py
@@ -2,7 +2,7 @@ import threading | @@ -2,7 +2,7 @@ import threading | ||
2 | 2 | ||
3 | import serial | 3 | import serial |
4 | import wx | 4 | import wx |
5 | -import wx.lib.pubsub as ps | 5 | +from wx.lib.pubsub import pub as Publisher |
6 | 6 | ||
7 | from numpy import * | 7 | from numpy import * |
8 | from math import sqrt | 8 | from math import sqrt |
@@ -55,10 +55,10 @@ class Corregister(threading.Thread): | @@ -55,10 +55,10 @@ class Corregister(threading.Thread): | ||
55 | img = self.q1 + (self.Minv*self.N)*(tracker - self.q2) | 55 | img = self.q1 + (self.Minv*self.N)*(tracker - self.q2) |
56 | coord = [float(img[0]), float(img[1]), float(img[2])] | 56 | coord = [float(img[0]), float(img[1]), float(img[2])] |
57 | coord_cam = float(img[0]), float(img[1]), float(img[2]) | 57 | coord_cam = float(img[0]), float(img[1]), float(img[2]) |
58 | - ps.Publisher().sendMessage('Set ball reference position based on bound', coord_cam) | ||
59 | - ps.Publisher().sendMessage('Set camera in volume', coord_cam) | ||
60 | - wx.CallAfter(ps.Publisher().sendMessage, 'Render volume viewer') | ||
61 | - wx.CallAfter(ps.Publisher().sendMessage, 'Co-registered Points', coord) | 58 | + Publisher.sendMessage('Set ball reference position based on bound', coord_cam) |
59 | + Publisher.sendMessage('Set camera in volume', coord_cam) | ||
60 | + wx.CallAfter(Publisher.sendMessage, 'Render volume viewer') | ||
61 | + wx.CallAfter(Publisher.sendMessage, 'Co-registered Points', coord) | ||
62 | sleep(0.005) | 62 | sleep(0.005) |
63 | 63 | ||
64 | if self._pause_: | 64 | if self._pause_: |
invesalius/data/editor.py
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
19 | 19 | ||
20 | import math | 20 | import math |
21 | -import wx.lib.pubsub as ps | 21 | +from wx.lib.pubsub import pub as Publisher |
22 | import vtk | 22 | import vtk |
23 | 23 | ||
24 | AXIAL = 2 | 24 | AXIAL = 2 |
@@ -120,8 +120,8 @@ class Editor: | @@ -120,8 +120,8 @@ class Editor: | ||
120 | print "Comecei" | 120 | print "Comecei" |
121 | self.DoOperation(wx, wy, wz) | 121 | self.DoOperation(wx, wy, wz) |
122 | print "Terminei" | 122 | print "Terminei" |
123 | - ps.Publisher().sendMessage('Update images', self.image) | ||
124 | - ps.Publisher().sendMessage('Update viewer', None) | 123 | + Publisher.sendMessage('Update images', self.image) |
124 | + Publisher.sendMessage('Update viewer', None) | ||
125 | 125 | ||
126 | #self.cursor.Update() | 126 | #self.cursor.Update() |
127 | obj.OnMouseMove() | 127 | obj.OnMouseMove() |
invesalius/data/imagedata_utils.py
@@ -25,7 +25,7 @@ import gdcm | @@ -25,7 +25,7 @@ import gdcm | ||
25 | import numpy | 25 | import numpy |
26 | import vtk | 26 | import vtk |
27 | import vtkgdcm | 27 | import vtkgdcm |
28 | -import wx.lib.pubsub as ps | 28 | +from wx.lib.pubsub import pub as Publisher |
29 | 29 | ||
30 | from vtk.util import numpy_support | 30 | from vtk.util import numpy_support |
31 | 31 | ||
@@ -361,7 +361,7 @@ def CreateImageData(filelist, zspacing, xyspacing,size, | @@ -361,7 +361,7 @@ def CreateImageData(filelist, zspacing, xyspacing,size, | ||
361 | class ImageCreator: | 361 | class ImageCreator: |
362 | def __init__(self): | 362 | def __init__(self): |
363 | self.running = True | 363 | self.running = True |
364 | - ps.Publisher().subscribe(self.CancelImageDataLoad, "Cancel DICOM load") | 364 | + Publisher.subscribe(self.CancelImageDataLoad, "Cancel DICOM load") |
365 | 365 | ||
366 | def CancelImageDataLoad(self, evt_pusub): | 366 | def CancelImageDataLoad(self, evt_pusub): |
367 | utils.debug("Canceling") | 367 | utils.debug("Canceling") |
invesalius/data/measures.py
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | import math | 4 | import math |
5 | import random | 5 | import random |
6 | 6 | ||
7 | -import wx.lib.pubsub as ps | 7 | +from wx.lib.pubsub import pub as Publisher |
8 | import vtk | 8 | import vtk |
9 | 9 | ||
10 | import constants as const | 10 | import constants as const |
@@ -32,11 +32,11 @@ class MeasurementManager(object): | @@ -32,11 +32,11 @@ class MeasurementManager(object): | ||
32 | self._bind_events() | 32 | self._bind_events() |
33 | 33 | ||
34 | def _bind_events(self): | 34 | def _bind_events(self): |
35 | - ps.Publisher().subscribe(self._add_point, "Add measurement point") | ||
36 | - ps.Publisher().subscribe(self._change_name, "Change measurement name") | ||
37 | - ps.Publisher().subscribe(self._remove_measurements, "Remove measurements") | ||
38 | - ps.Publisher().subscribe(self._set_visibility, "Show measurement") | ||
39 | - ps.Publisher().subscribe(self._load_measurements, "Load measurement dict") | 35 | + Publisher.subscribe(self._add_point, "Add measurement point") |
36 | + Publisher.subscribe(self._change_name, "Change measurement name") | ||
37 | + Publisher.subscribe(self._remove_measurements, "Remove measurements") | ||
38 | + Publisher.subscribe(self._set_visibility, "Show measurement") | ||
39 | + Publisher.subscribe(self._load_measurements, "Load measurement dict") | ||
40 | 40 | ||
41 | def _load_measurements(self, pubsub_evt): | 41 | def _load_measurements(self, pubsub_evt): |
42 | dict = pubsub_evt.data | 42 | dict = pubsub_evt.data |
@@ -51,16 +51,16 @@ class MeasurementManager(object): | @@ -51,16 +51,16 @@ class MeasurementManager(object): | ||
51 | for point in m.points: | 51 | for point in m.points: |
52 | x, y, z = point | 52 | x, y, z = point |
53 | actors = mr.AddPoint(x, y, z) | 53 | actors = mr.AddPoint(x, y, z) |
54 | - ps.Publisher().sendMessage(("Add actors", m.location), | 54 | + Publisher.sendMessage(("Add actors", m.location), |
55 | (actors, m.slice_number)) | 55 | (actors, m.slice_number)) |
56 | self.current = None | 56 | self.current = None |
57 | 57 | ||
58 | if not m.is_shown: | 58 | if not m.is_shown: |
59 | mr.SetVisibility(False) | 59 | mr.SetVisibility(False) |
60 | if m.location == const.SURFACE: | 60 | if m.location == const.SURFACE: |
61 | - ps.Publisher().sendMessage('Render volume viewer') | 61 | + Publisher.sendMessage('Render volume viewer') |
62 | else: | 62 | else: |
63 | - ps.Publisher().sendMessage('Update slice viewer') | 63 | + Publisher.sendMessage('Update slice viewer') |
64 | 64 | ||
65 | def _add_point(self, pubsub_evt): | 65 | def _add_point(self, pubsub_evt): |
66 | position = pubsub_evt.data[0] | 66 | position = pubsub_evt.data[0] |
@@ -103,12 +103,12 @@ class MeasurementManager(object): | @@ -103,12 +103,12 @@ class MeasurementManager(object): | ||
103 | print "---To REMOVE" | 103 | print "---To REMOVE" |
104 | actors = self.current[1].GetActors() | 104 | actors = self.current[1].GetActors() |
105 | slice_number = self.current[0].slice_number | 105 | slice_number = self.current[0].slice_number |
106 | - ps.Publisher().sendMessage(('Remove actors', | 106 | + Publisher.sendMessage(('Remove actors', |
107 | self.current[0].location), (actors, slice_number)) | 107 | self.current[0].location), (actors, slice_number)) |
108 | if self.current[0].location == const.SURFACE: | 108 | if self.current[0].location == const.SURFACE: |
109 | - ps.Publisher().sendMessage('Render volume viewer') | 109 | + Publisher.sendMessage('Render volume viewer') |
110 | else: | 110 | else: |
111 | - ps.Publisher().sendMessage('Update slice viewer') | 111 | + Publisher.sendMessage('Update slice viewer') |
112 | 112 | ||
113 | session = ses.Session() | 113 | session = ses.Session() |
114 | session.ChangeProject() | 114 | session.ChangeProject() |
@@ -121,7 +121,7 @@ class MeasurementManager(object): | @@ -121,7 +121,7 @@ class MeasurementManager(object): | ||
121 | x, y, z = position | 121 | x, y, z = position |
122 | actors = mr.AddPoint(x, y, z) | 122 | actors = mr.AddPoint(x, y, z) |
123 | m.points.append(position) | 123 | m.points.append(position) |
124 | - ps.Publisher().sendMessage(("Add actors", location), | 124 | + Publisher.sendMessage(("Add actors", location), |
125 | (actors, m.slice_number)) | 125 | (actors, m.slice_number)) |
126 | 126 | ||
127 | if mr.IsComplete(): | 127 | if mr.IsComplete(): |
@@ -139,7 +139,7 @@ class MeasurementManager(object): | @@ -139,7 +139,7 @@ class MeasurementManager(object): | ||
139 | value = u"%.2f°"% m.value | 139 | value = u"%.2f°"% m.value |
140 | 140 | ||
141 | msg = 'Update measurement info in GUI', | 141 | msg = 'Update measurement info in GUI', |
142 | - ps.Publisher().sendMessage(msg, | 142 | + Publisher.sendMessage(msg, |
143 | (index, name, colour, | 143 | (index, name, colour, |
144 | type_, location, | 144 | type_, location, |
145 | value)) | 145 | value)) |
@@ -156,10 +156,10 @@ class MeasurementManager(object): | @@ -156,10 +156,10 @@ class MeasurementManager(object): | ||
156 | m, mr = self.measures.pop(index) | 156 | m, mr = self.measures.pop(index) |
157 | actors = mr.GetActors() | 157 | actors = mr.GetActors() |
158 | prj.Project().RemoveMeasurement(index) | 158 | prj.Project().RemoveMeasurement(index) |
159 | - ps.Publisher().sendMessage(('Remove actors', m.location), | 159 | + Publisher.sendMessage(('Remove actors', m.location), |
160 | (actors, m.slice_number)) | 160 | (actors, m.slice_number)) |
161 | - ps.Publisher().sendMessage('Update slice viewer') | ||
162 | - ps.Publisher().sendMessage('Render volume viewer') | 161 | + Publisher.sendMessage('Update slice viewer') |
162 | + Publisher.sendMessage('Render volume viewer') | ||
163 | 163 | ||
164 | session = ses.Session() | 164 | session = ses.Session() |
165 | session.ChangeProject() | 165 | session.ChangeProject() |
@@ -170,9 +170,9 @@ class MeasurementManager(object): | @@ -170,9 +170,9 @@ class MeasurementManager(object): | ||
170 | m.is_shown = visibility | 170 | m.is_shown = visibility |
171 | mr.SetVisibility(visibility) | 171 | mr.SetVisibility(visibility) |
172 | if m.location == const.SURFACE: | 172 | if m.location == const.SURFACE: |
173 | - ps.Publisher().sendMessage('Render volume viewer') | 173 | + Publisher.sendMessage('Render volume viewer') |
174 | else: | 174 | else: |
175 | - ps.Publisher().sendMessage('Update slice viewer') | 175 | + Publisher.sendMessage('Update slice viewer') |
176 | 176 | ||
177 | 177 | ||
178 | class Measurement(): | 178 | class Measurement(): |
invesalius/data/polydata_utils.py
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
19 | 19 | ||
20 | import vtk | 20 | import vtk |
21 | -import wx.lib.pubsub as ps | 21 | +from wx.lib.pubsub import pub as Publisher |
22 | 22 | ||
23 | import vtk_utils as vu | 23 | import vtk_utils as vu |
24 | 24 |
invesalius/data/slice_.py
@@ -20,7 +20,7 @@ import math | @@ -20,7 +20,7 @@ import math | ||
20 | 20 | ||
21 | import numpy | 21 | import numpy |
22 | import vtk | 22 | import vtk |
23 | -import wx.lib.pubsub as ps | 23 | +from wx.lib.pubsub import pub as Publisher |
24 | 24 | ||
25 | import constants as const | 25 | import constants as const |
26 | import converters | 26 | import converters |
@@ -93,45 +93,45 @@ class Slice(object): | @@ -93,45 +93,45 @@ class Slice(object): | ||
93 | 93 | ||
94 | def __bind_events(self): | 94 | def __bind_events(self): |
95 | # General slice control | 95 | # General slice control |
96 | - ps.Publisher().subscribe(self.CreateSurfaceFromIndex, | 96 | + Publisher.subscribe(self.CreateSurfaceFromIndex, |
97 | 'Create surface from index') | 97 | 'Create surface from index') |
98 | # Mask control | 98 | # Mask control |
99 | - ps.Publisher().subscribe(self.__add_mask_thresh, 'Create new mask') | ||
100 | - ps.Publisher().subscribe(self.__select_current_mask, | 99 | + Publisher.subscribe(self.__add_mask_thresh, 'Create new mask') |
100 | + Publisher.subscribe(self.__select_current_mask, | ||
101 | 'Change mask selected') | 101 | 'Change mask selected') |
102 | # Mask properties | 102 | # Mask properties |
103 | - ps.Publisher().subscribe(self.__set_current_mask_edition_threshold, | 103 | + Publisher.subscribe(self.__set_current_mask_edition_threshold, |
104 | 'Set edition threshold values') | 104 | 'Set edition threshold values') |
105 | - ps.Publisher().subscribe(self.__set_current_mask_threshold, | 105 | + Publisher.subscribe(self.__set_current_mask_threshold, |
106 | 'Set threshold values') | 106 | 'Set threshold values') |
107 | - ps.Publisher().subscribe(self.__set_current_mask_threshold_actual_slice, | 107 | + Publisher.subscribe(self.__set_current_mask_threshold_actual_slice, |
108 | 'Changing threshold values') | 108 | 'Changing threshold values') |
109 | - ps.Publisher().subscribe(self.__set_current_mask_colour, | 109 | + Publisher.subscribe(self.__set_current_mask_colour, |
110 | 'Change mask colour') | 110 | 'Change mask colour') |
111 | - ps.Publisher().subscribe(self.__set_mask_name, 'Change mask name') | ||
112 | - ps.Publisher().subscribe(self.__show_mask, 'Show mask') | 111 | + Publisher.subscribe(self.__set_mask_name, 'Change mask name') |
112 | + Publisher.subscribe(self.__show_mask, 'Show mask') | ||
113 | 113 | ||
114 | - ps.Publisher().subscribe(self.__set_current_mask_threshold_limits, | 114 | + Publisher.subscribe(self.__set_current_mask_threshold_limits, |
115 | 'Update threshold limits') | 115 | 'Update threshold limits') |
116 | 116 | ||
117 | - ps.Publisher().subscribe(self.UpdateWindowLevelBackground,\ | 117 | + Publisher.subscribe(self.UpdateWindowLevelBackground,\ |
118 | 'Bright and contrast adjustment image') | 118 | 'Bright and contrast adjustment image') |
119 | 119 | ||
120 | - ps.Publisher().subscribe(self.UpdateColourTableBackground,\ | 120 | + Publisher.subscribe(self.UpdateColourTableBackground,\ |
121 | 'Change colour table from background image') | 121 | 'Change colour table from background image') |
122 | 122 | ||
123 | - ps.Publisher().subscribe(self.InputImageWidget, 'Input Image in the widget') | 123 | + Publisher.subscribe(self.InputImageWidget, 'Input Image in the widget') |
124 | 124 | ||
125 | - ps.Publisher().subscribe(self.OnExportMask,'Export mask to file') | 125 | + Publisher.subscribe(self.OnExportMask,'Export mask to file') |
126 | 126 | ||
127 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | 127 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
128 | 128 | ||
129 | - ps.Publisher().subscribe(self.OnEnableStyle, 'Enable style') | ||
130 | - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable style') | 129 | + Publisher.subscribe(self.OnEnableStyle, 'Enable style') |
130 | + Publisher.subscribe(self.OnDisableStyle, 'Disable style') | ||
131 | 131 | ||
132 | - ps.Publisher().subscribe(self.OnRemoveMasks, 'Remove masks') | ||
133 | - ps.Publisher().subscribe(self.OnDuplicateMasks, 'Duplicate masks') | ||
134 | - ps.Publisher().subscribe(self.UpdateSlice3D,'Update slice 3D') | 132 | + Publisher.subscribe(self.OnRemoveMasks, 'Remove masks') |
133 | + Publisher.subscribe(self.OnDuplicateMasks, 'Duplicate masks') | ||
134 | + Publisher.subscribe(self.UpdateSlice3D,'Update slice 3D') | ||
135 | 135 | ||
136 | def GetMaxSliceNumber(self, orientation): | 136 | def GetMaxSliceNumber(self, orientation): |
137 | shape = self.matrix.shape | 137 | shape = self.matrix.shape |
@@ -160,7 +160,7 @@ class Slice(object): | @@ -160,7 +160,7 @@ class Slice(object): | ||
160 | buffer_.discard_vtk_mask() | 160 | buffer_.discard_vtk_mask() |
161 | buffer_.discard_mask() | 161 | buffer_.discard_mask() |
162 | 162 | ||
163 | - ps.Publisher().sendMessage('Reload actual slice') | 163 | + Publisher.sendMessage('Reload actual slice') |
164 | 164 | ||
165 | def OnDuplicateMasks(self, pubsub_evt): | 165 | def OnDuplicateMasks(self, pubsub_evt): |
166 | selected_items = pubsub_evt.data | 166 | selected_items = pubsub_evt.data |
@@ -185,16 +185,16 @@ class Slice(object): | @@ -185,16 +185,16 @@ class Slice(object): | ||
185 | state = pubsub_evt.data | 185 | state = pubsub_evt.data |
186 | if (state in const.SLICE_STYLES): | 186 | if (state in const.SLICE_STYLES): |
187 | new_state = self.interaction_style.AddState(state) | 187 | new_state = self.interaction_style.AddState(state) |
188 | - ps.Publisher().sendMessage('Set slice interaction style', new_state) | 188 | + Publisher.sendMessage('Set slice interaction style', new_state) |
189 | 189 | ||
190 | def OnDisableStyle(self, pubsub_evt): | 190 | def OnDisableStyle(self, pubsub_evt): |
191 | state = pubsub_evt.data | 191 | state = pubsub_evt.data |
192 | if (state in const.SLICE_STYLES): | 192 | if (state in const.SLICE_STYLES): |
193 | new_state = self.interaction_style.RemoveState(state) | 193 | new_state = self.interaction_style.RemoveState(state) |
194 | - ps.Publisher().sendMessage('Set slice interaction style', new_state) | 194 | + Publisher.sendMessage('Set slice interaction style', new_state) |
195 | 195 | ||
196 | if (state == const.SLICE_STATE_EDITOR): | 196 | if (state == const.SLICE_STATE_EDITOR): |
197 | - ps.Publisher().sendMessage('Set interactor default cursor') | 197 | + Publisher.sendMessage('Set interactor default cursor') |
198 | 198 | ||
199 | def OnCloseProject(self, pubsub_evt): | 199 | def OnCloseProject(self, pubsub_evt): |
200 | self.CloseProject() | 200 | self.CloseProject() |
@@ -202,7 +202,7 @@ class Slice(object): | @@ -202,7 +202,7 @@ class Slice(object): | ||
202 | def CloseProject(self): | 202 | def CloseProject(self): |
203 | self.imagedata = None | 203 | self.imagedata = None |
204 | self.current_mask = None | 204 | self.current_mask = None |
205 | - ps.Publisher().sendMessage('Select first item from slice menu') | 205 | + Publisher.sendMessage('Select first item from slice menu') |
206 | #self.blend_filter = None | 206 | #self.blend_filter = None |
207 | #self.blend_filter = None | 207 | #self.blend_filter = None |
208 | #self.num_gradient = 0 | 208 | #self.num_gradient = 0 |
@@ -230,7 +230,7 @@ class Slice(object): | @@ -230,7 +230,7 @@ class Slice(object): | ||
230 | self.CreateMask(name=mask_name, threshold_range=thresh, colour =colour) | 230 | self.CreateMask(name=mask_name, threshold_range=thresh, colour =colour) |
231 | self.SetMaskColour(self.current_mask.index, self.current_mask.colour) | 231 | self.SetMaskColour(self.current_mask.index, self.current_mask.colour) |
232 | self.SelectCurrentMask(self.current_mask.index) | 232 | self.SelectCurrentMask(self.current_mask.index) |
233 | - ps.Publisher().sendMessage('Reload actual slice') | 233 | + Publisher.sendMessage('Reload actual slice') |
234 | 234 | ||
235 | def __select_current_mask(self, pubsub_evt): | 235 | def __select_current_mask(self, pubsub_evt): |
236 | mask_index = pubsub_evt.data | 236 | mask_index = pubsub_evt.data |
@@ -258,7 +258,7 @@ class Slice(object): | @@ -258,7 +258,7 @@ class Slice(object): | ||
258 | orientation) | 258 | orientation) |
259 | self.num_gradient += 1 | 259 | self.num_gradient += 1 |
260 | 260 | ||
261 | - ps.Publisher().sendMessage('Reload actual slice') | 261 | + Publisher.sendMessage('Reload actual slice') |
262 | 262 | ||
263 | def __set_current_mask_colour(self, pubsub_evt): | 263 | def __set_current_mask_colour(self, pubsub_evt): |
264 | # "if" is necessary because wx events are calling this before any mask | 264 | # "if" is necessary because wx events are calling this before any mask |
@@ -482,14 +482,14 @@ class Slice(object): | @@ -482,14 +482,14 @@ class Slice(object): | ||
482 | 482 | ||
483 | (r,g,b) = colour | 483 | (r,g,b) = colour |
484 | colour_wx = [r*255, g*255, b*255] | 484 | colour_wx = [r*255, g*255, b*255] |
485 | - ps.Publisher().sendMessage('Change mask colour in notebook', | 485 | + Publisher.sendMessage('Change mask colour in notebook', |
486 | (index, (r,g,b))) | 486 | (index, (r,g,b))) |
487 | - ps.Publisher().sendMessage('Set GUI items colour', colour_wx) | 487 | + Publisher.sendMessage('Set GUI items colour', colour_wx) |
488 | if update: | 488 | if update: |
489 | # Updating mask colour on vtkimagedata. | 489 | # Updating mask colour on vtkimagedata. |
490 | for buffer_ in self.buffer_slices.values(): | 490 | for buffer_ in self.buffer_slices.values(): |
491 | buffer_.discard_vtk_mask() | 491 | buffer_.discard_vtk_mask() |
492 | - ps.Publisher().sendMessage('Reload actual slice') | 492 | + Publisher.sendMessage('Reload actual slice') |
493 | 493 | ||
494 | session = ses.Session() | 494 | session = ses.Session() |
495 | session.ChangeProject() | 495 | session.ChangeProject() |
@@ -535,10 +535,10 @@ class Slice(object): | @@ -535,10 +535,10 @@ class Slice(object): | ||
535 | self.buffer_slices[orientation].mask = (255 * ((slice_ >= thresh_min) & (slice_ <= thresh_max))).astype('uint8') | 535 | self.buffer_slices[orientation].mask = (255 * ((slice_ >= thresh_min) & (slice_ <= thresh_max))).astype('uint8') |
536 | 536 | ||
537 | # Update viewer | 537 | # Update viewer |
538 | - #ps.Publisher().sendMessage('Update slice viewer') | 538 | + #Publisher.sendMessage('Update slice viewer') |
539 | 539 | ||
540 | # Update data notebook (GUI) | 540 | # Update data notebook (GUI) |
541 | - ps.Publisher().sendMessage('Set mask threshold in notebook', | 541 | + Publisher.sendMessage('Set mask threshold in notebook', |
542 | (self.current_mask.index, | 542 | (self.current_mask.index, |
543 | self.current_mask.threshold_range)) | 543 | self.current_mask.threshold_range)) |
544 | else: | 544 | else: |
@@ -557,7 +557,7 @@ class Slice(object): | @@ -557,7 +557,7 @@ class Slice(object): | ||
557 | for buffer_ in self.buffer_slices.values(): | 557 | for buffer_ in self.buffer_slices.values(): |
558 | buffer_.discard_vtk_mask() | 558 | buffer_.discard_vtk_mask() |
559 | buffer_.discard_mask() | 559 | buffer_.discard_mask() |
560 | - ps.Publisher().sendMessage('Reload actual slice') | 560 | + Publisher.sendMessage('Reload actual slice') |
561 | #--------------------------------------------------------------------------- | 561 | #--------------------------------------------------------------------------- |
562 | 562 | ||
563 | def SelectCurrentMask(self, index): | 563 | def SelectCurrentMask(self, index): |
@@ -581,13 +581,13 @@ class Slice(object): | @@ -581,13 +581,13 @@ class Slice(object): | ||
581 | "CORONAL": SliceBuffer(), | 581 | "CORONAL": SliceBuffer(), |
582 | "SAGITAL": SliceBuffer()} | 582 | "SAGITAL": SliceBuffer()} |
583 | 583 | ||
584 | - ps.Publisher().sendMessage('Set mask threshold in notebook', | 584 | + Publisher.sendMessage('Set mask threshold in notebook', |
585 | (index, | 585 | (index, |
586 | self.current_mask.threshold_range)) | 586 | self.current_mask.threshold_range)) |
587 | - ps.Publisher().sendMessage('Set threshold values in gradient', | 587 | + Publisher.sendMessage('Set threshold values in gradient', |
588 | self.current_mask.threshold_range) | 588 | self.current_mask.threshold_range) |
589 | - ps.Publisher().sendMessage('Select mask name in combo', index) | ||
590 | - ps.Publisher().sendMessage('Update slice viewer') | 589 | + Publisher.sendMessage('Select mask name in combo', index) |
590 | + Publisher.sendMessage('Update slice viewer') | ||
591 | #--------------------------------------------------------------------------- | 591 | #--------------------------------------------------------------------------- |
592 | 592 | ||
593 | def CreateSurfaceFromIndex(self, pubsub_evt): | 593 | def CreateSurfaceFromIndex(self, pubsub_evt): |
@@ -606,7 +606,7 @@ class Slice(object): | @@ -606,7 +606,7 @@ class Slice(object): | ||
606 | 606 | ||
607 | mask.matrix.flush() | 607 | mask.matrix.flush() |
608 | 608 | ||
609 | - ps.Publisher().sendMessage('Create surface', (algorithm, options, | 609 | + Publisher.sendMessage('Create surface', (algorithm, options, |
610 | self.matrix, | 610 | self.matrix, |
611 | self.matrix_filename, | 611 | self.matrix_filename, |
612 | mask, self.spacing, | 612 | mask, self.spacing, |
@@ -649,7 +649,7 @@ class Slice(object): | @@ -649,7 +649,7 @@ class Slice(object): | ||
649 | 649 | ||
650 | def __create_background(self, imagedata): | 650 | def __create_background(self, imagedata): |
651 | thresh_min, thresh_max = imagedata.GetScalarRange() | 651 | thresh_min, thresh_max = imagedata.GetScalarRange() |
652 | - ps.Publisher().sendMessage('Update threshold limits list', (thresh_min, | 652 | + Publisher.sendMessage('Update threshold limits list', (thresh_min, |
653 | thresh_max)) | 653 | thresh_max)) |
654 | 654 | ||
655 | # map scalar values into colors | 655 | # map scalar values into colors |
@@ -676,7 +676,7 @@ class Slice(object): | @@ -676,7 +676,7 @@ class Slice(object): | ||
676 | for buffer_ in self.buffer_slices.values(): | 676 | for buffer_ in self.buffer_slices.values(): |
677 | buffer_.discard_vtk_image() | 677 | buffer_.discard_vtk_image() |
678 | 678 | ||
679 | - ps.Publisher().sendMessage('Reload actual slice') | 679 | + Publisher.sendMessage('Reload actual slice') |
680 | 680 | ||
681 | def UpdateColourTableBackground(self, pubsub_evt): | 681 | def UpdateColourTableBackground(self, pubsub_evt): |
682 | values = pubsub_evt.data | 682 | values = pubsub_evt.data |
@@ -686,7 +686,7 @@ class Slice(object): | @@ -686,7 +686,7 @@ class Slice(object): | ||
686 | self.value_range = values[3] | 686 | self.value_range = values[3] |
687 | for buffer_ in self.buffer_slices.values(): | 687 | for buffer_ in self.buffer_slices.values(): |
688 | buffer_.discard_vtk_image() | 688 | buffer_.discard_vtk_image() |
689 | - ps.Publisher().sendMessage('Reload actual slice') | 689 | + Publisher.sendMessage('Reload actual slice') |
690 | 690 | ||
691 | def InputImageWidget(self, pubsub_evt): | 691 | def InputImageWidget(self, pubsub_evt): |
692 | widget, orientation = pubsub_evt.data | 692 | widget, orientation = pubsub_evt.data |
@@ -759,7 +759,7 @@ class Slice(object): | @@ -759,7 +759,7 @@ class Slice(object): | ||
759 | future_mask.index = index | 759 | future_mask.index = index |
760 | 760 | ||
761 | ## update gui related to mask | 761 | ## update gui related to mask |
762 | - ps.Publisher().sendMessage('Add mask', | 762 | + Publisher.sendMessage('Add mask', |
763 | (future_mask.index, | 763 | (future_mask.index, |
764 | future_mask.name, | 764 | future_mask.name, |
765 | future_mask.threshold_range, | 765 | future_mask.threshold_range, |
@@ -767,8 +767,8 @@ class Slice(object): | @@ -767,8 +767,8 @@ class Slice(object): | ||
767 | 767 | ||
768 | self.current_mask = future_mask | 768 | self.current_mask = future_mask |
769 | 769 | ||
770 | - ps.Publisher().sendMessage('Change mask selected', future_mask.index) | ||
771 | - ps.Publisher().sendMessage('Update slice viewer') | 770 | + Publisher.sendMessage('Change mask selected', future_mask.index) |
771 | + Publisher.sendMessage('Update slice viewer') | ||
772 | 772 | ||
773 | def __load_masks(self, imagedata, mask_dict): | 773 | def __load_masks(self, imagedata, mask_dict): |
774 | keys = mask_dict.keys() | 774 | keys = mask_dict.keys() |
@@ -779,7 +779,7 @@ class Slice(object): | @@ -779,7 +779,7 @@ class Slice(object): | ||
779 | # update gui related to mask | 779 | # update gui related to mask |
780 | utils.debug("__load_masks") | 780 | utils.debug("__load_masks") |
781 | utils.debug('THRESHOLD_RANGE %s'% mask.threshold_range) | 781 | utils.debug('THRESHOLD_RANGE %s'% mask.threshold_range) |
782 | - ps.Publisher().sendMessage('Add mask', | 782 | + Publisher.sendMessage('Add mask', |
783 | (mask.index, | 783 | (mask.index, |
784 | mask.name, | 784 | mask.name, |
785 | mask.threshold_range, | 785 | mask.threshold_range, |
@@ -788,8 +788,8 @@ class Slice(object): | @@ -788,8 +788,8 @@ class Slice(object): | ||
788 | self.current_mask = mask | 788 | self.current_mask = mask |
789 | self.__build_mask(imagedata, False) | 789 | self.__build_mask(imagedata, False) |
790 | 790 | ||
791 | - ps.Publisher().sendMessage('Change mask selected', mask.index) | ||
792 | - ps.Publisher().sendMessage('Update slice viewer') | 791 | + Publisher.sendMessage('Change mask selected', mask.index) |
792 | + Publisher.sendMessage('Update slice viewer') | ||
793 | 793 | ||
794 | def do_ww_wl(self, image): | 794 | def do_ww_wl(self, image): |
795 | colorer = vtk.vtkImageMapToWindowLevelColors() | 795 | colorer = vtk.vtkImageMapToWindowLevelColors() |
@@ -891,7 +891,7 @@ class Slice(object): | @@ -891,7 +891,7 @@ class Slice(object): | ||
891 | if o != orientation: | 891 | if o != orientation: |
892 | self.buffer_slices[o].discard_mask() | 892 | self.buffer_slices[o].discard_mask() |
893 | self.buffer_slices[o].discard_vtk_mask() | 893 | self.buffer_slices[o].discard_vtk_mask() |
894 | - ps.Publisher().sendMessage('Reload actual slice') | 894 | + Publisher.sendMessage('Reload actual slice') |
895 | 895 | ||
896 | def __build_mask(self, imagedata, create=True): | 896 | def __build_mask(self, imagedata, create=True): |
897 | # create new mask instance and insert it into project | 897 | # create new mask instance and insert it into project |
invesalius/data/surface.py
@@ -23,7 +23,7 @@ import plistlib | @@ -23,7 +23,7 @@ import plistlib | ||
23 | import random | 23 | import random |
24 | 24 | ||
25 | import vtk | 25 | import vtk |
26 | -import wx.lib.pubsub as ps | 26 | +from wx.lib.pubsub import pub as Publisher |
27 | 27 | ||
28 | import constants as const | 28 | import constants as const |
29 | import imagedata_utils as iu | 29 | import imagedata_utils as iu |
@@ -107,27 +107,27 @@ class SurfaceManager(): | @@ -107,27 +107,27 @@ class SurfaceManager(): | ||
107 | self.__bind_events() | 107 | self.__bind_events() |
108 | 108 | ||
109 | def __bind_events(self): | 109 | def __bind_events(self): |
110 | - ps.Publisher().subscribe(self.AddNewActor, 'Create surface') | ||
111 | - ps.Publisher().subscribe(self.SetActorTransparency, | 110 | + Publisher.subscribe(self.AddNewActor, 'Create surface') |
111 | + Publisher.subscribe(self.SetActorTransparency, | ||
112 | 'Set surface transparency') | 112 | 'Set surface transparency') |
113 | - ps.Publisher().subscribe(self.SetActorColour, | 113 | + Publisher.subscribe(self.SetActorColour, |
114 | 'Set surface colour') | 114 | 'Set surface colour') |
115 | 115 | ||
116 | - ps.Publisher().subscribe(self.OnChangeSurfaceName, 'Change surface name') | ||
117 | - ps.Publisher().subscribe(self.OnShowSurface, 'Show surface') | ||
118 | - ps.Publisher().subscribe(self.OnExportSurface,'Export surface to file') | ||
119 | - ps.Publisher().subscribe(self.OnLoadSurfaceDict, 'Load surface dict') | ||
120 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | ||
121 | - ps.Publisher().subscribe(self.OnSelectSurface, 'Change surface selected') | 116 | + Publisher.subscribe(self.OnChangeSurfaceName, 'Change surface name') |
117 | + Publisher.subscribe(self.OnShowSurface, 'Show surface') | ||
118 | + Publisher.subscribe(self.OnExportSurface,'Export surface to file') | ||
119 | + Publisher.subscribe(self.OnLoadSurfaceDict, 'Load surface dict') | ||
120 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | ||
121 | + Publisher.subscribe(self.OnSelectSurface, 'Change surface selected') | ||
122 | #---- | 122 | #---- |
123 | - ps.Publisher().subscribe(self.OnSplitSurface, 'Split surface') | ||
124 | - ps.Publisher().subscribe(self.OnLargestSurface, | 123 | + Publisher.subscribe(self.OnSplitSurface, 'Split surface') |
124 | + Publisher.subscribe(self.OnLargestSurface, | ||
125 | 'Create surface from largest region') | 125 | 'Create surface from largest region') |
126 | - ps.Publisher().subscribe(self.OnSeedSurface, "Create surface from seeds") | 126 | + Publisher.subscribe(self.OnSeedSurface, "Create surface from seeds") |
127 | 127 | ||
128 | - ps.Publisher().subscribe(self.OnDuplicate, "Duplicate surfaces") | ||
129 | - ps.Publisher().subscribe(self.OnRemove,"Remove surfaces") | ||
130 | - ps.Publisher().subscribe(self.UpdateSurfaceInterpolation, 'Update Surface Interpolation') | 128 | + Publisher.subscribe(self.OnDuplicate, "Duplicate surfaces") |
129 | + Publisher.subscribe(self.OnRemove,"Remove surfaces") | ||
130 | + Publisher.subscribe(self.UpdateSurfaceInterpolation, 'Update Surface Interpolation') | ||
131 | 131 | ||
132 | def OnDuplicate(self, pubsub_evt): | 132 | def OnDuplicate(self, pubsub_evt): |
133 | selected_items = pubsub_evt.data | 133 | selected_items = pubsub_evt.data |
@@ -163,7 +163,7 @@ class SurfaceManager(): | @@ -163,7 +163,7 @@ class SurfaceManager(): | ||
163 | if i > index: | 163 | if i > index: |
164 | new_dict[i-1] = old_dict[i] | 164 | new_dict[i-1] = old_dict[i] |
165 | old_dict = new_dict | 165 | old_dict = new_dict |
166 | - ps.Publisher().sendMessage('Remove surface actor from viewer', actor) | 166 | + Publisher.sendMessage('Remove surface actor from viewer', actor) |
167 | self.actors_dict = new_dict | 167 | self.actors_dict = new_dict |
168 | 168 | ||
169 | if self.last_surface_index in selected_items: | 169 | if self.last_surface_index in selected_items: |
@@ -185,7 +185,7 @@ class SurfaceManager(): | @@ -185,7 +185,7 @@ class SurfaceManager(): | ||
185 | new_polydata = pu.JoinSeedsParts(surface.polydata, | 185 | new_polydata = pu.JoinSeedsParts(surface.polydata, |
186 | points_id_list) | 186 | points_id_list) |
187 | index = self.CreateSurfaceFromPolydata(new_polydata) | 187 | index = self.CreateSurfaceFromPolydata(new_polydata) |
188 | - ps.Publisher().sendMessage('Show single surface', (index, True)) | 188 | + Publisher.sendMessage('Show single surface', (index, True)) |
189 | #self.ShowActor(index, True) | 189 | #self.ShowActor(index, True) |
190 | 190 | ||
191 | def OnSplitSurface(self, pubsub_evt): | 191 | def OnSplitSurface(self, pubsub_evt): |
@@ -204,7 +204,7 @@ class SurfaceManager(): | @@ -204,7 +204,7 @@ class SurfaceManager(): | ||
204 | index_list.append(index) | 204 | index_list.append(index) |
205 | #self.ShowActor(index, True) | 205 | #self.ShowActor(index, True) |
206 | 206 | ||
207 | - ps.Publisher().sendMessage('Show multiple surfaces', (index_list, True)) | 207 | + Publisher.sendMessage('Show multiple surfaces', (index_list, True)) |
208 | 208 | ||
209 | def OnLargestSurface(self, pubsub_evt): | 209 | def OnLargestSurface(self, pubsub_evt): |
210 | """ | 210 | """ |
@@ -217,7 +217,7 @@ class SurfaceManager(): | @@ -217,7 +217,7 @@ class SurfaceManager(): | ||
217 | 217 | ||
218 | new_polydata = pu.SelectLargestPart(surface.polydata) | 218 | new_polydata = pu.SelectLargestPart(surface.polydata) |
219 | new_index = self.CreateSurfaceFromPolydata(new_polydata) | 219 | new_index = self.CreateSurfaceFromPolydata(new_polydata) |
220 | - ps.Publisher().sendMessage('Show single surface', (new_index, True)) | 220 | + Publisher.sendMessage('Show single surface', (new_index, True)) |
221 | 221 | ||
222 | def CreateSurfaceFromPolydata(self, polydata, overwrite=False, | 222 | def CreateSurfaceFromPolydata(self, polydata, overwrite=False, |
223 | name=None, colour=None, | 223 | name=None, colour=None, |
@@ -279,9 +279,9 @@ class SurfaceManager(): | @@ -279,9 +279,9 @@ class SurfaceManager(): | ||
279 | surface.volume = volume | 279 | surface.volume = volume |
280 | self.last_surface_index = surface.index | 280 | self.last_surface_index = surface.index |
281 | 281 | ||
282 | - ps.Publisher().sendMessage('Load surface actor into viewer', actor) | 282 | + Publisher.sendMessage('Load surface actor into viewer', actor) |
283 | 283 | ||
284 | - ps.Publisher().sendMessage('Update surface info in GUI', | 284 | + Publisher.sendMessage('Update surface info in GUI', |
285 | (surface.index, surface.name, | 285 | (surface.index, surface.name, |
286 | surface.colour, surface.volume, | 286 | surface.colour, surface.volume, |
287 | surface.transparency)) | 287 | surface.transparency)) |
@@ -292,7 +292,7 @@ class SurfaceManager(): | @@ -292,7 +292,7 @@ class SurfaceManager(): | ||
292 | 292 | ||
293 | def CloseProject(self): | 293 | def CloseProject(self): |
294 | for index in self.actors_dict: | 294 | for index in self.actors_dict: |
295 | - ps.Publisher().sendMessage('Remove surface actor from viewer', self.actors_dict[index]) | 295 | + Publisher.sendMessage('Remove surface actor from viewer', self.actors_dict[index]) |
296 | del self.actors_dict | 296 | del self.actors_dict |
297 | self.actors_dict = {} | 297 | self.actors_dict = {} |
298 | 298 | ||
@@ -302,7 +302,7 @@ class SurfaceManager(): | @@ -302,7 +302,7 @@ class SurfaceManager(): | ||
302 | # self.actors_dict. | 302 | # self.actors_dict. |
303 | proj = prj.Project() | 303 | proj = prj.Project() |
304 | surface = proj.surface_dict[index] | 304 | surface = proj.surface_dict[index] |
305 | - ps.Publisher().sendMessage('Update surface info in GUI', | 305 | + Publisher.sendMessage('Update surface info in GUI', |
306 | (index, surface.name, | 306 | (index, surface.name, |
307 | surface.colour, surface.volume, | 307 | surface.colour, surface.volume, |
308 | surface.transparency)) | 308 | surface.transparency)) |
@@ -342,13 +342,13 @@ class SurfaceManager(): | @@ -342,13 +342,13 @@ class SurfaceManager(): | ||
342 | self.actors_dict[surface.index] = actor | 342 | self.actors_dict[surface.index] = actor |
343 | 343 | ||
344 | # Send actor by pubsub to viewer's render | 344 | # Send actor by pubsub to viewer's render |
345 | - ps.Publisher().sendMessage('Load surface actor into viewer', (actor)) | 345 | + Publisher.sendMessage('Load surface actor into viewer', (actor)) |
346 | 346 | ||
347 | - ps.Publisher().sendMessage('Update status text in GUI', | 347 | + Publisher.sendMessage('Update status text in GUI', |
348 | _("Ready")) | 348 | _("Ready")) |
349 | 349 | ||
350 | # The following lines have to be here, otherwise all volumes disappear | 350 | # The following lines have to be here, otherwise all volumes disappear |
351 | - ps.Publisher().sendMessage('Update surface info in GUI', | 351 | + Publisher.sendMessage('Update surface info in GUI', |
352 | (surface.index, surface.name, | 352 | (surface.index, surface.name, |
353 | surface.colour, surface.volume, | 353 | surface.colour, surface.volume, |
354 | surface.transparency)) | 354 | surface.transparency)) |
@@ -623,17 +623,17 @@ class SurfaceManager(): | @@ -623,17 +623,17 @@ class SurfaceManager(): | ||
623 | surface.volume = volume | 623 | surface.volume = volume |
624 | self.last_surface_index = surface.index | 624 | self.last_surface_index = surface.index |
625 | 625 | ||
626 | - ps.Publisher().sendMessage('Load surface actor into viewer', actor) | 626 | + Publisher.sendMessage('Load surface actor into viewer', actor) |
627 | 627 | ||
628 | # Send actor by pubsub to viewer's render | 628 | # Send actor by pubsub to viewer's render |
629 | if overwrite and self.actors_dict.keys(): | 629 | if overwrite and self.actors_dict.keys(): |
630 | old_actor = self.actors_dict[self.last_surface_index] | 630 | old_actor = self.actors_dict[self.last_surface_index] |
631 | - ps.Publisher().sendMessage('Remove surface actor from viewer', old_actor) | 631 | + Publisher.sendMessage('Remove surface actor from viewer', old_actor) |
632 | 632 | ||
633 | # Save actor for future management tasks | 633 | # Save actor for future management tasks |
634 | self.actors_dict[surface.index] = actor | 634 | self.actors_dict[surface.index] = actor |
635 | 635 | ||
636 | - ps.Publisher().sendMessage('Update surface info in GUI', | 636 | + Publisher.sendMessage('Update surface info in GUI', |
637 | (surface.index, surface.name, | 637 | (surface.index, surface.name, |
638 | surface.colour, surface.volume, | 638 | surface.colour, surface.volume, |
639 | surface.transparency)) | 639 | surface.transparency)) |
@@ -641,10 +641,10 @@ class SurfaceManager(): | @@ -641,10 +641,10 @@ class SurfaceManager(): | ||
641 | #When you finalize the progress. The bar is cleaned. | 641 | #When you finalize the progress. The bar is cleaned. |
642 | UpdateProgress = vu.ShowProgress(1) | 642 | UpdateProgress = vu.ShowProgress(1) |
643 | UpdateProgress(0, _("Ready")) | 643 | UpdateProgress(0, _("Ready")) |
644 | - ps.Publisher().sendMessage('Update status text in GUI', | 644 | + Publisher.sendMessage('Update status text in GUI', |
645 | _("Ready")) | 645 | _("Ready")) |
646 | 646 | ||
647 | - ps.Publisher().sendMessage('End busy cursor') | 647 | + Publisher.sendMessage('End busy cursor') |
648 | 648 | ||
649 | def UpdateSurfaceInterpolation(self, pub_evt): | 649 | def UpdateSurfaceInterpolation(self, pub_evt): |
650 | interpolation = int(ses.Session().surface_interpolation) | 650 | interpolation = int(ses.Session().surface_interpolation) |
@@ -652,13 +652,13 @@ class SurfaceManager(): | @@ -652,13 +652,13 @@ class SurfaceManager(): | ||
652 | 652 | ||
653 | for key in self.actors_dict: | 653 | for key in self.actors_dict: |
654 | self.actors_dict[key].GetProperty().SetInterpolation(interpolation) | 654 | self.actors_dict[key].GetProperty().SetInterpolation(interpolation) |
655 | - ps.Publisher().sendMessage('Render volume viewer') | 655 | + Publisher.sendMessage('Render volume viewer') |
656 | 656 | ||
657 | def RemoveActor(self, index): | 657 | def RemoveActor(self, index): |
658 | """ | 658 | """ |
659 | Remove actor, according to given actor index. | 659 | Remove actor, according to given actor index. |
660 | """ | 660 | """ |
661 | - ps.Publisher().sendMessage('Remove surface actor from viewer', (index)) | 661 | + Publisher.sendMessage('Remove surface actor from viewer', (index)) |
662 | self.actors_dict.pop(index) | 662 | self.actors_dict.pop(index) |
663 | # Remove surface from project's surface_dict | 663 | # Remove surface from project's surface_dict |
664 | proj = prj.Project() | 664 | proj = prj.Project() |
@@ -681,7 +681,7 @@ class SurfaceManager(): | @@ -681,7 +681,7 @@ class SurfaceManager(): | ||
681 | # Update value in project's surface_dict | 681 | # Update value in project's surface_dict |
682 | proj = prj.Project() | 682 | proj = prj.Project() |
683 | proj.surface_dict[index].is_shown = value | 683 | proj.surface_dict[index].is_shown = value |
684 | - ps.Publisher().sendMessage('Render volume viewer') | 684 | + Publisher.sendMessage('Render volume viewer') |
685 | 685 | ||
686 | def SetActorTransparency(self, pubsub_evt): | 686 | def SetActorTransparency(self, pubsub_evt): |
687 | """ | 687 | """ |
@@ -693,7 +693,7 @@ class SurfaceManager(): | @@ -693,7 +693,7 @@ class SurfaceManager(): | ||
693 | # Update value in project's surface_dict | 693 | # Update value in project's surface_dict |
694 | proj = prj.Project() | 694 | proj = prj.Project() |
695 | proj.surface_dict[index].transparency = value | 695 | proj.surface_dict[index].transparency = value |
696 | - ps.Publisher().sendMessage('Render volume viewer') | 696 | + Publisher.sendMessage('Render volume viewer') |
697 | 697 | ||
698 | def SetActorColour(self, pubsub_evt): | 698 | def SetActorColour(self, pubsub_evt): |
699 | """ | 699 | """ |
@@ -703,7 +703,7 @@ class SurfaceManager(): | @@ -703,7 +703,7 @@ class SurfaceManager(): | ||
703 | # Update value in project's surface_dict | 703 | # Update value in project's surface_dict |
704 | proj = prj.Project() | 704 | proj = prj.Project() |
705 | proj.surface_dict[index].colour = colour | 705 | proj.surface_dict[index].colour = colour |
706 | - ps.Publisher().sendMessage('Render volume viewer') | 706 | + Publisher.sendMessage('Render volume viewer') |
707 | 707 | ||
708 | def OnExportSurface(self, pubsub_evt): | 708 | def OnExportSurface(self, pubsub_evt): |
709 | filename, filetype = pubsub_evt.data | 709 | filename, filetype = pubsub_evt.data |
invesalius/data/surface_process.py
@@ -119,8 +119,8 @@ class SurfaceProcess(multiprocessing.Process): | @@ -119,8 +119,8 @@ class SurfaceProcess(multiprocessing.Process): | ||
119 | contour.ComputeScalarsOn() | 119 | contour.ComputeScalarsOn() |
120 | contour.ComputeGradientsOn() | 120 | contour.ComputeGradientsOn() |
121 | contour.ComputeNormalsOn() | 121 | contour.ComputeNormalsOn() |
122 | - contour.AddObserver("ProgressEvent", lambda obj,evt: | ||
123 | - self.SendProgress(obj, _("Generating 3D surface..."))) | 122 | + #contour.AddObserver("ProgressEvent", lambda obj,evt: |
123 | + # self.SendProgress(obj, _("Generating 3D surface..."))) | ||
124 | polydata = contour.GetOutput() | 124 | polydata = contour.GetOutput() |
125 | #else: #mode == "GRAYSCALE": | 125 | #else: #mode == "GRAYSCALE": |
126 | #mcubes = vtk.vtkMarchingCubes() | 126 | #mcubes = vtk.vtkMarchingCubes() |
invesalius/data/viewer_slice.py
@@ -27,7 +27,7 @@ import vtk | @@ -27,7 +27,7 @@ import vtk | ||
27 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | 27 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
28 | 28 | ||
29 | import wx | 29 | import wx |
30 | -import wx.lib.pubsub as ps | 30 | +from wx.lib.pubsub import pub as Publisher |
31 | 31 | ||
32 | import constants as const | 32 | import constants as const |
33 | import cursor_actors as ca | 33 | import cursor_actors as ca |
@@ -229,10 +229,10 @@ class Viewer(wx.Panel): | @@ -229,10 +229,10 @@ class Viewer(wx.Panel): | ||
229 | 229 | ||
230 | if state == const.SLICE_STATE_CROSS: | 230 | if state == const.SLICE_STATE_CROSS: |
231 | self.__set_cross_visibility(1) | 231 | self.__set_cross_visibility(1) |
232 | - ps.Publisher().sendMessage('Activate ball reference') | 232 | + Publisher.sendMessage('Activate ball reference') |
233 | else: | 233 | else: |
234 | self.__set_cross_visibility(0) | 234 | self.__set_cross_visibility(0) |
235 | - ps.Publisher().sendMessage('Deactivate ball reference') | 235 | + Publisher.sendMessage('Deactivate ball reference') |
236 | 236 | ||
237 | if state == const.STATE_WL: | 237 | if state == const.STATE_WL: |
238 | self.on_wl = True | 238 | self.on_wl = True |
@@ -322,7 +322,7 @@ class Viewer(wx.Panel): | @@ -322,7 +322,7 @@ class Viewer(wx.Panel): | ||
322 | 322 | ||
323 | def OnReleaseRightButton(self, evt, obj): | 323 | def OnReleaseRightButton(self, evt, obj): |
324 | self.right_pressed = 0 | 324 | self.right_pressed = 0 |
325 | - ps.Publisher().sendMessage('Update slice viewer') | 325 | + Publisher.sendMessage('Update slice viewer') |
326 | 326 | ||
327 | def OnLeftClick(self, evt, obj): | 327 | def OnLeftClick(self, evt, obj): |
328 | self.left_pressed = 1 | 328 | self.left_pressed = 1 |
@@ -332,7 +332,7 @@ class Viewer(wx.Panel): | @@ -332,7 +332,7 @@ class Viewer(wx.Panel): | ||
332 | 332 | ||
333 | def OnReleaseLeftButton(self, evt, obj): | 333 | def OnReleaseLeftButton(self, evt, obj): |
334 | self.left_pressed = 0 | 334 | self.left_pressed = 0 |
335 | - ps.Publisher().sendMessage('Update slice viewer') | 335 | + Publisher.sendMessage('Update slice viewer') |
336 | 336 | ||
337 | def OnWindowLevelMove(self, evt, obj): | 337 | def OnWindowLevelMove(self, evt, obj): |
338 | if (self.left_pressed): | 338 | if (self.left_pressed): |
@@ -342,7 +342,7 @@ class Viewer(wx.Panel): | @@ -342,7 +342,7 @@ class Viewer(wx.Panel): | ||
342 | self.acum_achange_level += mouse_y - self.last_y | 342 | self.acum_achange_level += mouse_y - self.last_y |
343 | self.last_x, self.last_y = mouse_x, mouse_y | 343 | self.last_x, self.last_y = mouse_x, mouse_y |
344 | 344 | ||
345 | - ps.Publisher().sendMessage('Bright and contrast adjustment image', | 345 | + Publisher.sendMessage('Bright and contrast adjustment image', |
346 | (self.acum_achange_window, self.acum_achange_level)) | 346 | (self.acum_achange_window, self.acum_achange_level)) |
347 | 347 | ||
348 | #self.SetWLText(self.acum_achange_level, | 348 | #self.SetWLText(self.acum_achange_level, |
@@ -350,12 +350,12 @@ class Viewer(wx.Panel): | @@ -350,12 +350,12 @@ class Viewer(wx.Panel): | ||
350 | 350 | ||
351 | const.WINDOW_LEVEL['Manual'] = (self.acum_achange_window,\ | 351 | const.WINDOW_LEVEL['Manual'] = (self.acum_achange_window,\ |
352 | self.acum_achange_level) | 352 | self.acum_achange_level) |
353 | - ps.Publisher().sendMessage('Check window and level other') | ||
354 | - ps.Publisher().sendMessage('Update window level value',(self.acum_achange_window, | 353 | + Publisher.sendMessage('Check window and level other') |
354 | + Publisher.sendMessage('Update window level value',(self.acum_achange_window, | ||
355 | self.acum_achange_level)) | 355 | self.acum_achange_level)) |
356 | #Necessary update the slice plane in the volume case exists | 356 | #Necessary update the slice plane in the volume case exists |
357 | - ps.Publisher().sendMessage('Update slice viewer') | ||
358 | - ps.Publisher().sendMessage('Render volume viewer') | 357 | + Publisher.sendMessage('Update slice viewer') |
358 | + Publisher.sendMessage('Render volume viewer') | ||
359 | 359 | ||
360 | def OnWindowLevelClick(self, evt, obj): | 360 | def OnWindowLevelClick(self, evt, obj): |
361 | self.last_x, self.last_y = self.interactor.GetLastEventPosition() | 361 | self.last_x, self.last_y = self.interactor.GetLastEventPosition() |
@@ -364,7 +364,7 @@ class Viewer(wx.Panel): | @@ -364,7 +364,7 @@ class Viewer(wx.Panel): | ||
364 | window, level = pubsub_evt.data | 364 | window, level = pubsub_evt.data |
365 | self.acum_achange_window, self.acum_achange_level = (window, level) | 365 | self.acum_achange_window, self.acum_achange_level = (window, level) |
366 | self.SetWLText(window, level) | 366 | self.SetWLText(window, level) |
367 | - ps.Publisher().sendMessage('Update all slice') | 367 | + Publisher.sendMessage('Update all slice') |
368 | 368 | ||
369 | 369 | ||
370 | def OnChangeSliceMove(self, evt, obj): | 370 | def OnChangeSliceMove(self, evt, obj): |
@@ -816,11 +816,11 @@ class Viewer(wx.Panel): | @@ -816,11 +816,11 @@ class Viewer(wx.Panel): | ||
816 | coord = self.calcultate_scroll_position(position) | 816 | coord = self.calcultate_scroll_position(position) |
817 | self.ScrollSlice(coord) | 817 | self.ScrollSlice(coord) |
818 | 818 | ||
819 | - ps.Publisher().sendMessage('Update cross position', coord_cross) | ||
820 | - ps.Publisher().sendMessage('Set ball reference position based on bound', | 819 | + Publisher.sendMessage('Update cross position', coord_cross) |
820 | + Publisher.sendMessage('Set ball reference position based on bound', | ||
821 | coord_cross) | 821 | coord_cross) |
822 | - ps.Publisher().sendMessage('Set camera in volume', coord_cross) | ||
823 | - ps.Publisher().sendMessage('Render volume viewer') | 822 | + Publisher.sendMessage('Set camera in volume', coord_cross) |
823 | + Publisher.sendMessage('Render volume viewer') | ||
824 | 824 | ||
825 | self.interactor.Render() | 825 | self.interactor.Render() |
826 | 826 | ||
@@ -831,26 +831,26 @@ class Viewer(wx.Panel): | @@ -831,26 +831,26 @@ class Viewer(wx.Panel): | ||
831 | position = self.slice_data.actor.GetInput().FindPoint(x, y, z) | 831 | position = self.slice_data.actor.GetInput().FindPoint(x, y, z) |
832 | coord_cross = self.slice_data.actor.GetInput().GetPoint(position) | 832 | coord_cross = self.slice_data.actor.GetInput().GetPoint(position) |
833 | coord = self.calcultate_scroll_position(position) | 833 | coord = self.calcultate_scroll_position(position) |
834 | - ps.Publisher().sendMessage('Update cross position', coord_cross) | 834 | + Publisher.sendMessage('Update cross position', coord_cross) |
835 | 835 | ||
836 | self.ScrollSlice(coord) | 836 | self.ScrollSlice(coord) |
837 | self.interactor.Render() | 837 | self.interactor.Render() |
838 | 838 | ||
839 | def ScrollSlice(self, coord): | 839 | def ScrollSlice(self, coord): |
840 | if self.orientation == "AXIAL": | 840 | if self.orientation == "AXIAL": |
841 | - ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), | 841 | + Publisher.sendMessage(('Set scroll position', 'SAGITAL'), |
842 | coord[0]) | 842 | coord[0]) |
843 | - ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), | 843 | + Publisher.sendMessage(('Set scroll position', 'CORONAL'), |
844 | coord[1]) | 844 | coord[1]) |
845 | elif self.orientation == "SAGITAL": | 845 | elif self.orientation == "SAGITAL": |
846 | - ps.Publisher().sendMessage(('Set scroll position', 'AXIAL'), | 846 | + Publisher.sendMessage(('Set scroll position', 'AXIAL'), |
847 | coord[2]) | 847 | coord[2]) |
848 | - ps.Publisher().sendMessage(('Set scroll position', 'CORONAL'), | 848 | + Publisher.sendMessage(('Set scroll position', 'CORONAL'), |
849 | coord[1]) | 849 | coord[1]) |
850 | elif self.orientation == "CORONAL": | 850 | elif self.orientation == "CORONAL": |
851 | - ps.Publisher().sendMessage(('Set scroll position', 'AXIAL'), | 851 | + Publisher.sendMessage(('Set scroll position', 'AXIAL'), |
852 | coord[2]) | 852 | coord[2]) |
853 | - ps.Publisher().sendMessage(('Set scroll position', 'SAGITAL'), | 853 | + Publisher.sendMessage(('Set scroll position', 'SAGITAL'), |
854 | coord[0]) | 854 | coord[0]) |
855 | 855 | ||
856 | def OnZoomMoveRight(self, evt, obj): | 856 | def OnZoomMoveRight(self, evt, obj): |
@@ -952,61 +952,61 @@ class Viewer(wx.Panel): | @@ -952,61 +952,61 @@ class Viewer(wx.Panel): | ||
952 | return x, y, z | 952 | return x, y, z |
953 | 953 | ||
954 | def __bind_events(self): | 954 | def __bind_events(self): |
955 | - ps.Publisher().subscribe(self.LoadImagedata, | 955 | + Publisher.subscribe(self.LoadImagedata, |
956 | 'Load slice to viewer') | 956 | 'Load slice to viewer') |
957 | - ps.Publisher().subscribe(self.SetBrushColour, | 957 | + Publisher.subscribe(self.SetBrushColour, |
958 | 'Change mask colour') | 958 | 'Change mask colour') |
959 | - ps.Publisher().subscribe(self.UpdateRender, | 959 | + Publisher.subscribe(self.UpdateRender, |
960 | 'Update slice viewer') | 960 | 'Update slice viewer') |
961 | - ps.Publisher().subscribe(self.ChangeSliceNumber, | 961 | + Publisher.subscribe(self.ChangeSliceNumber, |
962 | ('Set scroll position', | 962 | ('Set scroll position', |
963 | self.orientation)) | 963 | self.orientation)) |
964 | - ps.Publisher().subscribe(self.__update_cross_position, | 964 | + Publisher.subscribe(self.__update_cross_position, |
965 | 'Update cross position') | 965 | 'Update cross position') |
966 | - ps.Publisher().subscribe(self.Navigation, | 966 | + Publisher.subscribe(self.Navigation, |
967 | 'Co-registered Points') | 967 | 'Co-registered Points') |
968 | ### | 968 | ### |
969 | - ps.Publisher().subscribe(self.ChangeBrushSize, | 969 | + Publisher.subscribe(self.ChangeBrushSize, |
970 | 'Set edition brush size') | 970 | 'Set edition brush size') |
971 | - ps.Publisher().subscribe(self.ChangeBrushColour, | 971 | + Publisher.subscribe(self.ChangeBrushColour, |
972 | 'Add mask') | 972 | 'Add mask') |
973 | - ps.Publisher().subscribe(self.ChangeBrushActor, | 973 | + Publisher.subscribe(self.ChangeBrushActor, |
974 | 'Set brush format') | 974 | 'Set brush format') |
975 | - ps.Publisher().subscribe(self.ChangeBrushOperation, | 975 | + Publisher.subscribe(self.ChangeBrushOperation, |
976 | 'Set edition operation') | 976 | 'Set edition operation') |
977 | 977 | ||
978 | - ps.Publisher().subscribe(self.UpdateWindowLevelValue,\ | 978 | + Publisher.subscribe(self.UpdateWindowLevelValue,\ |
979 | 'Update window level value') | 979 | 'Update window level value') |
980 | 980 | ||
981 | - #ps.Publisher().subscribe(self.__set_cross_visibility,\ | 981 | + #Publisher.subscribe(self.__set_cross_visibility,\ |
982 | # 'Set cross visibility') | 982 | # 'Set cross visibility') |
983 | ### | 983 | ### |
984 | - ps.Publisher().subscribe(self.__set_layout, | 984 | + Publisher.subscribe(self.__set_layout, |
985 | 'Set slice viewer layout') | 985 | 'Set slice viewer layout') |
986 | 986 | ||
987 | - ps.Publisher().subscribe(self.OnSetInteractorStyle, | 987 | + Publisher.subscribe(self.OnSetInteractorStyle, |
988 | 'Set slice interaction style') | 988 | 'Set slice interaction style') |
989 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | 989 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
990 | 990 | ||
991 | ##### | 991 | ##### |
992 | - ps.Publisher().subscribe(self.OnShowText, | 992 | + Publisher.subscribe(self.OnShowText, |
993 | 'Show text actors on viewers') | 993 | 'Show text actors on viewers') |
994 | - ps.Publisher().subscribe(self.OnHideText, | 994 | + Publisher.subscribe(self.OnHideText, |
995 | 'Hide text actors on viewers') | 995 | 'Hide text actors on viewers') |
996 | - ps.Publisher().subscribe(self.OnExportPicture,'Export picture to file') | ||
997 | - ps.Publisher().subscribe(self.SetDefaultCursor, 'Set interactor default cursor') | 996 | + Publisher.subscribe(self.OnExportPicture,'Export picture to file') |
997 | + Publisher.subscribe(self.SetDefaultCursor, 'Set interactor default cursor') | ||
998 | 998 | ||
999 | - ps.Publisher().subscribe(self.AddActors, ('Add actors', ORIENTATIONS[self.orientation])) | ||
1000 | - ps.Publisher().subscribe(self.RemoveActors, ('Remove actors', ORIENTATIONS[self.orientation])) | 999 | + Publisher.subscribe(self.AddActors, 'Add actors ' + str(ORIENTATIONS[self.orientation])) |
1000 | + Publisher.subscribe(self.RemoveActors, 'Remove actors ' + str(ORIENTATIONS[self.orientation])) | ||
1001 | 1001 | ||
1002 | - ps.Publisher().subscribe(self.ReloadActualSlice, 'Reload actual slice') | 1002 | + Publisher.subscribe(self.ReloadActualSlice, 'Reload actual slice') |
1003 | 1003 | ||
1004 | 1004 | ||
1005 | def SetDefaultCursor(self, pusub_evt): | 1005 | def SetDefaultCursor(self, pusub_evt): |
1006 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) | 1006 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) |
1007 | 1007 | ||
1008 | def OnExportPicture(self, pubsub_evt): | 1008 | def OnExportPicture(self, pubsub_evt): |
1009 | - ps.Publisher().sendMessage('Begin busy cursor') | 1009 | + Publisher.sendMessage('Begin busy cursor') |
1010 | view_prop_list = [] | 1010 | view_prop_list = [] |
1011 | for slice_data in self.slice_data_list: | 1011 | for slice_data in self.slice_data_list: |
1012 | view_prop_list.append(slice_data.box_actor) | 1012 | view_prop_list.append(slice_data.box_actor) |
@@ -1055,7 +1055,7 @@ class Viewer(wx.Panel): | @@ -1055,7 +1055,7 @@ class Viewer(wx.Panel): | ||
1055 | for actor in view_prop_list: | 1055 | for actor in view_prop_list: |
1056 | self.ren.AddViewProp(actor) | 1056 | self.ren.AddViewProp(actor) |
1057 | 1057 | ||
1058 | - ps.Publisher().sendMessage('End busy cursor') | 1058 | + Publisher.sendMessage('End busy cursor') |
1059 | 1059 | ||
1060 | def OnShowText(self, pubsub_evt): | 1060 | def OnShowText(self, pubsub_evt): |
1061 | self.ShowTextActors() | 1061 | self.ShowTextActors() |
@@ -1084,7 +1084,7 @@ class Viewer(wx.Panel): | @@ -1084,7 +1084,7 @@ class Viewer(wx.Panel): | ||
1084 | self.SetInteractorStyle(state) | 1084 | self.SetInteractorStyle(state) |
1085 | 1085 | ||
1086 | if (state != const.SLICE_STATE_EDITOR): | 1086 | if (state != const.SLICE_STATE_EDITOR): |
1087 | - ps.Publisher().sendMessage('Set interactor default cursor') | 1087 | + Publisher.sendMessage('Set interactor default cursor') |
1088 | 1088 | ||
1089 | def ChangeBrushOperation(self, pubsub_evt): | 1089 | def ChangeBrushOperation(self, pubsub_evt): |
1090 | self._brush_cursor_op = pubsub_evt.data | 1090 | self._brush_cursor_op = pubsub_evt.data |
@@ -1342,7 +1342,7 @@ class Viewer(wx.Panel): | @@ -1342,7 +1342,7 @@ class Viewer(wx.Panel): | ||
1342 | def UpdateSlice3D(self, pos): | 1342 | def UpdateSlice3D(self, pos): |
1343 | original_orientation = project.Project().original_orientation | 1343 | original_orientation = project.Project().original_orientation |
1344 | pos = self.scroll.GetThumbPosition() | 1344 | pos = self.scroll.GetThumbPosition() |
1345 | - ps.Publisher().sendMessage('Change slice from slice plane',\ | 1345 | + Publisher.sendMessage('Change slice from slice plane',\ |
1346 | (self.orientation, pos)) | 1346 | (self.orientation, pos)) |
1347 | 1347 | ||
1348 | def OnScrollBar(self, evt=None, update3D=True): | 1348 | def OnScrollBar(self, evt=None, update3D=True): |
@@ -1354,8 +1354,8 @@ class Viewer(wx.Panel): | @@ -1354,8 +1354,8 @@ class Viewer(wx.Panel): | ||
1354 | # Update other slice's cross according to the new focal point from | 1354 | # Update other slice's cross according to the new focal point from |
1355 | # the actual orientation. | 1355 | # the actual orientation. |
1356 | focal_point = self.cross.GetFocalPoint() | 1356 | focal_point = self.cross.GetFocalPoint() |
1357 | - ps.Publisher().sendMessage('Update cross position', focal_point) | ||
1358 | - ps.Publisher().sendMessage('Update slice viewer') | 1357 | + Publisher.sendMessage('Update cross position', focal_point) |
1358 | + Publisher.sendMessage('Update slice viewer') | ||
1359 | else: | 1359 | else: |
1360 | self.interactor.Render() | 1360 | self.interactor.Render() |
1361 | if evt: | 1361 | if evt: |
@@ -1465,7 +1465,7 @@ class Viewer(wx.Panel): | @@ -1465,7 +1465,7 @@ class Viewer(wx.Panel): | ||
1465 | print x, y, z | 1465 | print x, y, z |
1466 | if self.pick.GetViewProp(): | 1466 | if self.pick.GetViewProp(): |
1467 | self.render_to_add = slice_data.renderer | 1467 | self.render_to_add = slice_data.renderer |
1468 | - ps.Publisher().sendMessage("Add measurement point", | 1468 | + Publisher.sendMessage("Add measurement point", |
1469 | ((x, y,z), const.LINEAR, ORIENTATIONS[self.orientation], | 1469 | ((x, y,z), const.LINEAR, ORIENTATIONS[self.orientation], |
1470 | slice_number)) | 1470 | slice_number)) |
1471 | self.interactor.Render() | 1471 | self.interactor.Render() |
@@ -1479,7 +1479,7 @@ class Viewer(wx.Panel): | @@ -1479,7 +1479,7 @@ class Viewer(wx.Panel): | ||
1479 | x, y, z = self.pick.GetPickPosition() | 1479 | x, y, z = self.pick.GetPickPosition() |
1480 | if self.pick.GetViewProp(): | 1480 | if self.pick.GetViewProp(): |
1481 | self.render_to_add = slice_data.renderer | 1481 | self.render_to_add = slice_data.renderer |
1482 | - ps.Publisher().sendMessage("Add measurement point", | 1482 | + Publisher.sendMessage("Add measurement point", |
1483 | ((x, y,z), const.ANGULAR, ORIENTATIONS[self.orientation], | 1483 | ((x, y,z), const.ANGULAR, ORIENTATIONS[self.orientation], |
1484 | slice_number)) | 1484 | slice_number)) |
1485 | self.interactor.Render() | 1485 | self.interactor.Render() |
invesalius/data/viewer_volume.py
@@ -26,7 +26,7 @@ import numpy | @@ -26,7 +26,7 @@ import numpy | ||
26 | import wx | 26 | import wx |
27 | import vtk | 27 | import vtk |
28 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | 28 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
29 | -import wx.lib.pubsub as ps | 29 | +from wx.lib.pubsub import pub as Publisher |
30 | 30 | ||
31 | import constants as const | 31 | import constants as const |
32 | import data.bases as bases | 32 | import data.bases as bases |
@@ -111,75 +111,74 @@ class Viewer(wx.Panel): | @@ -111,75 +111,74 @@ class Viewer(wx.Panel): | ||
111 | self.added_actor = 0 | 111 | self.added_actor = 0 |
112 | 112 | ||
113 | def __bind_events(self): | 113 | def __bind_events(self): |
114 | - ps.Publisher().subscribe(self.LoadActor, | 114 | + Publisher.subscribe(self.LoadActor, |
115 | 'Load surface actor into viewer') | 115 | 'Load surface actor into viewer') |
116 | - ps.Publisher().subscribe(self.RemoveActor, | 116 | + Publisher.subscribe(self.RemoveActor, |
117 | 'Remove surface actor from viewer') | 117 | 'Remove surface actor from viewer') |
118 | - ps.Publisher().subscribe(self.UpdateRender, | 118 | + Publisher.subscribe(self.UpdateRender, |
119 | 'Render volume viewer') | 119 | 'Render volume viewer') |
120 | - ps.Publisher().subscribe(self.ChangeBackgroundColour, | 120 | + Publisher.subscribe(self.ChangeBackgroundColour, |
121 | 'Change volume viewer background colour') | 121 | 'Change volume viewer background colour') |
122 | # Raycating - related | 122 | # Raycating - related |
123 | - ps.Publisher().subscribe(self.LoadVolume, | 123 | + Publisher.subscribe(self.LoadVolume, |
124 | 'Load volume into viewer') | 124 | 'Load volume into viewer') |
125 | - ps.Publisher().subscribe(self.OnSetWindowLevelText, | 125 | + Publisher.subscribe(self.OnSetWindowLevelText, |
126 | 'Set volume window and level text') | 126 | 'Set volume window and level text') |
127 | - ps.Publisher().subscribe(self.OnHideRaycasting, | 127 | + Publisher.subscribe(self.OnHideRaycasting, |
128 | 'Hide raycasting volume') | 128 | 'Hide raycasting volume') |
129 | - ps.Publisher().subscribe(self.OnShowRaycasting, | 129 | + Publisher.subscribe(self.OnShowRaycasting, |
130 | 'Update raycasting preset') | 130 | 'Update raycasting preset') |
131 | ### | 131 | ### |
132 | - ps.Publisher().subscribe(self.AppendActor,'AppendActor') | ||
133 | - ps.Publisher().subscribe(self.SetWidgetInteractor, | 132 | + Publisher.subscribe(self.AppendActor,'AppendActor') |
133 | + Publisher.subscribe(self.SetWidgetInteractor, | ||
134 | 'Set Widget Interactor') | 134 | 'Set Widget Interactor') |
135 | - ps.Publisher().subscribe(self.OnSetViewAngle, | 135 | + Publisher.subscribe(self.OnSetViewAngle, |
136 | 'Set volume view angle') | 136 | 'Set volume view angle') |
137 | 137 | ||
138 | - ps.Publisher().subscribe(self.OnDisableBrightContrast, | ||
139 | - ('Set interaction mode', | ||
140 | - const.MODE_SLICE_EDITOR)) | 138 | + Publisher.subscribe(self.OnDisableBrightContrast, |
139 | + 'Set interaction mode '+ | ||
140 | + str(const.MODE_SLICE_EDITOR)) | ||
141 | 141 | ||
142 | - ps.Publisher().subscribe(self.OnExportSurface, 'Export surface to file') | 142 | + Publisher.subscribe(self.OnExportSurface, 'Export surface to file') |
143 | 143 | ||
144 | - ps.Publisher().subscribe(self.LoadSlicePlane, 'Load slice plane') | 144 | + Publisher.subscribe(self.LoadSlicePlane, 'Load slice plane') |
145 | 145 | ||
146 | - ps.Publisher().subscribe(self.ResetCamClippingRange, 'Reset cam clipping range') | ||
147 | - ps.Publisher().subscribe(self.SetVolumeCamera, 'Set camera in volume') | 146 | + Publisher.subscribe(self.ResetCamClippingRange, 'Reset cam clipping range') |
147 | + Publisher.subscribe(self.SetVolumeCamera, 'Set camera in volume') | ||
148 | 148 | ||
149 | - ps.Publisher().subscribe(self.OnEnableStyle, 'Enable style') | ||
150 | - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable style') | 149 | + Publisher.subscribe(self.OnEnableStyle, 'Enable style') |
150 | + Publisher.subscribe(self.OnDisableStyle, 'Disable style') | ||
151 | 151 | ||
152 | - ps.Publisher().subscribe(self.OnHideText, | 152 | + Publisher.subscribe(self.OnHideText, |
153 | 'Hide text actors on viewers') | 153 | 'Hide text actors on viewers') |
154 | 154 | ||
155 | - ps.Publisher().subscribe(self.AddActors, ('Add actors', const.SURFACE)) | ||
156 | - ps.Publisher().subscribe(self.RemoveActors, ('Remove actors', | ||
157 | - const.SURFACE)) | 155 | + Publisher.subscribe(self.AddActors, 'Add actors ' + str(const.SURFACE)) |
156 | + Publisher.subscribe(self.RemoveActors, 'Remove actors ' + str(const.SURFACE)) | ||
158 | 157 | ||
159 | - ps.Publisher().subscribe(self.OnShowText, | 158 | + Publisher.subscribe(self.OnShowText, |
160 | 'Show text actors on viewers') | 159 | 'Show text actors on viewers') |
161 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | 160 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
162 | 161 | ||
163 | - ps.Publisher().subscribe(self.RemoveAllActor, 'Remove all volume actors') | 162 | + Publisher.subscribe(self.RemoveAllActor, 'Remove all volume actors') |
164 | 163 | ||
165 | - ps.Publisher().subscribe(self.OnExportPicture,'Export picture to file') | 164 | + Publisher.subscribe(self.OnExportPicture,'Export picture to file') |
166 | 165 | ||
167 | - ps.Publisher().subscribe(self.OnStartSeed,'Create surface by seeding - start') | ||
168 | - ps.Publisher().subscribe(self.OnEndSeed,'Create surface by seeding - end') | 166 | + Publisher.subscribe(self.OnStartSeed,'Create surface by seeding - start') |
167 | + Publisher.subscribe(self.OnEndSeed,'Create surface by seeding - end') | ||
169 | 168 | ||
170 | - ps.Publisher().subscribe(self.ActivateBallReference, | 169 | + Publisher.subscribe(self.ActivateBallReference, |
171 | 'Activate ball reference') | 170 | 'Activate ball reference') |
172 | - ps.Publisher().subscribe(self.DeactivateBallReference, | 171 | + Publisher.subscribe(self.DeactivateBallReference, |
173 | 'Deactivate ball reference') | 172 | 'Deactivate ball reference') |
174 | - ps.Publisher().subscribe(self.SetBallReferencePosition, | 173 | + Publisher.subscribe(self.SetBallReferencePosition, |
175 | 'Set ball reference position') | 174 | 'Set ball reference position') |
176 | - ps.Publisher().subscribe(self.SetBallReferencePositionBasedOnBound, | 175 | + Publisher.subscribe(self.SetBallReferencePositionBasedOnBound, |
177 | 'Set ball reference position based on bound') | 176 | 'Set ball reference position based on bound') |
178 | - ps.Publisher().subscribe(self.SetStereoMode, 'Set stereo mode') | 177 | + Publisher.subscribe(self.SetStereoMode, 'Set stereo mode') |
179 | 178 | ||
180 | - ps.Publisher().subscribe(self.Reposition3DPlane, 'Reposition 3D Plane') | 179 | + Publisher.subscribe(self.Reposition3DPlane, 'Reposition 3D Plane') |
181 | 180 | ||
182 | - ps.Publisher().subscribe(self.RemoveVolume, 'Remove Volume') | 181 | + Publisher.subscribe(self.RemoveVolume, 'Remove Volume') |
183 | 182 | ||
184 | 183 | ||
185 | 184 | ||
@@ -249,11 +248,11 @@ class Viewer(wx.Panel): | @@ -249,11 +248,11 @@ class Viewer(wx.Panel): | ||
249 | self.seed_points = [] | 248 | self.seed_points = [] |
250 | 249 | ||
251 | def OnEndSeed(self, pubsub_evt): | 250 | def OnEndSeed(self, pubsub_evt): |
252 | - ps.Publisher().sendMessage("Create surface from seeds", | 251 | + Publisher.sendMessage("Create surface from seeds", |
253 | self.seed_points) | 252 | self.seed_points) |
254 | 253 | ||
255 | def OnExportPicture(self, pubsub_evt): | 254 | def OnExportPicture(self, pubsub_evt): |
256 | - ps.Publisher().sendMessage('Begin busy cursor') | 255 | + Publisher.sendMessage('Begin busy cursor') |
257 | id, filename, filetype = pubsub_evt.data | 256 | id, filename, filetype = pubsub_evt.data |
258 | if id == const.VOLUME: | 257 | if id == const.VOLUME: |
259 | if filetype == const.FILETYPE_POV: | 258 | if filetype == const.FILETYPE_POV: |
@@ -289,7 +288,7 @@ class Viewer(wx.Panel): | @@ -289,7 +288,7 @@ class Viewer(wx.Panel): | ||
289 | writer.SetInput(image) | 288 | writer.SetInput(image) |
290 | writer.SetFileName(filename) | 289 | writer.SetFileName(filename) |
291 | writer.Write() | 290 | writer.Write() |
292 | - ps.Publisher().sendMessage('End busy cursor') | 291 | + Publisher.sendMessage('End busy cursor') |
293 | 292 | ||
294 | 293 | ||
295 | 294 | ||
@@ -301,7 +300,7 @@ class Viewer(wx.Panel): | @@ -301,7 +300,7 @@ class Viewer(wx.Panel): | ||
301 | self.slice_plane.Disable() | 300 | self.slice_plane.Disable() |
302 | self.slice_plane.DeletePlanes() | 301 | self.slice_plane.DeletePlanes() |
303 | del self.slice_plane | 302 | del self.slice_plane |
304 | - ps.Publisher().sendMessage('Uncheck image plane menu') | 303 | + Publisher.sendMessage('Uncheck image plane menu') |
305 | self.mouse_pressed = 0 | 304 | self.mouse_pressed = 0 |
306 | self.on_wl = False | 305 | self.on_wl = False |
307 | self.slice_plane = 0 | 306 | self.slice_plane = 0 |
@@ -499,9 +498,9 @@ class Viewer(wx.Panel): | @@ -499,9 +498,9 @@ class Viewer(wx.Panel): | ||
499 | diff_x = mouse_x - self.last_x | 498 | diff_x = mouse_x - self.last_x |
500 | diff_y = mouse_y - self.last_y | 499 | diff_y = mouse_y - self.last_y |
501 | self.last_x, self.last_y = mouse_x, mouse_y | 500 | self.last_x, self.last_y = mouse_x, mouse_y |
502 | - ps.Publisher().sendMessage('Set raycasting relative window and level', | 501 | + Publisher.sendMessage('Set raycasting relative window and level', |
503 | (diff_x, diff_y)) | 502 | (diff_x, diff_y)) |
504 | - ps.Publisher().sendMessage('Refresh raycasting widget points', None) | 503 | + Publisher.sendMessage('Refresh raycasting widget points', None) |
505 | self.interactor.Render() | 504 | self.interactor.Render() |
506 | 505 | ||
507 | def OnWindowLevelClick(self, obj, evt): | 506 | def OnWindowLevelClick(self, obj, evt): |
@@ -655,7 +654,7 @@ class Viewer(wx.Panel): | @@ -655,7 +654,7 @@ class Viewer(wx.Panel): | ||
655 | def RemoveAllActor(self, pubsub_evt): | 654 | def RemoveAllActor(self, pubsub_evt): |
656 | utils.debug("RemoveAllActor") | 655 | utils.debug("RemoveAllActor") |
657 | self.ren.RemoveAllProps() | 656 | self.ren.RemoveAllProps() |
658 | - ps.Publisher().sendMessage('Render volume viewer') | 657 | + Publisher.sendMessage('Render volume viewer') |
659 | 658 | ||
660 | 659 | ||
661 | def LoadSlicePlane(self, pubsub_evt): | 660 | def LoadSlicePlane(self, pubsub_evt): |
@@ -775,9 +774,9 @@ class Viewer(wx.Panel): | @@ -775,9 +774,9 @@ class Viewer(wx.Panel): | ||
775 | # m = self.measures[-1] | 774 | # m = self.measures[-1] |
776 | # m.AddPoint(x, y, z) | 775 | # m.AddPoint(x, y, z) |
777 | # if m.IsComplete(): | 776 | # if m.IsComplete(): |
778 | - # ps.Publisher().sendMessage("Add measure to list", | 777 | + # Publisher.sendMessage("Add measure to list", |
779 | # (u"3D", _(u"%.3f mm" % m.GetValue()))) | 778 | # (u"3D", _(u"%.3f mm" % m.GetValue()))) |
780 | - ps.Publisher().sendMessage("Add measurement point", | 779 | + Publisher.sendMessage("Add measurement point", |
781 | ((x, y,z), const.LINEAR, const.SURFACE)) | 780 | ((x, y,z), const.LINEAR, const.SURFACE)) |
782 | self.interactor.Render() | 781 | self.interactor.Render() |
783 | 782 | ||
@@ -802,11 +801,11 @@ class Viewer(wx.Panel): | @@ -802,11 +801,11 @@ class Viewer(wx.Panel): | ||
802 | # location = u"3D" | 801 | # location = u"3D" |
803 | # value = u"%.2f˚"% m.GetValue() | 802 | # value = u"%.2f˚"% m.GetValue() |
804 | # msg = 'Update measurement info in GUI', | 803 | # msg = 'Update measurement info in GUI', |
805 | - # ps.Publisher().sendMessage(msg, | 804 | + # Publisher.sendMessage(msg, |
806 | # (index, name, colour, | 805 | # (index, name, colour, |
807 | # type_, location, | 806 | # type_, location, |
808 | # value)) | 807 | # value)) |
809 | - ps.Publisher().sendMessage("Add measurement point", | 808 | + Publisher.sendMessage("Add measurement point", |
810 | ((x, y,z), const.ANGULAR, const.SURFACE)) | 809 | ((x, y,z), const.ANGULAR, const.SURFACE)) |
811 | self.interactor.Render() | 810 | self.interactor.Render() |
812 | 811 | ||
@@ -837,15 +836,15 @@ class SlicePlane: | @@ -837,15 +836,15 @@ class SlicePlane: | ||
837 | self.__bind_evt() | 836 | self.__bind_evt() |
838 | 837 | ||
839 | def __bind_evt(self): | 838 | def __bind_evt(self): |
840 | - ps.Publisher().subscribe(self.Enable, 'Enable plane') | ||
841 | - ps.Publisher().subscribe(self.Disable, 'Disable plane') | ||
842 | - ps.Publisher().subscribe(self.ChangeSlice, 'Change slice from slice plane') | ||
843 | - ps.Publisher().subscribe(self.UpdateAllSlice, 'Update all slice') | 839 | + Publisher.subscribe(self.Enable, 'Enable plane') |
840 | + Publisher.subscribe(self.Disable, 'Disable plane') | ||
841 | + Publisher.subscribe(self.ChangeSlice, 'Change slice from slice plane') | ||
842 | + Publisher.subscribe(self.UpdateAllSlice, 'Update all slice') | ||
844 | 843 | ||
845 | def Create(self): | 844 | def Create(self): |
846 | plane_x = self.plane_x = vtk.vtkImagePlaneWidget() | 845 | plane_x = self.plane_x = vtk.vtkImagePlaneWidget() |
847 | plane_x.InteractionOff() | 846 | plane_x.InteractionOff() |
848 | - ps.Publisher().sendMessage('Input Image in the widget', | 847 | + Publisher.sendMessage('Input Image in the widget', |
849 | (plane_x, 'SAGITAL')) | 848 | (plane_x, 'SAGITAL')) |
850 | plane_x.SetPlaneOrientationToXAxes() | 849 | plane_x.SetPlaneOrientationToXAxes() |
851 | plane_x.TextureVisibilityOn() | 850 | plane_x.TextureVisibilityOn() |
@@ -857,7 +856,7 @@ class SlicePlane: | @@ -857,7 +856,7 @@ class SlicePlane: | ||
857 | 856 | ||
858 | plane_y = self.plane_y = vtk.vtkImagePlaneWidget() | 857 | plane_y = self.plane_y = vtk.vtkImagePlaneWidget() |
859 | plane_y.DisplayTextOff() | 858 | plane_y.DisplayTextOff() |
860 | - ps.Publisher().sendMessage('Input Image in the widget', | 859 | + Publisher.sendMessage('Input Image in the widget', |
861 | (plane_y, 'CORONAL')) | 860 | (plane_y, 'CORONAL')) |
862 | plane_y.SetPlaneOrientationToYAxes() | 861 | plane_y.SetPlaneOrientationToYAxes() |
863 | plane_y.TextureVisibilityOn() | 862 | plane_y.TextureVisibilityOn() |
@@ -870,7 +869,7 @@ class SlicePlane: | @@ -870,7 +869,7 @@ class SlicePlane: | ||
870 | 869 | ||
871 | plane_z = self.plane_z = vtk.vtkImagePlaneWidget() | 870 | plane_z = self.plane_z = vtk.vtkImagePlaneWidget() |
872 | plane_z.InteractionOff() | 871 | plane_z.InteractionOff() |
873 | - ps.Publisher().sendMessage('Input Image in the widget', | 872 | + Publisher.sendMessage('Input Image in the widget', |
874 | (plane_z, 'AXIAL')) | 873 | (plane_z, 'AXIAL')) |
875 | plane_z.SetPlaneOrientationToZAxes() | 874 | plane_z.SetPlaneOrientationToZAxes() |
876 | plane_z.TextureVisibilityOn() | 875 | plane_z.TextureVisibilityOn() |
@@ -900,9 +899,9 @@ class SlicePlane: | @@ -900,9 +899,9 @@ class SlicePlane: | ||
900 | selected_prop2 = plane_y.GetSelectedPlaneProperty() | 899 | selected_prop2 = plane_y.GetSelectedPlaneProperty() |
901 | selected_prop2.SetColor(0, 1, 0) | 900 | selected_prop2.SetColor(0, 1, 0) |
902 | 901 | ||
903 | - ps.Publisher().sendMessage('Set Widget Interactor', plane_x) | ||
904 | - ps.Publisher().sendMessage('Set Widget Interactor', plane_y) | ||
905 | - ps.Publisher().sendMessage('Set Widget Interactor', plane_z) | 902 | + Publisher.sendMessage('Set Widget Interactor', plane_x) |
903 | + Publisher.sendMessage('Set Widget Interactor', plane_y) | ||
904 | + Publisher.sendMessage('Set Widget Interactor', plane_z) | ||
906 | 905 | ||
907 | self.Render() | 906 | self.Render() |
908 | 907 | ||
@@ -916,13 +915,13 @@ class SlicePlane: | @@ -916,13 +915,13 @@ class SlicePlane: | ||
916 | elif(label == "Sagital"): | 915 | elif(label == "Sagital"): |
917 | self.plane_x.On() | 916 | self.plane_x.On() |
918 | 917 | ||
919 | - ps.Publisher().sendMessage('Reposition 3D Plane', label) | 918 | + Publisher.sendMessage('Reposition 3D Plane', label) |
920 | 919 | ||
921 | else: | 920 | else: |
922 | self.plane_z.On() | 921 | self.plane_z.On() |
923 | self.plane_x.On() | 922 | self.plane_x.On() |
924 | self.plane_y.On() | 923 | self.plane_y.On() |
925 | - ps.Publisher().sendMessage('Set volume view angle', const.VOL_ISO) | 924 | + Publisher.sendMessage('Set volume view angle', const.VOL_ISO) |
926 | self.Render() | 925 | self.Render() |
927 | 926 | ||
928 | def Disable(self, evt_pubsub=None): | 927 | def Disable(self, evt_pubsub=None): |
@@ -942,25 +941,25 @@ class SlicePlane: | @@ -942,25 +941,25 @@ class SlicePlane: | ||
942 | self.Render() | 941 | self.Render() |
943 | 942 | ||
944 | def Render(self): | 943 | def Render(self): |
945 | - ps.Publisher().sendMessage('Render volume viewer') | 944 | + Publisher.sendMessage('Render volume viewer') |
946 | 945 | ||
947 | def ChangeSlice(self, pubsub_evt = None): | 946 | def ChangeSlice(self, pubsub_evt = None): |
948 | orientation, number = pubsub_evt.data | 947 | orientation, number = pubsub_evt.data |
949 | 948 | ||
950 | if orientation == "CORONAL" and self.plane_y.GetEnabled(): | 949 | if orientation == "CORONAL" and self.plane_y.GetEnabled(): |
951 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_y,orientation)) | 950 | + Publisher.sendMessage('Update slice 3D', (self.plane_y,orientation)) |
952 | self.Render() | 951 | self.Render() |
953 | elif orientation == "SAGITAL" and self.plane_x.GetEnabled(): | 952 | elif orientation == "SAGITAL" and self.plane_x.GetEnabled(): |
954 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_x,orientation)) | 953 | + Publisher.sendMessage('Update slice 3D', (self.plane_x,orientation)) |
955 | self.Render() | 954 | self.Render() |
956 | elif orientation == 'AXIAL' and self.plane_z.GetEnabled() : | 955 | elif orientation == 'AXIAL' and self.plane_z.GetEnabled() : |
957 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_z,orientation)) | 956 | + Publisher.sendMessage('Update slice 3D', (self.plane_z,orientation)) |
958 | self.Render() | 957 | self.Render() |
959 | 958 | ||
960 | def UpdateAllSlice(self, pubsub_evt): | 959 | def UpdateAllSlice(self, pubsub_evt): |
961 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_y,"CORONAL")) | ||
962 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_x,"SAGITAL")) | ||
963 | - ps.Publisher().sendMessage('Update slice 3D', (self.plane_z,"AXIAL")) | 960 | + Publisher.sendMessage('Update slice 3D', (self.plane_y,"CORONAL")) |
961 | + Publisher.sendMessage('Update slice 3D', (self.plane_x,"SAGITAL")) | ||
962 | + Publisher.sendMessage('Update slice 3D', (self.plane_z,"AXIAL")) | ||
964 | 963 | ||
965 | 964 | ||
966 | def DeletePlanes(self): | 965 | def DeletePlanes(self): |
invesalius/data/volume.py
@@ -22,7 +22,7 @@ import os | @@ -22,7 +22,7 @@ import os | ||
22 | import numpy | 22 | import numpy |
23 | import vtk | 23 | import vtk |
24 | import wx | 24 | import wx |
25 | -import wx.lib.pubsub as ps | 25 | +from wx.lib.pubsub import pub as Publisher |
26 | 26 | ||
27 | import constants as const | 27 | import constants as const |
28 | import project as prj | 28 | import project as prj |
@@ -89,25 +89,25 @@ class Volume(): | @@ -89,25 +89,25 @@ class Volume(): | ||
89 | self.__bind_events() | 89 | self.__bind_events() |
90 | 90 | ||
91 | def __bind_events(self): | 91 | def __bind_events(self): |
92 | - ps.Publisher().subscribe(self.OnHideVolume, | 92 | + Publisher.subscribe(self.OnHideVolume, |
93 | 'Hide raycasting volume') | 93 | 'Hide raycasting volume') |
94 | - ps.Publisher().subscribe(self.OnUpdatePreset, | 94 | + Publisher.subscribe(self.OnUpdatePreset, |
95 | 'Update raycasting preset') | 95 | 'Update raycasting preset') |
96 | - ps.Publisher().subscribe(self.OnSetCurve, | 96 | + Publisher.subscribe(self.OnSetCurve, |
97 | 'Set raycasting curve') | 97 | 'Set raycasting curve') |
98 | - ps.Publisher().subscribe(self.OnSetWindowLevel, | 98 | + Publisher.subscribe(self.OnSetWindowLevel, |
99 | 'Set raycasting wwwl') | 99 | 'Set raycasting wwwl') |
100 | - ps.Publisher().subscribe(self.Refresh, | 100 | + Publisher.subscribe(self.Refresh, |
101 | 'Set raycasting refresh') | 101 | 'Set raycasting refresh') |
102 | - ps.Publisher().subscribe(self.OnSetRelativeWindowLevel, | 102 | + Publisher.subscribe(self.OnSetRelativeWindowLevel, |
103 | 'Set raycasting relative window and level') | 103 | 'Set raycasting relative window and level') |
104 | - ps.Publisher().subscribe(self.OnEnableTool, | 104 | + Publisher.subscribe(self.OnEnableTool, |
105 | 'Enable raycasting tool') | 105 | 'Enable raycasting tool') |
106 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | ||
107 | - ps.Publisher().subscribe(self.ChangeBackgroundColour, | 106 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
107 | + Publisher.subscribe(self.ChangeBackgroundColour, | ||
108 | 'Change volume viewer background colour') | 108 | 'Change volume viewer background colour') |
109 | 109 | ||
110 | - ps.Publisher().subscribe(self.ResetRayCasting, 'Reset Reaycasting') | 110 | + Publisher.subscribe(self.ResetRayCasting, 'Reset Reaycasting') |
111 | 111 | ||
112 | def ResetRayCasting(self, pub_evt): | 112 | def ResetRayCasting(self, pub_evt): |
113 | if self.exist: | 113 | if self.exist: |
@@ -121,7 +121,7 @@ class Volume(): | @@ -121,7 +121,7 @@ class Volume(): | ||
121 | def CloseProject(self): | 121 | def CloseProject(self): |
122 | #if self.plane: | 122 | #if self.plane: |
123 | # self.plane = None | 123 | # self.plane = None |
124 | - # ps.Publisher().sendMessage('Remove surface actor from viewer', self.plane_actor) | 124 | + # Publisher.sendMessage('Remove surface actor from viewer', self.plane_actor) |
125 | if self.plane: | 125 | if self.plane: |
126 | self.plane.DestroyObjs() | 126 | self.plane.DestroyObjs() |
127 | del self.plane | 127 | del self.plane |
@@ -129,8 +129,8 @@ class Volume(): | @@ -129,8 +129,8 @@ class Volume(): | ||
129 | 129 | ||
130 | if self.exist: | 130 | if self.exist: |
131 | self.exist = None | 131 | self.exist = None |
132 | - ps.Publisher().sendMessage('Remove surface actor from viewer', self.volume) | ||
133 | - ps.Publisher().sendMessage('Disable volume cut menu') | 132 | + Publisher.sendMessage('Remove surface actor from viewer', self.volume) |
133 | + Publisher.sendMessage('Disable volume cut menu') | ||
134 | 134 | ||
135 | def OnLoadVolume(self, pubsub_evt): | 135 | def OnLoadVolume(self, pubsub_evt): |
136 | label = pubsub_evt.data | 136 | label = pubsub_evt.data |
@@ -141,16 +141,16 @@ class Volume(): | @@ -141,16 +141,16 @@ class Volume(): | ||
141 | self.volume.SetVisibility(0) | 141 | self.volume.SetVisibility(0) |
142 | if (self.plane and self.plane_on): | 142 | if (self.plane and self.plane_on): |
143 | self.plane.Disable() | 143 | self.plane.Disable() |
144 | - ps.Publisher().sendMessage('Render volume viewer') | 144 | + Publisher.sendMessage('Render volume viewer') |
145 | 145 | ||
146 | def OnShowVolume(self, pubsub_evt = None): | 146 | def OnShowVolume(self, pubsub_evt = None): |
147 | if self.exist: | 147 | if self.exist: |
148 | self.volume.SetVisibility(1) | 148 | self.volume.SetVisibility(1) |
149 | if (self.plane and self.plane_on): | 149 | if (self.plane and self.plane_on): |
150 | self.plane.Enable() | 150 | self.plane.Enable() |
151 | - ps.Publisher().sendMessage('Render volume viewer') | 151 | + Publisher.sendMessage('Render volume viewer') |
152 | else: | 152 | else: |
153 | - ps.Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL) | 153 | + Publisher.sendMessage('Load raycasting preset', const.RAYCASTING_LABEL) |
154 | self.LoadConfig() | 154 | self.LoadConfig() |
155 | self.LoadVolume() | 155 | self.LoadVolume() |
156 | self.exist = 1 | 156 | self.exist = 1 |
@@ -162,15 +162,15 @@ class Volume(): | @@ -162,15 +162,15 @@ class Volume(): | ||
162 | if self.exist: | 162 | if self.exist: |
163 | self.__load_preset() | 163 | self.__load_preset() |
164 | self.volume.SetVisibility(1) | 164 | self.volume.SetVisibility(1) |
165 | - #ps.Publisher().sendMessage('Render volume viewer') | 165 | + #Publisher.sendMessage('Render volume viewer') |
166 | else: | 166 | else: |
167 | self.LoadVolume() | 167 | self.LoadVolume() |
168 | self.CalculateHistogram() | 168 | self.CalculateHistogram() |
169 | self.exist = 1 | 169 | self.exist = 1 |
170 | 170 | ||
171 | colour = self.GetBackgroundColour() | 171 | colour = self.GetBackgroundColour() |
172 | - ps.Publisher.sendMessage('Change volume viewer background colour', colour) | ||
173 | - ps.Publisher.sendMessage('Change volume viewer gui colour', colour) | 172 | + Publisher.sendMessage('Change volume viewer background colour', colour) |
173 | + Publisher.sendMessage('Change volume viewer gui colour', colour) | ||
174 | 174 | ||
175 | def __load_preset_config(self): | 175 | def __load_preset_config(self): |
176 | self.config = prj.Project().raycasting_preset | 176 | self.config = prj.Project().raycasting_preset |
@@ -203,14 +203,14 @@ class Volume(): | @@ -203,14 +203,14 @@ class Volume(): | ||
203 | self.CalculateWWWL() | 203 | self.CalculateWWWL() |
204 | ww = self.ww | 204 | ww = self.ww |
205 | wl = self.wl | 205 | wl = self.wl |
206 | - ps.Publisher().sendMessage('Set volume window and level text', | 206 | + Publisher.sendMessage('Set volume window and level text', |
207 | (ww, wl)) | 207 | (ww, wl)) |
208 | 208 | ||
209 | def OnSetRelativeWindowLevel(self, pubsub_evt): | 209 | def OnSetRelativeWindowLevel(self, pubsub_evt): |
210 | diff_wl, diff_ww = pubsub_evt.data | 210 | diff_wl, diff_ww = pubsub_evt.data |
211 | ww = self.ww + diff_ww | 211 | ww = self.ww + diff_ww |
212 | wl = self.wl + diff_wl | 212 | wl = self.wl + diff_wl |
213 | - ps.Publisher().sendMessage('Set volume window and level text', | 213 | + Publisher.sendMessage('Set volume window and level text', |
214 | (ww, wl)) | 214 | (ww, wl)) |
215 | self.SetWWWL(ww, wl) | 215 | self.SetWWWL(ww, wl) |
216 | self.ww = ww | 216 | self.ww = ww |
@@ -593,7 +593,7 @@ class Volume(): | @@ -593,7 +593,7 @@ class Volume(): | ||
593 | 593 | ||
594 | self.exist = 1 | 594 | self.exist = 1 |
595 | 595 | ||
596 | - ps.Publisher().sendMessage('Load volume into viewer', | 596 | + Publisher.sendMessage('Load volume into viewer', |
597 | (volume, colour, (self.ww, self.wl))) | 597 | (volume, colour, (self.ww, self.wl))) |
598 | 598 | ||
599 | def OnEnableTool(self, pubsub_evt): | 599 | def OnEnableTool(self, pubsub_evt): |
@@ -621,7 +621,7 @@ class Volume(): | @@ -621,7 +621,7 @@ class Volume(): | ||
621 | accumulate.SetComponentOrigin(image.GetScalarRange()[0], 0, 0) | 621 | accumulate.SetComponentOrigin(image.GetScalarRange()[0], 0, 0) |
622 | accumulate.Update() | 622 | accumulate.Update() |
623 | n_image = numpy_support.vtk_to_numpy(accumulate.GetOutput().GetPointData().GetScalars()) | 623 | n_image = numpy_support.vtk_to_numpy(accumulate.GetOutput().GetPointData().GetScalars()) |
624 | - ps.Publisher().sendMessage('Load histogram', (n_image, | 624 | + Publisher.sendMessage('Load histogram', (n_image, |
625 | image.GetScalarRange())) | 625 | image.GetScalarRange())) |
626 | 626 | ||
627 | def TranslateScale(self, scale, value): | 627 | def TranslateScale(self, scale, value): |
@@ -640,11 +640,11 @@ class CutPlane: | @@ -640,11 +640,11 @@ class CutPlane: | ||
640 | self.__bind_events() | 640 | self.__bind_events() |
641 | 641 | ||
642 | def __bind_events(self): | 642 | def __bind_events(self): |
643 | - ps.Publisher().subscribe(self.Reset, | 643 | + Publisher.subscribe(self.Reset, |
644 | 'Reset Cut Plane') | 644 | 'Reset Cut Plane') |
645 | - ps.Publisher().subscribe(self.Enable, | 645 | + Publisher.subscribe(self.Enable, |
646 | 'Enable Cut Plane') | 646 | 'Enable Cut Plane') |
647 | - ps.Publisher().subscribe(self.Disable, | 647 | + Publisher.subscribe(self.Disable, |
648 | 'Disable Cut Plane') | 648 | 'Disable Cut Plane') |
649 | 649 | ||
650 | def Create(self): | 650 | def Create(self): |
@@ -673,8 +673,8 @@ class CutPlane: | @@ -673,8 +673,8 @@ class CutPlane: | ||
673 | plane_actor.GetProperty().BackfaceCullingOn() | 673 | plane_actor.GetProperty().BackfaceCullingOn() |
674 | plane_actor.GetProperty().SetOpacity(0) | 674 | plane_actor.GetProperty().SetOpacity(0) |
675 | plane_widget.AddObserver("InteractionEvent", self.Update) | 675 | plane_widget.AddObserver("InteractionEvent", self.Update) |
676 | - ps.Publisher().sendMessage('AppendActor', self.plane_actor) | ||
677 | - ps.Publisher().sendMessage('Set Widget Interactor', self.plane_widget) | 676 | + Publisher.sendMessage('AppendActor', self.plane_actor) |
677 | + Publisher.sendMessage('Set Widget Interactor', self.plane_widget) | ||
678 | plane_actor.SetVisibility(1) | 678 | plane_actor.SetVisibility(1) |
679 | plane_widget.On() | 679 | plane_widget.On() |
680 | self.plane = plane = vtk.vtkPlane() | 680 | self.plane = plane = vtk.vtkPlane() |
@@ -697,19 +697,19 @@ class CutPlane: | @@ -697,19 +697,19 @@ class CutPlane: | ||
697 | self.plane_actor.VisibilityOn() | 697 | self.plane_actor.VisibilityOn() |
698 | self.plane.SetNormal(plane_source.GetNormal()) | 698 | self.plane.SetNormal(plane_source.GetNormal()) |
699 | self.plane.SetOrigin(plane_source.GetOrigin()) | 699 | self.plane.SetOrigin(plane_source.GetOrigin()) |
700 | - ps.Publisher().sendMessage('Render volume viewer', None) | 700 | + Publisher.sendMessage('Render volume viewer', None) |
701 | 701 | ||
702 | def Enable(self, evt_pubsub=None): | 702 | def Enable(self, evt_pubsub=None): |
703 | self.plane_widget.On() | 703 | self.plane_widget.On() |
704 | self.plane_actor.VisibilityOn() | 704 | self.plane_actor.VisibilityOn() |
705 | self.volume_mapper.AddClippingPlane(self.plane) | 705 | self.volume_mapper.AddClippingPlane(self.plane) |
706 | - ps.Publisher().sendMessage('Render volume viewer', None) | 706 | + Publisher.sendMessage('Render volume viewer', None) |
707 | 707 | ||
708 | def Disable(self,evt_pubsub=None): | 708 | def Disable(self,evt_pubsub=None): |
709 | self.plane_widget.Off() | 709 | self.plane_widget.Off() |
710 | self.plane_actor.VisibilityOff() | 710 | self.plane_actor.VisibilityOff() |
711 | self.volume_mapper.RemoveClippingPlane(self.plane) | 711 | self.volume_mapper.RemoveClippingPlane(self.plane) |
712 | - ps.Publisher().sendMessage('Render volume viewer', None) | 712 | + Publisher.sendMessage('Render volume viewer', None) |
713 | 713 | ||
714 | def Reset(self, evt_pubsub=None): | 714 | def Reset(self, evt_pubsub=None): |
715 | plane_source = self.plane_source | 715 | plane_source = self.plane_source |
@@ -721,10 +721,10 @@ class CutPlane: | @@ -721,10 +721,10 @@ class CutPlane: | ||
721 | self.plane_actor.VisibilityOn() | 721 | self.plane_actor.VisibilityOn() |
722 | self.plane.SetNormal(self.normal) | 722 | self.plane.SetNormal(self.normal) |
723 | self.plane.SetOrigin(self.origin) | 723 | self.plane.SetOrigin(self.origin) |
724 | - ps.Publisher().sendMessage('Render volume viewer', None) | 724 | + Publisher.sendMessage('Render volume viewer', None) |
725 | 725 | ||
726 | def DestroyObjs(self): | 726 | def DestroyObjs(self): |
727 | - ps.Publisher().sendMessage('Remove surface actor from viewer', self.plane_actor) | 727 | + Publisher.sendMessage('Remove surface actor from viewer', self.plane_actor) |
728 | self.Disable() | 728 | self.Disable() |
729 | del self.plane_widget | 729 | del self.plane_widget |
730 | del self.plane_source | 730 | del self.plane_source |
invesalius/data/vtk_utils.py
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | import sys | 19 | import sys |
20 | 20 | ||
21 | import vtk | 21 | import vtk |
22 | -import wx.lib.pubsub as ps | 22 | +from wx.lib.pubsub import pub as Publisher |
23 | 23 | ||
24 | import constants as const | 24 | import constants as const |
25 | from gui.dialogs import ProgressDialog | 25 | from gui.dialogs import ProgressDialog |
@@ -76,7 +76,7 @@ def ShowProgress(number_of_filters = 1, | @@ -76,7 +76,7 @@ def ShowProgress(number_of_filters = 1, | ||
76 | progress[0] = progress[0] + ratio*difference | 76 | progress[0] = progress[0] + ratio*difference |
77 | # Tell GUI to update progress status value | 77 | # Tell GUI to update progress status value |
78 | if (dialog_type == "GaugeProgress"): | 78 | if (dialog_type == "GaugeProgress"): |
79 | - ps.Publisher().sendMessage('Update status in GUI', | 79 | + Publisher.sendMessage('Update status in GUI', |
80 | (progress[0], label)) | 80 | (progress[0], label)) |
81 | else: | 81 | else: |
82 | if (progress[0] >= 99.999): | 82 | if (progress[0] >= 99.999): |
invesalius/gui/data_notebook.py
@@ -26,7 +26,7 @@ import wx | @@ -26,7 +26,7 @@ import wx | ||
26 | import wx.grid | 26 | import wx.grid |
27 | import wx.lib.flatnotebook as fnb | 27 | import wx.lib.flatnotebook as fnb |
28 | import wx.lib.platebtn as pbtn | 28 | import wx.lib.platebtn as pbtn |
29 | -import wx.lib.pubsub as ps | 29 | +from wx.lib.pubsub import pub as Publisher |
30 | 30 | ||
31 | import constants as const | 31 | import constants as const |
32 | import gui.dialogs as dlg | 32 | import gui.dialogs as dlg |
@@ -76,15 +76,15 @@ class NotebookPanel(wx.Panel): | @@ -76,15 +76,15 @@ class NotebookPanel(wx.Panel): | ||
76 | self.__bind_events() | 76 | self.__bind_events() |
77 | 77 | ||
78 | def __bind_events(self): | 78 | def __bind_events(self): |
79 | - ps.Publisher().subscribe(self._FoldSurface, | 79 | + Publisher.subscribe(self._FoldSurface, |
80 | 'Fold surface task') | 80 | 'Fold surface task') |
81 | - ps.Publisher().subscribe(self._FoldSurface, | 81 | + Publisher.subscribe(self._FoldSurface, |
82 | 'Fold surface page') | 82 | 'Fold surface page') |
83 | - ps.Publisher().subscribe(self._FoldMeasure, | 83 | + Publisher.subscribe(self._FoldMeasure, |
84 | 'Fold measure task') | 84 | 'Fold measure task') |
85 | - ps.Publisher().subscribe(self._FoldMask, | 85 | + Publisher.subscribe(self._FoldMask, |
86 | 'Fold mask task') | 86 | 'Fold mask task') |
87 | - ps.Publisher().subscribe(self._FoldMask, | 87 | + Publisher.subscribe(self._FoldMask, |
88 | 'Fold mask page') | 88 | 'Fold mask page') |
89 | 89 | ||
90 | 90 | ||
@@ -205,9 +205,9 @@ class MeasureButtonControlPanel(wx.Panel): | @@ -205,9 +205,9 @@ class MeasureButtonControlPanel(wx.Panel): | ||
205 | def OnMenu(self, evt): | 205 | def OnMenu(self, evt): |
206 | id = evt.GetId() | 206 | id = evt.GetId() |
207 | if id == const.MEASURE_LINEAR: | 207 | if id == const.MEASURE_LINEAR: |
208 | - ps.Publisher().sendMessage('Set tool linear measure') | 208 | + Publisher.sendMessage('Set tool linear measure') |
209 | else: | 209 | else: |
210 | - ps.Publisher().sendMessage('Set tool angular measure') | 210 | + Publisher.sendMessage('Set tool angular measure') |
211 | 211 | ||
212 | def OnRemove(self): | 212 | def OnRemove(self): |
213 | self.parent.listctrl.RemoveMeasurements() | 213 | self.parent.listctrl.RemoveMeasurements() |
@@ -215,7 +215,7 @@ class MeasureButtonControlPanel(wx.Panel): | @@ -215,7 +215,7 @@ class MeasureButtonControlPanel(wx.Panel): | ||
215 | def OnDuplicate(self): | 215 | def OnDuplicate(self): |
216 | selected_items = self.parent.listctrl.GetSelected() | 216 | selected_items = self.parent.listctrl.GetSelected() |
217 | if selected_items: | 217 | if selected_items: |
218 | - ps.Publisher().sendMessage('Duplicate measurement', selected_items) | 218 | + Publisher.sendMessage('Duplicate measurement', selected_items) |
219 | else: | 219 | else: |
220 | dlg.MaskSelectionRequiredForDuplication() | 220 | dlg.MaskSelectionRequiredForDuplication() |
221 | 221 | ||
@@ -315,7 +315,7 @@ class ButtonControlPanel(wx.Panel): | @@ -315,7 +315,7 @@ class ButtonControlPanel(wx.Panel): | ||
315 | if ok: | 315 | if ok: |
316 | mask_name, thresh, colour = dialog.GetValue() | 316 | mask_name, thresh, colour = dialog.GetValue() |
317 | if mask_name: | 317 | if mask_name: |
318 | - ps.Publisher().sendMessage('Create new mask', | 318 | + Publisher.sendMessage('Create new mask', |
319 | (mask_name, thresh, colour)) | 319 | (mask_name, thresh, colour)) |
320 | 320 | ||
321 | def OnRemove(self): | 321 | def OnRemove(self): |
@@ -324,7 +324,7 @@ class ButtonControlPanel(wx.Panel): | @@ -324,7 +324,7 @@ class ButtonControlPanel(wx.Panel): | ||
324 | def OnDuplicate(self): | 324 | def OnDuplicate(self): |
325 | selected_items = self.parent.listctrl.GetSelected() | 325 | selected_items = self.parent.listctrl.GetSelected() |
326 | if selected_items: | 326 | if selected_items: |
327 | - ps.Publisher().sendMessage('Duplicate masks', selected_items) | 327 | + Publisher.sendMessage('Duplicate masks', selected_items) |
328 | else: | 328 | else: |
329 | dlg.MaskSelectionRequiredForDuplication() | 329 | dlg.MaskSelectionRequiredForDuplication() |
330 | 330 | ||
@@ -353,14 +353,14 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -353,14 +353,14 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
353 | 353 | ||
354 | 354 | ||
355 | def __bind_events(self): | 355 | def __bind_events(self): |
356 | - ps.Publisher().subscribe(self.AddMask, 'Add mask') | ||
357 | - ps.Publisher().subscribe(self.EditMaskThreshold, | 356 | + Publisher.subscribe(self.AddMask, 'Add mask') |
357 | + Publisher.subscribe(self.EditMaskThreshold, | ||
358 | 'Set mask threshold in notebook') | 358 | 'Set mask threshold in notebook') |
359 | - ps.Publisher().subscribe(self.EditMaskColour, | 359 | + Publisher.subscribe(self.EditMaskColour, |
360 | 'Change mask colour in notebook') | 360 | 'Change mask colour in notebook') |
361 | 361 | ||
362 | - ps.Publisher().subscribe(self.OnChangeCurrentMask, 'Change mask selected') | ||
363 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | 362 | + Publisher.subscribe(self.OnChangeCurrentMask, 'Change mask selected') |
363 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | ||
364 | 364 | ||
365 | def OnKeyEvent(self, event): | 365 | def OnKeyEvent(self, event): |
366 | keycode = event.GetKeyCode() | 366 | keycode = event.GetKeyCode() |
@@ -377,7 +377,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -377,7 +377,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
377 | selected_items = self.GetSelected() | 377 | selected_items = self.GetSelected() |
378 | 378 | ||
379 | if selected_items: | 379 | if selected_items: |
380 | - ps.Publisher().sendMessage('Remove masks', selected_items) | 380 | + Publisher.sendMessage('Remove masks', selected_items) |
381 | else: | 381 | else: |
382 | dlg.MaskSelectionRequiredForRemoval() | 382 | dlg.MaskSelectionRequiredForRemoval() |
383 | return | 383 | return |
@@ -400,8 +400,8 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -400,8 +400,8 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
400 | if new_dict: | 400 | if new_dict: |
401 | if index == self.current_index: | 401 | if index == self.current_index: |
402 | self.SetItemImage(0, 1) | 402 | self.SetItemImage(0, 1) |
403 | - ps.Publisher().sendMessage('Show mask', (0, 1)) | ||
404 | - ps.Publisher().sendMessage('Change mask selected', 0) | 403 | + Publisher.sendMessage('Show mask', (0, 1)) |
404 | + Publisher.sendMessage('Change mask selected', 0) | ||
405 | for key in new_dict: | 405 | for key in new_dict: |
406 | if key: | 406 | if key: |
407 | self.SetItemImage(key, 0) | 407 | self.SetItemImage(key, 0) |
@@ -457,7 +457,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -457,7 +457,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
457 | self.image_gray = Image.open("../icons/object_colour.jpg") | 457 | self.image_gray = Image.open("../icons/object_colour.jpg") |
458 | 458 | ||
459 | def OnEditLabel(self, evt): | 459 | def OnEditLabel(self, evt): |
460 | - ps.Publisher().sendMessage('Change mask name', | 460 | + Publisher.sendMessage('Change mask name', |
461 | (evt.GetIndex(), evt.GetLabel())) | 461 | (evt.GetIndex(), evt.GetLabel())) |
462 | evt.Skip() | 462 | evt.Skip() |
463 | 463 | ||
@@ -469,9 +469,9 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -469,9 +469,9 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
469 | for key in self.mask_list_index.keys(): | 469 | for key in self.mask_list_index.keys(): |
470 | if key != index: | 470 | if key != index: |
471 | self.SetItemImage(key, 0) | 471 | self.SetItemImage(key, 0) |
472 | - ps.Publisher().sendMessage('Change mask selected',index) | 472 | + Publisher.sendMessage('Change mask selected',index) |
473 | self.current_index = index | 473 | self.current_index = index |
474 | - ps.Publisher().sendMessage('Show mask', (index, flag)) | 474 | + Publisher.sendMessage('Show mask', (index, flag)) |
475 | 475 | ||
476 | def CreateColourBitmap(self, colour): | 476 | def CreateColourBitmap(self, colour): |
477 | """ | 477 | """ |
@@ -645,7 +645,7 @@ class SurfaceButtonControlPanel(wx.Panel): | @@ -645,7 +645,7 @@ class SurfaceButtonControlPanel(wx.Panel): | ||
645 | fill_holes, | 645 | fill_holes, |
646 | keep_largest] | 646 | keep_largest] |
647 | 647 | ||
648 | - ps.Publisher().sendMessage('Create surface', surface_data) | 648 | + Publisher.sendMessage('Create surface', surface_data) |
649 | 649 | ||
650 | def OnRemove(self): | 650 | def OnRemove(self): |
651 | self.parent.listctrl.RemoveSurfaces() | 651 | self.parent.listctrl.RemoveSurfaces() |
@@ -654,7 +654,7 @@ class SurfaceButtonControlPanel(wx.Panel): | @@ -654,7 +654,7 @@ class SurfaceButtonControlPanel(wx.Panel): | ||
654 | def OnDuplicate(self): | 654 | def OnDuplicate(self): |
655 | selected_items = self.parent.listctrl.GetSelected() | 655 | selected_items = self.parent.listctrl.GetSelected() |
656 | if selected_items: | 656 | if selected_items: |
657 | - ps.Publisher().sendMessage('Duplicate surfaces', selected_items) | 657 | + Publisher.sendMessage('Duplicate surfaces', selected_items) |
658 | else: | 658 | else: |
659 | dlg.SurfaceSelectionRequiredForDuplication() | 659 | dlg.SurfaceSelectionRequiredForDuplication() |
660 | 660 | ||
@@ -679,17 +679,17 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -679,17 +679,17 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
679 | self.surface_bmp_idx_to_name = {} | 679 | self.surface_bmp_idx_to_name = {} |
680 | 680 | ||
681 | def __init_evt(self): | 681 | def __init_evt(self): |
682 | - ps.Publisher().subscribe(self.AddSurface, | 682 | + Publisher.subscribe(self.AddSurface, |
683 | 'Update surface info in GUI') | 683 | 'Update surface info in GUI') |
684 | - ps.Publisher().subscribe(self.EditSurfaceTransparency, | 684 | + Publisher.subscribe(self.EditSurfaceTransparency, |
685 | 'Set surface transparency') | 685 | 'Set surface transparency') |
686 | - ps.Publisher().subscribe(self.EditSurfaceColour, | 686 | + Publisher.subscribe(self.EditSurfaceColour, |
687 | 'Set surface colour') | 687 | 'Set surface colour') |
688 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | ||
689 | - ps.Publisher().subscribe(self.OnHideSurface, 'Hide surface items') | 688 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
689 | + Publisher.subscribe(self.OnHideSurface, 'Hide surface items') | ||
690 | 690 | ||
691 | - ps.Publisher().subscribe(self.OnShowSingle, 'Show single surface') | ||
692 | - ps.Publisher().subscribe(self.OnShowMultiple, 'Show multiple surfaces') | 691 | + Publisher.subscribe(self.OnShowSingle, 'Show single surface') |
692 | + Publisher.subscribe(self.OnShowMultiple, 'Show multiple surfaces') | ||
693 | 693 | ||
694 | def __bind_events_wx(self): | 694 | def __bind_events_wx(self): |
695 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) | 695 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
@@ -734,7 +734,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -734,7 +734,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
734 | old_dict = new_dict | 734 | old_dict = new_dict |
735 | self.surface_list_index = new_dict | 735 | self.surface_list_index = new_dict |
736 | 736 | ||
737 | - ps.Publisher().sendMessage('Remove surfaces', selected_items) | 737 | + Publisher.sendMessage('Remove surfaces', selected_items) |
738 | else: | 738 | else: |
739 | dlg.SurfaceSelectionRequiredForRemoval() | 739 | dlg.SurfaceSelectionRequiredForRemoval() |
740 | 740 | ||
@@ -750,7 +750,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -750,7 +750,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
750 | # things will stop working, e.g.: OnCheckItem | 750 | # things will stop working, e.g.: OnCheckItem |
751 | 751 | ||
752 | last_surface_index = evt.m_itemIndex | 752 | last_surface_index = evt.m_itemIndex |
753 | - ps.Publisher().sendMessage('Change surface selected', | 753 | + Publisher.sendMessage('Change surface selected', |
754 | last_surface_index) | 754 | last_surface_index) |
755 | evt.Skip() | 755 | evt.Skip() |
756 | 756 | ||
@@ -801,7 +801,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -801,7 +801,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
801 | 801 | ||
802 | 802 | ||
803 | def OnEditLabel(self, evt): | 803 | def OnEditLabel(self, evt): |
804 | - ps.Publisher().sendMessage('Change surface name', (evt.GetIndex(), evt.GetLabel())) | 804 | + Publisher.sendMessage('Change surface name', (evt.GetIndex(), evt.GetLabel())) |
805 | evt.Skip() | 805 | evt.Skip() |
806 | 806 | ||
807 | def OnItemActivated(self, evt): | 807 | def OnItemActivated(self, evt): |
@@ -810,17 +810,17 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -810,17 +810,17 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
810 | 810 | ||
811 | 811 | ||
812 | def OnCheckItem(self, index, flag): | 812 | def OnCheckItem(self, index, flag): |
813 | - ps.Publisher().sendMessage('Show surface', (index, flag)) | 813 | + Publisher.sendMessage('Show surface', (index, flag)) |
814 | 814 | ||
815 | def OnShowSingle(self, pubsub_evt): | 815 | def OnShowSingle(self, pubsub_evt): |
816 | index, visibility = pubsub_evt.data | 816 | index, visibility = pubsub_evt.data |
817 | for key in self.surface_list_index.keys(): | 817 | for key in self.surface_list_index.keys(): |
818 | if key != index: | 818 | if key != index: |
819 | self.SetItemImage(key, not visibility) | 819 | self.SetItemImage(key, not visibility) |
820 | - ps.Publisher().sendMessage('Show surface', | 820 | + Publisher.sendMessage('Show surface', |
821 | (key, not visibility)) | 821 | (key, not visibility)) |
822 | self.SetItemImage(index, visibility) | 822 | self.SetItemImage(index, visibility) |
823 | - ps.Publisher().sendMessage('Show surface', | 823 | + Publisher.sendMessage('Show surface', |
824 | (index, visibility)) | 824 | (index, visibility)) |
825 | 825 | ||
826 | def OnShowMultiple(self, pubsub_evt): | 826 | def OnShowMultiple(self, pubsub_evt): |
@@ -828,11 +828,11 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -828,11 +828,11 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
828 | for key in self.surface_list_index.keys(): | 828 | for key in self.surface_list_index.keys(): |
829 | if key not in index_list: | 829 | if key not in index_list: |
830 | self.SetItemImage(key, not visibility) | 830 | self.SetItemImage(key, not visibility) |
831 | - ps.Publisher().sendMessage('Show surface', | 831 | + Publisher.sendMessage('Show surface', |
832 | (key, not visibility)) | 832 | (key, not visibility)) |
833 | for index in index_list: | 833 | for index in index_list: |
834 | self.SetItemImage(index, visibility) | 834 | self.SetItemImage(index, visibility) |
835 | - ps.Publisher().sendMessage('Show surface', | 835 | + Publisher.sendMessage('Show surface', |
836 | (index, visibility)) | 836 | (index, visibility)) |
837 | 837 | ||
838 | def AddSurface(self, pubsub_evt): | 838 | def AddSurface(self, pubsub_evt): |
@@ -935,14 +935,14 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -935,14 +935,14 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
935 | self._bmp_idx_to_name = {} | 935 | self._bmp_idx_to_name = {} |
936 | 936 | ||
937 | def __init_evt(self): | 937 | def __init_evt(self): |
938 | - ps.Publisher().subscribe(self.AddItem_, | 938 | + Publisher.subscribe(self.AddItem_, |
939 | 'Update measurement info in GUI') | 939 | 'Update measurement info in GUI') |
940 | - ps.Publisher().subscribe(self.EditItemColour, | 940 | + Publisher.subscribe(self.EditItemColour, |
941 | 'Set measurement colour') | 941 | 'Set measurement colour') |
942 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | ||
943 | - ps.Publisher().subscribe(self.OnShowSingle, 'Show single measurement') | ||
944 | - ps.Publisher().subscribe(self.OnShowMultiple, 'Show multiple measurements') | ||
945 | - ps.Publisher().subscribe(self.OnLoadData, 'Load measurement dict') | 942 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
943 | + Publisher.subscribe(self.OnShowSingle, 'Show single measurement') | ||
944 | + Publisher.subscribe(self.OnShowMultiple, 'Show multiple measurements') | ||
945 | + Publisher.subscribe(self.OnLoadData, 'Load measurement dict') | ||
946 | 946 | ||
947 | def __bind_events_wx(self): | 947 | def __bind_events_wx(self): |
948 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) | 948 | self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) |
@@ -980,7 +980,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -980,7 +980,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
980 | new_dict[i-1] = old_dict[i] | 980 | new_dict[i-1] = old_dict[i] |
981 | old_dict = new_dict | 981 | old_dict = new_dict |
982 | self._list_index = new_dict | 982 | self._list_index = new_dict |
983 | - ps.Publisher().sendMessage('Remove measurements', selected_items) | 983 | + Publisher.sendMessage('Remove measurements', selected_items) |
984 | else: | 984 | else: |
985 | dlg.MeasureSelectionRequiredForRemoval() | 985 | dlg.MeasureSelectionRequiredForRemoval() |
986 | 986 | ||
@@ -996,7 +996,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -996,7 +996,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
996 | # things will stop working, e.g.: OnCheckItem | 996 | # things will stop working, e.g.: OnCheckItem |
997 | 997 | ||
998 | last_index = evt.m_itemIndex | 998 | last_index = evt.m_itemIndex |
999 | - ps.Publisher().sendMessage('Change measurement selected', | 999 | + Publisher.sendMessage('Change measurement selected', |
1000 | last_index) | 1000 | last_index) |
1001 | evt.Skip() | 1001 | evt.Skip() |
1002 | 1002 | ||
@@ -1049,7 +1049,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -1049,7 +1049,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
1049 | 1049 | ||
1050 | 1050 | ||
1051 | def OnEditLabel(self, evt): | 1051 | def OnEditLabel(self, evt): |
1052 | - ps.Publisher().sendMessage('Change measurement name', (evt.GetIndex(), evt.GetLabel())) | 1052 | + Publisher.sendMessage('Change measurement name', (evt.GetIndex(), evt.GetLabel())) |
1053 | evt.Skip() | 1053 | evt.Skip() |
1054 | 1054 | ||
1055 | def OnItemActivated(self, evt): | 1055 | def OnItemActivated(self, evt): |
@@ -1058,17 +1058,17 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -1058,17 +1058,17 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
1058 | 1058 | ||
1059 | 1059 | ||
1060 | def OnCheckItem(self, index, flag): | 1060 | def OnCheckItem(self, index, flag): |
1061 | - ps.Publisher().sendMessage('Show measurement', (index, flag)) | 1061 | + Publisher.sendMessage('Show measurement', (index, flag)) |
1062 | 1062 | ||
1063 | def OnShowSingle(self, pubsub_evt): | 1063 | def OnShowSingle(self, pubsub_evt): |
1064 | index, visibility = pubsub_evt.data | 1064 | index, visibility = pubsub_evt.data |
1065 | for key in self._list_index.keys(): | 1065 | for key in self._list_index.keys(): |
1066 | if key != index: | 1066 | if key != index: |
1067 | self.SetItemImage(key, not visibility) | 1067 | self.SetItemImage(key, not visibility) |
1068 | - ps.Publisher().sendMessage('Show measurement', | 1068 | + Publisher.sendMessage('Show measurement', |
1069 | (key, not visibility)) | 1069 | (key, not visibility)) |
1070 | self.SetItemImage(index, visibility) | 1070 | self.SetItemImage(index, visibility) |
1071 | - ps.Publisher().sendMessage('Show measurement', | 1071 | + Publisher.sendMessage('Show measurement', |
1072 | (index, visibility)) | 1072 | (index, visibility)) |
1073 | 1073 | ||
1074 | def OnShowMultiple(self, pubsub_evt): | 1074 | def OnShowMultiple(self, pubsub_evt): |
@@ -1076,11 +1076,11 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -1076,11 +1076,11 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
1076 | for key in self._list_index.keys(): | 1076 | for key in self._list_index.keys(): |
1077 | if key not in index_list: | 1077 | if key not in index_list: |
1078 | self.SetItemImage(key, not visibility) | 1078 | self.SetItemImage(key, not visibility) |
1079 | - ps.Publisher().sendMessage('Show measurement', | 1079 | + Publisher.sendMessage('Show measurement', |
1080 | (key, not visibility)) | 1080 | (key, not visibility)) |
1081 | for index in index_list: | 1081 | for index in index_list: |
1082 | self.SetItemImage(index, visibility) | 1082 | self.SetItemImage(index, visibility) |
1083 | - ps.Publisher().sendMessage('Show measurement', | 1083 | + Publisher.sendMessage('Show measurement', |
1084 | (index, visibility)) | 1084 | (index, visibility)) |
1085 | 1085 | ||
1086 | def OnLoadData(self, pubsub_evt): | 1086 | def OnLoadData(self, pubsub_evt): |
invesalius/gui/default_tasks.py
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | 19 | ||
20 | import wx | 20 | import wx |
21 | import wx.lib.foldpanelbar as fpb | 21 | import wx.lib.foldpanelbar as fpb |
22 | -import wx.lib.pubsub as ps | 22 | +from wx.lib.pubsub import pub as Publisher |
23 | 23 | ||
24 | import constants as const | 24 | import constants as const |
25 | import data_notebook as nb | 25 | import data_notebook as nb |
@@ -139,7 +139,7 @@ class LowerTaskPanel(wx.Panel): | @@ -139,7 +139,7 @@ class LowerTaskPanel(wx.Panel): | ||
139 | col = style.GetFirstColour() | 139 | col = style.GetFirstColour() |
140 | self.enable_items.append(item) | 140 | self.enable_items.append(item) |
141 | 141 | ||
142 | - fold_panel.AddFoldPanelWindow(item, nb.NotebookPanel(item), Spacing= 0, | 142 | + fold_panel.AddFoldPanelWindow(item, nb.NotebookPanel(item), #Spacing= 0, |
143 | leftSpacing=0, rightSpacing=0) | 143 | leftSpacing=0, rightSpacing=0) |
144 | fold_panel.Expand(fold_panel.GetFoldPanel(0)) | 144 | fold_panel.Expand(fold_panel.GetFoldPanel(0)) |
145 | 145 | ||
@@ -161,7 +161,7 @@ class LowerTaskPanel(wx.Panel): | @@ -161,7 +161,7 @@ class LowerTaskPanel(wx.Panel): | ||
161 | 161 | ||
162 | 162 | ||
163 | def __bind_events(self): | 163 | def __bind_events(self): |
164 | - ps.Publisher().subscribe(self.OnEnableState, "Enable state project") | 164 | + Publisher.subscribe(self.OnEnableState, "Enable state project") |
165 | 165 | ||
166 | def OnEnableState(self, pubsub_evt): | 166 | def OnEnableState(self, pubsub_evt): |
167 | state = pubsub_evt.data | 167 | state = pubsub_evt.data |
@@ -229,7 +229,7 @@ class UpperTaskPanel(wx.Panel): | @@ -229,7 +229,7 @@ class UpperTaskPanel(wx.Panel): | ||
229 | # Add panel to FoldPanel | 229 | # Add panel to FoldPanel |
230 | fold_panel.AddFoldPanelWindow(item, | 230 | fold_panel.AddFoldPanelWindow(item, |
231 | panel(item), | 231 | panel(item), |
232 | - Spacing= 0, | 232 | + #Spacing= 0, |
233 | leftSpacing=0, | 233 | leftSpacing=0, |
234 | rightSpacing=0) | 234 | rightSpacing=0) |
235 | 235 | ||
@@ -254,10 +254,10 @@ class UpperTaskPanel(wx.Panel): | @@ -254,10 +254,10 @@ class UpperTaskPanel(wx.Panel): | ||
254 | 254 | ||
255 | def __bind_events(self): | 255 | def __bind_events(self): |
256 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) | 256 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) |
257 | - ps.Publisher().subscribe(self.OnEnableState, "Enable state project") | ||
258 | - ps.Publisher().subscribe(self.OnOverwrite, 'Create surface from index') | ||
259 | - ps.Publisher().subscribe(self.OnFoldSurface, 'Fold surface task') | ||
260 | - ps.Publisher().subscribe(self.OnFoldExport, 'Fold export task') | 257 | + Publisher.subscribe(self.OnEnableState, "Enable state project") |
258 | + Publisher.subscribe(self.OnOverwrite, 'Create surface from index') | ||
259 | + Publisher.subscribe(self.OnFoldSurface, 'Fold surface task') | ||
260 | + Publisher.subscribe(self.OnFoldExport, 'Fold export task') | ||
261 | 261 | ||
262 | def OnOverwrite(self, pubsub_evt): | 262 | def OnOverwrite(self, pubsub_evt): |
263 | self.overwrite = pubsub_evt.data[1] | 263 | self.overwrite = pubsub_evt.data[1] |
@@ -291,12 +291,12 @@ class UpperTaskPanel(wx.Panel): | @@ -291,12 +291,12 @@ class UpperTaskPanel(wx.Panel): | ||
291 | closed = evt.GetFoldStatus() | 291 | closed = evt.GetFoldStatus() |
292 | 292 | ||
293 | if id == self.__id_slice: | 293 | if id == self.__id_slice: |
294 | - ps.Publisher().sendMessage('Retrieve task slice style') | ||
295 | - ps.Publisher().sendMessage('Fold mask page') | 294 | + Publisher.sendMessage('Retrieve task slice style') |
295 | + Publisher.sendMessage('Fold mask page') | ||
296 | elif id == self.__id_surface: | 296 | elif id == self.__id_surface: |
297 | - ps.Publisher().sendMessage('Fold surface page') | 297 | + Publisher.sendMessage('Fold surface page') |
298 | else: | 298 | else: |
299 | - ps.Publisher().sendMessage('Disable task slice style') | 299 | + Publisher.sendMessage('Disable task slice style') |
300 | 300 | ||
301 | 301 | ||
302 | evt.Skip() | 302 | evt.Skip() |
invesalius/gui/default_viewers.py
@@ -20,7 +20,7 @@ import sys | @@ -20,7 +20,7 @@ import sys | ||
20 | 20 | ||
21 | import wx | 21 | import wx |
22 | import wx.lib.agw.fourwaysplitter as fws | 22 | import wx.lib.agw.fourwaysplitter as fws |
23 | -import wx.lib.pubsub as ps | 23 | +from wx.lib.pubsub import pub as Publisher |
24 | 24 | ||
25 | import data.viewer_slice as slice_viewer | 25 | import data.viewer_slice as slice_viewer |
26 | import data.viewer_volume as volume_viewer | 26 | import data.viewer_volume as volume_viewer |
@@ -123,11 +123,11 @@ class Panel(wx.Panel): | @@ -123,11 +123,11 @@ class Panel(wx.Panel): | ||
123 | 123 | ||
124 | def OnMaximize(self, evt): | 124 | def OnMaximize(self, evt): |
125 | if evt.GetPane().name == self.s4.name: | 125 | if evt.GetPane().name == self.s4.name: |
126 | - ps.Publisher().sendMessage('Show raycasting widget', None) | 126 | + Publisher.sendMessage('Show raycasting widget', None) |
127 | 127 | ||
128 | def OnRestore(self, evt): | 128 | def OnRestore(self, evt): |
129 | if evt.GetPane().name == self.s4.name: | 129 | if evt.GetPane().name == self.s4.name: |
130 | - ps.Publisher().sendMessage('Hide raycasting widget', None) | 130 | + Publisher.sendMessage('Hide raycasting widget', None) |
131 | 131 | ||
132 | def __init_four_way_splitter(self): | 132 | def __init_four_way_splitter(self): |
133 | 133 | ||
@@ -233,20 +233,20 @@ class VolumeInteraction(wx.Panel): | @@ -233,20 +233,20 @@ class VolumeInteraction(wx.Panel): | ||
233 | #self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize) | 233 | #self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize) |
234 | 234 | ||
235 | def __bind_events(self): | 235 | def __bind_events(self): |
236 | - ps.Publisher().subscribe(self.ShowRaycastingWidget, | 236 | + Publisher.subscribe(self.ShowRaycastingWidget, |
237 | 'Show raycasting widget') | 237 | 'Show raycasting widget') |
238 | - ps.Publisher().subscribe(self.HideRaycastingWidget, | 238 | + Publisher.subscribe(self.HideRaycastingWidget, |
239 | 'Hide raycasting widget') | 239 | 'Hide raycasting widget') |
240 | - ps.Publisher().subscribe(self.OnSetRaycastPreset, | 240 | + Publisher.subscribe(self.OnSetRaycastPreset, |
241 | 'Update raycasting preset') | 241 | 'Update raycasting preset') |
242 | - ps.Publisher().subscribe(self.RefreshPoints, | 242 | + Publisher.subscribe(self.RefreshPoints, |
243 | 'Refresh raycasting widget points') | 243 | 'Refresh raycasting widget points') |
244 | - ps.Publisher().subscribe(self.LoadHistogram, | 244 | + Publisher.subscribe(self.LoadHistogram, |
245 | 'Load histogram') | 245 | 'Load histogram') |
246 | 246 | ||
247 | def __update_curve_wwwl_text(self, curve): | 247 | def __update_curve_wwwl_text(self, curve): |
248 | ww, wl = self.clut_raycasting.GetCurveWWWl(curve) | 248 | ww, wl = self.clut_raycasting.GetCurveWWWl(curve) |
249 | - ps.Publisher().sendMessage('Set raycasting wwwl', (ww, wl, curve)) | 249 | + Publisher.sendMessage('Set raycasting wwwl', (ww, wl, curve)) |
250 | 250 | ||
251 | def ShowRaycastingWidget(self, evt_pubsub=None): | 251 | def ShowRaycastingWidget(self, evt_pubsub=None): |
252 | self.can_show_raycasting_widget = 1 | 252 | self.can_show_raycasting_widget = 1 |
@@ -262,18 +262,18 @@ class VolumeInteraction(wx.Panel): | @@ -262,18 +262,18 @@ class VolumeInteraction(wx.Panel): | ||
262 | self.aui_manager.Update() | 262 | self.aui_manager.Update() |
263 | 263 | ||
264 | def OnPointChanged(self, evt): | 264 | def OnPointChanged(self, evt): |
265 | - ps.Publisher.sendMessage('Set raycasting refresh', None) | ||
266 | - ps.Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | ||
267 | - ps.Publisher().sendMessage('Render volume viewer') | 265 | + Publisher.sendMessage('Set raycasting refresh', None) |
266 | + Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | ||
267 | + Publisher.sendMessage('Render volume viewer') | ||
268 | 268 | ||
269 | def OnCurveSelected(self, evt): | 269 | def OnCurveSelected(self, evt): |
270 | - ps.Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) | ||
271 | - ps.Publisher().sendMessage('Render volume viewer') | 270 | + Publisher.sendMessage('Set raycasting curve', evt.GetCurve()) |
271 | + Publisher.sendMessage('Render volume viewer') | ||
272 | 272 | ||
273 | def OnChangeCurveWL(self, evt): | 273 | def OnChangeCurveWL(self, evt): |
274 | curve = evt.GetCurve() | 274 | curve = evt.GetCurve() |
275 | self.__update_curve_wwwl_text(curve) | 275 | self.__update_curve_wwwl_text(curve) |
276 | - ps.Publisher().sendMessage('Render volume viewer') | 276 | + Publisher.sendMessage('Render volume viewer') |
277 | 277 | ||
278 | def OnSetRaycastPreset(self, evt_pubsub): | 278 | def OnSetRaycastPreset(self, evt_pubsub): |
279 | preset = project.Project().raycasting_preset | 279 | preset = project.Project().raycasting_preset |
@@ -400,11 +400,11 @@ class VolumeToolPanel(wx.Panel): | @@ -400,11 +400,11 @@ class VolumeToolPanel(wx.Panel): | ||
400 | self.__bind_events_wx() | 400 | self.__bind_events_wx() |
401 | 401 | ||
402 | def __bind_events(self): | 402 | def __bind_events(self): |
403 | - ps.Publisher().subscribe(self.ChangeButtonColour, | 403 | + Publisher.subscribe(self.ChangeButtonColour, |
404 | 'Change volume viewer gui colour') | 404 | 'Change volume viewer gui colour') |
405 | - ps.Publisher().subscribe(self.DisablePreset, 'Close project data') | ||
406 | - ps.Publisher().subscribe(self.Uncheck, 'Uncheck image plane menu') | ||
407 | - ps.Publisher().subscribe(self.DisableVolumeCutMenu, 'Disable volume cut menu') | 405 | + Publisher.subscribe(self.DisablePreset, 'Close project data') |
406 | + Publisher.subscribe(self.Uncheck, 'Uncheck image plane menu') | ||
407 | + Publisher.subscribe(self.DisableVolumeCutMenu, 'Disable volume cut menu') | ||
408 | 408 | ||
409 | def DisablePreset(self, pubsub_evt): | 409 | def DisablePreset(self, pubsub_evt): |
410 | self.off_item.Check(1) | 410 | self.off_item.Check(1) |
@@ -434,7 +434,7 @@ class VolumeToolPanel(wx.Panel): | @@ -434,7 +434,7 @@ class VolumeToolPanel(wx.Panel): | ||
434 | d = wx.TextEntryDialog(self, _("Preset name")) | 434 | d = wx.TextEntryDialog(self, _("Preset name")) |
435 | if d.ShowModal() == wx.ID_OK: | 435 | if d.ShowModal() == wx.ID_OK: |
436 | preset_name = d.GetValue() | 436 | preset_name = d.GetValue() |
437 | - ps.Publisher().sendMessage(_("Save raycasting preset"), | 437 | + Publisher.sendMessage(_("Save raycasting preset"), |
438 | preset_name) | 438 | preset_name) |
439 | 439 | ||
440 | def __init_menus(self, pubsub_evt=None): | 440 | def __init_menus(self, pubsub_evt=None): |
@@ -541,14 +541,14 @@ class VolumeToolPanel(wx.Panel): | @@ -541,14 +541,14 @@ class VolumeToolPanel(wx.Panel): | ||
541 | label = item.GetLabel() | 541 | label = item.GetLabel() |
542 | 542 | ||
543 | if not (checked): | 543 | if not (checked): |
544 | - ps.Publisher().sendMessage('Disable plane', label) | 544 | + Publisher.sendMessage('Disable plane', label) |
545 | else: | 545 | else: |
546 | - ps.Publisher().sendMessage('Enable plane', label) | 546 | + Publisher.sendMessage('Enable plane', label) |
547 | 547 | ||
548 | def OnMenuStereo(self, evt): | 548 | def OnMenuStereo(self, evt): |
549 | id = evt.GetId() | 549 | id = evt.GetId() |
550 | mode = ID_TO_STEREO_NAME[id] | 550 | mode = ID_TO_STEREO_NAME[id] |
551 | - ps.Publisher().sendMessage('Set stereo mode', mode) | 551 | + Publisher.sendMessage('Set stereo mode', mode) |
552 | 552 | ||
553 | 553 | ||
554 | def Uncheck(self, pubsub_evt): | 554 | def Uncheck(self, pubsub_evt): |
@@ -566,7 +566,7 @@ class VolumeToolPanel(wx.Panel): | @@ -566,7 +566,7 @@ class VolumeToolPanel(wx.Panel): | ||
566 | if id in ID_TO_NAME.keys(): | 566 | if id in ID_TO_NAME.keys(): |
567 | # Raycassting type was selected | 567 | # Raycassting type was selected |
568 | name = ID_TO_NAME[id] | 568 | name = ID_TO_NAME[id] |
569 | - ps.Publisher().sendMessage('Load raycasting preset', | 569 | + Publisher.sendMessage('Load raycasting preset', |
570 | ID_TO_NAME[id]) | 570 | ID_TO_NAME[id]) |
571 | # Enable or disable tools | 571 | # Enable or disable tools |
572 | if name != const.RAYCASTING_OFF_LABEL: | 572 | if name != const.RAYCASTING_OFF_LABEL: |
@@ -583,12 +583,12 @@ class VolumeToolPanel(wx.Panel): | @@ -583,12 +583,12 @@ class VolumeToolPanel(wx.Panel): | ||
583 | # if i is not item: | 583 | # if i is not item: |
584 | # i.Check(0) | 584 | # i.Check(0) |
585 | if not TOOL_STATE[id]: | 585 | if not TOOL_STATE[id]: |
586 | - ps.Publisher().sendMessage('Enable raycasting tool', | 586 | + Publisher.sendMessage('Enable raycasting tool', |
587 | [ID_TO_TOOL[id],1]) | 587 | [ID_TO_TOOL[id],1]) |
588 | TOOL_STATE[id] = True | 588 | TOOL_STATE[id] = True |
589 | item.Check(1) | 589 | item.Check(1) |
590 | else: | 590 | else: |
591 | - ps.Publisher().sendMessage('Enable raycasting tool', | 591 | + Publisher.sendMessage('Enable raycasting tool', |
592 | [ID_TO_TOOL[id],0]) | 592 | [ID_TO_TOOL[id],0]) |
593 | TOOL_STATE[id] = False | 593 | TOOL_STATE[id] = False |
594 | item.Check(0) | 594 | item.Check(0) |
@@ -599,11 +599,11 @@ class VolumeToolPanel(wx.Panel): | @@ -599,11 +599,11 @@ class VolumeToolPanel(wx.Panel): | ||
599 | bmp = wx.Bitmap(ID_TO_BMP[evt.GetId()][1], wx.BITMAP_TYPE_PNG) | 599 | bmp = wx.Bitmap(ID_TO_BMP[evt.GetId()][1], wx.BITMAP_TYPE_PNG) |
600 | self.button_view.SetBitmapSelected(bmp) | 600 | self.button_view.SetBitmapSelected(bmp) |
601 | 601 | ||
602 | - ps.Publisher().sendMessage('Set volume view angle', | 602 | + Publisher.sendMessage('Set volume view angle', |
603 | evt.GetId()) | 603 | evt.GetId()) |
604 | self.Refresh() | 604 | self.Refresh() |
605 | 605 | ||
606 | def OnSelectColour(self, evt): | 606 | def OnSelectColour(self, evt): |
607 | colour = c = [i/255.0 for i in evt.GetValue()] | 607 | colour = c = [i/255.0 for i in evt.GetValue()] |
608 | - ps.Publisher().sendMessage('Change volume viewer background colour', colour) | 608 | + Publisher.sendMessage('Change volume viewer background colour', colour) |
609 | 609 |
invesalius/gui/dialogs.py
@@ -26,7 +26,7 @@ import wx | @@ -26,7 +26,7 @@ import wx | ||
26 | from wx.lib import masked | 26 | from wx.lib import masked |
27 | from wx.lib.agw import floatspin | 27 | from wx.lib.agw import floatspin |
28 | from wx.lib.wordwrap import wordwrap | 28 | from wx.lib.wordwrap import wordwrap |
29 | -import wx.lib.pubsub as ps | 29 | +from wx.lib.pubsub import pub as Publisher |
30 | 30 | ||
31 | import constants as const | 31 | import constants as const |
32 | import gui.widgets.gradient as grad | 32 | import gui.widgets.gradient as grad |
@@ -113,7 +113,7 @@ class ProgressDialog(object): | @@ -113,7 +113,7 @@ class ProgressDialog(object): | ||
113 | self.dlg.SetSize(wx.Size(250,150)) | 113 | self.dlg.SetSize(wx.Size(250,150)) |
114 | 114 | ||
115 | def Cancel(self, evt): | 115 | def Cancel(self, evt): |
116 | - ps.Publisher().sendMessage("Cancel DICOM load") | 116 | + Publisher.sendMessage("Cancel DICOM load") |
117 | 117 | ||
118 | def Update(self, value, message): | 118 | def Update(self, value, message): |
119 | if(int(value) != self.maximum): | 119 | if(int(value) != self.maximum): |
invesalius/gui/dicom_preview_panel.py
@@ -29,7 +29,7 @@ import vtk | @@ -29,7 +29,7 @@ import vtk | ||
29 | 29 | ||
30 | from vtk.util import numpy_support | 30 | from vtk.util import numpy_support |
31 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor | 31 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
32 | -import wx.lib.pubsub as ps | 32 | +from wx.lib.pubsub import pub as Publisher |
33 | 33 | ||
34 | import constants as const | 34 | import constants as const |
35 | from reader import dicom_reader | 35 | from reader import dicom_reader |
@@ -646,7 +646,7 @@ class DicomPreviewSlice(wx.Panel): | @@ -646,7 +646,7 @@ class DicomPreviewSlice(wx.Panel): | ||
646 | self.selected_dicom = self.selected_panel.dicom_info | 646 | self.selected_dicom = self.selected_panel.dicom_info |
647 | self.GetEventHandler().ProcessEvent(my_evt) | 647 | self.GetEventHandler().ProcessEvent(my_evt) |
648 | 648 | ||
649 | - ps.Publisher().sendMessage("Selected Import Images", [self.first_selection, \ | 649 | + Publisher.sendMessage("Selected Import Images", [self.first_selection, \ |
650 | self.last_selection]) | 650 | self.last_selection]) |
651 | 651 | ||
652 | def OnScroll(self, evt=None): | 652 | def OnScroll(self, evt=None): |
invesalius/gui/frame.py
@@ -25,7 +25,7 @@ import webbrowser | @@ -25,7 +25,7 @@ import webbrowser | ||
25 | 25 | ||
26 | import wx | 26 | import wx |
27 | import wx.aui | 27 | import wx.aui |
28 | -import wx.lib.pubsub as ps | 28 | +from wx.lib.pubsub import pub as Publisher |
29 | 29 | ||
30 | import constants as const | 30 | import constants as const |
31 | import default_tasks as tasks | 31 | import default_tasks as tasks |
@@ -85,7 +85,7 @@ class Frame(wx.Frame): | @@ -85,7 +85,7 @@ class Frame(wx.Frame): | ||
85 | """ | 85 | """ |
86 | Bind events related to pubsub. | 86 | Bind events related to pubsub. |
87 | """ | 87 | """ |
88 | - sub = ps.Publisher().subscribe | 88 | + sub = Publisher.subscribe |
89 | sub(self._BeginBusyCursor, 'Begin busy cursor') | 89 | sub(self._BeginBusyCursor, 'Begin busy cursor') |
90 | sub(self._ShowContentPanel, 'Cancel DICOM load') | 90 | sub(self._ShowContentPanel, 'Cancel DICOM load') |
91 | sub(self._EndBusyCursor, 'End busy cursor') | 91 | sub(self._EndBusyCursor, 'End busy cursor') |
@@ -254,7 +254,7 @@ class Frame(wx.Frame): | @@ -254,7 +254,7 @@ class Frame(wx.Frame): | ||
254 | """ | 254 | """ |
255 | Show viewers and task, hide import panel. | 255 | Show viewers and task, hide import panel. |
256 | """ | 256 | """ |
257 | - ps.Publisher().sendMessage("Set layout button full") | 257 | + Publisher.sendMessage("Set layout button full") |
258 | aui_manager = self.aui_manager | 258 | aui_manager = self.aui_manager |
259 | aui_manager.GetPane("Import").Show(0) | 259 | aui_manager.GetPane("Import").Show(0) |
260 | aui_manager.GetPane("Data").Show(1) | 260 | aui_manager.GetPane("Data").Show(1) |
@@ -265,7 +265,7 @@ class Frame(wx.Frame): | @@ -265,7 +265,7 @@ class Frame(wx.Frame): | ||
265 | """ | 265 | """ |
266 | Show viewers and task, hide import panel. | 266 | Show viewers and task, hide import panel. |
267 | """ | 267 | """ |
268 | - ps.Publisher().sendMessage("Set layout button full") | 268 | + Publisher.sendMessage("Set layout button full") |
269 | aui_manager = self.aui_manager | 269 | aui_manager = self.aui_manager |
270 | aui_manager.GetPane("Retrieve").Show(1) | 270 | aui_manager.GetPane("Retrieve").Show(1) |
271 | aui_manager.GetPane("Data").Show(0) | 271 | aui_manager.GetPane("Data").Show(0) |
@@ -277,7 +277,7 @@ class Frame(wx.Frame): | @@ -277,7 +277,7 @@ class Frame(wx.Frame): | ||
277 | """ | 277 | """ |
278 | Show only DICOM import panel. | 278 | Show only DICOM import panel. |
279 | """ | 279 | """ |
280 | - ps.Publisher().sendMessage("Set layout button data only") | 280 | + Publisher.sendMessage("Set layout button data only") |
281 | aui_manager = self.aui_manager | 281 | aui_manager = self.aui_manager |
282 | aui_manager.GetPane("Import").Show(1) | 282 | aui_manager.GetPane("Import").Show(1) |
283 | aui_manager.GetPane("Data").Show(0) | 283 | aui_manager.GetPane("Data").Show(0) |
@@ -298,13 +298,13 @@ class Frame(wx.Frame): | @@ -298,13 +298,13 @@ class Frame(wx.Frame): | ||
298 | self.aui_manager.Update() | 298 | self.aui_manager.Update() |
299 | 299 | ||
300 | def CloseProject(self): | 300 | def CloseProject(self): |
301 | - ps.Publisher().sendMessage('Close Project') | 301 | + Publisher.sendMessage('Close Project') |
302 | 302 | ||
303 | def OnClose(self, evt): | 303 | def OnClose(self, evt): |
304 | """ | 304 | """ |
305 | Close all project data. | 305 | Close all project data. |
306 | """ | 306 | """ |
307 | - ps.Publisher().sendMessage('Close Project') | 307 | + Publisher.sendMessage('Close Project') |
308 | 308 | ||
309 | def OnMenuClick(self, evt): | 309 | def OnMenuClick(self, evt): |
310 | """ | 310 | """ |
@@ -344,7 +344,7 @@ class Frame(wx.Frame): | @@ -344,7 +344,7 @@ class Frame(wx.Frame): | ||
344 | """ | 344 | """ |
345 | Refresh GUI when frame is resized. | 345 | Refresh GUI when frame is resized. |
346 | """ | 346 | """ |
347 | - ps.Publisher().sendMessage(('ProgressBar Reposition')) | 347 | + Publisher.sendMessage(('ProgressBar Reposition')) |
348 | evt.Skip() | 348 | evt.Skip() |
349 | 349 | ||
350 | def ShowPreferences(self): | 350 | def ShowPreferences(self): |
@@ -357,9 +357,9 @@ class Frame(wx.Frame): | @@ -357,9 +357,9 @@ class Frame(wx.Frame): | ||
357 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] | 357 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] |
358 | ses.Session().language = values[const.LANGUAGE] | 358 | ses.Session().language = values[const.LANGUAGE] |
359 | 359 | ||
360 | - ps.Publisher().sendMessage('Remove Volume') | ||
361 | - ps.Publisher().sendMessage('Reset Reaycasting') | ||
362 | - ps.Publisher().sendMessage('Update Surface Interpolation') | 360 | + Publisher.sendMessage('Remove Volume') |
361 | + Publisher.sendMessage('Reset Reaycasting') | ||
362 | + Publisher.sendMessage('Update Surface Interpolation') | ||
363 | 363 | ||
364 | def ShowAbout(self): | 364 | def ShowAbout(self): |
365 | """ | 365 | """ |
@@ -371,7 +371,7 @@ class Frame(wx.Frame): | @@ -371,7 +371,7 @@ class Frame(wx.Frame): | ||
371 | """ | 371 | """ |
372 | Save project. | 372 | Save project. |
373 | """ | 373 | """ |
374 | - ps.Publisher().sendMessage('Show save dialog', False) | 374 | + Publisher.sendMessage('Show save dialog', False) |
375 | 375 | ||
376 | def ShowGettingStarted(self): | 376 | def ShowGettingStarted(self): |
377 | """ | 377 | """ |
@@ -385,29 +385,29 @@ class Frame(wx.Frame): | @@ -385,29 +385,29 @@ class Frame(wx.Frame): | ||
385 | """ | 385 | """ |
386 | Show import DICOM panel. | 386 | Show import DICOM panel. |
387 | """ | 387 | """ |
388 | - ps.Publisher().sendMessage('Show import directory dialog') | 388 | + Publisher.sendMessage('Show import directory dialog') |
389 | 389 | ||
390 | def ShowRetrieveDicomPanel(self): | 390 | def ShowRetrieveDicomPanel(self): |
391 | print "teste.............." | 391 | print "teste.............." |
392 | - ps.Publisher().sendMessage('Show retrieve dicom panel') | 392 | + Publisher.sendMessage('Show retrieve dicom panel') |
393 | 393 | ||
394 | def ShowOpenProject(self): | 394 | def ShowOpenProject(self): |
395 | """ | 395 | """ |
396 | Show open project dialog. | 396 | Show open project dialog. |
397 | """ | 397 | """ |
398 | - ps.Publisher().sendMessage('Show open project dialog') | 398 | + Publisher.sendMessage('Show open project dialog') |
399 | 399 | ||
400 | def ShowSaveAsProject(self): | 400 | def ShowSaveAsProject(self): |
401 | """ | 401 | """ |
402 | Show save as dialog. | 402 | Show save as dialog. |
403 | """ | 403 | """ |
404 | - ps.Publisher().sendMessage('Show save dialog', True) | 404 | + Publisher.sendMessage('Show save dialog', True) |
405 | 405 | ||
406 | def ShowAnalyzeImporter(self): | 406 | def ShowAnalyzeImporter(self): |
407 | """ | 407 | """ |
408 | Show save as dialog. | 408 | Show save as dialog. |
409 | """ | 409 | """ |
410 | - ps.Publisher().sendMessage('Show analyze dialog', True) | 410 | + Publisher.sendMessage('Show analyze dialog', True) |
411 | 411 | ||
412 | # ------------------------------------------------------------------ | 412 | # ------------------------------------------------------------------ |
413 | # ------------------------------------------------------------------ | 413 | # ------------------------------------------------------------------ |
@@ -441,7 +441,7 @@ class MenuBar(wx.MenuBar): | @@ -441,7 +441,7 @@ class MenuBar(wx.MenuBar): | ||
441 | # events should be binded directly from wx.Menu / wx.MenuBar | 441 | # events should be binded directly from wx.Menu / wx.MenuBar |
442 | # message "Binding events of wx.MenuBar" on [wxpython-users] | 442 | # message "Binding events of wx.MenuBar" on [wxpython-users] |
443 | # mail list in Oct 20 2008 | 443 | # mail list in Oct 20 2008 |
444 | - sub = ps.Publisher().subscribe | 444 | + sub = Publisher.subscribe |
445 | sub(self.OnEnableState, "Enable state project") | 445 | sub(self.OnEnableState, "Enable state project") |
446 | 446 | ||
447 | def __init_items(self): | 447 | def __init_items(self): |
@@ -578,7 +578,7 @@ class ProgressBar(wx.Gauge): | @@ -578,7 +578,7 @@ class ProgressBar(wx.Gauge): | ||
578 | """ | 578 | """ |
579 | Bind events related to pubsub. | 579 | Bind events related to pubsub. |
580 | """ | 580 | """ |
581 | - sub = ps.Publisher().subscribe | 581 | + sub = Publisher.subscribe |
582 | sub(self._Layout, 'ProgressBar Reposition') | 582 | sub(self._Layout, 'ProgressBar Reposition') |
583 | 583 | ||
584 | def _Layout(self, evt_pubsub=None): | 584 | def _Layout(self, evt_pubsub=None): |
@@ -626,7 +626,7 @@ class StatusBar(wx.StatusBar): | @@ -626,7 +626,7 @@ class StatusBar(wx.StatusBar): | ||
626 | """ | 626 | """ |
627 | Bind events related to pubsub. | 627 | Bind events related to pubsub. |
628 | """ | 628 | """ |
629 | - sub = ps.Publisher().subscribe | 629 | + sub = Publisher.subscribe |
630 | sub(self._SetProgressValue, 'Update status in GUI') | 630 | sub(self._SetProgressValue, 'Update status in GUI') |
631 | sub(self._SetProgressLabel, 'Update status text in GUI') | 631 | sub(self._SetProgressLabel, 'Update status text in GUI') |
632 | 632 | ||
@@ -714,7 +714,7 @@ class ProjectToolBar(wx.ToolBar): | @@ -714,7 +714,7 @@ class ProjectToolBar(wx.ToolBar): | ||
714 | """ | 714 | """ |
715 | Bind events related to pubsub. | 715 | Bind events related to pubsub. |
716 | """ | 716 | """ |
717 | - sub = ps.Publisher().subscribe | 717 | + sub = Publisher.subscribe |
718 | sub(self._EnableState, "Enable state project") | 718 | sub(self._EnableState, "Enable state project") |
719 | 719 | ||
720 | def __init_items(self): | 720 | def __init_items(self): |
@@ -846,7 +846,7 @@ class ObjectToolBar(wx.ToolBar): | @@ -846,7 +846,7 @@ class ObjectToolBar(wx.ToolBar): | ||
846 | """ | 846 | """ |
847 | Bind events related to pubsub. | 847 | Bind events related to pubsub. |
848 | """ | 848 | """ |
849 | - sub = ps.Publisher().subscribe | 849 | + sub = Publisher.subscribe |
850 | sub(self._EnableState, "Enable state project") | 850 | sub(self._EnableState, "Enable state project") |
851 | sub(self._UntoggleAllItems, 'Untoggle object toolbar items') | 851 | sub(self._UntoggleAllItems, 'Untoggle object toolbar items') |
852 | sub(self._ToggleLinearMeasure, "Set tool linear measure") | 852 | sub(self._ToggleLinearMeasure, "Set tool linear measure") |
@@ -982,8 +982,8 @@ class ObjectToolBar(wx.ToolBar): | @@ -982,8 +982,8 @@ class ObjectToolBar(wx.ToolBar): | ||
982 | """ | 982 | """ |
983 | id = const.STATE_MEASURE_DISTANCE | 983 | id = const.STATE_MEASURE_DISTANCE |
984 | self.ToggleTool(id, True) | 984 | self.ToggleTool(id, True) |
985 | - ps.Publisher().sendMessage('Enable style', id) | ||
986 | - ps.Publisher().sendMessage('Untoggle slice toolbar items') | 985 | + Publisher.sendMessage('Enable style', id) |
986 | + Publisher.sendMessage('Untoggle slice toolbar items') | ||
987 | for item in const.TOOL_STATES: | 987 | for item in const.TOOL_STATES: |
988 | state = self.GetToolState(item) | 988 | state = self.GetToolState(item) |
989 | if state and (item != id): | 989 | if state and (item != id): |
@@ -997,8 +997,8 @@ class ObjectToolBar(wx.ToolBar): | @@ -997,8 +997,8 @@ class ObjectToolBar(wx.ToolBar): | ||
997 | """ | 997 | """ |
998 | id = const.STATE_MEASURE_ANGLE | 998 | id = const.STATE_MEASURE_ANGLE |
999 | self.ToggleTool(id, True) | 999 | self.ToggleTool(id, True) |
1000 | - ps.Publisher().sendMessage('Enable style', id) | ||
1001 | - ps.Publisher().sendMessage('Untoggle slice toolbar items') | 1000 | + Publisher.sendMessage('Enable style', id) |
1001 | + Publisher.sendMessage('Untoggle slice toolbar items') | ||
1002 | for item in const.TOOL_STATES: | 1002 | for item in const.TOOL_STATES: |
1003 | state = self.GetToolState(item) | 1003 | state = self.GetToolState(item) |
1004 | if state and (item != id): | 1004 | if state and (item != id): |
@@ -1013,13 +1013,13 @@ class ObjectToolBar(wx.ToolBar): | @@ -1013,13 +1013,13 @@ class ObjectToolBar(wx.ToolBar): | ||
1013 | state = self.GetToolState(id) | 1013 | state = self.GetToolState(id) |
1014 | if state and ((id == const.STATE_MEASURE_DISTANCE) or\ | 1014 | if state and ((id == const.STATE_MEASURE_DISTANCE) or\ |
1015 | (id == const.STATE_MEASURE_ANGLE)): | 1015 | (id == const.STATE_MEASURE_ANGLE)): |
1016 | - ps.Publisher().sendMessage('Fold measure task') | 1016 | + Publisher.sendMessage('Fold measure task') |
1017 | 1017 | ||
1018 | if state: | 1018 | if state: |
1019 | - ps.Publisher().sendMessage('Enable style', id) | ||
1020 | - ps.Publisher().sendMessage('Untoggle slice toolbar items') | 1019 | + Publisher.sendMessage('Enable style', id) |
1020 | + Publisher.sendMessage('Untoggle slice toolbar items') | ||
1021 | else: | 1021 | else: |
1022 | - ps.Publisher().sendMessage('Disable style', id) | 1022 | + Publisher.sendMessage('Disable style', id) |
1023 | 1023 | ||
1024 | for item in const.TOOL_STATES: | 1024 | for item in const.TOOL_STATES: |
1025 | state = self.GetToolState(item) | 1025 | state = self.GetToolState(item) |
@@ -1099,7 +1099,7 @@ class SliceToolBar(wx.ToolBar): | @@ -1099,7 +1099,7 @@ class SliceToolBar(wx.ToolBar): | ||
1099 | """ | 1099 | """ |
1100 | Bind events related to pubsub. | 1100 | Bind events related to pubsub. |
1101 | """ | 1101 | """ |
1102 | - sub = ps.Publisher().subscribe | 1102 | + sub = Publisher.subscribe |
1103 | sub(self._EnableState, "Enable state project") | 1103 | sub(self._EnableState, "Enable state project") |
1104 | sub(self._UntoggleAllItems, 'Untoggle slice toolbar items') | 1104 | sub(self._UntoggleAllItems, 'Untoggle slice toolbar items') |
1105 | 1105 | ||
@@ -1131,7 +1131,7 @@ class SliceToolBar(wx.ToolBar): | @@ -1131,7 +1131,7 @@ class SliceToolBar(wx.ToolBar): | ||
1131 | self.ToggleTool(id, False) | 1131 | self.ToggleTool(id, False) |
1132 | if id == const.SLICE_STATE_CROSS: | 1132 | if id == const.SLICE_STATE_CROSS: |
1133 | msg = 'Set cross visibility' | 1133 | msg = 'Set cross visibility' |
1134 | - ps.Publisher().sendMessage(msg, 0) | 1134 | + Publisher.sendMessage(msg, 0) |
1135 | 1135 | ||
1136 | def OnToggle(self, evt): | 1136 | def OnToggle(self, evt): |
1137 | """ | 1137 | """ |
@@ -1142,10 +1142,10 @@ class SliceToolBar(wx.ToolBar): | @@ -1142,10 +1142,10 @@ class SliceToolBar(wx.ToolBar): | ||
1142 | state = self.GetToolState(id) | 1142 | state = self.GetToolState(id) |
1143 | 1143 | ||
1144 | if state: | 1144 | if state: |
1145 | - ps.Publisher().sendMessage('Enable style', id) | ||
1146 | - ps.Publisher().sendMessage('Untoggle object toolbar items') | 1145 | + Publisher.sendMessage('Enable style', id) |
1146 | + Publisher.sendMessage('Untoggle object toolbar items') | ||
1147 | else: | 1147 | else: |
1148 | - ps.Publisher().sendMessage('Disable style', id) | 1148 | + Publisher.sendMessage('Disable style', id) |
1149 | 1149 | ||
1150 | for item in const.TOOL_SLICE_STATES: | 1150 | for item in const.TOOL_SLICE_STATES: |
1151 | state = self.GetToolState(item) | 1151 | state = self.GetToolState(item) |
@@ -1201,7 +1201,7 @@ class LayoutToolBar(wx.ToolBar): | @@ -1201,7 +1201,7 @@ class LayoutToolBar(wx.ToolBar): | ||
1201 | """ | 1201 | """ |
1202 | Bind events related to pubsub. | 1202 | Bind events related to pubsub. |
1203 | """ | 1203 | """ |
1204 | - sub = ps.Publisher().subscribe | 1204 | + sub = Publisher.subscribe |
1205 | sub(self._EnableState, "Enable state project") | 1205 | sub(self._EnableState, "Enable state project") |
1206 | sub(self._SetLayoutWithTask, "Set layout button data only") | 1206 | sub(self._SetLayoutWithTask, "Set layout button data only") |
1207 | sub(self._SetLayoutWithoutTask, "Set layout button full") | 1207 | sub(self._SetLayoutWithoutTask, "Set layout button full") |
@@ -1318,13 +1318,13 @@ class LayoutToolBar(wx.ToolBar): | @@ -1318,13 +1318,13 @@ class LayoutToolBar(wx.ToolBar): | ||
1318 | """ | 1318 | """ |
1319 | if self.ontool_layout: | 1319 | if self.ontool_layout: |
1320 | self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITHOUT_MENU) | 1320 | self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITHOUT_MENU) |
1321 | - ps.Publisher().sendMessage('Show task panel') | 1321 | + Publisher.sendMessage('Show task panel') |
1322 | self.SetToolShortHelp(ID_LAYOUT,_("Hide task panel")) | 1322 | self.SetToolShortHelp(ID_LAYOUT,_("Hide task panel")) |
1323 | self.ontool_layout = False | 1323 | self.ontool_layout = False |
1324 | else: | 1324 | else: |
1325 | self.bitmap = self.BMP_WITH_MENU | 1325 | self.bitmap = self.BMP_WITH_MENU |
1326 | self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITH_MENU) | 1326 | self.SetToolNormalBitmap(ID_LAYOUT,self.BMP_WITH_MENU) |
1327 | - ps.Publisher().sendMessage('Hide task panel') | 1327 | + Publisher.sendMessage('Hide task panel') |
1328 | self.SetToolShortHelp(ID_LAYOUT, _("Show task panel")) | 1328 | self.SetToolShortHelp(ID_LAYOUT, _("Show task panel")) |
1329 | self.ontool_layout = True | 1329 | self.ontool_layout = True |
1330 | 1330 | ||
@@ -1334,14 +1334,14 @@ class LayoutToolBar(wx.ToolBar): | @@ -1334,14 +1334,14 @@ class LayoutToolBar(wx.ToolBar): | ||
1334 | """ | 1334 | """ |
1335 | if self.ontool_text: | 1335 | if self.ontool_text: |
1336 | self.SetToolNormalBitmap(ID_TEXT,self.BMP_WITH_TEXT) | 1336 | self.SetToolNormalBitmap(ID_TEXT,self.BMP_WITH_TEXT) |
1337 | - ps.Publisher().sendMessage('Hide text actors on viewers') | 1337 | + Publisher.sendMessage('Hide text actors on viewers') |
1338 | self.SetToolShortHelp(ID_TEXT,_("Show text")) | 1338 | self.SetToolShortHelp(ID_TEXT,_("Show text")) |
1339 | - ps.Publisher().sendMessage('Update AUI') | 1339 | + Publisher.sendMessage('Update AUI') |
1340 | self.ontool_text = False | 1340 | self.ontool_text = False |
1341 | else: | 1341 | else: |
1342 | self.SetToolNormalBitmap(ID_TEXT, self.BMP_WITHOUT_TEXT) | 1342 | self.SetToolNormalBitmap(ID_TEXT, self.BMP_WITHOUT_TEXT) |
1343 | - ps.Publisher().sendMessage('Show text actors on viewers') | 1343 | + Publisher.sendMessage('Show text actors on viewers') |
1344 | self.SetToolShortHelp(ID_TEXT,_("Hide text")) | 1344 | self.SetToolShortHelp(ID_TEXT,_("Hide text")) |
1345 | - ps.Publisher().sendMessage('Update AUI') | 1345 | + Publisher.sendMessage('Update AUI') |
1346 | self.ontool_text = True | 1346 | self.ontool_text = True |
1347 | 1347 |
invesalius/gui/import_network_panel.py
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | import wx | 19 | import wx |
20 | import sys | 20 | import sys |
21 | import wx.gizmos as gizmos | 21 | import wx.gizmos as gizmos |
22 | -import wx.lib.pubsub as ps | 22 | +from wx.lib.pubsub import pub as Publisher |
23 | import wx.lib.splitter as spl | 23 | import wx.lib.splitter as spl |
24 | 24 | ||
25 | import constants as const | 25 | import constants as const |
@@ -134,8 +134,8 @@ class InnerPanel(wx.Panel): | @@ -134,8 +134,8 @@ class InnerPanel(wx.Panel): | ||
134 | self.SetAutoLayout(1) | 134 | self.SetAutoLayout(1) |
135 | 135 | ||
136 | def _bind_pubsubevt(self): | 136 | def _bind_pubsubevt(self): |
137 | - #ps.Publisher().subscribe(self.ShowDicomPreview, "Load import panel") | ||
138 | - #ps.Publisher().subscribe(self.GetSelectedImages ,"Selected Import Images") | 137 | + #Publisher.subscribe(self.ShowDicomPreview, "Load import panel") |
138 | + #Publisher.subscribe(self.GetSelectedImages ,"Selected Import Images") | ||
139 | pass | 139 | pass |
140 | 140 | ||
141 | def GetSelectedImages(self, pubsub_evt): | 141 | def GetSelectedImages(self, pubsub_evt): |
@@ -181,7 +181,7 @@ class InnerPanel(wx.Panel): | @@ -181,7 +181,7 @@ class InnerPanel(wx.Panel): | ||
181 | self.LoadDicom(group) | 181 | self.LoadDicom(group) |
182 | 182 | ||
183 | def OnClickCancel(self, evt): | 183 | def OnClickCancel(self, evt): |
184 | - #ps.Publisher().sendMessage("Cancel DICOM load") | 184 | + #Publisher.sendMessage("Cancel DICOM load") |
185 | pass | 185 | pass |
186 | 186 | ||
187 | def LoadDicom(self, group): | 187 | def LoadDicom(self, group): |
@@ -199,7 +199,7 @@ class InnerPanel(wx.Panel): | @@ -199,7 +199,7 @@ class InnerPanel(wx.Panel): | ||
199 | 199 | ||
200 | nslices_result = slice_amont / (interval + 1) | 200 | nslices_result = slice_amont / (interval + 1) |
201 | if (nslices_result > 1): | 201 | if (nslices_result > 1): |
202 | - #ps.Publisher().sendMessage('Open DICOM group', (group, interval, | 202 | + #Publisher.sendMessage('Open DICOM group', (group, interval, |
203 | # [self.first_image_selection, self.last_image_selection])) | 203 | # [self.first_image_selection, self.last_image_selection])) |
204 | pass | 204 | pass |
205 | else: | 205 | else: |
@@ -218,9 +218,9 @@ class TextPanel(wx.Panel): | @@ -218,9 +218,9 @@ class TextPanel(wx.Panel): | ||
218 | self.__bind_pubsub_evt() | 218 | self.__bind_pubsub_evt() |
219 | 219 | ||
220 | def __bind_pubsub_evt(self): | 220 | def __bind_pubsub_evt(self): |
221 | - #ps.Publisher().subscribe(self.SelectSeries, 'Select series in import panel') | ||
222 | - ps.Publisher().subscribe(self.Populate, 'Populate tree') | ||
223 | - ps.Publisher().subscribe(self.SetHostsList, 'Set FindPanel hosts list') | 221 | + #Publisher.subscribe(self.SelectSeries, 'Select series in import panel') |
222 | + Publisher.subscribe(self.Populate, 'Populate tree') | ||
223 | + Publisher.subscribe(self.SetHostsList, 'Set FindPanel hosts list') | ||
224 | 224 | ||
225 | def __bind_events_wx(self): | 225 | def __bind_events_wx(self): |
226 | self.Bind(wx.EVT_SIZE, self.OnSize) | 226 | self.Bind(wx.EVT_SIZE, self.OnSize) |
@@ -405,7 +405,7 @@ class TextPanel(wx.Panel): | @@ -405,7 +405,7 @@ class TextPanel(wx.Panel): | ||
405 | self.hosts = evt_pub.data | 405 | self.hosts = evt_pub.data |
406 | 406 | ||
407 | def GetHostList(self): | 407 | def GetHostList(self): |
408 | - ps.Publisher().sendMessage('Get NodesPanel host list') | 408 | + Publisher.sendMessage('Get NodesPanel host list') |
409 | return self.hosts | 409 | return self.hosts |
410 | 410 | ||
411 | def OnSelChanged(self, evt): | 411 | def OnSelChanged(self, evt): |
@@ -413,7 +413,7 @@ class TextPanel(wx.Panel): | @@ -413,7 +413,7 @@ class TextPanel(wx.Panel): | ||
413 | if self._selected_by_user: | 413 | if self._selected_by_user: |
414 | group = self.tree.GetItemPyData(item) | 414 | group = self.tree.GetItemPyData(item) |
415 | if isinstance(group, dcm.DicomGroup): | 415 | if isinstance(group, dcm.DicomGroup): |
416 | - #ps.Publisher().sendMessage('Load group into import panel', | 416 | + #Publisher.sendMessage('Load group into import panel', |
417 | # group) | 417 | # group) |
418 | pass | 418 | pass |
419 | 419 | ||
@@ -423,7 +423,7 @@ class TextPanel(wx.Panel): | @@ -423,7 +423,7 @@ class TextPanel(wx.Panel): | ||
423 | my_evt.SetSelectedID(id) | 423 | my_evt.SetSelectedID(id) |
424 | self.GetEventHandler().ProcessEvent(my_evt) | 424 | self.GetEventHandler().ProcessEvent(my_evt) |
425 | 425 | ||
426 | - #ps.Publisher().sendMessage('Load patient into import panel', | 426 | + #Publisher.sendMessage('Load patient into import panel', |
427 | # group) | 427 | # group) |
428 | else: | 428 | else: |
429 | parent_id = self.tree.GetItemParent(item) | 429 | parent_id = self.tree.GetItemParent(item) |
@@ -449,7 +449,7 @@ class TextPanel(wx.Panel): | @@ -449,7 +449,7 @@ class TextPanel(wx.Panel): | ||
449 | dn.RunCMove((patient_id, serie_id)) | 449 | dn.RunCMove((patient_id, serie_id)) |
450 | #dn.SetSearchWord(self.find_txt.GetValue()) | 450 | #dn.SetSearchWord(self.find_txt.GetValue()) |
451 | 451 | ||
452 | - #ps.Publisher().sendMessage('Populate tree', dn.RunCFind()) | 452 | + #Publisher.sendMessage('Populate tree', dn.RunCFind()) |
453 | 453 | ||
454 | 454 | ||
455 | 455 | ||
@@ -522,10 +522,10 @@ class FindPanel(wx.Panel): | @@ -522,10 +522,10 @@ class FindPanel(wx.Panel): | ||
522 | self._bind_gui_evt() | 522 | self._bind_gui_evt() |
523 | 523 | ||
524 | def __bind_evt(self): | 524 | def __bind_evt(self): |
525 | - ps.Publisher().subscribe(self.SetHostsList, 'Set FindPanel hosts list') | ||
526 | - #ps.Publisher().subscribe(self.ShowDicomSeries, 'Load dicom preview') | ||
527 | - #ps.Publisher().subscribe(self.SetDicomSeries, 'Load group into import panel') | ||
528 | - #ps.Publisher().subscribe(self.SetPatientSeries, 'Load patient into import panel') | 525 | + Publisher.subscribe(self.SetHostsList, 'Set FindPanel hosts list') |
526 | + #Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview') | ||
527 | + #Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel') | ||
528 | + #Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel') | ||
529 | pass | 529 | pass |
530 | 530 | ||
531 | def _bind_gui_evt(self): | 531 | def _bind_gui_evt(self): |
@@ -545,14 +545,14 @@ class FindPanel(wx.Panel): | @@ -545,14 +545,14 @@ class FindPanel(wx.Panel): | ||
545 | dn.SetAETitle(self.hosts[0][3]) | 545 | dn.SetAETitle(self.hosts[0][3]) |
546 | dn.SetSearchWord(self.find_txt.GetValue()) | 546 | dn.SetSearchWord(self.find_txt.GetValue()) |
547 | 547 | ||
548 | - ps.Publisher().sendMessage('Populate tree', dn.RunCFind()) | 548 | + Publisher.sendMessage('Populate tree', dn.RunCFind()) |
549 | 549 | ||
550 | 550 | ||
551 | def SetHostsList(self, evt_pub): | 551 | def SetHostsList(self, evt_pub): |
552 | self.hosts = evt_pub.data | 552 | self.hosts = evt_pub.data |
553 | 553 | ||
554 | def GetHostList(self): | 554 | def GetHostList(self): |
555 | - ps.Publisher().sendMessage('Get NodesPanel host list') | 555 | + Publisher.sendMessage('Get NodesPanel host list') |
556 | return self.hosts | 556 | return self.hosts |
557 | 557 | ||
558 | class HostFindPanel(wx.Panel): | 558 | class HostFindPanel(wx.Panel): |
@@ -612,7 +612,7 @@ class NodesTree(wx.ListCtrl, CheckListCtrlMixin,listmix.ListCtrlAutoWidthMixin, | @@ -612,7 +612,7 @@ class NodesTree(wx.ListCtrl, CheckListCtrlMixin,listmix.ListCtrlAutoWidthMixin, | ||
612 | listmix.TextEditMixin.__init__(self) | 612 | listmix.TextEditMixin.__init__(self) |
613 | 613 | ||
614 | def OnCheckItem(self, index, flag): | 614 | def OnCheckItem(self, index, flag): |
615 | - ps.Publisher().sendMessage("Check item dict", [index, flag]) | 615 | + Publisher.sendMessage("Check item dict", [index, flag]) |
616 | 616 | ||
617 | def OpenEditor(self, col, row): | 617 | def OpenEditor(self, col, row): |
618 | 618 | ||
@@ -650,9 +650,9 @@ class NodesPanel(wx.Panel): | @@ -650,9 +650,9 @@ class NodesPanel(wx.Panel): | ||
650 | 650 | ||
651 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.EndEdition, self.tree_node) | 651 | self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.EndEdition, self.tree_node) |
652 | 652 | ||
653 | - ps.Publisher().subscribe(self.CheckItemDict, "Check item dict") | ||
654 | - ps.Publisher().subscribe(self.GetHostsList, "Get NodesPanel host list") | ||
655 | - #ps.Publisher().subscribe(self.UnCheckItemDict, "Uncheck item dict") | 653 | + Publisher.subscribe(self.CheckItemDict, "Check item dict") |
654 | + Publisher.subscribe(self.GetHostsList, "Get NodesPanel host list") | ||
655 | + #Publisher.subscribe(self.UnCheckItemDict, "Uncheck item dict") | ||
656 | 656 | ||
657 | 657 | ||
658 | def __init_gui(self): | 658 | def __init_gui(self): |
@@ -711,7 +711,7 @@ class NodesPanel(wx.Panel): | @@ -711,7 +711,7 @@ class NodesPanel(wx.Panel): | ||
711 | self.sizer = sizer | 711 | self.sizer = sizer |
712 | 712 | ||
713 | def GetHostsList(self, pub_evt): | 713 | def GetHostsList(self, pub_evt): |
714 | - ps.Publisher().sendMessage('Set FindPanel hosts list', self.hosts) | 714 | + Publisher.sendMessage('Set FindPanel hosts list', self.hosts) |
715 | 715 | ||
716 | 716 | ||
717 | def EndEdition(self, evt): | 717 | def EndEdition(self, evt): |
invesalius/gui/import_panel.py
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
19 | import wx | 19 | import wx |
20 | import wx.gizmos as gizmos | 20 | import wx.gizmos as gizmos |
21 | -import wx.lib.pubsub as ps | 21 | +from wx.lib.pubsub import pub as Publisher |
22 | import wx.lib.splitter as spl | 22 | import wx.lib.splitter as spl |
23 | 23 | ||
24 | import constants as const | 24 | import constants as const |
@@ -126,8 +126,8 @@ class InnerPanel(wx.Panel): | @@ -126,8 +126,8 @@ class InnerPanel(wx.Panel): | ||
126 | self.SetAutoLayout(1) | 126 | self.SetAutoLayout(1) |
127 | 127 | ||
128 | def _bind_pubsubevt(self): | 128 | def _bind_pubsubevt(self): |
129 | - ps.Publisher().subscribe(self.ShowDicomPreview, "Load import panel") | ||
130 | - ps.Publisher().subscribe(self.GetSelectedImages ,"Selected Import Images") | 129 | + Publisher.subscribe(self.ShowDicomPreview, "Load import panel") |
130 | + Publisher.subscribe(self.GetSelectedImages ,"Selected Import Images") | ||
131 | 131 | ||
132 | def GetSelectedImages(self, pubsub_evt): | 132 | def GetSelectedImages(self, pubsub_evt): |
133 | self.first_image_selection = pubsub_evt.data[0] | 133 | self.first_image_selection = pubsub_evt.data[0] |
@@ -171,7 +171,7 @@ class InnerPanel(wx.Panel): | @@ -171,7 +171,7 @@ class InnerPanel(wx.Panel): | ||
171 | self.LoadDicom(group) | 171 | self.LoadDicom(group) |
172 | 172 | ||
173 | def OnClickCancel(self, evt): | 173 | def OnClickCancel(self, evt): |
174 | - ps.Publisher().sendMessage("Cancel DICOM load") | 174 | + Publisher.sendMessage("Cancel DICOM load") |
175 | 175 | ||
176 | def LoadDicom(self, group): | 176 | def LoadDicom(self, group): |
177 | interval = self.combo_interval.GetSelection() | 177 | interval = self.combo_interval.GetSelection() |
@@ -187,7 +187,7 @@ class InnerPanel(wx.Panel): | @@ -187,7 +187,7 @@ class InnerPanel(wx.Panel): | ||
187 | 187 | ||
188 | nslices_result = slice_amont / (interval + 1) | 188 | nslices_result = slice_amont / (interval + 1) |
189 | if (nslices_result > 1): | 189 | if (nslices_result > 1): |
190 | - ps.Publisher().sendMessage('Open DICOM group', (group, interval, | 190 | + Publisher.sendMessage('Open DICOM group', (group, interval, |
191 | [self.first_image_selection, self.last_image_selection])) | 191 | [self.first_image_selection, self.last_image_selection])) |
192 | else: | 192 | else: |
193 | dlg.MissingFilesForReconstruction() | 193 | dlg.MissingFilesForReconstruction() |
@@ -205,7 +205,7 @@ class TextPanel(wx.Panel): | @@ -205,7 +205,7 @@ class TextPanel(wx.Panel): | ||
205 | self.__bind_pubsub_evt() | 205 | self.__bind_pubsub_evt() |
206 | 206 | ||
207 | def __bind_pubsub_evt(self): | 207 | def __bind_pubsub_evt(self): |
208 | - ps.Publisher().subscribe(self.SelectSeries, 'Select series in import panel') | 208 | + Publisher.subscribe(self.SelectSeries, 'Select series in import panel') |
209 | 209 | ||
210 | def __bind_events_wx(self): | 210 | def __bind_events_wx(self): |
211 | self.Bind(wx.EVT_SIZE, self.OnSize) | 211 | self.Bind(wx.EVT_SIZE, self.OnSize) |
@@ -312,7 +312,7 @@ class TextPanel(wx.Panel): | @@ -312,7 +312,7 @@ class TextPanel(wx.Panel): | ||
312 | if self._selected_by_user: | 312 | if self._selected_by_user: |
313 | group = self.tree.GetItemPyData(item) | 313 | group = self.tree.GetItemPyData(item) |
314 | if isinstance(group, dcm.DicomGroup): | 314 | if isinstance(group, dcm.DicomGroup): |
315 | - ps.Publisher().sendMessage('Load group into import panel', | 315 | + Publisher.sendMessage('Load group into import panel', |
316 | group) | 316 | group) |
317 | 317 | ||
318 | elif isinstance(group, dcm.PatientGroup): | 318 | elif isinstance(group, dcm.PatientGroup): |
@@ -321,7 +321,7 @@ class TextPanel(wx.Panel): | @@ -321,7 +321,7 @@ class TextPanel(wx.Panel): | ||
321 | my_evt.SetSelectedID(id) | 321 | my_evt.SetSelectedID(id) |
322 | self.GetEventHandler().ProcessEvent(my_evt) | 322 | self.GetEventHandler().ProcessEvent(my_evt) |
323 | 323 | ||
324 | - ps.Publisher().sendMessage('Load patient into import panel', | 324 | + Publisher.sendMessage('Load patient into import panel', |
325 | group) | 325 | group) |
326 | else: | 326 | else: |
327 | parent_id = self.tree.GetItemParent(item) | 327 | parent_id = self.tree.GetItemParent(item) |
@@ -421,9 +421,9 @@ class SeriesPanel(wx.Panel): | @@ -421,9 +421,9 @@ class SeriesPanel(wx.Panel): | ||
421 | self._bind_gui_evt() | 421 | self._bind_gui_evt() |
422 | 422 | ||
423 | def __bind_evt(self): | 423 | def __bind_evt(self): |
424 | - ps.Publisher().subscribe(self.ShowDicomSeries, 'Load dicom preview') | ||
425 | - ps.Publisher().subscribe(self.SetDicomSeries, 'Load group into import panel') | ||
426 | - ps.Publisher().subscribe(self.SetPatientSeries, 'Load patient into import panel') | 424 | + Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview') |
425 | + Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel') | ||
426 | + Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel') | ||
427 | 427 | ||
428 | def _bind_gui_evt(self): | 428 | def _bind_gui_evt(self): |
429 | self.serie_preview.Bind(dpp.EVT_CLICK_SERIE, self.OnSelectSerie) | 429 | self.serie_preview.Bind(dpp.EVT_CLICK_SERIE, self.OnSelectSerie) |
@@ -487,9 +487,9 @@ class SlicePanel(wx.Panel): | @@ -487,9 +487,9 @@ class SlicePanel(wx.Panel): | ||
487 | self.__bind_evt() | 487 | self.__bind_evt() |
488 | 488 | ||
489 | def __bind_evt(self): | 489 | def __bind_evt(self): |
490 | - ps.Publisher().subscribe(self.ShowDicomSeries, 'Load dicom preview') | ||
491 | - ps.Publisher().subscribe(self.SetDicomSeries, 'Load group into import panel') | ||
492 | - ps.Publisher().subscribe(self.SetPatientSeries, 'Load patient into import panel') | 490 | + Publisher.subscribe(self.ShowDicomSeries, 'Load dicom preview') |
491 | + Publisher.subscribe(self.SetDicomSeries, 'Load group into import panel') | ||
492 | + Publisher.subscribe(self.SetPatientSeries, 'Load patient into import panel') | ||
493 | 493 | ||
494 | def __init_gui(self): | 494 | def __init_gui(self): |
495 | self.SetBackgroundColour((255,255,255)) | 495 | self.SetBackgroundColour((255,255,255)) |
invesalius/gui/preferences.py
1 | import wx | 1 | import wx |
2 | import constants as const | 2 | import constants as const |
3 | -import wx.lib.pubsub as ps | 3 | +from wx.lib.pubsub import pub as Publisher |
4 | import session as ses | 4 | import session as ses |
5 | from language_dialog import ComboBoxLanguage | 5 | from language_dialog import ComboBoxLanguage |
6 | 6 | ||
@@ -62,7 +62,7 @@ class Preferences(wx.Dialog): | @@ -62,7 +62,7 @@ class Preferences(wx.Dialog): | ||
62 | self.__bind_events() | 62 | self.__bind_events() |
63 | 63 | ||
64 | def __bind_events(self): | 64 | def __bind_events(self): |
65 | - ps.Publisher().subscribe(self.LoadPreferences, 'Load Preferences') | 65 | + Publisher.subscribe(self.LoadPreferences, 'Load Preferences') |
66 | 66 | ||
67 | 67 | ||
68 | def GetPreferences(self): | 68 | def GetPreferences(self): |
invesalius/gui/task_exporter.py
@@ -23,7 +23,7 @@ import sys | @@ -23,7 +23,7 @@ import sys | ||
23 | import wx | 23 | import wx |
24 | import wx.lib.hyperlink as hl | 24 | import wx.lib.hyperlink as hl |
25 | import wx.lib.platebtn as pbtn | 25 | import wx.lib.platebtn as pbtn |
26 | -import wx.lib.pubsub as ps | 26 | +from wx.lib.pubsub import pub as Publisher |
27 | 27 | ||
28 | import constants as const | 28 | import constants as const |
29 | import gui.dialogs as dlg | 29 | import gui.dialogs as dlg |
@@ -253,7 +253,7 @@ class InnerTaskPanel(wx.Panel): | @@ -253,7 +253,7 @@ class InnerTaskPanel(wx.Panel): | ||
253 | value = dlg.ExportPicture(self.id_to_name[id]) | 253 | value = dlg.ExportPicture(self.id_to_name[id]) |
254 | if value: | 254 | if value: |
255 | filename, filetype = value | 255 | filename, filetype = value |
256 | - ps.Publisher().sendMessage('Export picture to file', | 256 | + Publisher.sendMessage('Export picture to file', |
257 | (id, filename, filetype)) | 257 | (id, filename, filetype)) |
258 | 258 | ||
259 | 259 | ||
@@ -287,7 +287,7 @@ class InnerTaskPanel(wx.Panel): | @@ -287,7 +287,7 @@ class InnerTaskPanel(wx.Panel): | ||
287 | if filename.split(".")[-1] != extension: | 287 | if filename.split(".")[-1] != extension: |
288 | filename = filename + "."+ extension | 288 | filename = filename + "."+ extension |
289 | filetype = const.FILETYPE_IMAGEDATA | 289 | filetype = const.FILETYPE_IMAGEDATA |
290 | - ps.Publisher().sendMessage('Export mask to file', | 290 | + Publisher.sendMessage('Export mask to file', |
291 | (filename, filetype)) | 291 | (filename, filetype)) |
292 | 292 | ||
293 | 293 | ||
@@ -323,7 +323,7 @@ class InnerTaskPanel(wx.Panel): | @@ -323,7 +323,7 @@ class InnerTaskPanel(wx.Panel): | ||
323 | if sys.platform != 'win32': | 323 | if sys.platform != 'win32': |
324 | if filename.split(".")[-1] != extension: | 324 | if filename.split(".")[-1] != extension: |
325 | filename = filename + "."+ extension | 325 | filename = filename + "."+ extension |
326 | - ps.Publisher().sendMessage('Export surface to file', | 326 | + Publisher.sendMessage('Export surface to file', |
327 | (filename, filetype)) | 327 | (filename, filetype)) |
328 | else: | 328 | else: |
329 | dlg = wx.MessageDialog(None, | 329 | dlg = wx.MessageDialog(None, |
invesalius/gui/task_importer.py
@@ -22,7 +22,7 @@ import sys | @@ -22,7 +22,7 @@ import sys | ||
22 | import wx | 22 | import wx |
23 | import wx.lib.hyperlink as hl | 23 | import wx.lib.hyperlink as hl |
24 | import wx.lib.platebtn as pbtn | 24 | import wx.lib.platebtn as pbtn |
25 | -import wx.lib.pubsub as ps | 25 | +from wx.lib.pubsub import pub as Publisher |
26 | 26 | ||
27 | import constants as const | 27 | import constants as const |
28 | import gui.dialogs as dlg | 28 | import gui.dialogs as dlg |
@@ -140,7 +140,7 @@ class InnerTaskPanel(wx.Panel): | @@ -140,7 +140,7 @@ class InnerTaskPanel(wx.Panel): | ||
140 | #self.__bind_events() | 140 | #self.__bind_events() |
141 | 141 | ||
142 | #def __bind_events(self): | 142 | #def __bind_events(self): |
143 | - # ps.Publisher().subscribe(self.OnLoadRecentProjects, "Load recent projects") | 143 | + # Publisher.subscribe(self.OnLoadRecentProjects, "Load recent projects") |
144 | 144 | ||
145 | #def OnLoadRecentProjects(self, pubsub_evt): | 145 | #def OnLoadRecentProjects(self, pubsub_evt): |
146 | # projects = pubsub_evt.data | 146 | # projects = pubsub_evt.data |
@@ -217,22 +217,22 @@ class InnerTaskPanel(wx.Panel): | @@ -217,22 +217,22 @@ class InnerTaskPanel(wx.Panel): | ||
217 | 217 | ||
218 | ####### | 218 | ####### |
219 | def ImportDicom(self): | 219 | def ImportDicom(self): |
220 | - ps.Publisher().sendMessage('Show import directory dialog') | 220 | + Publisher.sendMessage('Show import directory dialog') |
221 | 221 | ||
222 | def OpenProject(self, path=None): | 222 | def OpenProject(self, path=None): |
223 | if path: | 223 | if path: |
224 | - ps.Publisher().sendMessage('Open recent project', path) | 224 | + Publisher.sendMessage('Open recent project', path) |
225 | else: | 225 | else: |
226 | - ps.Publisher().sendMessage('Show open project dialog') | 226 | + Publisher.sendMessage('Show open project dialog') |
227 | 227 | ||
228 | def SaveAsProject(self): | 228 | def SaveAsProject(self): |
229 | - ps.Publisher().sendMessage('Show save dialog', True) | 229 | + Publisher.sendMessage('Show save dialog', True) |
230 | 230 | ||
231 | def SaveProject(self): | 231 | def SaveProject(self): |
232 | - ps.Publisher().sendMessage('Show save dialog', False) | 232 | + Publisher.sendMessage('Show save dialog', False) |
233 | 233 | ||
234 | def CloseProject(self): | 234 | def CloseProject(self): |
235 | - ps.Publisher().sendMessage('Close Project') | 235 | + Publisher.sendMessage('Close Project') |
236 | ####### | 236 | ####### |
237 | 237 | ||
238 | def OnButton(self, evt): | 238 | def OnButton(self, evt): |
invesalius/gui/task_navigator.py
@@ -25,7 +25,7 @@ import wx | @@ -25,7 +25,7 @@ import wx | ||
25 | import wx.lib.hyperlink as hl | 25 | import wx.lib.hyperlink as hl |
26 | import wx.lib.masked.numctrl | 26 | import wx.lib.masked.numctrl |
27 | import wx.lib.platebtn as pbtn | 27 | import wx.lib.platebtn as pbtn |
28 | -import wx.lib.pubsub as ps | 28 | +from wx.lib.pubsub import pub as Publisher |
29 | 29 | ||
30 | import data.bases as db | 30 | import data.bases as db |
31 | import data.co_registration as dcr | 31 | import data.co_registration as dcr |
@@ -286,8 +286,8 @@ class InnerTaskPanel(wx.Panel): | @@ -286,8 +286,8 @@ class InnerTaskPanel(wx.Panel): | ||
286 | self.button_getpoint.SetToolTip(tooltip) | 286 | self.button_getpoint.SetToolTip(tooltip) |
287 | 287 | ||
288 | def __bind_events(self): | 288 | def __bind_events(self): |
289 | - ps.Publisher().subscribe(self.__update_points_img, 'Update cross position') | ||
290 | - ps.Publisher().subscribe(self.__update_points_plh, 'Update plh position') | 289 | + Publisher.subscribe(self.__update_points_img, 'Update cross position') |
290 | + Publisher.subscribe(self.__update_points_plh, 'Update plh position') | ||
291 | 291 | ||
292 | def __update_points_img(self, pubsub_evt): | 292 | def __update_points_img(self, pubsub_evt): |
293 | x, y, z = pubsub_evt.data[1] | 293 | x, y, z = pubsub_evt.data[1] |
@@ -355,7 +355,7 @@ class InnerTaskPanel(wx.Panel): | @@ -355,7 +355,7 @@ class InnerTaskPanel(wx.Panel): | ||
355 | self.N, self.q2, self.Ninv = db.Bases(self.coord1b, self.coord2b, self.coord3b).Basecreation() | 355 | self.N, self.q2, self.Ninv = db.Bases(self.coord1b, self.coord2b, self.coord3b).Basecreation() |
356 | 356 | ||
357 | if self.aux_plh_ref1 == 0 or self.aux_plh_ref2 == 0 or self.aux_plh_ref3 == 0: | 357 | if self.aux_plh_ref1 == 0 or self.aux_plh_ref2 == 0 or self.aux_plh_ref3 == 0: |
358 | - ps.Publisher().sendMessage('Update plh position', coord) | 358 | + Publisher.sendMessage('Update plh position', coord) |
359 | 359 | ||
360 | def Coordinates(self): | 360 | def Coordinates(self): |
361 | #Get Polhemus points for base creation | 361 | #Get Polhemus points for base creation |
invesalius/gui/task_slice.py
@@ -22,7 +22,7 @@ import sys | @@ -22,7 +22,7 @@ import sys | ||
22 | import wx | 22 | import wx |
23 | import wx.lib.hyperlink as hl | 23 | import wx.lib.hyperlink as hl |
24 | import wx.lib.platebtn as pbtn | 24 | import wx.lib.platebtn as pbtn |
25 | -import wx.lib.pubsub as ps | 25 | +from wx.lib.pubsub import pub as Publisher |
26 | 26 | ||
27 | import data.mask as mask | 27 | import data.mask as mask |
28 | import data.slice_ as slice_ | 28 | import data.slice_ as slice_ |
@@ -155,10 +155,10 @@ class InnerTaskPanel(wx.Panel): | @@ -155,10 +155,10 @@ class InnerTaskPanel(wx.Panel): | ||
155 | options = dlgs.GetOptions() | 155 | options = dlgs.GetOptions() |
156 | else: | 156 | else: |
157 | return | 157 | return |
158 | - ps.Publisher().sendMessage('Create surface from index', | 158 | + Publisher.sendMessage('Create surface from index', |
159 | (self.GetMaskSelected(), | 159 | (self.GetMaskSelected(), |
160 | overwrite, algorithm, options)) | 160 | overwrite, algorithm, options)) |
161 | - ps.Publisher().sendMessage('Fold surface task') | 161 | + Publisher.sendMessage('Fold surface task') |
162 | else: | 162 | else: |
163 | dlg.InexistentMask() | 163 | dlg.InexistentMask() |
164 | 164 | ||
@@ -176,7 +176,7 @@ class InnerTaskPanel(wx.Panel): | @@ -176,7 +176,7 @@ class InnerTaskPanel(wx.Panel): | ||
176 | if ok: | 176 | if ok: |
177 | mask_name, thresh, colour = dialog.GetValue() | 177 | mask_name, thresh, colour = dialog.GetValue() |
178 | if mask_name: | 178 | if mask_name: |
179 | - ps.Publisher().sendMessage('Create new mask', | 179 | + Publisher.sendMessage('Create new mask', |
180 | (mask_name, thresh, colour)) | 180 | (mask_name, thresh, colour)) |
181 | 181 | ||
182 | def GetMaskSelected(self): | 182 | def GetMaskSelected(self): |
@@ -260,8 +260,8 @@ class InnerFoldPanel(wx.Panel): | @@ -260,8 +260,8 @@ class InnerFoldPanel(wx.Panel): | ||
260 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) | 260 | self.fold_panel.Bind(fpb.EVT_CAPTIONBAR, self.OnFoldPressCaption) |
261 | 261 | ||
262 | def __bind_pubsub_evt(self): | 262 | def __bind_pubsub_evt(self): |
263 | - ps.Publisher().subscribe(self.OnRetrieveStyle, 'Retrieve task slice style') | ||
264 | - ps.Publisher().subscribe(self.OnDisableStyle, 'Disable task slice style') | 263 | + Publisher.subscribe(self.OnRetrieveStyle, 'Retrieve task slice style') |
264 | + Publisher.subscribe(self.OnDisableStyle, 'Disable task slice style') | ||
265 | 265 | ||
266 | def OnFoldPressCaption(self, evt): | 266 | def OnFoldPressCaption(self, evt): |
267 | id = evt.GetTag().GetId() | 267 | id = evt.GetTag().GetId() |
@@ -269,24 +269,24 @@ class InnerFoldPanel(wx.Panel): | @@ -269,24 +269,24 @@ class InnerFoldPanel(wx.Panel): | ||
269 | 269 | ||
270 | if self.__id_editor == id: | 270 | if self.__id_editor == id: |
271 | if closed: | 271 | if closed: |
272 | - ps.Publisher().sendMessage('Disable style', const.SLICE_STATE_EDITOR) | 272 | + Publisher.sendMessage('Disable style', const.SLICE_STATE_EDITOR) |
273 | self.last_style = None | 273 | self.last_style = None |
274 | else: | 274 | else: |
275 | - ps.Publisher().sendMessage('Enable style', const.SLICE_STATE_EDITOR) | 275 | + Publisher.sendMessage('Enable style', const.SLICE_STATE_EDITOR) |
276 | self.last_style = const.SLICE_STATE_EDITOR | 276 | self.last_style = const.SLICE_STATE_EDITOR |
277 | else: | 277 | else: |
278 | - ps.Publisher().sendMessage('Disable style', const.SLICE_STATE_EDITOR) | 278 | + Publisher.sendMessage('Disable style', const.SLICE_STATE_EDITOR) |
279 | self.last_style = None | 279 | self.last_style = None |
280 | 280 | ||
281 | evt.Skip() | 281 | evt.Skip() |
282 | 282 | ||
283 | def OnRetrieveStyle(self, pubsub_evt): | 283 | def OnRetrieveStyle(self, pubsub_evt): |
284 | if (self.last_style == const.SLICE_STATE_EDITOR): | 284 | if (self.last_style == const.SLICE_STATE_EDITOR): |
285 | - ps.Publisher().sendMessage('Enable style', const.SLICE_STATE_EDITOR) | 285 | + Publisher.sendMessage('Enable style', const.SLICE_STATE_EDITOR) |
286 | 286 | ||
287 | def OnDisableStyle(self, pubsub_evt): | 287 | def OnDisableStyle(self, pubsub_evt): |
288 | if (self.last_style == const.SLICE_STATE_EDITOR): | 288 | if (self.last_style == const.SLICE_STATE_EDITOR): |
289 | - ps.Publisher().sendMessage('Disable style', const.SLICE_STATE_EDITOR) | 289 | + Publisher.sendMessage('Disable style', const.SLICE_STATE_EDITOR) |
290 | 290 | ||
291 | def GetMaskSelected(self): | 291 | def GetMaskSelected(self): |
292 | x= self.mask_prop_panel.GetMaskSelected() | 292 | x= self.mask_prop_panel.GetMaskSelected() |
@@ -356,19 +356,19 @@ class MaskProperties(wx.Panel): | @@ -356,19 +356,19 @@ class MaskProperties(wx.Panel): | ||
356 | 356 | ||
357 | 357 | ||
358 | def __bind_events(self): | 358 | def __bind_events(self): |
359 | - ps.Publisher().subscribe(self.AddMask, 'Add mask') | 359 | + Publisher.subscribe(self.AddMask, 'Add mask') |
360 | # TODO: Uncomment | 360 | # TODO: Uncomment |
361 | - ps.Publisher().subscribe(self.SetThresholdBounds, | 361 | + Publisher.subscribe(self.SetThresholdBounds, |
362 | 'Update threshold limits') | 362 | 'Update threshold limits') |
363 | - ps.Publisher().subscribe(self.SetThresholdModes, 'Set threshold modes') | ||
364 | - ps.Publisher().subscribe(self.SetItemsColour, 'Set GUI items colour') | ||
365 | - ps.Publisher().subscribe(self.SetThresholdValues, | 363 | + Publisher.subscribe(self.SetThresholdModes, 'Set threshold modes') |
364 | + Publisher.subscribe(self.SetItemsColour, 'Set GUI items colour') | ||
365 | + Publisher.subscribe(self.SetThresholdValues, | ||
366 | 'Set threshold values in gradient') | 366 | 'Set threshold values in gradient') |
367 | - ps.Publisher().subscribe(self.SelectMaskName, 'Select mask name in combo') | ||
368 | - ps.Publisher().subscribe(self.ChangeMaskName, 'Change mask name') | ||
369 | - ps.Publisher().subscribe(self.OnRemoveMasks, 'Remove masks') | ||
370 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | ||
371 | - ps.Publisher().subscribe(self.SetThresholdValues2, 'Set threshold values') | 367 | + Publisher.subscribe(self.SelectMaskName, 'Select mask name in combo') |
368 | + Publisher.subscribe(self.ChangeMaskName, 'Change mask name') | ||
369 | + Publisher.subscribe(self.OnRemoveMasks, 'Remove masks') | ||
370 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') | ||
371 | + Publisher.subscribe(self.SetThresholdValues2, 'Set threshold values') | ||
372 | 372 | ||
373 | def OnCloseProject(self, pubsub_evt): | 373 | def OnCloseProject(self, pubsub_evt): |
374 | self.CloseProject() | 374 | self.CloseProject() |
@@ -484,7 +484,7 @@ class MaskProperties(wx.Panel): | @@ -484,7 +484,7 @@ class MaskProperties(wx.Panel): | ||
484 | def OnComboName(self, evt): | 484 | def OnComboName(self, evt): |
485 | mask_name = evt.GetString() | 485 | mask_name = evt.GetString() |
486 | mask_index = evt.GetSelection() | 486 | mask_index = evt.GetSelection() |
487 | - ps.Publisher().sendMessage('Change mask selected', mask_index) | 487 | + Publisher.sendMessage('Change mask selected', mask_index) |
488 | 488 | ||
489 | def OnComboThresh(self, evt): | 489 | def OnComboThresh(self, evt): |
490 | (thresh_min, thresh_max) = Project().threshold_modes[evt.GetString()] | 490 | (thresh_min, thresh_max) = Project().threshold_modes[evt.GetString()] |
@@ -496,7 +496,7 @@ class MaskProperties(wx.Panel): | @@ -496,7 +496,7 @@ class MaskProperties(wx.Panel): | ||
496 | def OnSlideChanged(self, evt): | 496 | def OnSlideChanged(self, evt): |
497 | thresh_min = self.gradient.GetMinValue() | 497 | thresh_min = self.gradient.GetMinValue() |
498 | thresh_max = self.gradient.GetMaxValue() | 498 | thresh_max = self.gradient.GetMaxValue() |
499 | - ps.Publisher().sendMessage('Set threshold values', | 499 | + Publisher.sendMessage('Set threshold values', |
500 | (thresh_min, thresh_max)) | 500 | (thresh_min, thresh_max)) |
501 | session = ses.Session() | 501 | session = ses.Session() |
502 | session.ChangeProject() | 502 | session.ChangeProject() |
@@ -504,7 +504,7 @@ class MaskProperties(wx.Panel): | @@ -504,7 +504,7 @@ class MaskProperties(wx.Panel): | ||
504 | def OnSlideChanging(self, evt): | 504 | def OnSlideChanging(self, evt): |
505 | thresh_min = self.gradient.GetMinValue() | 505 | thresh_min = self.gradient.GetMinValue() |
506 | thresh_max = self.gradient.GetMaxValue() | 506 | thresh_max = self.gradient.GetMaxValue() |
507 | - ps.Publisher().sendMessage('Changing threshold values', | 507 | + Publisher.sendMessage('Changing threshold values', |
508 | (thresh_min, thresh_max)) | 508 | (thresh_min, thresh_max)) |
509 | session = ses.Session() | 509 | session = ses.Session() |
510 | session.ChangeProject() | 510 | session.ChangeProject() |
@@ -512,7 +512,7 @@ class MaskProperties(wx.Panel): | @@ -512,7 +512,7 @@ class MaskProperties(wx.Panel): | ||
512 | def OnSelectColour(self, evt): | 512 | def OnSelectColour(self, evt): |
513 | colour = evt.GetValue() | 513 | colour = evt.GetValue() |
514 | self.gradient.SetColour(colour) | 514 | self.gradient.SetColour(colour) |
515 | - ps.Publisher().sendMessage('Change mask colour', colour) | 515 | + Publisher.sendMessage('Change mask colour', colour) |
516 | 516 | ||
517 | class EditionTools(wx.Panel): | 517 | class EditionTools(wx.Panel): |
518 | def __init__(self, parent): | 518 | def __init__(self, parent): |
@@ -599,10 +599,10 @@ class EditionTools(wx.Panel): | @@ -599,10 +599,10 @@ class EditionTools(wx.Panel): | ||
599 | self.combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp) | 599 | self.combo_brush_op.Bind(wx.EVT_COMBOBOX, self.OnComboBrushOp) |
600 | 600 | ||
601 | def __bind_events(self): | 601 | def __bind_events(self): |
602 | - ps.Publisher().subscribe(self.SetThresholdBounds, | 602 | + Publisher.subscribe(self.SetThresholdBounds, |
603 | 'Update threshold limits') | 603 | 'Update threshold limits') |
604 | - ps.Publisher().subscribe(self.ChangeMaskColour, 'Change mask colour') | ||
605 | - ps.Publisher().subscribe(self.SetGradientColour, 'Add mask') | 604 | + Publisher.subscribe(self.ChangeMaskColour, 'Change mask colour') |
605 | + Publisher.subscribe(self.SetGradientColour, 'Add mask') | ||
606 | 606 | ||
607 | def ChangeMaskColour(self, pubsub_evt): | 607 | def ChangeMaskColour(self, pubsub_evt): |
608 | colour = pubsub_evt.data | 608 | colour = pubsub_evt.data |
@@ -632,7 +632,7 @@ class EditionTools(wx.Panel): | @@ -632,7 +632,7 @@ class EditionTools(wx.Panel): | ||
632 | thresh_min = self.gradient_thresh.GetMinValue() | 632 | thresh_min = self.gradient_thresh.GetMinValue() |
633 | thresh_max = self.gradient_thresh.GetMaxValue() | 633 | thresh_max = self.gradient_thresh.GetMaxValue() |
634 | if self.bind_evt_gradient: | 634 | if self.bind_evt_gradient: |
635 | - ps.Publisher().sendMessage('Set edition threshold values', | 635 | + Publisher.sendMessage('Set edition threshold values', |
636 | (thresh_min, thresh_max)) | 636 | (thresh_min, thresh_max)) |
637 | 637 | ||
638 | def OnMenu(self, evt): | 638 | def OnMenu(self, evt): |
@@ -646,17 +646,17 @@ class EditionTools(wx.Panel): | @@ -646,17 +646,17 @@ class EditionTools(wx.Panel): | ||
646 | 646 | ||
647 | self.btn_brush_format.SetBitmap(bitmap[evt.GetId()]) | 647 | self.btn_brush_format.SetBitmap(bitmap[evt.GetId()]) |
648 | 648 | ||
649 | - ps.Publisher().sendMessage('Set brush format', brush[evt.GetId()]) | 649 | + Publisher.sendMessage('Set brush format', brush[evt.GetId()]) |
650 | 650 | ||
651 | def OnBrushSize(self, evt): | 651 | def OnBrushSize(self, evt): |
652 | """ """ | 652 | """ """ |
653 | # FIXME: Using wx.EVT_SPINCTRL in MacOS it doesnt capture changes only | 653 | # FIXME: Using wx.EVT_SPINCTRL in MacOS it doesnt capture changes only |
654 | # in the text ctrl - so we are capturing only changes on text | 654 | # in the text ctrl - so we are capturing only changes on text |
655 | # Strangelly this is being called twice | 655 | # Strangelly this is being called twice |
656 | - ps.Publisher().sendMessage('Set edition brush size',self.spin.GetValue()) | 656 | + Publisher.sendMessage('Set edition brush size',self.spin.GetValue()) |
657 | 657 | ||
658 | def OnComboBrushOp(self, evt): | 658 | def OnComboBrushOp(self, evt): |
659 | brush_op_id = evt.GetSelection() | 659 | brush_op_id = evt.GetSelection() |
660 | - ps.Publisher().sendMessage('Set edition operation', brush_op_id) | 660 | + Publisher.sendMessage('Set edition operation', brush_op_id) |
661 | 661 | ||
662 | 662 |
invesalius/gui/task_surface.py
@@ -20,7 +20,7 @@ import sys | @@ -20,7 +20,7 @@ import sys | ||
20 | 20 | ||
21 | import wx | 21 | import wx |
22 | import wx.lib.hyperlink as hl | 22 | import wx.lib.hyperlink as hl |
23 | -import wx.lib.pubsub as ps | 23 | +from wx.lib.pubsub import pub as Publisher |
24 | 24 | ||
25 | import constants as const | 25 | import constants as const |
26 | import gui.dialogs as dlg | 26 | import gui.dialogs as dlg |
@@ -126,7 +126,7 @@ class InnerTaskPanel(wx.Panel): | @@ -126,7 +126,7 @@ class InnerTaskPanel(wx.Panel): | ||
126 | 126 | ||
127 | def OnButtonNextTask(self, evt): | 127 | def OnButtonNextTask(self, evt): |
128 | if evt: | 128 | if evt: |
129 | - ps.Publisher().sendMessage('Fold export task') | 129 | + Publisher.sendMessage('Fold export task') |
130 | evt.Skip() | 130 | evt.Skip() |
131 | 131 | ||
132 | def OnLinkNewSurface(self, evt=None): | 132 | def OnLinkNewSurface(self, evt=None): |
@@ -161,7 +161,7 @@ class InnerTaskPanel(wx.Panel): | @@ -161,7 +161,7 @@ class InnerTaskPanel(wx.Panel): | ||
161 | fill_holes, | 161 | fill_holes, |
162 | keep_largest] | 162 | keep_largest] |
163 | 163 | ||
164 | - ps.Publisher().sendMessage('Create surface', surface_data) | 164 | + Publisher.sendMessage('Create surface', surface_data) |
165 | dialog.Destroy() | 165 | dialog.Destroy() |
166 | if evt: | 166 | if evt: |
167 | evt.Skip() | 167 | evt.Skip() |
@@ -346,10 +346,10 @@ class SurfaceTools(wx.Panel): | @@ -346,10 +346,10 @@ class SurfaceTools(wx.Panel): | ||
346 | self.SelectSeed() | 346 | self.SelectSeed() |
347 | 347 | ||
348 | def SelectLargest(self): | 348 | def SelectLargest(self): |
349 | - ps.Publisher().sendMessage('Create surface from largest region') | 349 | + Publisher.sendMessage('Create surface from largest region') |
350 | 350 | ||
351 | def SplitSurface(self): | 351 | def SplitSurface(self): |
352 | - ps.Publisher().sendMessage('Split surface') | 352 | + Publisher.sendMessage('Split surface') |
353 | 353 | ||
354 | def SelectSeed(self): | 354 | def SelectSeed(self): |
355 | if self.button_seeds.IsPressed(): | 355 | if self.button_seeds.IsPressed(): |
@@ -358,12 +358,12 @@ class SurfaceTools(wx.Panel): | @@ -358,12 +358,12 @@ class SurfaceTools(wx.Panel): | ||
358 | self.EndSeeding() | 358 | self.EndSeeding() |
359 | 359 | ||
360 | def StartSeeding(self): | 360 | def StartSeeding(self): |
361 | - ps.Publisher().sendMessage('Enable style', const.VOLUME_STATE_SEED) | ||
362 | - ps.Publisher().sendMessage('Create surface by seeding - start') | 361 | + Publisher.sendMessage('Enable style', const.VOLUME_STATE_SEED) |
362 | + Publisher.sendMessage('Create surface by seeding - start') | ||
363 | 363 | ||
364 | def EndSeeding(self): | 364 | def EndSeeding(self): |
365 | - ps.Publisher().sendMessage('Disable style', const.VOLUME_STATE_SEED) | ||
366 | - ps.Publisher().sendMessage('Create surface by seeding - end') | 365 | + Publisher.sendMessage('Disable style', const.VOLUME_STATE_SEED) |
366 | + Publisher.sendMessage('Create surface by seeding - end') | ||
367 | 367 | ||
368 | 368 | ||
369 | 369 | ||
@@ -437,12 +437,12 @@ class SurfaceProperties(wx.Panel): | @@ -437,12 +437,12 @@ class SurfaceProperties(wx.Panel): | ||
437 | self.__bind_events() | 437 | self.__bind_events() |
438 | 438 | ||
439 | def __bind_events(self): | 439 | def __bind_events(self): |
440 | - ps.Publisher().subscribe(self.InsertNewSurface, | 440 | + Publisher.subscribe(self.InsertNewSurface, |
441 | 'Update surface info in GUI') | 441 | 'Update surface info in GUI') |
442 | - ps.Publisher().subscribe(self.ChangeSurfaceName, | 442 | + Publisher.subscribe(self.ChangeSurfaceName, |
443 | 'Change surface name') | 443 | 'Change surface name') |
444 | - ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | ||
445 | - ps.Publisher().subscribe(self.OnRemoveSurfaces, 'Remove surfaces') | 444 | + Publisher.subscribe(self.OnCloseProject, 'Close project data') |
445 | + Publisher.subscribe(self.OnRemoveSurfaces, 'Remove surfaces') | ||
446 | 446 | ||
447 | 447 | ||
448 | def OnRemoveSurfaces(self, pubsub_evt): | 448 | def OnRemoveSurfaces(self, pubsub_evt): |
@@ -497,11 +497,11 @@ class SurfaceProperties(wx.Panel): | @@ -497,11 +497,11 @@ class SurfaceProperties(wx.Panel): | ||
497 | def OnComboName(self, evt): | 497 | def OnComboName(self, evt): |
498 | surface_name = evt.GetString() | 498 | surface_name = evt.GetString() |
499 | surface_index = evt.GetSelection() | 499 | surface_index = evt.GetSelection() |
500 | - ps.Publisher().sendMessage('Change surface selected', surface_index) | 500 | + Publisher.sendMessage('Change surface selected', surface_index) |
501 | 501 | ||
502 | def OnSelectColour(self, evt): | 502 | def OnSelectColour(self, evt): |
503 | colour = [value/255.0 for value in evt.GetValue()] | 503 | colour = [value/255.0 for value in evt.GetValue()] |
504 | - ps.Publisher().sendMessage('Set surface colour', | 504 | + Publisher.sendMessage('Set surface colour', |
505 | (self.combo_surface_name.GetSelection(), | 505 | (self.combo_surface_name.GetSelection(), |
506 | colour)) | 506 | colour)) |
507 | 507 | ||
@@ -512,7 +512,7 @@ class SurfaceProperties(wx.Panel): | @@ -512,7 +512,7 @@ class SurfaceProperties(wx.Panel): | ||
512 | # This problem is in wx.Widgets and therefore we'll simply overcome it: | 512 | # This problem is in wx.Widgets and therefore we'll simply overcome it: |
513 | if (wx.Platform == "__WXMAC__"): | 513 | if (wx.Platform == "__WXMAC__"): |
514 | transparency = evt.GetInt()/(0.96*float(MAX_TRANSPARENCY)) | 514 | transparency = evt.GetInt()/(0.96*float(MAX_TRANSPARENCY)) |
515 | - ps.Publisher().sendMessage('Set surface transparency', | 515 | + Publisher.sendMessage('Set surface transparency', |
516 | (self.combo_surface_name.GetSelection(), | 516 | (self.combo_surface_name.GetSelection(), |
517 | transparency)) | 517 | transparency)) |
518 | 518 |
invesalius/gui/task_tools.py
@@ -21,7 +21,7 @@ import wx | @@ -21,7 +21,7 @@ import wx | ||
21 | import wx.lib.embeddedimage as emb | 21 | import wx.lib.embeddedimage as emb |
22 | import wx.lib.hyperlink as hl | 22 | import wx.lib.hyperlink as hl |
23 | import wx.lib.platebtn as pbtn | 23 | import wx.lib.platebtn as pbtn |
24 | -import wx.lib.pubsub as ps | 24 | +from wx.lib.pubsub import pub as Publisher |
25 | 25 | ||
26 | import constants | 26 | import constants |
27 | 27 | ||
@@ -121,11 +121,11 @@ class InnerTaskPanel(wx.Panel): | @@ -121,11 +121,11 @@ class InnerTaskPanel(wx.Panel): | ||
121 | print "TODO: Send Signal - Add text annotation (both 2d and 3d)" | 121 | print "TODO: Send Signal - Add text annotation (both 2d and 3d)" |
122 | 122 | ||
123 | def OnLinkLinearMeasure(self): | 123 | def OnLinkLinearMeasure(self): |
124 | - ps.Publisher().sendMessage('Enable style', | 124 | + Publisher.sendMessage('Enable style', |
125 | constants.STATE_MEASURE_DISTANCE) | 125 | constants.STATE_MEASURE_DISTANCE) |
126 | 126 | ||
127 | def OnLinkAngularMeasure(self): | 127 | def OnLinkAngularMeasure(self): |
128 | - ps.Publisher().sendMessage('Enable style', | 128 | + Publisher.sendMessage('Enable style', |
129 | constants.STATE_MEASURE_ANGLE) | 129 | constants.STATE_MEASURE_ANGLE) |
130 | 130 | ||
131 | def OnButton(self, evt): | 131 | def OnButton(self, evt): |
invesalius/gui/widgets/slice_menu.py
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | import sys | 22 | import sys |
23 | 23 | ||
24 | import wx | 24 | import wx |
25 | -import wx.lib.pubsub as ps | 25 | +from wx.lib.pubsub import pub as Publisher |
26 | import constants as const | 26 | import constants as const |
27 | 27 | ||
28 | class SliceMenu(wx.Menu): | 28 | class SliceMenu(wx.Menu): |
@@ -116,8 +116,8 @@ class SliceMenu(wx.Menu): | @@ -116,8 +116,8 @@ class SliceMenu(wx.Menu): | ||
116 | self.__bind_events() | 116 | self.__bind_events() |
117 | 117 | ||
118 | def __bind_events(self): | 118 | def __bind_events(self): |
119 | - ps.Publisher().subscribe(self.CheckWindowLevelOther, 'Check window and level other') | ||
120 | - ps.Publisher().subscribe(self.FirstItemSelect, 'Select first item from slice menu') | 119 | + Publisher.subscribe(self.CheckWindowLevelOther, 'Check window and level other') |
120 | + Publisher.subscribe(self.FirstItemSelect, 'Select first item from slice menu') | ||
121 | 121 | ||
122 | def FirstItemSelect(self, pusub_evt): | 122 | def FirstItemSelect(self, pusub_evt): |
123 | 123 | ||
@@ -143,28 +143,28 @@ class SliceMenu(wx.Menu): | @@ -143,28 +143,28 @@ class SliceMenu(wx.Menu): | ||
143 | if(key in const.WINDOW_LEVEL.keys()): | 143 | if(key in const.WINDOW_LEVEL.keys()): |
144 | print "a" | 144 | print "a" |
145 | window, level = const.WINDOW_LEVEL[key] | 145 | window, level = const.WINDOW_LEVEL[key] |
146 | - ps.Publisher().sendMessage('Bright and contrast adjustment image', | 146 | + Publisher.sendMessage('Bright and contrast adjustment image', |
147 | (window, level)) | 147 | (window, level)) |
148 | - ps.Publisher().sendMessage('Update window level value',\ | 148 | + Publisher.sendMessage('Update window level value',\ |
149 | (window, level)) | 149 | (window, level)) |
150 | - ps.Publisher().sendMessage('Update window and level text',\ | 150 | + Publisher.sendMessage('Update window and level text',\ |
151 | "WL: %d WW: %d"%(level, window)) | 151 | "WL: %d WW: %d"%(level, window)) |
152 | - ps.Publisher().sendMessage('Update slice viewer') | 152 | + Publisher.sendMessage('Update slice viewer') |
153 | 153 | ||
154 | #Necessary update the slice plane in the volume case exists | 154 | #Necessary update the slice plane in the volume case exists |
155 | - ps.Publisher().sendMessage('Render volume viewer') | 155 | + Publisher.sendMessage('Render volume viewer') |
156 | 156 | ||
157 | elif(key in const.SLICE_COLOR_TABLE.keys()): | 157 | elif(key in const.SLICE_COLOR_TABLE.keys()): |
158 | print "b" | 158 | print "b" |
159 | values = const.SLICE_COLOR_TABLE[key] | 159 | values = const.SLICE_COLOR_TABLE[key] |
160 | - ps.Publisher().sendMessage('Change colour table from background image', values) | ||
161 | - ps.Publisher().sendMessage('Update slice viewer') | 160 | + Publisher.sendMessage('Change colour table from background image', values) |
161 | + Publisher.sendMessage('Update slice viewer') | ||
162 | 162 | ||
163 | elif(key in const.IMAGE_TILING.keys()): | 163 | elif(key in const.IMAGE_TILING.keys()): |
164 | print "c" | 164 | print "c" |
165 | values = const.IMAGE_TILING[key] | 165 | values = const.IMAGE_TILING[key] |
166 | - ps.Publisher().sendMessage('Set slice viewer layout', values) | ||
167 | - ps.Publisher().sendMessage('Update slice viewer') | 166 | + Publisher.sendMessage('Set slice viewer layout', values) |
167 | + Publisher.sendMessage('Update slice viewer') | ||
168 | 168 | ||
169 | evt.Skip() | 169 | evt.Skip() |
170 | 170 |
invesalius/invesalius.py
@@ -34,8 +34,11 @@ else: | @@ -34,8 +34,11 @@ else: | ||
34 | wxversion.select('2.8-unicode', optionsRequired=True) | 34 | wxversion.select('2.8-unicode', optionsRequired=True) |
35 | 35 | ||
36 | import wx | 36 | import wx |
37 | -from wx.lib.pubsub import setupv1 | ||
38 | -import wx.lib.pubsub as ps | 37 | +#from wx.lib.pubsub import setupv1 #new wx |
38 | +from wx.lib.pubsub import setuparg1# as psv1 | ||
39 | +#from wx.lib.pubsub import Publisher | ||
40 | +#import wx.lib.pubsub as ps | ||
41 | +from wx.lib.pubsub import pub as Publisher | ||
39 | import wx.lib.agw.advancedsplash as agw | 42 | import wx.lib.agw.advancedsplash as agw |
40 | 43 | ||
41 | if sys.platform == 'linux2': | 44 | if sys.platform == 'linux2': |
@@ -71,7 +74,7 @@ class InVesalius(wx.App): | @@ -71,7 +74,7 @@ class InVesalius(wx.App): | ||
71 | Open drag & drop files under darwin | 74 | Open drag & drop files under darwin |
72 | """ | 75 | """ |
73 | path = os.path.abspath(filename) | 76 | path = os.path.abspath(filename) |
74 | - ps.Publisher().sendMessage('Open project', path) | 77 | + Publisher.sendMessage('Open project', path) |
75 | 78 | ||
76 | # ------------------------------------------------------------------ | 79 | # ------------------------------------------------------------------ |
77 | 80 | ||
@@ -215,13 +218,13 @@ def parse_comand_line(): | @@ -215,13 +218,13 @@ def parse_comand_line(): | ||
215 | 218 | ||
216 | # If debug argument... | 219 | # If debug argument... |
217 | if options.debug: | 220 | if options.debug: |
218 | - ps.Publisher().subscribe(print_events, '') | 221 | + Publisher.subscribe(print_events, '') |
219 | session.debug = 1 | 222 | session.debug = 1 |
220 | 223 | ||
221 | # If import DICOM argument... | 224 | # If import DICOM argument... |
222 | if options.dicom_dir: | 225 | if options.dicom_dir: |
223 | import_dir = options.dicom_dir | 226 | import_dir = options.dicom_dir |
224 | - ps.Publisher().sendMessage('Import directory', import_dir) | 227 | + Publisher().sendMessage('Import directory', import_dir) |
225 | return True | 228 | return True |
226 | 229 | ||
227 | # Check if there is a file path somewhere in what the user wrote | 230 | # Check if there is a file path somewhere in what the user wrote |
@@ -233,7 +236,7 @@ def parse_comand_line(): | @@ -233,7 +236,7 @@ def parse_comand_line(): | ||
233 | file = args[i] | 236 | file = args[i] |
234 | if os.path.isfile(file): | 237 | if os.path.isfile(file): |
235 | path = os.path.abspath(file) | 238 | path = os.path.abspath(file) |
236 | - ps.Publisher().sendMessage('Open project', path) | 239 | + Publisher.sendMessage('Open project', path) |
237 | i = 0 | 240 | i = 0 |
238 | return True | 241 | return True |
239 | return False | 242 | return False |
@@ -255,7 +258,8 @@ def main(): | @@ -255,7 +258,8 @@ def main(): | ||
255 | 258 | ||
256 | if __name__ == '__main__': | 259 | if __name__ == '__main__': |
257 | # Needed in win 32 exe | 260 | # Needed in win 32 exe |
258 | - if hasattr(sys,"frozen") and sys.frozen == "windows_exe": | 261 | + if hasattr(sys,"frozen") and (sys.frozen == "windows_exe"\ |
262 | + or sys.frozen == "console_exe"): | ||
259 | multiprocessing.freeze_support() | 263 | multiprocessing.freeze_support() |
260 | 264 | ||
261 | #Click in the .inv3 file support | 265 | #Click in the .inv3 file support |
invesalius/presets.py
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | import os | 19 | import os |
20 | import plistlib | 20 | import plistlib |
21 | 21 | ||
22 | -import wx.lib.pubsub as ps | 22 | +from wx.lib.pubsub import pub as Publisher |
23 | 23 | ||
24 | from utils import TwoWaysDictionary | 24 | from utils import TwoWaysDictionary |
25 | 25 | ||
@@ -64,7 +64,7 @@ class Presets(): | @@ -64,7 +64,7 @@ class Presets(): | ||
64 | self.__bind_events() | 64 | self.__bind_events() |
65 | 65 | ||
66 | def __bind_events(self): | 66 | def __bind_events(self): |
67 | - ps.Publisher.subscribe(self.UpdateThresholdModes, | 67 | + Publisher.subscribe(self.UpdateThresholdModes, |
68 | 'Update threshold limits list') | 68 | 'Update threshold limits list') |
69 | 69 | ||
70 | def UpdateThresholdModes(self, evt): | 70 | def UpdateThresholdModes(self, evt): |
@@ -93,7 +93,7 @@ class Presets(): | @@ -93,7 +93,7 @@ class Presets(): | ||
93 | 93 | ||
94 | presets[key] = (t_min, t_max) | 94 | presets[key] = (t_min, t_max) |
95 | 95 | ||
96 | - ps.Publisher().sendMessage('Update threshold limits', (thresh_min, | 96 | + Publisher.sendMessage('Update threshold limits', (thresh_min, |
97 | thresh_max)) | 97 | thresh_max)) |
98 | 98 | ||
99 | def SavePlist(self, filename): | 99 | def SavePlist(self, filename): |
invesalius/project.py
@@ -26,7 +26,7 @@ import tarfile | @@ -26,7 +26,7 @@ import tarfile | ||
26 | import tempfile | 26 | import tempfile |
27 | 27 | ||
28 | import wx | 28 | import wx |
29 | -import wx.lib.pubsub as ps | 29 | +from wx.lib.pubsub import pub as Publisher |
30 | import vtk | 30 | import vtk |
31 | 31 | ||
32 | import constants as const | 32 | import constants as const |
@@ -184,7 +184,7 @@ class Project(object): | @@ -184,7 +184,7 @@ class Project(object): | ||
184 | def SetRaycastPreset(self, label): | 184 | def SetRaycastPreset(self, label): |
185 | path = os.path.join(RAYCASTING_PRESETS_DIRECTORY, label + '.plist') | 185 | path = os.path.join(RAYCASTING_PRESETS_DIRECTORY, label + '.plist') |
186 | preset = plistlib.readPlist(path) | 186 | preset = plistlib.readPlist(path) |
187 | - ps.Publisher.sendMessage('Set raycasting preset', preset) | 187 | + Publisher.sendMessage('Set raycasting preset', preset) |
188 | 188 | ||
189 | def GetMeasuresDict(self): | 189 | def GetMeasuresDict(self): |
190 | measures = {} | 190 | measures = {} |
invesalius/reader/dicom_reader.py
@@ -27,7 +27,7 @@ from multiprocessing import cpu_count | @@ -27,7 +27,7 @@ from multiprocessing import cpu_count | ||
27 | import vtk | 27 | import vtk |
28 | import vtkgdcm | 28 | import vtkgdcm |
29 | import gdcm | 29 | import gdcm |
30 | -import wx.lib.pubsub as ps | 30 | +from wx.lib.pubsub import pub as Publisher |
31 | 31 | ||
32 | import constants as const | 32 | import constants as const |
33 | import dicom | 33 | import dicom |
@@ -317,7 +317,7 @@ def GetDicomGroups(directory, recursive=True): | @@ -317,7 +317,7 @@ def GetDicomGroups(directory, recursive=True): | ||
317 | 317 | ||
318 | class ProgressDicomReader: | 318 | class ProgressDicomReader: |
319 | def __init__(self): | 319 | def __init__(self): |
320 | - ps.Publisher().subscribe(self.CancelLoad, "Cancel DICOM load") | 320 | + Publisher.subscribe(self.CancelLoad, "Cancel DICOM load") |
321 | 321 | ||
322 | def CancelLoad(self, evt_pubsub): | 322 | def CancelLoad(self, evt_pubsub): |
323 | self.running = False | 323 | self.running = False |
@@ -332,10 +332,10 @@ class ProgressDicomReader: | @@ -332,10 +332,10 @@ class ProgressDicomReader: | ||
332 | self.GetDicomGroups(path,recursive) | 332 | self.GetDicomGroups(path,recursive) |
333 | 333 | ||
334 | def UpdateLoadFileProgress(self,cont_progress): | 334 | def UpdateLoadFileProgress(self,cont_progress): |
335 | - ps.Publisher().sendMessage("Update dicom load", cont_progress) | 335 | + Publisher.sendMessage("Update dicom load", cont_progress) |
336 | 336 | ||
337 | def EndLoadFile(self, patient_list): | 337 | def EndLoadFile(self, patient_list): |
338 | - ps.Publisher().sendMessage("End dicom load", patient_list) | 338 | + Publisher.sendMessage("End dicom load", patient_list) |
339 | 339 | ||
340 | def GetDicomGroups(self, path, recursive): | 340 | def GetDicomGroups(self, path, recursive): |
341 | 341 |
invesalius/session.py
@@ -24,7 +24,8 @@ import sys | @@ -24,7 +24,8 @@ import sys | ||
24 | from threading import Thread | 24 | from threading import Thread |
25 | import time | 25 | import time |
26 | 26 | ||
27 | -import wx.lib.pubsub as ps | 27 | +#import wx.lib.pubsub as ps |
28 | +from wx.lib.pubsub import pub as Publisher | ||
28 | 29 | ||
29 | from utils import Singleton, debug | 30 | from utils import Singleton, debug |
30 | 31 | ||
@@ -38,7 +39,7 @@ class Session(object): | @@ -38,7 +39,7 @@ class Session(object): | ||
38 | 39 | ||
39 | ws = self.ws = WriteSession(self) | 40 | ws = self.ws = WriteSession(self) |
40 | ws.start() | 41 | ws.start() |
41 | - ps.Publisher().subscribe(self.StopRecording, "Stop Config Recording") | 42 | + Publisher.subscribe(self.StopRecording, "Stop Config Recording") |
42 | 43 | ||
43 | def CreateItens(self): | 44 | def CreateItens(self): |
44 | import constants as const | 45 | import constants as const |
@@ -117,7 +118,7 @@ class Session(object): | @@ -117,7 +118,7 @@ class Session(object): | ||
117 | def CreateProject(self, filename): | 118 | def CreateProject(self, filename): |
118 | import constants as const | 119 | import constants as const |
119 | debug("Session.CreateProject") | 120 | debug("Session.CreateProject") |
120 | - ps.Publisher().sendMessage('Begin busy cursor') | 121 | + Publisher.sendMessage('Begin busy cursor') |
121 | # Set session info | 122 | # Set session info |
122 | self.project_path = (self.tempdir, filename) | 123 | self.project_path = (self.tempdir, filename) |
123 | self.project_status = const.PROJ_NEW | 124 | self.project_status = const.PROJ_NEW |
invesalius/style.py
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | # detalhes. | 17 | # detalhes. |
18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
19 | 19 | ||
20 | -import wx.lib.pubsub as ps | 20 | +from wx.lib.pubsub import pub as Publisher |
21 | 21 | ||
22 | 22 | ||
23 | # mode.py | 23 | # mode.py |