Commit e2a484bd6cf01d05f6daaf85ee8feeb6a7285194

Authored by rmatsuda
2 parents 78c5f802 d498a62e
Exists in master

Merge branch 'master' into icp

Showing 113 changed files with 355 additions and 317 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 113 files displayed.

@@ -40,7 +40,11 @@ if sys.platform == 'win32': @@ -40,7 +40,11 @@ if sys.platform == 'win32':
40 # #wxversion.ensureMinimal('2.8-unicode', optionsRequired=True) 40 # #wxversion.ensureMinimal('2.8-unicode', optionsRequired=True)
41 # #wxversion.select('2.8-unicode', optionsRequired=True) 41 # #wxversion.select('2.8-unicode', optionsRequired=True)
42 # # wxversion.ensureMinimal('4.0') 42 # # wxversion.ensureMinimal('4.0')
43 - 43 +
  44 +# Forcing to use X11, OpenGL in wxPython doesn't work with Wayland.
  45 +if sys.platform not in ("win32", "darwin"):
  46 + os.environ["GDK_BACKEND"] = "x11"
  47 +
44 import wx 48 import wx
45 try: 49 try:
46 from wx.adv import SplashScreen 50 from wx.adv import SplashScreen
@@ -98,7 +102,7 @@ class InVesalius(wx.App): @@ -98,7 +102,7 @@ class InVesalius(wx.App):
98 """ 102 """
99 Initialize splash screen and main frame. 103 Initialize splash screen and main frame.
100 """ 104 """
101 - 105 +
102 from multiprocessing import freeze_support 106 from multiprocessing import freeze_support
103 freeze_support() 107 freeze_support()
104 108
@@ -179,18 +183,18 @@ class Inv3SplashScreen(SplashScreen): @@ -179,18 +183,18 @@ class Inv3SplashScreen(SplashScreen):
179 183
180 # session.SaveConfigFileBackup() 184 # session.SaveConfigFileBackup()
181 185
182 - 186 +
183 # Only after language was defined, splash screen will be 187 # Only after language was defined, splash screen will be
184 # shown 188 # shown
185 if lang: 189 if lang:
186 - 190 +
187 #import locale 191 #import locale
188 #try: 192 #try:
189 # locale.setlocale(locale.LC_ALL, '') 193 # locale.setlocale(locale.LC_ALL, '')
190 #except locale.Error: 194 #except locale.Error:
191 # pass 195 # pass
192 -  
193 - 196 +
  197 +
194 # For pt_BR, splash_pt.png should be used 198 # For pt_BR, splash_pt.png should be used
195 if (lang.startswith('pt')): 199 if (lang.startswith('pt')):
196 icon_file = "splash_pt.png" 200 icon_file = "splash_pt.png"
@@ -202,13 +206,13 @@ class Inv3SplashScreen(SplashScreen): @@ -202,13 +206,13 @@ class Inv3SplashScreen(SplashScreen):
202 abs_file_path = os.path.abspath(".." + os.sep) 206 abs_file_path = os.path.abspath(".." + os.sep)
203 path = abs_file_path 207 path = abs_file_path
204 path = os.path.join(path, 'icons', icon_file) 208 path = os.path.join(path, 'icons', icon_file)
205 - 209 +
206 else: 210 else:
207 211
208 path = os.path.join(".","icons", icon_file) 212 path = os.path.join(".","icons", icon_file)
209 if not os.path.exists(path): 213 if not os.path.exists(path):
210 path = os.path.join(".", "icons", "splash_en.png") 214 path = os.path.join(".", "icons", "splash_en.png")
211 - 215 +
212 bmp = wx.Image(path).ConvertToBitmap() 216 bmp = wx.Image(path).ConvertToBitmap()
213 217
214 try: 218 try:
@@ -232,10 +236,10 @@ class Inv3SplashScreen(SplashScreen): @@ -232,10 +236,10 @@ class Inv3SplashScreen(SplashScreen):
232 from invesalius.gui.frame import Frame 236 from invesalius.gui.frame import Frame
233 from invesalius.control import Controller 237 from invesalius.control import Controller
234 from invesalius.project import Project 238 from invesalius.project import Project
235 - 239 +
236 self.main = Frame(None) 240 self.main = Frame(None)
237 self.control = Controller(self.main) 241 self.control = Controller(self.main)
238 - 242 +
239 self.fc = wx.CallLater(200, self.ShowMain) 243 self.fc = wx.CallLater(200, self.ShowMain)
240 options, args = parse_comand_line() 244 options, args = parse_comand_line()
241 wx.CallLater(1, use_cmd_optargs, options, args) 245 wx.CallLater(1, use_cmd_optargs, options, args)
@@ -498,7 +502,7 @@ def main(): @@ -498,7 +502,7 @@ def main():
498 if __name__ == '__main__': 502 if __name__ == '__main__':
499 #Is needed because of pyinstaller 503 #Is needed because of pyinstaller
500 multiprocessing.freeze_support() 504 multiprocessing.freeze_support()
501 - 505 +
502 #Needed in win 32 exe 506 #Needed in win 32 exe
503 if hasattr(sys,"frozen") and sys.platform.startswith('win'): 507 if hasattr(sys,"frozen") and sys.platform.startswith('win'):
504 508
@@ -523,4 +527,3 @@ if __name__ == '__main__': @@ -523,4 +527,3 @@ if __name__ == '__main__':
523 527
524 # Init application 528 # Init application
525 main() 529 main()
526 -  
icons/3D_glasses_original.png

12.6 KB | W: | H:

2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/be.bmp
No preview for this file type
icons/be.png 0 → 100644

595 Bytes

icons/brush_circle.jpg

1.17 KB

icons/brush_circle.png 0 → 100644

1.07 KB

icons/brush_square.jpg

1022 Bytes

icons/brush_square.png 0 → 100644

934 Bytes

icons/ca.bmp
No preview for this file type
icons/ca.png 0 → 100644

307 Bytes

icons/cross_original.png

1.37 KB | W: | H:

1.48 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/cs.bmp
No preview for this file type
icons/cs.png 0 → 100644

646 Bytes

icons/de_DE.bmp
No preview for this file type
icons/de_DE.png 0 → 100644

562 Bytes

icons/el_GR.bmp
No preview for this file type
icons/el_GR.png 0 → 100644

576 Bytes

icons/en.bmp
No preview for this file type
icons/en.png 0 → 100644

957 Bytes

icons/es.bmp
No preview for this file type
icons/es.png 0 → 100644

472 Bytes

icons/file_from_internet_original.png

3.04 KB | W: | H:

3.15 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/file_import_original.png

1.96 KB | W: | H:

2.07 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/file_open_original.png

1.93 KB | W: | H:

2.04 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/file_save_original.png

1.71 KB | W: | H:

1.82 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/fr.bmp
No preview for this file type
icons/fr.png 0 → 100644

360 Bytes

icons/it.bmp
No preview for this file type
icons/it.png

196 Bytes | W: | H:

488 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/ja.bmp
No preview for this file type
icons/ja.png 0 → 100644

431 Bytes

icons/ko.bmp
No preview for this file type
icons/ko.png 0 → 100644

721 Bytes

icons/layout_data_only.gif

1.17 KB

icons/layout_data_only.png

1.43 KB | W: | H:

931 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/layout_data_only_original.gif

788 Bytes

icons/layout_data_only_original.png

1004 Bytes | W: | H:

855 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/layout_full.gif

1.17 KB

icons/layout_full.png

1.46 KB | W: | H:

917 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/layout_full_original.gif

804 Bytes

icons/layout_full_original.png

996 Bytes | W: | H:

883 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/measure_angle.jpg

701 Bytes

icons/measure_angle.png

1.79 KB | W: | H:

4.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/measure_angle_original.jpg

1.79 KB

icons/measure_angle_original.png

2.16 KB | W: | H:

6.49 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/measure_line_original.png

2.09 KB | W: | H:

2.21 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/object_add.gif

1.58 KB

icons/object_add_original.png

9.17 KB | W: | H:

2.03 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/object_colour.jpg

360 Bytes

icons/object_colour.png 0 → 100644

352 Bytes

icons/object_invisible.jpg

297 Bytes

icons/object_invisible.png 0 → 100644

284 Bytes

icons/object_remove.gif

1.65 KB

icons/object_remove_original.png

9.47 KB | W: | H:

