-
Notifications
You must be signed in to change notification settings - Fork 0
/
Landscape_gui.m
179 lines (144 loc) · 5.84 KB
/
Landscape_gui.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
function Landscape_gui
%LANDSCAPE_GUI create the gui window for landscape
clear all;
% Create the window figure
gui_figure = figure('Visible', 'off', 'Position', [200,400,900,500], 'MenuBar', 'None', 'NumberTitle', 'off');
% Assign the a name to appear in the window title
gui_figure.Name = 'Landscape';
% Move the window to the center of the screen
movegui(gui_figure,'center')
% Add necessary folders and subfolders
root_dir = pwd;
addpath([root_dir '/auxiliary/']);
addpath([root_dir '/fitting/']);
addpath([root_dir '/gui/']);
addpath([root_dir '/heatmaps/']);
addpath([root_dir '/io/']);
addpath([root_dir '/parameter_setup/']);
addpath([root_dir '/preprocessing/']);
addpath([root_dir '/registration/']);
addpath(genpath([root_dir '/segmentation/']));
addpath([root_dir '/visualization/']);
% Set up standard parameters
global p
p = ParameterTotal();
% Set default search path for data
dataPath = [root_dir '/data'];
% Set default search path for results
resultsPath = [root_dir '/results'];
% Buttons and UI elements from top to bottom
% Button that opens the settings window
button_settings = uicontrol('Style', 'pushbutton', ...
'String', 'Settings', ...
'FontName', 'Arial', ...
'FontSize', 15, ...
'BackgroundColor', [0.5,0.5,0.5], ...
'Position', [350, 350, 200, 100], ...
'Callback', @button_settings_callback);
% Button that starts the processing
button_processing = uicontrol('Style', 'pushbutton', ...
'String', 'Registration', ...
'Position', [50,200,200,100], ...
'FontName', 'Arial', ...
'FontSize', 15, ...
'BackgroundColor', [0.6,0.7,1], ...
'Callback', {@button_processing_callback});
% Arrow to indicate the order of steps
annotation('arrow', [0.3 0.37], [0.5 0.5])
% Button that starts the evaluation
button_evaluation = uicontrol('Style', 'pushbutton', ...
'String', 'Evaluation', ...
'Position', [350,200,200,100], ...
'FontName', 'Arial', ...
'FontSize', 15, ...
'BackgroundColor', [0.6,0.7,1], ...
'Callback', {@button_evaluation_callback});
% Arrow to indicate the order of steps
annotation('arrow', [0.63 0.7], [0.5 0.5])
% Button that starts the heatmap creation
button_heatmap = uicontrol('Style', 'pushbutton', ...
'String', 'Visualization', ...
'Position', [650,200,200,100], ...
'FontName', 'Arial', ...
'FontSize', 15, ...
'BackgroundColor', [0.6,0.7,1], ...
'Callback', {@button_heatmap_callback});
% Text that indicates the current status of the program
box_status = uicontrol('Style', 'text', ...
'String', 'Ready', ...
'Position', [250, 100, 400, 50], ...
'FontName', 'Arial', ...
'FontSize', 30);
% Show the window
gui_figure.Visible = 'on';
%--------------------------------------------------------------------------
%Button Functions
%--------------------------------------------------------------------------
% Function that starts the processing
function button_processing_callback(source, eventdata)
% Update status
box_status.String = 'Registering...';
try
% Get the required data location and results path from the user
p.dataPath = uigetdir(dataPath,'Please select a folder with the data');
btn = questdlg('Do you want to use an existing results folder or create a new one?','New folder?','Create new','Use existing','Create new');
if strcmp(btn,'Create new')
p.resultsPath = uigetdir(resultsPath,'Please select a directory for the new folder');
answ = inputdlg('Please enter a name for the new folder');
p.resultsPath = [p.resultsPath,'/',answ{1}];
mkdir(p.resultsPath);
else
p.resultsPath = uigetdir(resultsPath,'Please select a folder for the results');
end
% Start the processing script
processing_gui(p);
catch ME
disp(ME);
end
% Update status
box_status.String = 'Ready';
end
% Function that starts the evaluation
function button_evaluation_callback(source, eventdata)
% Update status
box_status.String = 'Evaluating...';
try
% Get the results location from the user
p.resultsPath = uigetdir(resultsPath,'Please select a results folder to evaluate');
checkDirectory(p.resultsPath);
% Start the evaluation script
evaluation_gui(p);
catch ME
disp(ME)
end
% Update status
box_status.String = 'Ready';
end
% Function that starts the heatmap creation
function button_heatmap_callback(source, eventdata)
% Update status
box_status.String = 'Visualizing...';
try
% Get the results location from the user
p.resultsPath = uigetdir(resultsPath,'Please select a results folder to generate heatmap');
p.resultsPathAccepted = [p.resultsPath,'/accepted'];
if ~exist([p.resultsPath,'/heatmaps'],'dir')
mkdir([p.resultsPath,'/heatmaps']);
end
% Start the heatmap script
generateHeatmaps(p);
catch ME
disp(ME)
end
% Update status
box_status.String = 'Ready';
end
% Function that opens the settings window
function button_settings_callback(source, eventdata)
% Create the window and pass it on to the settings script
f = figure('Visible', 'off', 'Position', [400,400,500,500], 'MenuBar', 'None', 'NumberTitle', 'off', 'Name', 'Settings');
movegui(f, 'center');
f.Visible = 'on';
settings_gui(f);
end
end