-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpLabeler.m
58 lines (48 loc) · 2.06 KB
/
pLabeler.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
classdef pLabeler < handle
properties
gHandles % Struct with handles of GUI's graphic objects
defPath = 'C:\';
projectPath = "";
projectName = "";
currImgID = 0;
xmlStruct = [];
lastDrawnBbox = [];
end
methods
%------------------------------------------------------------------
% CLASS CONSTRUCTOR METHOD
%-----------------------------------------------------------------
function app = pLabeler()
% Make sure only one GUI instance is called at a time
figs = findobj(allchild(groot), 'flat', 'Tag', 'fig_UI');
if isempty(figs)
% Build the GUI is no GUI is already displayed
buildApp(app)
else
% Give back focus to the GUI if one instance exists
figure(figs(1))
end
end
%-----------------------------------------------------------------
%-----------------------------------------------------------------
function buildApp(app)
% Create all the graphics elements in the 2 figures
app.gHandles = graphics.createFigures();
% Disable all images interactions until a project is loaded
functionality.enableTool(app, 'noProjectLoaded', 'off')
% Assign callbacks to all the buttons in the GUI
functionality.assignCallbacks(app)
% Add custom CloseRequestFcn to all the figures
app.gHandles.fig_image.CloseRequestFcn = @app.closeFunction;
app.gHandles.fig_pLabeler.CloseRequestFcn = @app.closeFunction;
end
function closeFunction(app,~,~)
% Store the currentImgID in the XML file if a project is loaded
if strlength(app.projectName) ~= 0
projManager.updateXML_currentImgID(app)
end
delete(app.gHandles.fig_image)
delete(app.gHandles.fig_pLabeler)
end
end
end