Skip to content
Snippets Groups Projects
Commit 5a340476 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Gui/Thresholding: small fixes

parent 2e164072
No related branches found
No related tags found
No related merge requests found
......@@ -13,17 +13,37 @@ classdef GtGuiMultiThresholdVolume < GtGuiThresholdGrain
self.setSegmentFunction(@(thr, morph)segmentVolumeMultiple(self));
end
function changeThresholds(obj, new_thresholds)
for ii_t = 1:numel(obj.threshold)
obj.setThresholds(new_thresholds(ii_t), ii_t);
set(obj.conf.h_thr_slider(ii_t), 'Value', obj.threshold(ii_t));
end
set(obj.conf.h_thr_edit, 'String', sprintf(' %g;', obj.threshold));
obj.updateDisplay();
end
function movedSlider(obj)
new_thresh = get(obj.conf.h_thr_slider(1), 'Value')
set(obj.conf.h_thr_edit, 'String', num2str(obj.threshold(1)));
new_thresh = get(obj.conf.h_thr_slider(1), 'Value');
obj.setThresholds(new_thresh, 1);
new_thresh = get(obj.conf.h_thr_slider(2), 'Value')
set(obj.conf.h_thr_edit, 'String', num2str(obj.threshold(2)));
new_thresh = get(obj.conf.h_thr_slider(2), 'Value');
obj.setThresholds(new_thresh, 2);
set(obj.conf.h_thr_edit, 'String', sprintf(' %g;', obj.threshold));
obj.updateDisplay();
end
function setThresholds(obj, new_threshold, n)
obj.threshold(n) = new_threshold;
if (obj.threshold(n) > obj.max_threshold)
obj.threshold(n) = obj.max_threshold;
elseif (obj.threshold(n) < obj.min_threshold)
obj.threshold(n) = obj.min_threshold;
end
end
end
methods (Access = protected)
......@@ -131,15 +151,4 @@ classdef GtGuiMultiThresholdVolume < GtGuiThresholdGrain
end
end
end
methods (Access = protected)
function setThresholds(obj, new_threshold, n)
obj.threshold(n) = new_threshold;
if (obj.threshold(n) > obj.max_threshold)
obj.threshold(n) = obj.max_threshold;
elseif (obj.threshold(n) < obj.min_threshold)
obj.threshold(n) = obj.min_threshold;
end
end
end
end
......@@ -81,7 +81,7 @@ classdef GtGuiThresholdGrain < GtVolView
'Style', 'text', ...
'String', '');
set(obj.conf.upper_t_boxes, 'Sizes', [250, 100, -1, 70, 140]);
set(obj.conf.upper_t_boxes, 'Sizes', [250, -1, 100, 70, 140]);
obj.conf.slider_main_t_boxes = uiextras.VBox( ...
'Parent', obj.conf.center_t_boxes);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment