- https://www.mathworks.com/matlabcentral/answers/418893-how-to-display-an-image-in-ui-figure-on-app-designer
- https://www.mathworks.com/matlabcentral/answers/401480-how-do-i-run-all-images-in-a-folder-through-an-image-processing-code
- https://www.mathworks.com/matlabcentral/answers/399998-add-static-images-with-app-designer#answer_367315
How to loop over images in a folder in an AppDesigner GUI?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Unfortunately, I have absolutely no experience with AppDesigner yet. If there is a good tutorial going in the direction of what I want to solve, I'd also appreciate a hint to the corresponding link.
Now to my problem: I have a folder filled with images that are named following the convention A_i.tif and B_i.tif, i.e. for every i there are two images A and B.
How can I create a GUI using AppDesigner that "loops" over all i = 1:N image pairs, displays one pair at a time and waits for the user to click one of 3 button options before the next image pair is loaded and displayed?
I am only asking for the "loop" functionality, I'll be able to do the rest. The rather generic code frame is
classdef ManualCheckGUI < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
KeepButton matlab.ui.control.Button
RemoveButton matlab.ui.control.Button
UndoButton matlab.ui.control.Button
end
methods (Access = private)
% Button pushed function: KeepButton
function KeepButtonPushed(app, event)
end
% Button pushed function: RemoveButton
function RemoveButtonPushed(app, event)
end
% Button pushed function: UndoButton
function UndoButtonPushed(app, event)
end
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
setAutoResize(app, app.UIFigure, true)
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title');
xlabel(app.UIAxes, 'X');
ylabel(app.UIAxes, 'Y');
app.UIAxes.Position = [16 160 300 185];
% Create UIAxes2
app.UIAxes2 = uiaxes(app.UIFigure);
title(app.UIAxes2, 'Title');
xlabel(app.UIAxes2, 'X');
ylabel(app.UIAxes2, 'Y');
app.UIAxes2.Position = [325 160 300 185];
% Create KeepButton
app.KeepButton = uibutton(app.UIFigure, 'push');
app.KeepButton.ButtonPushedFcn = createCallbackFcn(app, @KeepButtonPushed, true);
app.KeepButton.Position = [134 110 100 22];
app.KeepButton.Text = 'Keep';
% Create RemoveButton
app.RemoveButton = uibutton(app.UIFigure, 'push');
app.RemoveButton.ButtonPushedFcn = createCallbackFcn(app, @RemoveButtonPushed, true);
app.RemoveButton.Position = [449 110 100 22];
app.RemoveButton.Text = 'Remove';
% Create UndoButton
app.UndoButton = uibutton(app.UIFigure, 'push');
app.UndoButton.ButtonPushedFcn = createCallbackFcn(app, @UndoButtonPushed, true);
app.UndoButton.Position = [289 110 100 22];
app.UndoButton.Text = 'Undo';
end
end
methods (Access = public)
% Construct app
function app = ManualCheckGUI()
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
0 comentarios
Respuestas (1)
Praveen Reddy
el 15 de Mzo. de 2023
Hi Michael,
I understand that you want to loop through all images in a folder but wait for the user to perform a UI activity before loading the next pair of images. You can use a state variable in the for loop to pause the execution (Alternatively state button). Toggle the state value in appropriate call back functions to resume the for loop. I have tried to replicate the functionality with a text box; however, you can use the similar logic with an image panel component instead of text box. I have attached the mlapp file for reference.
The following resources also might help you:
0 comentarios
Ver también
Categorías
Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!