1.97 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/object_visible.jpg

1.88 KB

icons/object_visible.png 0 → 100644

3.34 KB

icons/print_original.png

2.21 KB | W: | H:

2.32 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/pt.bmp
No preview for this file type
icons/pt.png 0 → 100644

651 Bytes

icons/pt_BR.bmp
No preview for this file type
icons/pt_BR.png 0 → 100644

596 Bytes

icons/redo_original.png

1.64 KB | W: | H:

1.75 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/ro.bmp
No preview for this file type
icons/ro.png 0 → 100644

278 Bytes

icons/ru.bmp
No preview for this file type
icons/ru.png 0 → 100644

289 Bytes

icons/slice_original.png

828 Bytes | W: | H:

942 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/slice_plane_original.png

2.64 KB | W: | H:

2.01 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/surface_export_original.png

27.4 KB | W: | H:

3.25 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/text.gif

243 Bytes

icons/text.png

477 Bytes | W: | H:

422 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/text_inverted_original.png

541 Bytes | W: | H:

655 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/text_original.png

567 Bytes | W: | H:

681 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_annotation_original.png

21.6 KB | W: | H:

2.21 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_contrast_original.png

1.65 KB | W: | H:

1.76 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_photo_original.png

2.87 KB | W: | H:

2.99 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_rotate_original.gif

1.63 KB

icons/tool_rotate_original.png

2.45 KB | W: | H:

2.57 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_translate_original.png

2.21 KB | W: | H:

2.32 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_zoom_in_original.png

13.5 KB | W: | H:

2.64 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_zoom_original.png

2.11 KB | W: | H:

2.22 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_zoom_out_original.png

13.6 KB | W: | H:

2.64 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tool_zoom_select_original.png

2.23 KB | W: | H:

2.35 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/tr_TR.bmp
No preview for this file type
icons/tr_TR.png 0 → 100644

409 Bytes

icons/undo_original.png

1.72 KB | W: | H:

1.83 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/volume_raycasting_original.png

3.03 KB | W: | H:

2.21 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
icons/zh_TW.bmp
No preview for this file type
icons/zh_TW.png 0 → 100644

846 Bytes

invesalius/data/imagedata_utils.py
@@ -500,34 +500,6 @@ def img2memmap(group): @@ -500,34 +500,6 @@ def img2memmap(group):
500 return matrix, scalar_range, temp_file 500 return matrix, scalar_range, temp_file
501 501
502 502
503 -def imgnormalize(data, srange=(0, 255)):  
504 - """  
505 - Normalize image pixel intensity for int16 gray scale values.  
506 -  
507 - :param data: image matrix  
508 - :param srange: range for normalization, default is 0 to 255  
509 - :return: normalized pixel intensity matrix  
510 - """  
511 -  
512 - dataf = numpy.asarray(data)  
513 - rangef = numpy.asarray(srange)  
514 - faux = numpy.ravel(dataf).astype(float)  
515 - minimum = numpy.min(faux)  
516 - maximum = numpy.max(faux)  
517 - lower = rangef[0]  
518 - upper = rangef[1]  
519 -  
520 - if minimum == maximum:  
521 - datan = numpy.ones(dataf.shape)*(upper + lower) / 2.  
522 - else:  
523 - datan = (faux-minimum)*(upper-lower) / (maximum-minimum) + lower  
524 -  
525 - datan = numpy.reshape(datan, dataf.shape)  
526 - datan = datan.astype(numpy.int16)  
527 -  
528 - return datan  
529 -  
530 -  
531 def get_LUT_value_255(data, window, level): 503 def get_LUT_value_255(data, window, level):
532 shape = data.shape 504 shape = data.shape
533 data_ = data.ravel() 505 data_ = data.ravel()
@@ -539,6 +511,8 @@ def get_LUT_value_255(data, window, level): @@ -539,6 +511,8 @@ def get_LUT_value_255(data, window, level):
539 return data 511 return data
540 512
541 513
542 -def image_normalize(image, min_=0.0, max_=1.0): 514 +def image_normalize(image, min_=0.0, max_=1.0, output_dtype=np.int16):
  515 + output = np.empty(shape=image.shape, dtype=output_dtype)
543 imin, imax = image.min(), image.max() 516 imin, imax = image.min(), image.max()
544 - return (image - imin) * ((max_ - min_) / (imax - imin)) + min_ 517 + output[:] = (image - imin) * ((max_ - min_) / (imax - imin)) + min_
  518 + return output
invesalius/data/slice_.py
@@ -301,7 +301,10 @@ class Slice(metaclass=utils.Singleton): @@ -301,7 +301,10 @@ class Slice(metaclass=utils.Singleton):
301 301
302 for name in self.aux_matrices: 302 for name in self.aux_matrices:
303 m = self.aux_matrices[name] 303 m = self.aux_matrices[name]
304 - f = m.filename 304 + try:
  305 + f = m.filename
  306 + except AttributeError:
  307 + continue
305 m._mmap.close() 308 m._mmap.close()
306 m = None 309 m = None
307 os.remove(f) 310 os.remove(f)
@@ -347,6 +350,8 @@ class Slice(metaclass=utils.Singleton): @@ -347,6 +350,8 @@ class Slice(metaclass=utils.Singleton):
347 self.SetMaskEditionThreshold(index, threshold_range) 350 self.SetMaskEditionThreshold(index, threshold_range)
348 351
349 def __set_current_mask_threshold(self, threshold_range): 352 def __set_current_mask_threshold(self, threshold_range):
  353 + if self.current_mask is None:
  354 + return
350 index = self.current_mask.index 355 index = self.current_mask.index
351 self.num_gradient += 1 356 self.num_gradient += 1
352 self.current_mask.matrix[:] = 0 357 self.current_mask.matrix[:] = 0
@@ -387,6 +392,8 @@ class Slice(metaclass=utils.Singleton): @@ -387,6 +392,8 @@ class Slice(metaclass=utils.Singleton):
387 Publisher.sendMessage("Reload actual slice") 392 Publisher.sendMessage("Reload actual slice")
388 393
389 def __set_current_mask_threshold_actual_slice(self, threshold_range): 394 def __set_current_mask_threshold_actual_slice(self, threshold_range):
  395 + if self.current_mask is None:
  396 + return
