Skip to content

Commit

Permalink
imSlicer: update dialogs to work with GuiLayout v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dlegland committed Jul 30, 2015
1 parent a0fa198 commit fbe71f1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 37 deletions.
24 changes: 11 additions & 13 deletions matImage/imStacks/CropStackDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ function setupLayout(hf)
end


mainPanel = uiextras.VBox('Parent', hf);
mainPanel = uix.VBox('Parent', hf);

dim = this.parent.imageSize;

% Add two text boxes for bounds in X direction
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -85,12 +85,12 @@ function setupLayout(hf)
'String', num2str(dim(1)), ...
'BackgroundColor', bgColor);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 40 40]);
set(hLine, 'Widths', [-1 40 40]);


% Add two text boxes for bounds in y direction
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -110,11 +110,11 @@ function setupLayout(hf)
'String', num2str(dim(2)), ...
'BackgroundColor', bgColor);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 40 40]);
set(hLine, 'Widths', [-1 40 40]);

% Add two text boxes for bounds in Z direction
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -134,27 +134,25 @@ function setupLayout(hf)
'String', num2str(dim(3)), ...
'BackgroundColor', bgColor);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 40 40]);
set(hLine, 'Widths', [-1 40 40]);

mainPanel.Sizes = [40 40 40];


controlPanel = uiextras.HButtonBox('Parent', mainPanel, ...
% add control panel with two buttons
controlPanel = uix.HButtonBox('Parent', mainPanel, ...
'ButtonSize', [70 40], ...
'VerticalAlignment', 'Top', ...
'VerticalAlignment', 'top', ...
'Spacing', 5, 'Padding', 5, ...
'Units', 'normalized', ...
'Position', [0 0 1 1]);
this.handles.applyButton = uicontrol('Style', 'PushButton', ...
'Parent', controlPanel, ...
'String', 'OK', ...
'Callback', @this.onApplyButtonClicked);

this.handles.closeButton = uicontrol('Style', 'PushButton', ...
'Parent', controlPanel, ...
'String', 'Close', ...
'Callback', @this.onCloseButtonClicked);

set(mainPanel, 'Heights', [40 40 40 -1]);
end
end

Expand Down
23 changes: 18 additions & 5 deletions matImage/imStacks/LabelIsosurfacesOptionsDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ function setupLayout(hf)
mainPanel = uiextras.VBox('Parent', hf);

% control panel: use vertical layout
optionsPanel = uiextras.VButtonBox('Parent', mainPanel, ...
optionsPanel = uix.VButtonBox('Parent', mainPanel, ...
'ButtonSize', [150 30], ...
'VerticalAlignment', 'Top', ...
'HorizontalAlignment', 'Center', ...
'VerticalAlignment', 'top', ...
'HorizontalAlignment', 'center', ...
'Spacing', 5, 'Padding', 5);

this.handles.rotateOx = uicontrol(...
Expand All @@ -79,9 +79,10 @@ function setupLayout(hf)
'Value', 0, ...
'HorizontalAlignment', 'Left');

buttonsPanel = uiextras.HButtonBox('Parent', mainPanel, ...
% add control panel with "Compute" and "Close" buttons
buttonsPanel = uix.HButtonBox('Parent', mainPanel, ...
'ButtonSize', [70 30], ...
'VerticalAlignment', 'Top', ...
'VerticalAlignment', 'top', ...
'Spacing', 5, 'Padding', 5, ...
'Units', 'normalized', ...
'Position', [0 0 1 1]);
Expand All @@ -107,6 +108,11 @@ function setupLayout(hf)
methods
function onApplyButtonClicked(this, hObject, eventdata) %#ok<INUSD>

% first, disable "compute" button to avoid multiple calls
set(this.handles.applyButton, 'enable', 'off');
hDlg = msgbox({'Computing isosurfaces,', 'Please wait...'}, ...
'Isosurface computing');

% extract options from widgets
rotateXAxis = get(this.handles.rotateOx, 'Value');
smooth = get(this.handles.smooth, 'Value');
Expand Down Expand Up @@ -213,6 +219,13 @@ function onApplyButtonClicked(this, hObject, eventdata) %#ok<INUSD>
zlabel('Z Axis');
end
end

% re-enable "apply" button
set(this.handles.applyButton, 'enable', 'on');
if ishandle(hDlg)
close(hDlg);
end

end

end % end methods
Expand Down
10 changes: 5 additions & 5 deletions matImage/imStacks/OrthoSlicer3dOptionsDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ function setupLayout(hf)
mainPanel = uiextras.VBox('Parent', hf);

% control panel: use vertical layout
optionsPanel = uiextras.VButtonBox('Parent', mainPanel, ...
optionsPanel = uix.VButtonBox('Parent', mainPanel, ...
'ButtonSize', [150 30], ...
'VerticalAlignment', 'Top', ...
'HorizontalAlignment', 'Center', ...
'VerticalAlignment', 'top', ...
'HorizontalAlignment', 'center', ...
'Spacing', 5, 'Padding', 5);

this.handles.rotateOx = uicontrol(...
Expand All @@ -79,9 +79,9 @@ function setupLayout(hf)
'Value', 0, ...
'HorizontalAlignment', 'Left');

buttonsPanel = uiextras.HButtonBox('Parent', mainPanel, ...
buttonsPanel = uix.HButtonBox('Parent', mainPanel, ...
'ButtonSize', [70 30], ...
'VerticalAlignment', 'Top', ...
'VerticalAlignment', 'top', ...
'Spacing', 5, 'Padding', 5, ...
'Units', 'normalized', ...
'Position', [0 0 1 1]);
Expand Down
26 changes: 12 additions & 14 deletions matImage/imStacks/SlicerHistogramDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function setupDialogLayout(hf)

% Add a combo box for the type of histogram bounds
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -166,12 +166,12 @@ function setupDialogLayout(hf)
'BackgroundColor', bgColor, ...
'Callback',@this.onBoundsTypeChanged);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 60]);
set(hLine, 'Widths', [-1 60]);


% Add two text boxes for manual bounds
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -195,7 +195,7 @@ function setupDialogLayout(hf)
'Enable', 'off', ...
'Callback',@this.onMaxBoundChanged);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 50 50]);
set(hLine, 'Widths', [-1 50 50]);

