Skip to content

Commit 990a28b

Browse files
committed
ImageAreaOpening.m: fix gui bugs
1 parent a05bc58 commit 990a28b

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

ImageM/+imagem/+actions/+process/+binary/ImageAreaOpening.m

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,6 @@ function run(obj, frame)
8787
minVal = 0;
8888
maxVal = double(max(areas));
8989

90-
% compute slider steps
91-
valExtent = maxVal + 1;
92-
93-
% set unit step equal to 1 grayscale unit
94-
sliderStep1 = 1 / valExtent;
95-
sliderStep2 = 10 / valExtent;
96-
97-
% background color of most widgets
98-
bgColor = getWidgetBackgroundColor(obj.Viewer.Gui);
99-
100-
10190
% creates the figure
10291
hf = figure(...
10392
'Name', 'Image Area Opening', ...
@@ -123,22 +112,19 @@ function run(obj, frame)
123112
@obj.onMinSizeTextChanged);
124113

125114
% one slider for changing value
126-
obj.Handles.ValueSlider = uicontrol(...
127-
'Style', 'Slider', ...
128-
'Parent', mainPanel, ...
129-
'Min', minVal, 'Max', maxVal, ...
130-
'Value', obj.MinSizeValue, ...
131-
'SliderStep', [sliderStep1 sliderStep2], ...
132-
'BackgroundColor', bgColor, ...
115+
hs = addSlider(gui, mainPanel, ...
116+
[minVal maxVal], ...
117+
obj.MinSizeValue, ...
133118
'Callback', @obj.onSliderValueChanged);
119+
obj.Handles.ValueSlider = hs;
134120

135121
% setup listener for slider continuous changes
136122
addlistener(obj.Handles.ValueSlider, ...
137123
'ContinuousValueChange', @obj.onSliderValueChanged);
138124

139125
% add combo box for choosing region connectivity
140126
[obj.Handles.ConnectivityPopup, ht] = addComboBoxLine(gui, mainPanel, ...
141-
'Connectivity:', {num2str(obj.ConnValues(:)', '%d')}', ...
127+
'Connectivity:', {num2str(obj.ConnValues(:), '%d')}', ...
142128
@obj.onConnectivityChanged);
143129

144130
% disable choice of connectivity for label images
@@ -276,7 +262,7 @@ function onMinSizeTextChanged(obj, varargin)
276262

277263
function onSliderValueChanged(obj, varargin)
278264
val = get(obj.Handles.ValueSlider, 'Value');
279-
obj.MinSizeValue = val;
265+
obj.MinSizeValue = round(val);
280266

281267
updateWidgets(obj);
282268
end

0 commit comments

Comments
 (0)