390 index = self.current_mask.index 397 index = self.current_mask.index
391 for orientation in self.buffer_slices: 398 for orientation in self.buffer_slices:
392 self.buffer_slices[orientation].discard_vtk_mask() 399 self.buffer_slices[orientation].discard_vtk_mask()
@@ -624,7 +631,7 @@ class Slice(metaclass=utils.Singleton): @@ -624,7 +631,7 @@ class Slice(metaclass=utils.Singleton):
624 self.buffer_slices[orientation].vtk_image = image 631 self.buffer_slices[orientation].vtk_image = image
625 self.buffer_slices[orientation].vtk_mask = mask 632 self.buffer_slices[orientation].vtk_mask = mask
626 633
627 - if self.to_show_aux == "watershed" and self.current_mask.is_shown: 634 + if self.to_show_aux == "watershed" and self.current_mask is not None and self.current_mask.is_shown:
628 m = self.get_aux_slice("watershed", orientation, slice_number) 635 m = self.get_aux_slice("watershed", orientation, slice_number)
629 tmp_vimage = converters.to_vtk(m, self.spacing, slice_number, orientation) 636 tmp_vimage = converters.to_vtk(m, self.spacing, slice_number, orientation)
630 cimage = self.do_custom_colour( 637 cimage = self.do_custom_colour(
invesalius/data/viewer_slice.py
@@ -102,13 +102,13 @@ class ContourMIPConfig(wx.Panel): @@ -102,13 +102,13 @@ class ContourMIPConfig(wx.Panel):
102 self.txt_mip_border = wx.StaticText(self, -1, _("Sharpness")) 102 self.txt_mip_border = wx.StaticText(self, -1, _("Sharpness"))
103 103
104 sizer = wx.BoxSizer(wx.HORIZONTAL) 104 sizer = wx.BoxSizer(wx.HORIZONTAL)
105 - sizer.Add(txt_mip_size, 0, wx.EXPAND | wx.ALL, 2) 105 + sizer.Add(txt_mip_size, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 2)
106 sizer.Add(self.mip_size_spin, 0) 106 sizer.Add(self.mip_size_spin, 0)
107 try: 107 try:
108 sizer.Add(10, 0) 108 sizer.Add(10, 0)
109 except TypeError: 109 except TypeError:
110 sizer.Add((10, 0)) 110 sizer.Add((10, 0))
111 - sizer.Add(self.txt_mip_border, 0, wx.EXPAND | wx.ALL, 2) 111 + sizer.Add(self.txt_mip_border, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 2)
112 sizer.Add(self.border_spin, 0, wx.EXPAND) 112 sizer.Add(self.border_spin, 0, wx.EXPAND)
113 try: 113 try:
114 sizer.Add(10, 0) 114 sizer.Add(10, 0)
@@ -1438,8 +1438,12 @@ class Viewer(wx.Panel): @@ -1438,8 +1438,12 @@ class Viewer(wx.Panel):
1438 index = max_slice_number - 1 1438 index = max_slice_number - 1
1439 inverted = self.mip_ctrls.inverted.GetValue() 1439 inverted = self.mip_ctrls.inverted.GetValue()
1440 border_size = self.mip_ctrls.border_spin.GetValue() 1440 border_size = self.mip_ctrls.border_spin.GetValue()
1441 - image = self.slice_.GetSlices(self.orientation, index,  
1442 - self.number_slices, inverted, border_size) 1441 + try:
  1442 + image = self.slice_.GetSlices(self.orientation, index,
  1443 + self.number_slices, inverted,
  1444 + border_size)
  1445 + except IndexError:
  1446 + return
1443 self.slice_data.actor.SetInputData(image) 1447 self.slice_data.actor.SetInputData(image)
1444 for actor in self.actors_by_slice_number[self.slice_data.number]: 1448 for actor in self.actors_by_slice_number[self.slice_data.number]:
1445 self.slice_data.renderer.RemoveActor(actor) 1449 self.slice_data.renderer.RemoveActor(actor)
invesalius/gui/brain_seg_dialog.py
@@ -81,6 +81,8 @@ class BrainSegmenterDialog(wx.Dialog): @@ -81,6 +81,8 @@ class BrainSegmenterDialog(wx.Dialog):
81 self.txt_threshold.SetMinClientSize((w, -1)) 81 self.txt_threshold.SetMinClientSize((w, -1))
82 self.chk_new_mask = wx.CheckBox(self, wx.ID_ANY, _("Create new mask")) 82 self.chk_new_mask = wx.CheckBox(self, wx.ID_ANY, _("Create new mask"))
83 self.chk_new_mask.SetValue(True) 83 self.chk_new_mask.SetValue(True)
  84 + self.chk_apply_wwwl = wx.CheckBox(self, wx.ID_ANY, _("Apply WW&WL"))
  85 + self.chk_apply_wwwl.SetValue(False)
84 self.progress = wx.Gauge(self, -1) 86 self.progress = wx.Gauge(self, -1)
85 self.lbl_progress_caption = wx.StaticText(self, -1, _("Elapsed time:")) 87 self.lbl_progress_caption = wx.StaticText(self, -1, _("Elapsed time:"))
86 self.lbl_time = wx.StaticText(self, -1, _("00:00:00")) 88 self.lbl_time = wx.StaticText(self, -1, _("00:00:00"))
@@ -115,11 +117,12 @@ class BrainSegmenterDialog(wx.Dialog): @@ -115,11 +117,12 @@ class BrainSegmenterDialog(wx.Dialog):
115 sizer_3.Add( 117 sizer_3.Add(
116 self.sld_threshold, 118 self.sld_threshold,
117 1, 119 1,
118 - wx.ALIGN_CENTER | wx.BOTTOM | wx.EXPAND | wx.LEFT | wx.RIGHT, 120 + wx.BOTTOM | wx.EXPAND | wx.LEFT | wx.RIGHT,
119 5, 121 5,
120 ) 122 )
121 sizer_3.Add(self.txt_threshold, 0, wx.ALL, 5) 123 sizer_3.Add(self.txt_threshold, 0, wx.ALL, 5)
122 main_sizer.Add(sizer_3, 0, wx.EXPAND, 0) 124 main_sizer.Add(sizer_3, 0, wx.EXPAND, 0)
  125 + main_sizer.Add(self.chk_apply_wwwl, 0, wx.EXPAND | wx.ALL, 5)
123 main_sizer.Add(self.chk_new_mask, 0, wx.EXPAND | wx.ALL, 5) 126 main_sizer.Add(self.chk_new_mask, 0, wx.EXPAND | wx.ALL, 5)
124 main_sizer.Add(self.progress, 0, wx.EXPAND | wx.ALL, 5) 127 main_sizer.Add(self.progress, 0, wx.EXPAND | wx.ALL, 5)
125 time_sizer = wx.BoxSizer(wx.HORIZONTAL) 128 time_sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -128,15 +131,15 @@ class BrainSegmenterDialog(wx.Dialog): @@ -128,15 +131,15 @@ class BrainSegmenterDialog(wx.Dialog):
128 main_sizer.Add(time_sizer, 0, wx.EXPAND | wx.ALL, 5) 131 main_sizer.Add(time_sizer, 0, wx.EXPAND | wx.ALL, 5)
129 sizer_buttons = wx.BoxSizer(wx.HORIZONTAL) 132 sizer_buttons = wx.BoxSizer(wx.HORIZONTAL)
130 sizer_buttons.Add( 133 sizer_buttons.Add(
131 - self.btn_close, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 5 134 + self.btn_close, 0, wx.ALIGN_BOTTOM | wx.ALL, 5
132 ) 135 )
133 sizer_buttons.Add( 136 sizer_buttons.Add(
134 - self.btn_stop, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 5 137 + self.btn_stop, 0, wx.ALIGN_BOTTOM | wx.ALL, 5
135 ) 138 )
136 sizer_buttons.Add( 139 sizer_buttons.Add(
137 - self.btn_segment, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 5 140 + self.btn_segment, 0, wx.ALIGN_BOTTOM | wx.ALL, 5
138 ) 141 )
139 - main_sizer.Add(sizer_buttons, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 0) 142 + main_sizer.Add(sizer_buttons, 0, wx.ALIGN_RIGHT | wx.ALL, 0)
140 self.SetSizer(main_sizer) 143 self.SetSizer(main_sizer)
141 main_sizer.Fit(self) 144 main_sizer.Fit(self)
142 main_sizer.SetSizeHints(self) 145 main_sizer.SetSizeHints(self)
@@ -216,6 +219,7 @@ class BrainSegmenterDialog(wx.Dialog): @@ -216,6 +219,7 @@ class BrainSegmenterDialog(wx.Dialog):
216 device_id = self.plaidml_devices[self.cb_devices.GetValue()] 219 device_id = self.plaidml_devices[self.cb_devices.GetValue()]
217 except (KeyError, AttributeError): 220 except (KeyError, AttributeError):
218 device_id = "llvm_cpu.0" 221 device_id = "llvm_cpu.0"
  222 + apply_wwwl = self.chk_apply_wwwl.GetValue()
219 create_new_mask = self.chk_new_mask.GetValue() 223 create_new_mask = self.chk_new_mask.GetValue()
220 use_gpu = self.chk_use_gpu.GetValue() 224 use_gpu = self.chk_use_gpu.GetValue()
221 prob_threshold = self.sld_threshold.GetValue() / 100.0 225 prob_threshold = self.sld_threshold.GetValue() / 100.0
@@ -224,8 +228,11 @@ class BrainSegmenterDialog(wx.Dialog): @@ -224,8 +228,11 @@ class BrainSegmenterDialog(wx.Dialog):
224 self.btn_segment.Disable() 228 self.btn_segment.Disable()
225 self.chk_new_mask.Disable() 229 self.chk_new_mask.Disable()
226 230
  231 + window_width = slc.Slice().window_width
  232 + window_level = slc.Slice().window_level
  233 +
227 try: 234 try:
228 - self.ps = segment.SegmentProcess(image, create_new_mask, backend, device_id, use_gpu) 235 + self.ps = segment.SegmentProcess(image, create_new_mask, backend, device_id, use_gpu, apply_wwwl, window_width, window_level)
229 self.ps.start() 236 self.ps.start()
230 except (multiprocessing.ProcessError, OSError, ValueError) as err: 237 except (multiprocessing.ProcessError, OSError, ValueError) as err:
231 self.OnStop(None) 238 self.OnStop(None)
invesalius/gui/data_notebook.py
@@ -351,18 +351,89 @@ class ButtonControlPanel(wx.Panel): @@ -351,18 +351,89 @@ class ButtonControlPanel(wx.Panel):
351 else: 351 else:
352 dlg.MaskSelectionRequiredForDuplication() 352 dlg.MaskSelectionRequiredForDuplication()
353 353
354 -class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCtrlMixin):  
355 354
  355 +class InvListCtrl(wx.ListCtrl):
356 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, 356 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
357 - size=wx.DefaultSize, style=wx.LC_REPORT): 357 + size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_EDIT_LABELS):
  358 + wx.ListCtrl.__init__(self, parent, ID, pos, size, style=style)
  359 + self.__bind_events_wx()
