This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbackground_removal_gui_2.m
685 lines (584 loc) · 27.4 KB
/
background_removal_gui_2.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
% Thing I'd like to add: ability to lock all the figures from a point, so
% that when you zoom in or scan one fig, you zoom in and scan all the figs
% for that point. Probably have to keep track of each figure, and also add
% listeners to all them or something.
function varargout = background_removal_gui_2(varargin)
% BACKGROUND_REMOVAL_GUI_2 MATLAB code for background_removal_gui_2.fig
% BACKGROUND_REMOVAL_GUI_2, by itself, creates a new BACKGROUND_REMOVAL_GUI_2 or raises the existing
% singleton*.
%
% H = BACKGROUND_REMOVAL_GUI_2 returns the handle to a new BACKGROUND_REMOVAL_GUI_2 or the handle to
% the existing singleton*.
%
% BACKGROUND_REMOVAL_GUI_2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in BACKGROUND_REMOVAL_GUI_2.M with the given input arguments.
%
% BACKGROUND_REMOVAL_GUI_2('Property','value',...) creates a new BACKGROUND_REMOVAL_GUI_2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before background_removal_gui_2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to background_removal_gui_2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help background_removal_gui_2
% Last Modified by GUIDE v2.5 16-Jul-2019 12:14:46
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @background_removal_gui_2_OpeningFcn, ...
'gui_OutputFcn', @background_removal_gui_2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before background_removal_gui_2 is made visible.
function background_removal_gui_2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to background_removal_gui_2 (see VARARGIN)
feature('DefaultCharacterSet','UTF-8');
global pipeline_data;
pipeline_data = struct();
pipeline_data.bgChannel = '181';
pipeline_data.removingBackground = false;
pipeline_data.points = PointManager();
pipeline_data.points.offset = [0,0];
pipeline_data.background_point = '';
% Choose default command line output for background_removal_gui_2
handles.output = hObject;
[path, name, ext] = fileparts(mfilename('fullpath'));
options = json.read([path, filesep, 'src', filesep, 'options.json']);
fontsize = options.fontsize;
warning('off', 'MATLAB:hg:uicontrol:StringMustBeNonEmpty');
warning('off', 'MATLAB:imagesci:tifftagsread:expectedTagDataFormat');
path = strsplit(path, filesep);
path(end) = [];
path = strjoin(path, filesep);
pipeline_data.defaultPath = path;
% Update handles structure
guidata(hObject, handles);
setUIFontSize(handles, fontsize)
% UIWAIT mak es background_removal_gui_2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = background_removal_gui_2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% Manage Points and Select Background Channel =============================
% --- Executes on button press in add_point.
function add_point_Callback(hObject, eventdata, handles)
global pipeline_data;
pointdiles = uigetdiles(pipeline_data.defaultPath);
if ~isempty(pointdiles)
[pipeline_data.defaultPath, ~, ~] = fileparts(pointdiles{1});
pipeline_data.points.add(pointdiles);
set(handles.selected_points_listbox, 'string', pipeline_data.points.getNames());
set(handles.eval_point_menu, 'string', pipeline_data.points.getNames());
set(handles.background_channel_menu, 'string', pipeline_data.points.labels());
set(handles.eval_channel_menu, 'string', pipeline_data.points.getBgRmText())
end
fix_menus_and_lists(handles);
load_background(handles);
function fix_handle(handle)
try
if isempty(get(handle, 'string'))
set(handle, 'string', {''});
set(handle, 'value', 1)
end
if ~isnumeric(get(handle, 'value'))
set(handle, 'value', 1)
end
catch
end
function fix_menus_and_lists(handles)
fix_handle(handles.selected_points_listbox);
fix_handle(handles.background_channel_menu);
fix_handle(handles.eval_point_menu);
fix_handle(handles.eval_channel_menu);
% --- Executes on button press in remove_point.
function remove_point_Callback(hObject, eventdata, handles)
global pipeline_data;
try
pointIndex = get(handles.selected_points_listbox, 'value');
pointList = get(handles.selected_points_listbox, 'string');
removedPoint = pointList{pointIndex};
if ~isempty(removedPoint)
pipeline_data.points.remove('name', removedPoint);
set(handles.selected_points_listbox, 'string', pipeline_data.points.getNames());
set(handles.eval_point_menu, 'string', pipeline_data.points.getNames());
set(handles.background_channel_menu, 'string', pipeline_data.points.labels());
set(handles.eval_channel_menu, 'string', pipeline_data.points.getBgRmText());
% we may not need this anymore, only used for displaying point
% identity?
if strcmp(removedPoint, pipeline_data.background_point)
set(handles.background_selection_indicator, 'string', '');
end
if pointIndex~=1
set(handles.selected_points_listbox, 'value', pointIndex-1);
else
set(handles.selected_points_listbox, 'value', 1);
end
end
catch
% probably no points loaded
end
fix_menus_and_lists(handles);
% --- Executes on selection change in selected_points_listbox.
function selected_points_listbox_Callback(hObject, eventdata, handles)
load_background(handles);
% --- Executes during object creation, after setting all properties.
function selected_points_listbox_CreateFcn(hObject, eventdata, handles)
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
set(hObject, 'string', {});
% --- Executes on selection change in background_channel_menu.
function background_channel_menu_Callback(hObject, eventdata, handles)
load_background(handles);
% --- Executes during object creation, after setting all properties.
function background_channel_menu_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function load_background(handles)
try
global pipeline_data;
contents = cellstr(get(handles.selected_points_listbox, 'string'));
point_index = get(handles.selected_points_listbox, 'value');
point_name = contents{point_index};
if ~isempty(point_name)
pipeline_data.background_point = point_name;
channel_index = get(handles.background_channel_menu, 'value');
contents = cellstr(get(handles.background_channel_menu, 'string'));
channel = contents{channel_index};
contents = cellstr(get(handles.background_channel_menu, 'string'));
pipeline_data.bgChannelInd = get(handles.background_channel_menu,'value');
pipeline_data.bgChannel = contents{pipeline_data.bgChannelInd};
pipeline_data.capBgChannel = str2double(get(handles.background_cap_display, 'string'));
nums = [32, 40, 9583, 176, 9633, 176, 41, 9583, 32, 32, 32];
% set(handles.background_selection_indicator, 'string', [point_filename, newline, char(nums), channel]);
set(handles.background_selection_indicator, 'string', [char(nums), channel]);
MIBIloadAndDisplayBackgroundChannel(get(handles.radiobutton1, 'value'))
end
catch err
% err
% warning('Failed to load point');
end
% Background Removal Parameters ===========================================
function gaussian_radius_bkg_Callback(hObject, eventdata, handles)
try
if isnan(str2double(get(hObject,'string')))
set(hObject, 'string', '0');
gui_warning('Value for Gaussian radius is not a number');
end
catch
gui_warning('Value for Gaussian radius is not a number');
end
% --- Executes during object creation, after setting all properties.
function gaussian_radius_bkg_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
global pipeline_data;
try
pipeline_data.gausRad = str2double(get(hObject,'string'));
catch
gui_warning('Value for Gaussian radius is not a number');
end
function threshold_bkg_Callback(hObject, eventdata, handles)
try
if isnan(str2double(get(hObject,'string')))
set(hObject, 'string', '0');
gui_warning('Value for Threshold is not a number');
end
catch
gui_warning('Value for Threshold is not a number');
end
% --- Executes during object creation, after setting all properties.
function threshold_bkg_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
global pipeline_data;
try
pipeline_data.t = str2double(get(hObject,'string'));
catch
gui_warning('Value for Threshold is not a number');
end
function rm_val_Callback(hObject, eventdata, handles)
try
if isnan(str2double(get(hObject,'string')))
set(hObject, 'string', '0');
gui_warning('Value for Removal Value is not a number');
else
global pipeline_data;
label_index = get(handles.eval_channel_menu, 'value');
if get(handles.rm_val_button, 'value')==1
pipeline_data.points.setBgRmParam(label_index, 'rm_value', str2double(get(hObject, 'string')));
elseif get(handles.rm_val_button, 'value')==0
all_labels = pipeline_data.points.labels();
for label_index=1:numel(all_labels)
pipeline_data.points.setBgRmParam(label_index, 'rm_value', str2double(get(hObject, 'string')));
end
end
set(handles.eval_channel_menu, 'string', pipeline_data.points.getBgRmText());
end
catch
gui_warning('Value for Removal Value is not a number');
end
fix_menus_and_lists(handles);
% --- Executes during object creation, after setting all properties.
function rm_val_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
global pipeline_data;
try
% pipeline_data.removeVal = str2double(get(hObject,'string'));
catch
gui_warning('Value for Removal Value is not a number');
end
function background_cap_display_Callback(hObject, eventdata, handles)
try
if isnan(str2double(get(hObject,'string')))
set(hObject, 'string', '0');
gui_warning('Value for Background Cap is not a number');
end
catch
gui_warning('Value for Background Cap is not a number');
end
% --- Executes during object creation, after setting all properties.
function background_cap_display_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
global pipeline_data;
try
pipeline_data.capBgChannel = str2double(get(hObject,'string'));
catch
gui_warning('Value for Background Cap is not a number');
end
function evaluation_cap_display_Callback(hObject, eventdata, handles)
try
if isnan(str2double(get(hObject,'string')))
set(hObject, 'string', '0');
gui_warning('Value for Evaluation Cap is not a number');
end
catch
gui_warning('Value for Evaluation Cap is not a number');
end
% --- Executes during object creation, after setting all properties.
function evaluation_cap_display_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
try
global pipeline_data;
pipeline_data.capEvalChannel = str2double(get(hObject,'string'));
catch
gui_warning('Value for Evaluation Cap is not a number');
end
function handle_background_and_evaluation_params(handles)
global pipeline_data;
gausRad = get(handles.gaussian_radius_bkg, 'string');
threshold = get(handles.threshold_bkg, 'string');
rm_val = get(handles.rm_val, 'string');
capBgChannel = get(handles.background_cap_display, 'string');
capEvalChannel = get(handles.evaluation_cap_display, 'string');
pipeline_data.gausRad = str2double(gausRad);
pipeline_data.t = str2double(threshold);
% pipeline_data.removeVal = str2double(rm_val);
pipeline_data.capEvalChannel = str2double(capEvalChannel);
pipeline_data.capBgChannel = str2double(capBgChannel);
pipeline_data.background_param_LISTstring = tabJoin({gausRad, threshold, capBgChannel}, 10);
pipeline_data.evaluation_param_LISTstring = tabJoin({rm_val, capEvalChannel}, 19);
pipeline_data.all_param_TITLEstring = [ '[ ', gausRad, ' : ', threshold, ' : ', capBgChannel, ' : ', rm_val, ' : ', capEvalChannel, ' ]'];
pipeline_data.all_param_DISPstring = [gausRad, newline, threshold, newline, capBgChannel, newline, capEvalChannel];
% --- Executes on button press in test.
function test_Callback(hObject, eventdata, handles)
% try
global pipeline_data;
point_index = get(handles.selected_points_listbox, 'value');
contents = cellstr(get(handles.selected_points_listbox, 'string'));
point_filename = contents{point_index};
pipeline_data.background_point = point_filename;
handle_background_and_evaluation_params(handles);
set(handles.figure1, 'pointer', 'watch')
drawnow
MIBItestBackgroundParameters_graded(get(handles.radiobutton2, 'value'));
set(handles.figure1, 'pointer', 'arrow')
% when we run test, we want to store the params we just used in bkg_rm_settings_listbox
% this means store gaussian_radius_bkg, threshold_bkg, rm_val, background_cap_display
% param_string = tabJoin({gausRad, threshold, rm_val, capBgChannel, capEvalChannel}, 6);
curList = get(handles.bkg_rm_settings_listbox, 'string');
set(handles.bkgrm_params_display, 'string', pipeline_data.all_param_DISPstring);
if numel(curList)==0 || ~strcmp(pipeline_data.background_param_LISTstring, curList{1})
curList(2:end+1) = curList(1:end);
curList{1} = pipeline_data.background_param_LISTstring;
set(handles.bkg_rm_settings_listbox, 'string', curList);
end
set(handles.remove_background, 'Enable', 'on');
% catch e
% disp(e);
% set(handles.figure1, 'pointer', 'arrow')
% gui_warning('No point selected');
% end
% --- Executes on selection change in bkg_rm_settings_listbox.
function bkg_rm_settings_listbox_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function bkg_rm_settings_listbox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
set(hObject, 'string', {});
% --- Executes on button press in reload_bkg_params.
function reload_bkg_params_Callback(hObject, eventdata, handles)
try
contents = cellstr(get(handles.bkg_rm_settings_listbox,'string'));
settings_index = get(handles.bkg_rm_settings_listbox,'value');
settings = str2double(tabSplit(contents{settings_index}));
gausRad = settings(1);
threshold = settings(2);
capBgChannel = settings(3);
set(handles.gaussian_radius_bkg, 'string', num2str(gausRad));
set(handles.threshold_bkg, 'string', num2str(threshold));
set(handles.background_cap_display, 'string', num2str(capBgChannel));
global pipeline_data;
pipeline_data.capBgChannel = capBgChannel;
pipeline_data.t = threshold;
pipeline_data.gausRad = gausRad;
catch
% do nothing
end
% --- Executes on button press in delete_bkg_setting.
function delete_bkg_setting_Callback(hObject, eventdata, handles)
try
index = get(handles.bkg_rm_settings_listbox,'value');
contents = cellstr(get(handles.bkg_rm_settings_listbox,'string'));
contents(index) = [];
set(handles.bkg_rm_settings_listbox, 'string', contents);
if (index~=1)
set(handles.bkg_rm_settings_listbox, 'value', index-1);
else
set(handles.bkg_rm_settings_listbox, 'value', 1);
end
catch
% uh oh
end
% Select Evaluation Channels ==============================================
% --- Executes on selection change in eval_channels_list.
function eval_channels_list_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function eval_channels_list_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
set(hObject, 'string', {});
% --- Executes on selection change in eval_point_menu.
function eval_point_menu_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function eval_point_menu_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in eval_channel_menu.
function eval_channel_menu_Callback(hObject, eventdata, handles)
global pipeline_data;
try
label_index = get(hObject, 'value');
rm_value = pipeline_data.points.getBgRmParam(label_index).rm_value;
set(handles.rm_val, 'string', num2str(rm_value));
end
% --- Executes during object creation, after setting all properties.
function eval_channel_menu_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in evaluate_point.
function evaluate_point_Callback(hObject, eventdata, handles)
% try
contents = cellstr(get(handles.eval_point_menu,'string'));
evalPoint = contents{get(handles.eval_point_menu,'value')};
contents = cellstr(get(handles.eval_channel_menu,'string'));
evalChannelInd = get(handles.eval_channel_menu,'value');
evalChannel = contents{evalChannelInd};
handle_background_and_evaluation_params(handles)
global pipeline_data;
pipeline_data.evalChannel = evalChannel;
pipeline_data.evalChannelInd = evalChannelInd;
set(handles.figure1, 'pointer', 'watch');
drawnow;
MIBIevaluateBackgroundParameters_graded({evalPoint});
set(handles.figure1, 'pointer', 'arrow');
curList = get(handles.eval_settings_listbox, 'string');
set(handles.bkgrm_params_display, 'string', pipeline_data.all_param_DISPstring);
if numel(curList)==0 || ~strcmp(pipeline_data.evaluation_param_LISTstring, curList{1})
curList(2:end+1) = curList(1:end);
curList{1} = pipeline_data.evaluation_param_LISTstring;
set(handles.eval_settings_listbox, 'string', curList);
end
set(handles.remove_background, 'Enable', 'on');
% catch err
% err
% set(handles.figure1, 'pointer', 'arrow');
% gui_warning('No point selected');
% end
% --- Executes on button press in evaluate_all_points.
function evaluate_all_points_Callback(hObject, eventdata, handles)
try
contents = cellstr(get(handles.eval_channel_menu,'string'));
evalPoints = cellstr(get(handles.eval_point_menu,'string'));
evalChannelInd = get(handles.eval_channel_menu,'value');
evalChannel = contents{evalChannelInd};
handle_background_and_evaluation_params(handles)
global pipeline_data;
pipeline_data.evalChannel = evalChannel;
pipeline_data.evalChannelInd = evalChannelInd;
set(handles.figure1, 'pointer', 'watch');
drawnow
MIBIevaluateBackgroundParameters_graded(evalPoints);
set(handles.figure1, 'pointer', 'arrow');
curList = get(handles.eval_settings_listbox, 'string');
set(handles.bkgrm_params_display, 'string', pipeline_data.all_param_DISPstring);
if numel(curList)==0 || ~strcmp(pipeline_data.evaluation_param_LISTstring, curList{1})
curList(2:end+1) = curList(1:end);
curList{1} = pipeline_data.evaluation_param_LISTstring;
set(handles.eval_settings_listbox, 'string', curList);
end
set(handles.remove_background, 'Enable', 'on');
catch
set(handles.figure1, 'pointer', 'arrow');
end
% --- Executes on button press in remove_background.
function remove_background_Callback(hObject, eventdata, handles)
set(handles.figure1, 'pointer', 'watch');
drawnow
global pipeline_data;
pipeline_data.points.save_no_background();
set(handles.figure1, 'pointer', 'arrow');
msg = {'+----------------------------------------------+',...
'| |',...
'| Done removing background |',...
'| |',...
'+----------------------------------------------+'};
m = gui_msgbox(msg);
% --- Executes on button press in load_params.
function load_params_Callback(hObject, eventdata, handles)
global pipeline_data;
handle_background_and_evaluation_params(handles);
set(handles.bkgrm_params_display, 'string', pipeline_data.all_param_DISPstring);
set(handles.remove_background, 'Enable', 'on');
% --- Executes on selection change in eval_settings_listbox.
function eval_settings_listbox_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function eval_settings_listbox_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in reload_eval_params.
function reload_eval_params_Callback(hObject, eventdata, handles)
try
contents = cellstr(get(handles.eval_settings_listbox, 'string'));
settings_index = get(handles.eval_settings_listbox, 'value');
settings = str2double(tabSplit(contents{settings_index}));
rm_val = settings(1);
capEvalChannel = settings(2);
set(handles.rm_val, 'string', num2str(rm_val));
set(handles.evaluation_cap_display, 'string', num2str(capEvalChannel));
global pipeline_data;
% pipeline_data.removeVal = rm_val;
pipeline_data.capEvalChannel = capEvalChannel;
catch e
disp(e);
end
% --- Executes on button press in delete_eval_setting.
function delete_eval_setting_Callback(hObject, eventdata, handles)
try
index = get(handles.eval_settings_listbox,'value');
contents = cellstr(get(handles.eval_settings_listbox,'string'));
contents(index) = [];
set(handles.eval_settings_listbox, 'string', contents);
if (index~=1)
set(handles.eval_settings_listbox, 'value', index-1);
else
set(handles.eval_settings_listbox, 'value', 1);
end
catch
% uh oh
end
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% --- Executes on button press in rm_val_button.
function rm_val_button_Callback(hObject, eventdata, handles)
% hObject handle to rm_val_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of rm_val_button
if get(hObject, 'value')==1
set(hObject, 'string', 'Remove value')
elseif get(hObject, 'value')==0
set(hObject, 'string', 'Remove values')
end
function setUIFontSize(handles, fontSize)
fields = fieldnames(handles);
for i=1:numel(fields)
ui_element_name = fields{i};
ui_element = getfield(handles, ui_element_name);
try
ui_element.FontSize = fontSize;
catch
% probably no FontSize field to modify
end
end
function offset_Callback(hObject, eventdata, handles)
% hObject handle to offset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of offset as text
% str2double(get(hObject,'String')) returns contents of offset as a double
global pipeline_data;
curr_string = get(hObject, 'string');
curr_string = strrep(curr_string, ' ', '');
vals = strsplit(curr_string, ',');
if numel(vals)==2
i_offset = str2double(vals{1});
j_offset = str2double(vals{2});
if ~(isnan(i_offset) || isnan(j_offset))
pipeline_data.points.offset = [i_offset, j_offset];
else
set(hObject, 'string', '0,0');
end
else
set(hObject, 'string', '0,0');
end
% --- Executes during object creation, after setting all properties.
function offset_CreateFcn(hObject, eventdata, handles)
% hObject handle to offset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end