Commit bb1d8e5f8b75faf0df41599d11d8f9d13b14f6fd

Authored by tfmoraes
Committed by Thiago Franco de Moraes
1 parent c87d9ede
Exists in beta4 and in 1 other branch beta3

FIX: bug in the initialization when using spanish lang because is was being sett…

…ing custom as initial threshold preset
invesalius/constants.py
@@ -189,7 +189,7 @@ VOLUME_POSITION = {AXIAL: [AXIAL_VOLUME_CAM_VIEW_UP, AXIAL_VOLUME_CAM_POSITION], @@ -189,7 +189,7 @@ VOLUME_POSITION = {AXIAL: [AXIAL_VOLUME_CAM_VIEW_UP, AXIAL_VOLUME_CAM_POSITION],
189 # Mask threshold options 189 # Mask threshold options
190 proj = Project() 190 proj = Project()
191 THRESHOLD_RANGE = proj.threshold_modes[_("Bone")] 191 THRESHOLD_RANGE = proj.threshold_modes[_("Bone")]
192 -THRESHOLD_PRESETS_INDEX = 0 #Bone 192 +THRESHOLD_PRESETS_INDEX = _("Bone")
193 THRESHOLD_HUE_RANGE = (0, 0.6667) 193 THRESHOLD_HUE_RANGE = (0, 0.6667)
194 THRESHOLD_INVALUE = 5000 194 THRESHOLD_INVALUE = 5000
195 THRESHOLD_OUTVALUE = 0 195 THRESHOLD_OUTVALUE = 0
invesalius/gui/task_slice.py
@@ -474,6 +474,11 @@ class MaskProperties(wx.Panel): @@ -474,6 +474,11 @@ class MaskProperties(wx.Panel):
474 self.combo_thresh.SetSelection(default_thresh) 474 self.combo_thresh.SetSelection(default_thresh)
475 (thresh_min, thresh_max) =\ 475 (thresh_min, thresh_max) =\
476 self.threshold_modes[thresh_modes_names[default_thresh]] 476 self.threshold_modes[thresh_modes_names[default_thresh]]
  477 + elif default_thresh in proj.threshold_modes.keys():
  478 + index = self.threshold_modes_names.index(default_thresh)
  479 + self.combo_thresh.SetSelection(index)
  480 + thresh_min, thresh_max = self.threshold_modes[default_thresh]
  481 +
477 elif default_thresh in proj.threshold_modes.values(): 482 elif default_thresh in proj.threshold_modes.values():
478 preset_name = proj.threshold_modes.get_key(default_thresh)[0] 483 preset_name = proj.threshold_modes.get_key(default_thresh)[0]
479 index = self.threshold_modes_names.index(preset_name) 484 index = self.threshold_modes_names.index(preset_name)
invesalius/gui/widgets/gradient.py
@@ -440,20 +440,22 @@ class GradientCtrl(wx.Panel): @@ -440,20 +440,22 @@ class GradientCtrl(wx.Panel):
440 value = self.min_range 440 value = self.min_range
441 441
442 def SetMaxValue(self, value): 442 def SetMaxValue(self, value):
443 - value = int(value)  
444 - if value > self.max_range:  
445 - value = int(self.max_range)  
446 - self.spin_max.SetValue(value)  
447 - self.gradient_slider.SetMaximun(value)  
448 - self.maximun = value 443 + if value:
  444 + value = int(value)
  445 + if value > self.max_range:
  446 + value = int(self.max_range)
  447 + self.spin_max.SetValue(value)
  448 + self.gradient_slider.SetMaximun(value)
  449 + self.maximun = value
449 450
450 def SetMinValue(self, value): 451 def SetMinValue(self, value):
451 - value = int(value)  
452 - if value < self.min_range:  
453 - value = int(self.min_range)  
454 - self.spin_min.SetValue(value)  
455 - self.gradient_slider.SetMinimun(value)  
456 - self.minimun = value 452 + if value:
  453 + value = int(value)
  454 + if value < self.min_range:
  455 + value = int(self.min_range)
  456 + self.spin_min.SetValue(value)
  457 + self.gradient_slider.SetMinimun(value)
  458 + self.minimun = value
457 459
458 def ChangeMinValue(self, e): 460 def ChangeMinValue(self, e):
459 # Why do I need to change slide min value if it has been changed for 461 # Why do I need to change slide min value if it has been changed for