358 360
359 - # native look and feel for MacOS  
360 - #if wx.Platform == "__WXMAC__":  
361 - # wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", 0) 361 + def __bind_events_wx(self):
  362 + self.Bind(wx.EVT_LEFT_DOWN, self.OnClickItem)
  363 + self.Bind(wx.EVT_LEFT_DCLICK, self.OnDblClickItem)
  364 +
  365 + def CreateColourBitmap(self, colour):
  366 + """
  367 + Create a wx Image with a mask colour.
  368 + colour: colour in rgb format(0 - 1)
  369 + """
  370 + image = self.image_gray
  371 + new_image = Image.new("RGB", image.size)
  372 + for x in range(image.size[0]):
  373 + for y in range(image.size[1]):
  374 + pixel_colour = [int(i*image.getpixel((x,y)))
  375 + for i in colour]
  376 + new_image.putpixel((x,y), tuple(pixel_colour))
  377 +
  378 + wx_image = wx.Image(new_image.size[0],
  379 + new_image.size[1])
  380 + try:
  381 + wx_image.SetData(new_image.tostring())
  382 + except Exception:
  383 + wx_image.SetData(new_image.tobytes())
  384 + return wx.Bitmap(wx_image.Scale(16, 16))
  385 +
  386 + def OnClickItem(self, evt):
  387 + self._click_check = False
  388 + item_idx, flag = (self.HitTest(evt.GetPosition()))
  389 + if item_idx > -1:
  390 + column_clicked = self.get_column_clicked(evt.GetPosition())
  391 + if column_clicked == 0:
  392 + self._click_check = True
  393 + item = self.GetItem(item_idx, 0)
  394 + flag = not bool(item.GetImage())
  395 + self.SetItemImage(item_idx, int(flag))
  396 + self.OnCheckItem(item_idx, flag)
  397 + return
  398 + evt.Skip()
362 399
363 - wx.ListCtrl.__init__(self, parent, ID, pos, size, style=wx.LC_REPORT)  
364 - listmix.TextEditMixin.__init__(self)  
365 - listmix.CheckListCtrlMixin.__init__(self) 400 + def OnDblClickItem(self, evt):
  401 + self._click_check = False
  402 + item_idx, flag = (self.HitTest(evt.GetPosition()))
  403 + if item_idx > -1:
  404 + column_clicked = self.get_column_clicked(evt.GetPosition())
  405 + if column_clicked == 1:
  406 + item = self.GetItem(item_idx, 1)
  407 + self.enter_edition(item)
  408 + return
  409 + evt.Skip()
  410 +
  411 + def enter_edition(self, item):
  412 + ctrl = self.EditLabel(item.GetId())
  413 + w, h = ctrl.GetClientSize()
  414 + w = self.GetColumnWidth(1)
  415 + ctrl.SetClientSize(w, h)
  416 + ctrl.SetValue(item.GetText())
  417 + ctrl.SelectAll()
  418 +
  419 +
  420 + def get_column_clicked(self, position):
  421 + epx, epy = position
  422 + wpx, wpy = self.GetPosition()
  423 + width_sum = 0
  424 + for i in range(self.GetColumnCount()):
  425 + width_sum += self.GetColumnWidth(i)
  426 + if (epx - wpx) <= width_sum:
  427 + return i
  428 + return -1
  429 +
  430 +
  431 +
  432 +class MasksListCtrlPanel(InvListCtrl):
  433 + def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
  434 + size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_EDIT_LABELS):
  435 + super().__init__(parent, ID, pos, size, style=style)
  436 + self._click_check = False
366 self.mask_list_index = {} 437 self.mask_list_index = {}
367 self.current_index = 0 438 self.current_index = 0
368 self.__init_columns() 439 self.__init_columns()
@@ -371,12 +442,9 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt @@ -371,12 +442,9 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt
371 self.__bind_events() 442 self.__bind_events()
372 443
373 def __bind_events_wx(self): 444 def __bind_events_wx(self):
374 - self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)  
375 - self.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnBeginLabelEdit)  
376 self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) 445 self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel)
377 self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent) 446 self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent)
378 447
379 -  
380 def __bind_events(self): 448 def __bind_events(self):
381 Publisher.subscribe(self.AddMask, 'Add mask') 449 Publisher.subscribe(self.AddMask, 'Add mask')
382 Publisher.subscribe(self.EditMaskThreshold, 450 Publisher.subscribe(self.EditMaskThreshold,
@@ -438,7 +506,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt @@ -438,7 +506,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt
438 self.current_index -= 1 506 self.current_index -= 1
439 self.SetItemImage(self.current_index, 1) 507 self.SetItemImage(self.current_index, 1)
440 508
441 -  
442 def OnCloseProject(self): 509 def OnCloseProject(self):
443 self.DeleteAllItems() 510 self.DeleteAllItems()
444 self.mask_list_index = {} 511 self.mask_list_index = {}
@@ -475,13 +542,13 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt @@ -475,13 +542,13 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt
475 def __init_image_list(self): 542 def __init_image_list(self):
476 self.imagelist = wx.ImageList(16, 16) 543 self.imagelist = wx.ImageList(16, 16)
477 544
478 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.jpg")) 545 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.png"))
479 bitmap = wx.Bitmap(image.Scale(16, 16)) 546 bitmap = wx.Bitmap(image.Scale(16, 16))
480 bitmap.SetWidth(16) 547 bitmap.SetWidth(16)
481 bitmap.SetHeight(16) 548 bitmap.SetHeight(16)
482 img_null = self.imagelist.Add(bitmap) 549 img_null = self.imagelist.Add(bitmap)
483 550
484 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.jpg")) 551 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.png"))
485 bitmap = wx.Bitmap(image.Scale(16, 16)) 552 bitmap = wx.Bitmap(image.Scale(16, 16))
486 bitmap.SetWidth(16) 553 bitmap.SetWidth(16)
487 bitmap.SetHeight(16) 554 bitmap.SetHeight(16)
@@ -489,23 +556,16 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt @@ -489,23 +556,16 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt
489 556
490 self.SetImageList(self.imagelist,wx.IMAGE_LIST_SMALL) 557 self.SetImageList(self.imagelist,wx.IMAGE_LIST_SMALL)
491 558
492 - self.image_gray = Image.open(os.path.join(inv_paths.ICON_DIR, "object_colour.jpg"))  
493 -  
494 - def OnBeginLabelEdit(self, evt):  
495 - if evt.GetColumn() == 1:  
496 - evt.Skip()  
497 - else:  
498 - evt.Veto() 559 + self.image_gray = Image.open(os.path.join(inv_paths.ICON_DIR, "object_colour.png"))
499 560
500 def OnEditLabel(self, evt): 561 def OnEditLabel(self, evt):
501 - Publisher.sendMessage('Change mask name',  
502 - index=evt.GetIndex(), name=evt.GetLabel()) 562 + if not evt.IsEditCancelled():
  563 + index = evt.GetIndex()
  564 + self.SetItem(index, 1, evt.GetLabel())
  565 + Publisher.sendMessage('Change mask name',
  566 + index=evt.GetIndex(), name=evt.GetLabel())