% Add a check box for automatically computing the number of bins
this.handles.autoBinNumberCheckBox = uicontrol('Style', 'CheckBox', ...
Expand All @@ -207,7 +207,7 @@ function setupDialogLayout(hf)

% Add a text box for the number of histogram bins
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -224,11 +224,11 @@ function setupDialogLayout(hf)
'Enable', 'off', ...
'Callback',@this.onBinNumberChanged);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 40]);
set(hLine, 'Widths', [-1 40]);

% Add a combo box for the histogram type
% First the line container
hLine = uiextras.HBox('Parent', mainPanel, ...
hLine = uix.HBox('Parent', mainPanel, ...
'Spacing', 5, 'Padding', 5);
% Then the label
uicontrol('Style', 'Text', ...
Expand All @@ -245,7 +245,7 @@ function setupDialogLayout(hf)
'BackgroundColor', bgColor, ...
'Callback',@this.onDisplayTypeChanged);
% setup sizes in horizontal direction
set(hLine, 'Sizes', [-1 60]);
set(hLine, 'Widths', [-1 60]);


% Add a check box for taking into account or not the background
Expand All @@ -262,14 +262,12 @@ function setupDialogLayout(hf)
'String', 'Auto update', ...
'Value', true, ...
'Callback',@this.onAutoUpdateChanged);
controlPanel = uiextras.HButtonBox('Parent', mainPanel, ...

% add control panel with "Apply" and "Close" buttons
controlPanel = uix.HButtonBox('Parent', mainPanel, ...
'ButtonSize', [70 60], ...
'VerticalAlignment', 'bottom', ...
'Spacing', 5, 'Padding', 5, ...
'Units', 'normalized', ...
'Position', [0 0 1 1]);
'Spacing', 5, 'Padding', 5);
this.handles.applyButton = uicontrol('Style', 'PushButton', ...
'Parent', controlPanel, ...
'String', 'Apply', ...
Expand Down

0 comments on commit fbe71f1

Please sign in to comment.