Commit b2d587c7eae7a72bf0a20ffb304544b6fc0869af
1 parent
b960eb66
Exists in
master
and in
65 other branches
FIX: bug in the initialization when using spanish lang because is was being sett…
…ing custom as initial threshold preset
Showing
3 changed files
with
20 additions
and
13 deletions
Show diff stats
invesalius/constants.py
| ... | ... | @@ -190,7 +190,7 @@ VOLUME_POSITION = {AXIAL: [AXIAL_VOLUME_CAM_VIEW_UP, AXIAL_VOLUME_CAM_POSITION], |
| 190 | 190 | # Mask threshold options |
| 191 | 191 | proj = Project() |
| 192 | 192 | THRESHOLD_RANGE = proj.threshold_modes[_("Bone")] |
| 193 | -THRESHOLD_PRESETS_INDEX = 0 #Bone | |
| 193 | +THRESHOLD_PRESETS_INDEX = _("Bone") | |
| 194 | 194 | THRESHOLD_HUE_RANGE = (0, 0.6667) |
| 195 | 195 | THRESHOLD_INVALUE = 5000 |
| 196 | 196 | THRESHOLD_OUTVALUE = 0 | ... | ... |
invesalius/gui/task_slice.py
| ... | ... | @@ -474,6 +474,11 @@ class MaskProperties(wx.Panel): |
| 474 | 474 | self.combo_thresh.SetSelection(default_thresh) |
| 475 | 475 | (thresh_min, thresh_max) =\ |
| 476 | 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 | 482 | elif default_thresh in proj.threshold_modes.values(): |
| 478 | 483 | preset_name = proj.threshold_modes.get_key(default_thresh)[0] |
| 479 | 484 | index = self.threshold_modes_names.index(preset_name) | ... | ... |
invesalius/gui/widgets/gradient.py
| ... | ... | @@ -440,20 +440,22 @@ class GradientCtrl(wx.Panel): |
| 440 | 440 | value = self.min_range |
| 441 | 441 | |
| 442 | 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 | 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 | 460 | def ChangeMinValue(self, e): |
| 459 | 461 | # Why do I need to change slide min value if it has been changed for | ... | ... |