503 evt.Skip() 567 evt.Skip()
504 568
505 - def OnItemActivated(self, evt):  
506 - self.ToggleItem(evt.Index)  
507 - # pass  
508 -  
509 def OnCheckItem(self, index, flag): 569 def OnCheckItem(self, index, flag):
510 if flag: 570 if flag:
511 for key in self.mask_list_index.keys(): 571 for key in self.mask_list_index.keys():
@@ -515,26 +575,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt @@ -515,26 +575,7 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCt
515 self.current_index = index 575 self.current_index = index
516 Publisher.sendMessage('Show mask', index=index, value=flag) 576 Publisher.sendMessage('Show mask', index=index, value=flag)
517 577
518 - def CreateColourBitmap(self, colour):  
519 - """  
520 - Create a wx Image with a mask colour.  
521 - colour: colour in rgb format(0 - 1)  
522 - """  
523 - image = self.image_gray  
524 - new_image = Image.new("RGB", image.size)  
525 - for x in range(image.size[0]):  
526 - for y in range(image.size[1]):  
527 - pixel_colour = [int(i*image.getpixel((x,y)))  
528 - for i in colour]  
529 - new_image.putpixel((x,y), tuple(pixel_colour))  
530 578
531 - wx_image = wx.Image(new_image.size[0],  
532 - new_image.size[1])  
533 - try:  
534 - wx_image.SetData(new_image.tostring())  
535 - except Exception:  
536 - wx_image.SetData(new_image.tobytes())  
537 - return wx.Bitmap(wx_image.Scale(16, 16))  
538 579
539 def InsertNewItem(self, index=0, label=_("Mask"), threshold="(1000, 4500)", 580 def InsertNewItem(self, index=0, label=_("Mask"), threshold="(1000, 4500)",
540 colour=None): 581 colour=None):
@@ -718,19 +759,11 @@ class SurfaceButtonControlPanel(wx.Panel): @@ -718,19 +759,11 @@ class SurfaceButtonControlPanel(wx.Panel):
718 def AffineStatus(self, affine, status): 759 def AffineStatus(self, affine, status):
719 self.affinestatus = status 760 self.affinestatus = status
720 761
721 -class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCtrlMixin):  
722 - 762 +class SurfacesListCtrlPanel(InvListCtrl):
723 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, 763 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
724 - size=wx.DefaultSize, style=wx.LC_REPORT):  
725 -  
726 - # native look and feel for MacOS  
727 - #if wx.Platform == "__WXMAC__":  
728 - # wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", 0)  
729 -  
730 - wx.ListCtrl.__init__(self, parent, ID, pos, size, style=wx.LC_REPORT)  
731 - listmix.TextEditMixin.__init__(self)  
732 - listmix.CheckListCtrlMixin.__init__(self)  
733 - 764 + size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_EDIT_LABELS):
  765 + super().__init__(parent, ID, pos, size, style=style)
  766 + self._click_check = False
734 self.__init_columns() 767 self.__init_columns()
735 self.__init_image_list() 768 self.__init_image_list()
736 self.__init_evt() 769 self.__init_evt()
@@ -752,8 +785,6 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -752,8 +785,6 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
752 Publisher.subscribe(self.OnShowMultiple, 'Show multiple surfaces') 785 Publisher.subscribe(self.OnShowMultiple, 'Show multiple surfaces')
753 786
754 def __bind_events_wx(self): 787 def __bind_events_wx(self):
755 - self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)  
756 - self.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnBeginLabelEdit)  
757 self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) 788 self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel)
758 #self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected_) 789 #self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected_)
759 self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent) 790 self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent)
@@ -841,13 +872,13 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -841,13 +872,13 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
841 def __init_image_list(self): 872 def __init_image_list(self):
842 self.imagelist = wx.ImageList(16, 16) 873 self.imagelist = wx.ImageList(16, 16)
843 874
844 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.jpg")) 875 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.png"))
845 bitmap = wx.Bitmap(image.Scale(16, 16)) 876 bitmap = wx.Bitmap(image.Scale(16, 16))
846 bitmap.SetWidth(16) 877 bitmap.SetWidth(16)
847 bitmap.SetHeight(16) 878 bitmap.SetHeight(16)
848 img_null = self.imagelist.Add(bitmap) 879 img_null = self.imagelist.Add(bitmap)
849 880
850 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.jpg")) 881 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.png"))
851 bitmap = wx.Bitmap(image.Scale(16, 16)) 882 bitmap = wx.Bitmap(image.Scale(16, 16))
852 bitmap.SetWidth(16) 883 bitmap.SetWidth(16)
853 bitmap.SetHeight(16) 884 bitmap.SetHeight(16)
@@ -855,7 +886,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -855,7 +886,7 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
855 886
856 self.SetImageList(self.imagelist,wx.IMAGE_LIST_SMALL) 887 self.SetImageList(self.imagelist,wx.IMAGE_LIST_SMALL)
857 888
858 - self.image_gray = Image.open(os.path.join(inv_paths.ICON_DIR, "object_colour.jpg")) 889 + self.image_gray = Image.open(os.path.join(inv_paths.ICON_DIR, "object_colour.png"))
859 890
860 def OnBeginLabelEdit(self, evt): 891 def OnBeginLabelEdit(self, evt):
861 if evt.GetColumn() == 1: 892 if evt.GetColumn() == 1:
@@ -864,11 +895,10 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -864,11 +895,10 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
864 evt.Veto() 895 evt.Veto()
865 896
866 def OnEditLabel(self, evt): 897 def OnEditLabel(self, evt):
867 - Publisher.sendMessage('Change surface name', index=evt.GetIndex(), name=evt.GetLabel())  
868 - evt.Skip()  
869 -  
870 - def OnItemActivated(self, evt):  
871 - self.ToggleItem(evt.Index) 898 + if not evt.IsEditCancelled():
  899 + index = evt.GetIndex()
  900 + self.SetItem(index, 1, evt.GetLabel())
  901 + Publisher.sendMessage('Change surface name', index=evt.GetIndex(), name=evt.GetLabel())
872 evt.Skip() 902 evt.Skip()
873 903
874 def OnCheckItem(self, index, flag): 904 def OnCheckItem(self, index, flag):
@@ -944,28 +974,6 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -944,28 +974,6 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
944 self.SetItem(index, 4, transparency) 974 self.SetItem(index, 4, transparency)
945 self.SetItemImage(index, 1) 975 self.SetItemImage(index, 1)
946 976
947 - def CreateColourBitmap(self, colour):  
948 - """  
949 - Create a wx Image with a mask colour.  
950 - colour: colour in rgb format(0 - 1)  
951 - """  
952 - image = self.image_gray  
953 - new_image = Image.new("RGB", image.size)  
954 - for x in range(image.size[0]):  
955 - for y in range(image.size[1]):  
956 - pixel_colour = [int(i*image.getpixel((x,y)))  
957 - for i in colour]  
958 - new_image.putpixel((x,y), tuple(pixel_colour))  
959 -  
960 - wx_image = wx.Image(new_image.size[0],  
961 - new_image.size[1])  
962 - try:  
963 - wx_image.SetData(new_image.tostring())  
964 - except Exception:  
965 - wx_image.SetData(new_image.tobytes())  
966 -  
967 - return wx.Bitmap(wx_image.Scale(16, 16))  
968 -  
969 def EditSurfaceTransparency(self, surface_index, transparency): 977 def EditSurfaceTransparency(self, surface_index, transparency):
970 """ 978 """
971 Set actor transparency (oposite to opacity) according to given actor 979 Set actor transparency (oposite to opacity) according to given actor
@@ -985,19 +993,11 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -985,19 +993,11 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
985 #------------------------------------------------- 993 #-------------------------------------------------
986 #------------------------------------------------- 994 #-------------------------------------------------
987 995
988 -class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCtrlMixin):  
989 - 996 +class MeasuresListCtrlPanel(InvListCtrl):
990 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, 997 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
991 - size=wx.DefaultSize, style=wx.LC_REPORT):  
992 -  
993 - # native look and feel for MacOS  
994 - #if wx.Platform == "__WXMAC__":  
995 - # wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", 0)  
996 -  
997 - wx.ListCtrl.__init__(self, parent, ID, pos, size, style=wx.LC_REPORT)  
998 - listmix.TextEditMixin.__init__(self)  
999 - listmix.CheckListCtrlMixin.__init__(self)  
1000 - 998 + size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_EDIT_LABELS):
  999 + super().__init__(parent, ID, pos, size, style=style)
  1000 + self._click_check = False
