-
Notifications
You must be signed in to change notification settings - Fork 1
/
eeg_tf.m
735 lines (665 loc) · 21.8 KB
/
eeg_tf.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
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
function eeg_tf(varargin)
% EEG_TF - Time-Frequency Analysis, the Graphical User Interface
%
% EEG_TF() generates graphical user interface for performing
% time-frequency analysis of EEG or any 3D signals. No arguments are
% necessary in the function call.
%
% Optional arguments can be given in the form:
% EEG_TF(data, fs, time) where
% - data: 3D or 2D signal with dimentions [channels, time, trials], the
% last dimention can be omitted if data is not epoched
% - fs: sampling frequency in Hz, e.g. 128 Hz
% - time: start and end times in seconds, e.g. [-0.5, 1] sec, or full
% time vector in seconds
%
% The Matlab package is developped by Alina Beliakova (CRNS, France) in 2021.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Global values
% Handle to this main figure
global hf_MAIN;
% Check to see if GUI is already running and clear variables, otherwise
% variables and handles can get mixed up.
if ~isempty(hf_MAIN)
clearvars
end
% Handles to other controls in this main window
global ht_errorStatus
global ht_loadStatus
global ht_channelsStatus
global ht_samplesStatus
global ht_timerangeStatus
global ht_samplingrateStatus
global ht_weightsStatus
global hcm_electrode_space
global ht_eventsStatus
global hpm_individual
global hpm_compare
global he_chanOI
global he_freqOI
global he_timeOI
global hpm_method
global hcm_dB
global he_baseline
global he_timeLM
global he_freqLM
% Global variables to store all the values
global g_EEG_dataset
global g_params
% Initialize the global variables
% if the data is passed from the workspace, fill the dataset structure
if exist('varargin','var') && length(varargin) == 3
data = varargin{1};
fs = varargin{2};
time = varargin{3};
g_EEG_dataset.filenames = '-';
g_EEG_dataset.pathname = '-';
g_EEG_dataset.nb_files = 1;
g_EEG_dataset.EEG = [];
g_EEG_dataset.time = [time(1), time(end)];
g_EEG_dataset.fs = fs;
g_EEG_dataset.events = [];
g_EEG_dataset.data = data;
g_EEG_dataset.w = ones(size(data,1));
clear data fs times
else
g_EEG_dataset = [];
end
g_params.eventsOI = [];
g_params.individual = 1;
g_params.compare = 2;
g_params.chanOI = 1;
g_params.freqOI = 1:45;
g_params.timeOI = [0, 500];
g_params.method = 1;
g_params.dB = 1;
g_params.baseline = [-400, -200];
% g_params.accelerate = 1;
g_params.time_landmarks = 0;
g_params.freq_landmarks = [9,13,19,30,44];
% advanced setting for the tf transform
g_params.advanced_settings.stft.default = 1;
g_params.advanced_settings.stft.windowing = [];
g_params.advanced_settings.stft.window_length = [];
g_params.advanced_settings.stft.step = [];
g_params.advanced_settings.stft.previous_settings = [];
g_params.advanced_settings.wavelets.default = 1;
g_params.advanced_settings.wavelets.correct_nl = 1;
g_params.advanced_settings.wavelets.nb_cycles = [];
g_params.advanced_settings.wavelets.log = [];
g_params.advanced_settings.wavelets.previous_settings = [];
g_figures.open_figures = findobj(allchild(0), 'flat', 'Type', 'figure');
% These are regarded as constants and are used to store
% the strings for the popup menus the current value is
% seen in the variables above
% D - refers to strings that are displayed
% V - refers to string values that are used in FPICA
global c_Individual_strD
global c_Individual_strV
global c_Compare_strD
global c_Compare_strV
global c_Method_strD
global c_Method_strV
global c_dB_strD
global c_dB_strV
% All the values for these are set here - even for
% variables that are not used in this file
c_Individual_strD = 'Individual|Group';
c_Individual_strV = {'ind'; 'group'};
c_Compare_strD = 'Compare|Merge';
c_Compare_strV = {'compare'; 'merge'};
c_Method_strD = 'STFT|Wavelets';
c_Method_strV = {'stft'; 'wavelets'};
c_dB_strD = 'dB|Raw';
c_dB_strV = {'db'; 'raw'};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Configuration options
win_width = 600;
win_height = 780;
FIGURENAME = 'EEG_TF';
FIGURETAG = 'f_EEG_TF';
SCREENSIZE = get(0,'ScreenSize');
FIGURESIZE = [round(0.5*SCREENSIZE(3)) (SCREENSIZE(4)-round(0.1*SCREENSIZE(4))-win_height) win_width win_height];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create the figure
a = figure('Color',[0.95 0.95 0.95], ...
'PaperType','a4letter', ...
'Name', FIGURENAME, ...
'NumberTitle', 'off', ...
'Tag', FIGURETAG, ...
'Position', FIGURESIZE, ...
'MenuBar', 'none');
% Resizing has to be denied after the window has been created -
% otherwise the window shows only as a tiny window in Windows XP.
set (a, 'Resize', 'off');
hf_MAIN = a;
set(hf_MAIN, 'HandleVisibility', 'callback');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create the frames
% pos_l=2;
% pos_w=FIGURESIZE(3)-4;
% pos_h=FIGURESIZE(4)-4;
% pos_t=FIGURESIZE(4)-2-pos_h;
% h_f_background = uicontrol('Parent',a, ...
% 'BackgroundColor',[0.8 0.9 0.9], ...
% 'Position',[pos_l pos_t pos_w pos_h], ...
% 'Style','frame', ...
% 'Tag','f_background');
margin = 4;
pos_l = margin;
pos_w = 2*win_width/3;
pos_h = 220;
pos_t=FIGURESIZE(4)-margin-pos_h;
h_f_data = uicontrol('Parent',a, ...
'BackgroundColor',[0.7 0.8 0.8], ...
'Position',[pos_l pos_t pos_w pos_h], ...
'Style','frame');
pos_h=pos_t - margin - margin/2;
pos_t=4;
h_f_params = uicontrol('Parent',a, ...
'BackgroundColor',[0.7 0.8 0.8], ...
'Position',[pos_l pos_t pos_w pos_h], ...
'Style','frame');
pos_l = pos_l + pos_w + margin/2;
pos_w = win_width/3-8;
pos_h = FIGURESIZE(4)-2*margin;
pos_t = FIGURESIZE(4)-margin-pos_h;
h_f_side = uicontrol('Parent',a, ...
'BackgroundColor',[0.6 0.7 0.7], ...
'Position',[pos_l pos_t pos_w pos_h], ...
'Style','frame');
%----------------------------------------------------------
bgc = get(h_f_data, 'BackgroundColor');
pos_frame = get(h_f_data, 'Position');
% Controls in f_data
pos_h = 20;
pos_w = 200;
pos_l = pos_frame(1) + 6;
pos_t = pos_frame(2) + pos_frame(4) - pos_h - 6;
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','EEG data', ...
'FontSize', 10, 'FontWeight', 'bold', ...
'Style','text');
pos_l = pos_l + pos_w;
pos_w = 100;
ht_loadStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Not loaded yet', ...
'FontSize', 10,...
'Style','text');
% info about the data
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Number of channels:', ...
'FontSize', 10,...
'Style','text');
pos_l = pos_l + pos_w;
pos_w = 100;
ht_channelsStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','-', ...
'FontSize', 10,...
'Style','text');
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Number of time points:', ...
'FontSize', 10,...
'Style','text');
pos_l = pos_l + pos_w;
pos_w = 100;
ht_samplesStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','-', ...
'FontSize', 10,...
'Style','text');
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Time range:', ...
'FontSize', 10,...
'Style','text');
pos_l = pos_l + pos_w;
pos_w = 100;
ht_timerangeStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','-', ...
'FontSize', 10,...
'Style','text');
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Sampling rate:', ...
'FontSize', 10,...
'Style','text');
pos_l = pos_l + pos_w;
pos_w = 100;
ht_samplingrateStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','-', ...
'FontSize', 10,...
'Style','text');
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','BSS/gBSS weights:', ...
'FontSize', 10,...
'Style','text');
pos_l = pos_l + pos_w;
pos_w = 100;
ht_weightsStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Not loaded yet', ...
'FontSize', 10,...
'Style','text');
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Keep electrode space:', ...
'Style','text', ...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
hcm_electrode_space = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'Callback','gui_callback KeepElectrodes', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'Style','checkbox', ...
'FontSize', 10, ...
'Value',0);
%-------------------------------------------------
% Controls in f_params
% title
pos_frame=get(h_f_params, 'Position');
pos_l = pos_frame(1) + 6;
pos_h = 20;
pos_t = pos_frame(2) + pos_frame(4) - pos_h - 6;
pos_w = 200;
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Parameters of the analysis', ...
'FontWeight', 'bold', ...
'Style','text', ...
'FontSize', 10);
% which conditions
pos_l = pos_frame(1) + 6;
pos_t = pos_t - 10 - pos_h;
pos_w = 150;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback ChooseEvents', ...
'Interruptible', 'off', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'FontSize', 10,...
'String','Choose events',...
'Tag', 't_choose_events');
pos_l = pos_l + 200;
pos_w = 190;
ht_eventsStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Conditions are not chosen yet', ...
'FontSize', 10,...
'Style','text');
% merge or compare
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Merge or compare conditions:', ...
'Style','text', ...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
hpm_compare = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeCompare', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String',c_Compare_strD, ...
'Style','popupmenu', ...
'FontSize', 10, ...
'Value',g_params.compare,...
'Tag', 't_compare');
% ind or group
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Individual or group:', ...
'Style','text', ...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
hpm_individual = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeIndividual', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String',c_Individual_strD, ...
'Style','popupmenu', ...
'FontSize', 10, ...
'Value',g_params.individual,...
'Tag', 't_individual');
% which channels
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Which channels to include:', ...
'TooltipString', 'Acceptable format is 1,2,3,.. or 1:3', ...
'FontSize', 10,...
'Style','text');
pos_l = pos_l + 200;
pos_w = 100;
he_chanOI = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeChanOI', ...
'HorizontalAlignment','right', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','1', ...
'FontSize', 10,...
'Style','edit');
% which frequencies
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Frequncy range of interest:', ...
'FontSize', 10,...
'TooltipString', 'Acceptable format is 1:45', ...
'Style','text');
pos_l = pos_l + 200;
pos_w = 100;
he_freqOI = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeFreqOI', ...
'HorizontalAlignment','right', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','1:45', ...
'Style','edit', ...
'FontSize', 10);
% which time range
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Time range of interest, ms:', ...
'FontSize', 10,...
'TooltipString', 'Acceptable format is 0:500', ...
'Style','text');
pos_l = pos_l + 200;
pos_w = 100;
he_timeOI = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeTimeOI', ...
'HorizontalAlignment','right', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','0:500', ...
'Style','edit', ...
'FontSize', 10);
%--------------------------------
% Spectral analysis parameters
pos_l = pos_frame(1) + 6;
pos_t = pos_t - 15 - pos_h;
pos_w = 300;
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Parameters of the spectral decomposition', ...
'FontWeight', 'bold', ...
'Style','text', ...
'FontSize', 10);
% which transform
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Short-Time FT or Wavelets:', ...
'Style','text', ...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
hpm_method = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeMethod', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String',c_Method_strD, ...
'Style','popupmenu', ...
'FontSize', 10, ...
'Value',g_params.method);
% dB or raw
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Tansform data in dB:', ...
'Style','text', ...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
hcm_dB = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'Callback','gui_callback ChangedB', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'Style','checkbox', ...
'FontSize', 10, ...
'Value',g_params.dB);
% baseline
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h*2, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h*2], ...
'String','Baseline for dB convertion in ms:', ...
'TooltipString', 'Acceptable format is -400:-200', ...
'Style','text', ...
'FontSize', 10,...
'Tag', 't_baseline');
pos_l = pos_l + 200;
pos_w = 100;
pos_t = pos_t + pos_h;
he_baseline = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChangeBaseline', ...
'HorizontalAlignment','right', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','-400:-200', ...
'Style','edit', ...
'FontSize', 10);
pos_l = pos_frame(1) + 6;
pos_t = pos_t - 10 - pos_h;
pos_w = 150;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback AdvancedSettings', ...
'Interruptible', 'off', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'FontSize', 10,...
'String','Advanced settings');
%--------------------------------
% Plotting parameters
pos_l = pos_frame(1) + 6;
pos_t = pos_t - 15 - pos_h;
pos_w = 300;
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Parameters of the plot(s)', ...
'FontWeight', 'bold', ...
'Style','text', ...
'FontSize', 10);
% time landmarks
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h*2, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h*2], ...
'String','Plot landmarks on the time axis at ... ms:', ...
'TooltipString', 'Acceptable format is 0,200,...', ...
'Style','text',...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
pos_t = pos_t + pos_h;
he_timeLM = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChooseTimeLM', ...
'HorizontalAlignment','right', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','0', ...
'Style','edit', ...
'FontSize', 10);
% frequency landmarks
[pos_l, pos_t, pos_w] = set_position(pos_t, pos_h*3, pos_frame);
b = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Position',[pos_l pos_t pos_w pos_h*2], ...
'String','Plot landmarks on the frequency axis at ... Hz:', ...
'TooltipString', 'Acceptable format is 7,13,19,...', ...
'Style','text',...
'FontSize', 10);
pos_l = pos_l + 200;
pos_w = 100;
pos_t = pos_t + pos_h;
he_freqLM = uicontrol('Parent',a, ...
'BackgroundColor',[1 1 1], ...
'Callback','gui_callback ChooseFreqLM', ...
'HorizontalAlignment','right', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','7,13,19,30,44', ...
'Style','edit', ...
'FontSize', 10);
% Error and warning line
pos_l = pos_frame(1) + 6;
pos_t = pos_frame(2) + 6;
pos_h = 30;
pos_w = 350;
ht_errorStatus = uicontrol('Parent',a, ...
'BackgroundColor',bgc, ...
'HorizontalAlignment','left', ...
'Callback','gui_callback Error', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','', ...
'ForegroundColor', [1 1 1],...
'FontWeight', 'bold', ...
'Style','text',...
'FontSize', 10);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Controls in f_side
pos_vspace = 6;
pos_hspace = 22;
pos_temp=get(h_f_side, 'Position');
pos_l=pos_temp(1)+pos_hspace;
pos_w=150;
pos_h=30;
pos_t=pos_temp(2)+pos_temp(4)-pos_vspace-pos_h;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback LoadData', ...
'Interruptible', 'off', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Load *.set data',...
'FontWeight', 'bold','FontSize', 10);
pos_t=pos_t-pos_h-pos_vspace;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback LoadWeights', ...
'Interruptible', 'off', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Load BSS/gBSS weights',...
'FontSize', 10);
pos_t=pos_t-pos_h-pos_vspace;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback PlotSpectra', ...
'Interruptible', 'off', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Plot spectrogram(s)',...
'FontWeight', 'bold','FontSize', 10);
pos_t=pos_t-pos_h-pos_vspace;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback SaveImage', ...
'Interruptible', 'off', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Save images',...
'FontSize', 10);
pos_t=pos_t-pos_h-pos_vspace;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback Quit', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Quit',...
'FontSize', 10);
% pos_t=pos_t-pos_h-pos_vspace;
% b = uicontrol('Parent',a, ...
% 'BackgroundColor',[0.9 0.9 0.9], ...
% 'Callback','gui_callback Interrupt', ...
% 'Position',[pos_l pos_t pos_w pos_h], ...
% 'String','Interrupt', ...
% 'Visible','off');
pos_t = pos_frame(2) + pos_vspace + pos_h + pos_vspace;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback About', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','About...', ...
'FontSize', 10);
pos_t = pos_frame(2) + pos_vspace;
b = uicontrol('Parent',a, ...
'BackgroundColor',[0.9 0.9 0.9], ...
'Callback','gui_callback Help', ...
'Position',[pos_l pos_t pos_w pos_h], ...
'String','Help', ...
'FontSize', 10);
%--------------------------------------------
% Do rest of the initialization...
gui_callback InitAll;
gui_callback_advanced InitAll;
function [pos_l, pos_t, pos_w] = set_position(pos_t, pos_h, pos_frame)
pos_w = 200;
pos_l = pos_frame(1) + 6;
pos_t = pos_t - 10 - pos_h;
end
end