IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
uip_reptt.m
Go to the documentation of this file.
1 %> @ingroup guigroup
2 %> @file
3 %> @brief Repeated Train-Test (@ref reptt) Properties Window
4 %>
5 %> This window asks for properties common to all @ref reptt classes
6 %>
7 %> @image html Screenshot-uip_reptt.png
8 %>
9 %> <b>Test post-processor</b> (optional) - see reptt::postpr_test
10 %>
11 %> <b>Estimation post-processor</b> - see reptt::postpr_est
12 %>
13 %> <b>Mold Classifiers</b> - see reptt::block_mold
14 %>
15 %> <b>Mold Train-Test Logs</b> - see reptt::log_mold
16 %>
17 %> @sa reptt
18 
19 %> @cond
20 function varargout = uip_reptt(varargin)
21 % Begin initialization code - DO NOT EDIT
22 gui_Singleton = 0;
23 gui_State = struct('gui_Name', mfilename, ...
24  'gui_Singleton', gui_Singleton, ...
25  'gui_OpeningFcn', @uip_reptt_OpeningFcn, ...
26  'gui_OutputFcn', @uip_reptt_OutputFcn, ...
27  'gui_LayoutFcn', [] , ...
28  'gui_Callback', []);
29 if nargin && ischar(varargin{1})
30  gui_State.gui_Callback = str2func(varargin{1});
31 end
32 
33 if nargout
34  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
35 else
36  gui_mainfcn(gui_State, varargin{:});
37 end
38 % End initialization code - DO NOT EDIT
39 
40 % --- Executes just before uip_reptt is made visible.
41 function uip_reptt_OpeningFcn(hObject, eventdata, handles, varargin)
42 handles.output.flag_ok = 0;
43 handles.names_block_mold = {};
44 handles.names_log_mold = {};
45 guidata(hObject, handles);
46 gui_set_position(hObject);
47 refresh(handles);
48 
49 % --- Outputs from this function are returned to the command line.
50 function varargout = uip_reptt_OutputFcn(hObject, eventdata, handles)
51 try
52  uiwait(handles.figure1);
53  handles = guidata(hObject); % Handles is not a handle(!), so gotta retrieve it again to see changes in .output
54  varargout{1} = handles.output;
55  delete(gcf);
56 catch %#ok<*CTCH>
57  output.flag_ok = 0;
58  output.params = {};
59  varargout{1} = output;
60 end;
61 
62 
63 %############################################
64 %############################################
65 
66 %############
67 function refresh(handles)
68 
69 % logs and classifiers
70 listbox_load_from_workspace('ttlog', handles.listbox_log_mold, 0);
71 v = get(handles.listbox_log_mold, 'Value');
72 if sum(v > length(handles.names_log_mold)) > 0 && ~isempty(handles.names_log_mold)
73  set(handles.listbox_log_mold, 'Value', 1);
74 end;
75 set(handles.edit_log_mold, 'String', handles.names_log_mold);
76 
77 listbox_load_from_workspace({'clssr', 'block_cascade_base'}, handles.listbox_block_mold, 0);
78 v = get(handles.listbox_block_mold, 'Value');
79 if sum(v > length(handles.names_block_mold)) > 0 && ~isempty(handles.names_block_mold)
80  set(handles.listbox_block_mold, 'Value', 1);
81 end;
82 set(handles.edit_block_mold, 'String', handles.names_block_mold);
83 
84 
85 % others
86 listbox_load_from_workspace('block', handles.popupmenu_postpr_est, 0);
87 listbox_load_from_workspace('block', handles.popupmenu_postpr_test, 1);
88 
89 
90 local_show_description(handles, []);
91 
92 %############
93 function local_show_description(handles, listbox)
94 if isempty(listbox)
95  set(handles.edit_description, 'String', {});
96 end;
97 show_description(listbox, handles.edit_description);
98 
99 %############################################
100 %############################################
101 
102 
103 % --- Executes on button press in pushbuttonOk.
104 function pushbuttonOk_Callback(hObject, eventdata, handles)
105 try
106  spostpr_test = listbox_get_selected_1stname(handles.popupmenu_postpr_test);
107  if isempty(spostpr_test)
108  spostpr_test = '[]';
109  end;
110  spostpr_est = listbox_get_selected_1stname(handles.popupmenu_postpr_est);
111  if isempty(spostpr_est)
112  irerror('Estimation Post-Processor not specified!');
113  end;
114 
115  if isempty(handles.names_block_mold)
116  irerror('No mold Classifiers specified!');
117  end;
118 
119  if isempty(handles.names_log_mold)
120  irerror('No mold Train-Test Logs specified!');
121  end;
122 
123 
124  handles.output.params = {...
125  'postpr_test', spostpr_test, ...
126  'postpr_est', spostpr_est, ...
127  'log_mold', params2str2(handles.names_log_mold) ...
128  'block_mold', [params2str2(handles.names_block_mold), ''''], ... % Transposes the list of blocks to have a column instead of a row
129  };
130  handles.output.flag_ok = 1;
131  guidata(hObject, handles);
132  uiresume();
133 catch ME
134  irerrordlg(ME.message, 'Cannot continue');
135 end;
136 
137 % --- Executes on selection change in listbox_block_mold.
138 function listbox_block_mold_Callback(hObject, eventdata, handles) %#ok<*INUSL,*DEFNU>
139 local_show_description(handles, handles.listbox_block_mold);
140 
141 % --- Executes on selection change in listbox_log_mold.
142 function listbox_log_mold_Callback(hObject, eventdata, handles)
143 local_show_description(handles, handles.listbox_log_mold);
144 
145 
146 % --- Executes on button press in pushbutton_block_mold_add.
147 function pushbutton_block_mold_add_Callback(hObject, eventdata, handles)
148 nn = listbox_get_selected_1stname(handles.listbox_block_mold);
149 if ~isempty(nn)
150  handles.names_block_mold{end+1} = nn;
151  guidata(hObject, handles);
152  refresh(handles);
153 end;
154 
155 % --- Executes on button press in pushbutton_block_mold_restart.
156 function pushbutton_block_mold_restart_Callback(hObject, eventdata, handles)
157 set(handles.edit_block_mold, 'String', {});
158 handles.names_block_mold = [];
159 guidata(hObject, handles);
160 refresh(handles);
161 
162 % --- Executes on button press in pushbutton_log_mold_add.
163 function pushbutton_log_mold_add_Callback(hObject, eventdata, handles)
164 nn = listbox_get_selected_1stname(handles.listbox_log_mold);
165 if ~isempty(nn)
166  handles.names_log_mold{end+1} = nn;
167  guidata(hObject, handles);
168  refresh(handles);
169 end;
170 
171 % --- Executes on button press in pushbutton_log_mold_restart.
172 function pushbutton_log_mold_restart_Callback(hObject, eventdata, handles)
173 set(handles.edit_log_mold, 'String', {});
174 handles.names_log_mold = [];
175 guidata(hObject, handles);
176 refresh(handles);
177 
178 function edit_description_Callback(hObject, eventdata, handles) %#ok<*INUSD>
179 
180 % --- Executes during object creation, after setting all properties.
181 function edit_description_CreateFcn(hObject, eventdata, handles)
182 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
183  set(hObject,'BackgroundColor','white');
184 end
185 
186 % --- Executes on selection change in popupmenu_postpr_test.
187 function popupmenu_postpr_test_Callback(hObject, eventdata, handles)
188 local_show_description(handles, handles.popupmenu_postpr_test);
189 
190 % --- Executes during object creation, after setting all properties.
191 function popupmenu_postpr_test_CreateFcn(hObject, eventdata, handles)
192 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
193  set(hObject,'BackgroundColor','white');
194 end
195 
196 
197 
198 % --- Executes on selection change in popupmenu_postpr_est.
199 function popupmenu_postpr_est_Callback(hObject, eventdata, handles)
200 local_show_description(handles, handles.popupmenu_postpr_est);
201 
202 
203 % --- Executes during object creation, after setting all properties.
204 function popupmenu_postpr_est_CreateFcn(hObject, eventdata, handles)
205 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
206  set(hObject,'BackgroundColor','white');
207 end
208 
209 function edit_block_mold_Callback(hObject, eventdata, handles)
210 
211 % --- Executes during object creation, after setting all properties.
212 function edit_block_mold_CreateFcn(hObject, eventdata, handles)
213 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
214  set(hObject,'BackgroundColor','white');
215 end
216 
217 % --- Executes during object creation, after setting all properties.
218 function listbox_log_mold_CreateFcn(hObject, eventdata, handles)
219 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
220  set(hObject,'BackgroundColor','white');
221 end
222 
223 function edit_log_mold_Callback(hObject, eventdata, handles)
224 
225 % --- Executes during object creation, after setting all properties.
226 function edit_log_mold_CreateFcn(hObject, eventdata, handles)
227 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
228  set(hObject,'BackgroundColor','white');
229 end
230 
231 % --- Executes during object creation, after setting all properties.
232 function listbox_block_mold_CreateFcn(hObject, eventdata, handles)
233 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
234  set(hObject,'BackgroundColor','white');
235 end
236 
237 % --- Executes on selection change in popupmenu_data.
238 function popupmenu_data_Callback(hObject, eventdata, handles)
239 local_show_description(handles, handles.popupmenu_data);
240 
241 
242 % --- Executes during object creation, after setting all properties.
243 function popupmenu_data_CreateFcn(hObject, eventdata, handles)
244 
245 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
246  set(hObject,'BackgroundColor','white');
247 end
248 %> @endcond
Property log_mold
Cell array. Molds for the recording.
Definition: reptt.m:17
Property block_mold
Cell array. Blocks to be trained-tested.
Definition: reptt.m:14
function irerror(in s)
function show_description(in h_list, in h_edit)
function listbox_get_selected_1stname(in h_listbox)
function params2str2(in params)
Base Block class.
Definition: block.m:2
Property postpr_test
(Optional) Block to post-process the test data. For example, a grag_classes_first.
Definition: reptt.m:20
function listbox_load_from_workspace(in classname, in h_list, in flag_blank, in string_empty, in input)
function gui_set_position(in hObject)
REPeated Train-Test.
Definition: reptt.m:8
Property postpr_est
Definition: reptt.m:25