1001 self.__init_columns() 1001 self.__init_columns()
1002 self.__init_image_list() 1002 self.__init_image_list()
1003 self.__init_evt() 1003 self.__init_evt()
@@ -1017,13 +1017,10 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -1017,13 +1017,10 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
1017 Publisher.subscribe(self.OnRemoveGUIMeasure, 'Remove GUI measurement') 1017 Publisher.subscribe(self.OnRemoveGUIMeasure, 'Remove GUI measurement')
1018 1018
1019 def __bind_events_wx(self): 1019 def __bind_events_wx(self):
1020 - self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)  
1021 - self.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnBeginLabelEdit)  
1022 self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) 1020 self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel)
1023 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected_) 1021 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected_)
1024 self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent) 1022 self.Bind(wx.EVT_KEY_UP, self.OnKeyEvent)
1025 1023
1026 -  
1027 def OnKeyEvent(self, event): 1024 def OnKeyEvent(self, event):
1028 keycode = event.GetKeyCode() 1025 keycode = event.GetKeyCode()
1029 # Delete key 1026 # Delete key
@@ -1116,13 +1113,13 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -1116,13 +1113,13 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
1116 def __init_image_list(self): 1113 def __init_image_list(self):
1117 self.imagelist = wx.ImageList(16, 16) 1114 self.imagelist = wx.ImageList(16, 16)
1118 1115
1119 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.jpg")) 1116 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.png"))
1120 bitmap = wx.Bitmap(image.Scale(16, 16)) 1117 bitmap = wx.Bitmap(image.Scale(16, 16))
1121 bitmap.SetWidth(16) 1118 bitmap.SetWidth(16)
1122 bitmap.SetHeight(16) 1119 bitmap.SetHeight(16)
1123 img_null = self.imagelist.Add(bitmap) 1120 img_null = self.imagelist.Add(bitmap)
1124 1121
1125 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.jpg")) 1122 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.png"))
1126 bitmap = wx.Bitmap(image.Scale(16, 16)) 1123 bitmap = wx.Bitmap(image.Scale(16, 16))
1127 bitmap.SetWidth(16) 1124 bitmap.SetWidth(16)
1128 bitmap.SetHeight(16) 1125 bitmap.SetHeight(16)
@@ -1130,7 +1127,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -1130,7 +1127,7 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
1130 1127
1131 self.SetImageList(self.imagelist,wx.IMAGE_LIST_SMALL) 1128 self.SetImageList(self.imagelist,wx.IMAGE_LIST_SMALL)
1132 1129
1133 - self.image_gray = Image.open(os.path.join(inv_paths.ICON_DIR, "object_colour.jpg")) 1130 + self.image_gray = Image.open(os.path.join(inv_paths.ICON_DIR, "object_colour.png"))
1134 1131
1135 def OnBeginLabelEdit(self, evt): 1132 def OnBeginLabelEdit(self, evt):
1136 if evt.GetColumn() == 1: 1133 if evt.GetColumn() == 1:
@@ -1139,14 +1136,12 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -1139,14 +1136,12 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
1139 evt.Veto() 1136 evt.Veto()
1140 1137
1141 def OnEditLabel(self, evt): 1138 def OnEditLabel(self, evt):
1142 - Publisher.sendMessage('Change measurement name', index=evt.GetIndex(), name=evt.GetLabel()) 1139 + if not evt.IsEditCancelled():
  1140 + index = evt.GetIndex()
  1141 + self.SetItem(index, 1, evt.GetLabel())
  1142 + Publisher.sendMessage('Change measurement name', index=evt.GetIndex(), name=evt.GetLabel())
1143 evt.Skip() 1143 evt.Skip()
1144 1144
1145 - def OnItemActivated(self, evt):  
1146 - self.ToggleItem(evt.Index)  
1147 - evt.Skip()  
1148 -  
1149 -  
1150 def OnCheckItem(self, index, flag): 1145 def OnCheckItem(self, index, flag):
1151 Publisher.sendMessage('Show measurement', index=index, visibility=flag) 1146 Publisher.sendMessage('Show measurement', index=index, visibility=flag)
1152 1147
@@ -1238,27 +1233,6 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -1238,27 +1233,6 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
1238 self.SetItemImage(index, 1) 1233 self.SetItemImage(index, 1)
1239 self.Refresh() 1234 self.Refresh()
1240 1235
1241 - def CreateColourBitmap(self, colour):  
1242 - """  
1243 - Create a wx Image with a mask colour.  
1244 - colour: colour in rgb format(0 - 1)  
1245 - """  
1246 - image = self.image_gray  
1247 - new_image = Image.new("RGB", image.size)  
1248 - for x in range(image.size[0]):  
1249 - for y in range(image.size[1]):  
1250 - pixel_colour = [int(i*image.getpixel((x,y)))  
1251 - for i in colour]  
1252 - new_image.putpixel((x,y), tuple(pixel_colour))  
1253 -  
1254 - wx_image = wx.Image(new_image.size[0],  
1255 - new_image.size[1])  
1256 - try:  
1257 - wx_image.SetData(new_image.tostring())  
1258 - except:  
1259 - wx_image.SetData(new_image.tobytes())  
1260 - return wx.Bitmap(wx_image.Scale(16, 16))  
1261 -  
1262 def EditItemColour(self, measure_index, colour): 1236 def EditItemColour(self, measure_index, colour):
1263 """ 1237 """
1264 """ 1238 """
@@ -1273,19 +1247,12 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis @@ -1273,19 +1247,12 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckLis
1273 #******************************************************************* 1247 #*******************************************************************
1274 1248
1275 1249
1276 -class AnnotationsListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.CheckListCtrlMixin): 1250 +class AnnotationsListCtrlPanel(wx.ListCtrl):
1277 # TODO: Remove edimixin, allow only visible and invisible 1251 # TODO: Remove edimixin, allow only visible and invisible
1278 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, 1252 def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
1279 - size=wx.DefaultSize, style=wx.LC_REPORT):  
1280 -  
1281 - # native look and feel for MacOS  
1282 - #if wx.Platform == "__WXMAC__":  
1283 - # wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", 0)  
1284 -  
1285 - wx.ListCtrl.__init__(self, parent, ID, pos, size, style=wx.LC_REPORT)  
1286 - listmix.TextEditMixin.__init__(self)  
1287 - listmix.CheckListCtrlMixin.__init__(self)  
1288 - 1253 + size=wx.DefaultSize, style=wx.LC_REPORT | wx.LC_EDIT_LABELS):
  1254 + wx.ListCtrl.__init__(self, parent, ID, pos, size, style=style)
  1255 + self._click_check = False
1289 self.__init_columns() 1256 self.__init_columns()
1290 self.__init_image_list() 1257 self.__init_image_list()
1291 self.__init_evt() 1258 self.__init_evt()
@@ -1311,19 +1278,19 @@ class AnnotationsListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.Check @@ -1311,19 +1278,19 @@ class AnnotationsListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin, listmix.Check
1311 def __init_image_list(self): 1278 def __init_image_list(self):
1312 self.imagelist = wx.ImageList(16, 16) 1279 self.imagelist = wx.ImageList(16, 16)
1313 1280
1314 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.jpg")) 1281 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_visible.png"))
1315 bitmap = wx.Bitmap(image.Scale(16, 16)) 1282 bitmap = wx.Bitmap(image.Scale(16, 16))
1316 bitmap.SetWidth(16) 1283 bitmap.SetWidth(16)
1317 bitmap.SetHeight(16) 1284 bitmap.SetHeight(16)
1318 img_check = self.imagelist.Add(bitmap) 1285 img_check = self.imagelist.Add(bitmap)
1319 1286
1320 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.jpg")) 1287 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_invisible.png"))
1321 bitmap = wx.Bitmap(image.Scale(16, 16)) 1288 bitmap = wx.Bitmap(image.Scale(16, 16))
1322 bitmap.SetWidth(16) 1289 bitmap.SetWidth(16)
1323 bitmap.SetHeight(16) 1290 bitmap.SetHeight(16)
1324 img_null = self.imagelist.Add(bitmap) 1291 img_null = self.imagelist.Add(bitmap)
1325 1292
1326 - image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_colour.jpg")) 1293 + image = wx.Image(os.path.join(inv_paths.ICON_DIR, "object_colour.png"))
1327 bitmap = wx.Bitmap(image.Scale(16, 16)) 1294 bitmap = wx.Bitmap(image.Scale(16, 16))
1328 bitmap.SetWidth(16) 1295 bitmap.SetWidth(16)
1329 bitmap.SetHeight(16) 1296 bitmap.SetHeight(16)
invesalius/gui/default_tasks.py
@@ -123,6 +123,7 @@ class Panel(wx.Panel): @@ -123,6 +123,7 @@ class Panel(wx.Panel):
123 123
124 #self.SetSizerAndFit(sizer) 124 #self.SetSizerAndFit(sizer)
125 self.SetSizer(sizer) 125 self.SetSizer(sizer)
  126 + self.Layout()
