1 %> @ingroup guigroup sheware mainguis
3 %> @brief GUI
for loading datasets from the SHEware database.
5 %> The parameters names <b>Experiment</b>, <b>Domain</b>, <b>Deactivation Scheme</b>, <b>Tray</b>, and <b>Classifier</b> match SHEware terminology (e.g.
"classifier" in IRootLab has another meaning).
7 %> Each <b>Classifier</b> selected will generate one
class level in the dataset.
9 %> After clicking on <b>Generate dataset</b>:
10 %> @arg data will be retrieved from the SHEware database
11 %> @arg the Window will close
12 %> @arg a
new dataset will appear in @c datatool (and in MATLAB workspace).
14 %> @image html Screenshot-sheload.png
17 function varargout = sheload(varargin)
18 % Last Modified by GUIDE v2.5 22-Nov-2012 16:15:46
20 % Begin initialization code - DO NOT EDIT
22 gui_State =
struct(
'gui_Name', mfilename, ...
23 'gui_Singleton', gui_Singleton, ...
24 'gui_OpeningFcn', @sheload_OpeningFcn, ...
25 'gui_OutputFcn', @sheload_OutputFcn, ...
26 'gui_LayoutFcn', [] , ...
28 if nargin && ischar(varargin{1})
29 gui_State.gui_Callback = str2func(varargin{1});
33 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
35 gui_mainfcn(gui_State, varargin{:});
37 % End initialization code - DO NOT EDIT
40 % --- Executes just before sheload is made visible.
41 function sheload_OpeningFcn(hObject, eventdata, handles, varargin)
44 handles.output.flag_ok = 0;
45 handles.ids_experiment = [];
46 handles.ids_domain = [];
47 handles.ids_deact = [];
48 handles.ids_judge = [];
49 handles.ids_tray = [];
50 handles.idxs_judge = []; % will be synchronized with which is shown in edit_judge
51 guidata(hObject, handles);
53 populate_experiment(handles);
60 % --- Outputs from this function are returned to the command clae.
61 function varargout = sheload_OutputFcn(hObject, eventdata, handles)
63 uiwait(handles.figure1);
64 handles = guidata(hObject);
65 varargout{1} = handles.output;
70 varargout{1} = output;
72 varargout{1} = handles.output;
74 %############################################
77 function z = get_idexperiment(hh)
78 idx = get(hh.popupmenu_experiment, 'Value');
82 z = hh.ids_experiment(idx-1);
86 function z = get_iddomain(hh)
87 idx = get(hh.popupmenu_domain, 'Value');
91 z = hh.ids_domain(idx-1);
95 function z = get_iddeact(hh)
96 idx = get(hh.popupmenu_deact, 'Value');
100 z = hh.ids_deact(idx-1);
104 function z = get_idtray(hh)
105 idx = get(hh.popupmenu_tray, 'Value');
109 z = hh.ids_tray(idx-1);
113 function z = get_idjudge(hh)
115 if numel(hh.idxs_judge) > 0
116 z = hh.ids_judge(hh.idxs_judge);
121 function populate_experiment(hh)
123 b =
irquery(sprintf(
'select id, name from experiment order by name'));
127 a = [a sprintf('%s (
id %d)', names{i}, ids(i))];
129 set(hh.popupmenu_experiment,
'Value', 1);
130 set(hh.popupmenu_experiment,
'String', a);
131 switch_experiment(hh);
132 hh.ids_experiment = ids;
133 guidata(hh.figure1, hh);
137 function populate_domain(hh)
139 idexperiment = get_idexperiment(hh);
141 b =
irquery(sprintf(
'select domain.id, domain.name, count(*) as ccc from series left join domain on domain.id = series.iddomain where series.idexperiment = %d group by series.iddomain order by domain.name', idexperiment));
146 a = [a sprintf('%s (
id %d) - %d series', names{i}, ids(i), counts(i))];
149 guidata(hh.figure1, hh);
151 set(hh.popupmenu_domain,
'Value', 1);
152 set(hh.popupmenu_domain,
'String', a);
157 function populate_deact(hh)
158 a = {
'(Leave blank)'};
159 idexperiment = get_idexperiment(hh);
160 b =
irquery(sprintf(
'select id, name from deact order by name'));
164 for i = 1:length(ids)
165 b =
irquery(sprintf('select count(*)
as ccc from deact_spectrum left join spectrum on deact_spectrum.idspectrum = spectrum.
id where iddeact = %d and spectrum.idexperiment = %d', ids(i), idexperiment));
167 a = [a sprintf('%s (
id %d) - %d outliers', names{i}, ids(i), count)];
171 a = [a sprintf('%s (
id %d)', names{i}, ids(i))];
174 set(hh.popupmenu_deact,
'String', a);
176 guidata(hh.figure1, hh);
179 function populate_tray(hh)
180 a = {
'(Leave blank)'};
181 idexperiment = get_idexperiment(hh);
183 b =
irquery(sprintf([
'select tray.id, tray.code, count(*) as ccc from spectrum ' ...
184 'left join colony on spectrum.idcolony = colony.id ' ...
185 'left join slide on colony.idslide = slide.id ' ...
186 'left join tray on slide.idtray = tray.id ' ...
187 'where spectrum.idexperiment = %d group by tray.id order by tray.code'], idexperiment));
192 a = [a sprintf('%s (
id %d) - %d scans', names{i}, ids(i), counts(i))];
195 guidata(hh.figure1, hh);
197 set(hh.popupmenu_tray,
'Value', 1);
198 set(hh.popupmenu_tray,
'String', a);
202 function populate_judge(hh)
204 idexperiment = get_idexperiment(hh);
206 b =
irquery(sprintf([
'select judge.id, judge.name, count(*) as ccc from spectrum_judge ' ...
207 'left join spectrum on spectrum_judge.idspectrum = spectrum.id ' ...
208 'left join judge on spectrum_judge.idjudge = judge.id ' ...
209 'where spectrum.idexperiment = %d and judge.class_name = "judge_score_human" group by judge.id order by judge.name'], idexperiment));
214 a = [a sprintf('%s (
id %d)', names{i}, ids(i))];
219 set(hh.listbox_judge,
'Value', 1);
220 set(hh.listbox_judge,
'String', a);
221 guidata(hh.figure1, hh);
226 function sync_judge(hh)
227 if isempty(hh.idxs_judge)
230 aa = get(hh.listbox_judge, 'String');
231 a = aa(hh.idxs_judge);
233 set(hh.edit_judge, 'String', a);
239 function switch_experiment(hh)
241 populate_deact(guidata(hh.figure1));
242 populate_tray(guidata(hh.figure1));
243 populate_judge(guidata(hh.figure1));
246 function switch_domain(hh)
249 function switch_deact(hh)
252 function switch_tray(hh)
255 function switch_judge(hh)
260 %############################################
261 %############################################
264 % --- Executes on button press in pushbutton_ok.
265 function pushbutton_ok_Callback(hObject, eventdata, handles)
267 idexperiment = get_idexperiment(handles);
268 iddomain = get_iddomain(handles);
269 idjudge = get_idjudge(handles);
270 iddeact = get_iddeact(handles);
271 idtray = get_idtray(handles);
273 if isempty(idexperiment)
274 irerror('Please select an experiment!');
277 irerror('Please select a domain!');
283 sprintf('o.idexperiment = %s;\n', mat2str(idexperiment)), ...
284 sprintf('o.idjudge = %s;\n', mat2str(idjudge)), ...
285 sprintf('o.iddomain = %s;\n', mat2str(iddomain)), ...
286 sprintf('o.iddeact = %s\n', mat2str(iddeact)), ...
287 sprintf('o.idtray = %s;\n', mat2str(idtray)), ...
288 sprintf('%s = o.load();\n', name) ...
290 ircode_eval(scode, 'Loads dataset from SHEware database');
291 handles.output.flag_ok = 1;
292 guidata(hObject, handles);
299 % --- Executes on selection change in popupmenu_experiment.
300 function popupmenu_experiment_Callback(hObject, eventdata, handles)
301 switch_experiment(handles);
303 % --- Executes during
object creation, after setting all properties.
304 function popupmenu_experiment_CreateFcn(hObject, eventdata, handles)
305 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
306 set(hObject,'BackgroundColor','white');
309 % --- Executes on selection change in popupmenu_domain.
310 function popupmenu_domain_Callback(hObject, eventdata, handles)
313 % --- Executes during
object creation, after setting all properties.
314 function popupmenu_domain_CreateFcn(hObject, eventdata, handles)
315 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
316 set(hObject,'BackgroundColor','white');
320 % --- Executes on selection change in popupmenu_deact.
321 function popupmenu_deact_Callback(hObject, eventdata, handles)
324 % --- Executes during
object creation, after setting all properties.
325 function popupmenu_deact_CreateFcn(hObject, eventdata, handles)
326 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
327 set(hObject,'BackgroundColor','white');
331 % --- Executes on selection change in popupmenu_tray.
332 function popupmenu_tray_Callback(hObject, eventdata, handles)
335 % --- Executes during
object creation, after setting all properties.
336 function popupmenu_tray_CreateFcn(hObject, eventdata, handles)
337 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
338 set(hObject,'BackgroundColor','white');
342 % --- Executes on selection change in listbox_judge.
343 function listbox_judge_Callback(hObject, eventdata, handles)
345 % --- Executes during
object creation, after setting all properties.
346 function listbox_judge_CreateFcn(hObject, eventdata, handles)
347 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
348 set(hObject,'BackgroundColor','white');
351 % --- Executes on button press in pushbutton_add.
352 function pushbutton_add_Callback(hObject, eventdata, handles)
353 if numel(handles.ids_judge) > 0
354 handles.idxs_judge(end+1) = get(handles.listbox_judge, 'Value');
355 guidata(handles.figure1, handles);
359 % --- Executes on button press in pushbutton_restart.
360 function pushbutton_restart_Callback(hObject, eventdata, handles)
361 handles.idxs_judge = [];
362 guidata(handles.figure1, handles);
366 function edit_judge_Callback(hObject, eventdata, handles)
369 % --- Executes during
object creation, after setting all properties.
370 function edit_judge_CreateFcn(hObject, eventdata, handles)
371 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
372 set(hObject,'BackgroundColor','white');
376 function pushbutton_launch_objtool_Callback(hObject, eventdata, handles)
380 function pushbutton_launch_datatool_Callback(hObject, eventdata, handles)
function send_error(in ME)
Dataset loader/saver for the SHEWare database.
function connect_to_cells()
function ircode_eval(in s, in title)
function gui_set_position(in hObject)
function irquery(in varargin)
Analysis Session (AS) base class.
function find_varname(in prefix)
function irerrordlg(in errorstring, in dlgname)