126 127
127 128
128 # Lower fold panel 129 # Lower fold panel
invesalius/gui/default_viewers.py
@@ -111,7 +111,7 @@ class Panel(wx.Panel): @@ -111,7 +111,7 @@ class Panel(wx.Panel):
111 p3.SetPopupMenu(menu) 111 p3.SetPopupMenu(menu)
112 112
113 113
114 - if sys.platform == 'win32': 114 + if sys.platform == 'win32' or wx.VERSION >= (4, 1):
115 self.aui_manager.AddPane(p1, s1) 115 self.aui_manager.AddPane(p1, s1)
116 self.aui_manager.AddPane(p2, s2) 116 self.aui_manager.AddPane(p2, s2)
117 self.aui_manager.AddPane(p3, s3) 117 self.aui_manager.AddPane(p3, s3)
@@ -604,7 +604,7 @@ class VolumeToolPanel(wx.Panel): @@ -604,7 +604,7 @@ class VolumeToolPanel(wx.Panel):
604 id = evt.GetId() 604 id = evt.GetId()
605 item = ID_TO_ITEMSLICEMENU[id] 605 item = ID_TO_ITEMSLICEMENU[id]
606 checked = item.IsChecked() 606 checked = item.IsChecked()
607 - label = item.GetLabel() 607 + label = item.GetItemLabelText()
608 608
609 if not (checked): 609 if not (checked):
610 Publisher.sendMessage('Disable plane', plane_label=label) 610 Publisher.sendMessage('Disable plane', plane_label=label)
invesalius/gui/dialogs.py
@@ -245,9 +245,7 @@ WILDCARD_OPEN = &quot;InVesalius 3 project (*.inv3)|*.inv3|&quot; \ @@ -245,9 +245,7 @@ WILDCARD_OPEN = &quot;InVesalius 3 project (*.inv3)|*.inv3|&quot; \
245 WILDCARD_ANALYZE = "Analyze 7.5 (*.hdr)|*.hdr|" \ 245 WILDCARD_ANALYZE = "Analyze 7.5 (*.hdr)|*.hdr|" \
246 "All files (*.*)|*.*" 246 "All files (*.*)|*.*"
247 247
248 -WILDCARD_NIFTI = "NIfTI 1 (*.nii)|*.nii|" \  
249 - "Compressed NIfTI (*.nii.gz)|*.nii.gz|" \  
250 - "HDR NIfTI (*.hdr)|*.hdr|" \ 248 +WILDCARD_NIFTI = "NIfTI 1 (*.nii;*.nii.gz;*.hdr)|*.nii;*.nii.gz;*.hdr|" \
251 "All files (*.*)|*.*" 249 "All files (*.*)|*.*"
252 #".[jJ][pP][gG]" 250 #".[jJ][pP][gG]"
253 WILDCARD_PARREC = "PAR/REC (*.par)|*.par|" \ 251 WILDCARD_PARREC = "PAR/REC (*.par)|*.par|" \
@@ -1950,17 +1948,17 @@ class WatershedOptionsPanel(wx.Panel): @@ -1950,17 +1948,17 @@ class WatershedOptionsPanel(wx.Panel):
1950 min_value=1, max_value=10) 1948 min_value=1, max_value=10)
1951 1949
1952 box_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Conectivity"), wx.VERTICAL) 1950 box_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Conectivity"), wx.VERTICAL)
1953 - box_sizer.Add(self.choice_2dcon, 0, wx.ALIGN_CENTER_VERTICAL,2)  
1954 - box_sizer.Add(self.choice_3dcon, 0, wx.ALIGN_CENTER_VERTICAL,2) 1951 + box_sizer.Add(self.choice_2dcon, 0, wx.ALL, 5)
  1952 + box_sizer.Add(self.choice_3dcon, 0, wx.ALL, 5)
1955 1953
1956 g_sizer = wx.BoxSizer(wx.HORIZONTAL) 1954 g_sizer = wx.BoxSizer(wx.HORIZONTAL)
1957 - g_sizer.Add(wx.StaticText(self, -1, _("Gaussian sigma")), 0, wx.ALIGN_RIGHT | wx.ALL, 5)  
1958 - g_sizer.Add(self.gaussian_size, 0, wx.ALIGN_LEFT | wx.ALL, 5) 1955 + g_sizer.Add(wx.StaticText(self, -1, _("Gaussian sigma")), 0, wx.ALIGN_CENTER | wx.ALL, 5)
  1956 + g_sizer.Add(self.gaussian_size, 0, wx.ALL, 5)
1959 1957
1960 sizer = wx.BoxSizer(wx.VERTICAL) 1958 sizer = wx.BoxSizer(wx.VERTICAL)
1961 - sizer.Add(self.choice_algorithm, 0, wx.ALIGN_CENTER_VERTICAL,2)  
1962 - sizer.Add(box_sizer, 1, wx.EXPAND,2)  
1963 - sizer.Add(g_sizer, 0, wx.ALIGN_LEFT, 2) 1959 + sizer.Add(self.choice_algorithm, 0, wx.ALL, 5)
  1960 + sizer.Add(box_sizer, 1, wx.EXPAND | wx.ALL, 5)
  1961 + sizer.Add(g_sizer, 0, wx.ALL, 5)
1964 1962
1965 self.SetSizer(sizer) 1963 self.SetSizer(sizer)
1966 sizer.Fit(self) 1964 sizer.Fit(self)
@@ -1998,8 +1996,7 @@ class WatershedOptionsDialog(wx.Dialog): @@ -1998,8 +1996,7 @@ class WatershedOptionsDialog(wx.Dialog):
1998 btnsizer.Realize() 1996 btnsizer.Realize()
1999 1997
2000 sizer.Add(wop, 0, wx.EXPAND) 1998 sizer.Add(wop, 0, wx.EXPAND)
2001 - sizer.Add(btnsizer, 0, wx.EXPAND)  
2002 - sizer.AddSpacer(5) 1999 + sizer.Add(btnsizer, 0, wx.ALIGN_RIGHT | wx.BOTTOM, 5)
2003 2000
2004 self.SetSizer(sizer) 2001 self.SetSizer(sizer)
2005 sizer.Fit(self) 2002 sizer.Fit(self)
@@ -2060,16 +2057,16 @@ class MaskBooleanDialog(wx.Dialog): @@ -2060,16 +2057,16 @@ class MaskBooleanDialog(wx.Dialog):
2060 2057
2061 gsizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5, vgap=5) 2058 gsizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5, vgap=5)
2062 2059
2063 - gsizer.Add(wx.StaticText(self, -1, _(u"Mask 1"))) 2060 + gsizer.Add(wx.StaticText(self, -1, _(u"Mask 1")), 0, wx.ALIGN_CENTER_VERTICAL)
2064 gsizer.Add(self.mask1, 1, wx.EXPAND) 2061 gsizer.Add(self.mask1, 1, wx.EXPAND)
2065 - gsizer.Add(wx.StaticText(self, -1, _(u"Operation"))) 2062 + gsizer.Add(wx.StaticText(self, -1, _(u"Operation")), 0, wx.ALIGN_CENTER_VERTICAL)
2066 gsizer.Add(self.op_boolean, 1, wx.EXPAND) 2063 gsizer.Add(self.op_boolean, 1, wx.EXPAND)
2067 - gsizer.Add(wx.StaticText(self, -1, _(u"Mask 2"))) 2064 + gsizer.Add(wx.StaticText(self, -1, _(u"Mask 2")), 0, wx.ALIGN_CENTER_VERTICAL)
2068 gsizer.Add(self.mask2, 1, wx.EXPAND) 2065 gsizer.Add(self.mask2, 1, wx.EXPAND)
2069 2066
2070 sizer = wx.BoxSizer(wx.VERTICAL) 2067 sizer = wx.BoxSizer(wx.VERTICAL)
2071 - sizer.Add(gsizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)  
2072 - sizer.Add(btnsizer, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5) 2068 + sizer.Add(gsizer, 0, wx.EXPAND | wx.ALL, border=5)
  2069 + sizer.Add(btnsizer, 0, wx.EXPAND | wx.ALL, border=5)
2073 2070
2074 self.SetSizer(sizer) 2071 self.SetSizer(sizer)
2075 sizer.Fit(self) 2072 sizer.Fit(self)
@@ -2798,8 +2795,8 @@ class SelectPartsOptionsDialog(wx.Dialog): @@ -2798,8 +2795,8 @@ class SelectPartsOptionsDialog(wx.Dialog):
2798 sizer.AddSpacer(5) 2795 sizer.AddSpacer(5)
2799 2796
2800 btn_sizer = wx.BoxSizer(wx.HORIZONTAL) 2797 btn_sizer = wx.BoxSizer(wx.HORIZONTAL)
2801 - btn_sizer.Add(self.btn_ok, 0, flag=wx.ALIGN_RIGHT, border=5)  
2802 - btn_sizer.Add(self.btn_cancel, 0, flag=wx.LEFT|wx.ALIGN_RIGHT, border=5) 2798 + btn_sizer.Add(self.btn_ok, 0)# flag=wx.ALIGN_RIGHT, border=5)
  2799 + btn_sizer.Add(self.btn_cancel, 0, flag=wx.LEFT, border=5)
2803 2800
2804 sizer.Add(btn_sizer, 0, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT, border=5) 2801 sizer.Add(btn_sizer, 0, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT, border=5)
2805 sizer.AddSpacer(5) 2802 sizer.AddSpacer(5)
@@ -3202,8 +3199,8 @@ class FillHolesAutoDialog(wx.Dialog): @@ -3202,8 +3199,8 @@ class FillHolesAutoDialog(wx.Dialog):
3202 sizer.AddSpacer(5) 3199 sizer.AddSpacer(5)
3203 3200
3204 btn_sizer = wx.BoxSizer(wx.HORIZONTAL) 3201 btn_sizer = wx.BoxSizer(wx.HORIZONTAL)
3205 - btn_sizer.Add(self.apply_btn, 0, flag=wx.ALIGN_RIGHT, border=5)  
3206 - btn_sizer.Add(self.close_btn, 0, flag=wx.LEFT|wx.ALIGN_RIGHT, border=5) 3202 + btn_sizer.Add(self.apply_btn, 0)# flag=wx.ALIGN_RIGHT, border=5)
  3203 + btn_sizer.Add(self.close_btn, 0, flag=wx.LEFT, border=5)
3207 3204
3208 sizer.Add(btn_sizer, 0, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT, border=5) 3205 sizer.Add(btn_sizer, 0, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT, border=5)
3209 3206
invesalius/gui/dicom_preview_panel.py
@@ -789,8 +789,8 @@ class SingleImagePreview(wx.Panel): @@ -789,8 +789,8 @@ class SingleImagePreview(wx.Panel):
789 in_sizer.Add(checkbox, 0) 789 in_sizer.Add(checkbox, 0)
790 790
791 sizer = wx.BoxSizer(wx.VERTICAL) 791 sizer = wx.BoxSizer(wx.VERTICAL)
792 - sizer.Add(self.panel, 20, wx.GROW|wx.EXPAND)  
793 - sizer.Add(in_sizer, 1, wx.GROW|wx.EXPAND) 792 + sizer.Add(self.panel, 1, wx.GROW|wx.EXPAND)
  793 + sizer.Add(in_sizer, 0, wx.GROW|wx.EXPAND)
794 sizer.Fit(self) 794 sizer.Fit(self)
795 795
796 self.SetSizer(sizer) 796 self.SetSizer(sizer)
invesalius/gui/frame.py
@@ -214,7 +214,7 @@ class Frame(wx.Frame): @@ -214,7 +214,7 @@ class Frame(wx.Frame):
214 # Add toolbars to manager 214 # Add toolbars to manager
215 # This is pretty tricky -- order on win32 is inverted when 215 # This is pretty tricky -- order on win32 is inverted when
216 # compared to linux2 & darwin 216 # compared to linux2 & darwin
217 - if sys.platform == 'win32': 217 + if sys.platform == 'win32' or wx.VERSION >= (4, 1):
218 t1 = ProjectToolBar(self) 218 t1 = ProjectToolBar(self)
219 t2 = HistoryToolBar(self) 219 t2 = HistoryToolBar(self)
220 t3 = LayoutToolBar(self) 220 t3 = LayoutToolBar(self)
@@ -259,6 +259,8 @@ class Frame(wx.Frame): @@ -259,6 +259,8 @@ class Frame(wx.Frame):
259 # TODO: Allow saving and restoring perspectives 259 # TODO: Allow saving and restoring perspectives
260 self.perspective_all = aui_manager.SavePerspective() 260 self.perspective_all = aui_manager.SavePerspective()
261 261
  262 + self.Layout()
  263 +
262 def _BeginBusyCursor(self): 264 def _BeginBusyCursor(self):
263 """ 265 """
264 Start busy cursor. 266 Start busy cursor.
@@ -1941,11 +1943,11 @@ class LayoutToolBar(AuiToolBar): @@ -1941,11 +1943,11 @@ class LayoutToolBar(AuiToolBar):
1941 d = inv_paths.ICON_DIR 1943 d = inv_paths.ICON_DIR
1942 if sys.platform == 'darwin': 1944 if sys.platform == 'darwin':
1943 # Bitmaps for show/hide task panel item 1945 # Bitmaps for show/hide task panel item
1944 - p = os.path.join(d, "layout_data_only_original.gif")  
1945 - self.BMP_WITH_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_GIF) 1946 + p = os.path.join(d, "layout_data_only_original.png")
  1947 + self.BMP_WITH_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_PNG)
1946 1948
1947 - p = os.path.join(d, "layout_full_original.gif")  
1948 - self.BMP_WITHOUT_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_GIF) 1949 + p = os.path.join(d, "layout_full_original.png")
  1950 + self.BMP_WITHOUT_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_PNG)
1949 1951
1950 # Bitmaps for show/hide task item 1952 # Bitmaps for show/hide task item
1951 p = os.path.join(d, "text_inverted_original.png") 1953 p = os.path.join(d, "text_inverted_original.png")
@@ -1956,11 +1958,11 @@ class LayoutToolBar(AuiToolBar): @@ -1956,11 +1958,11 @@ class LayoutToolBar(AuiToolBar):
1956 1958
1957 else: 1959 else:
1958 # Bitmaps for show/hide task panel item 1960 # Bitmaps for show/hide task panel item
1959 - p = os.path.join(d, "layout_data_only.gif")  
1960 - self.BMP_WITH_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_GIF) 1961 + p = os.path.join(d, "layout_data_only.png")
  1962 + self.BMP_WITH_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_PNG)
1961 1963
1962 - p = os.path.join(d, "layout_full.gif")  
1963 - self.BMP_WITHOUT_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_GIF) 1964 + p = os.path.join(d, "layout_full.png")
  1965 + self.BMP_WITHOUT_MENU = wx.Bitmap(str(p), wx.BITMAP_TYPE_PNG)
1964 1966
1965 # Bitmaps for show/hide task item 1967 # Bitmaps for show/hide task item
1966 p = os.path.join(d, "text_inverted.png") 1968 p = os.path.join(d, "text_inverted.png")
invesalius/gui/import_panel.py
@@ -104,7 +104,7 @@ class InnerPanel(wx.Panel): @@ -104,7 +104,7 @@ class InnerPanel(wx.Panel):
104 104
105 inner_sizer = wx.BoxSizer(wx.HORIZONTAL) 105 inner_sizer = wx.BoxSizer(wx.HORIZONTAL)
106 inner_sizer.Add(btnsizer, 0, wx.LEFT|wx.TOP, 5) 106 inner_sizer.Add(btnsizer, 0, wx.LEFT|wx.TOP, 5)
107 - inner_sizer.Add(self.combo_interval, 0, wx.LEFT|wx.RIGHT|wx.TOP, 5) 107 + inner_sizer.Add(self.combo_interval, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, 5)
108 panel.SetSizer(inner_sizer) 108 panel.SetSizer(inner_sizer)
109 inner_sizer.Fit(panel) 109 inner_sizer.Fit(panel)
110 110