-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMITT.m
1259 lines (1204 loc) · 49 KB
/
MITT.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
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function MITT
% Opens the launch window
% Called from command line
% Calls OrganizeInput, CleanSeries, ClassifyArrayGUI, ClassifyArrayAuto
% modifications May 2016 by BM
% add buttons for SpikeARMA and setARMAopts to allow despiking by this method
% don't turn off Run button if any of three boxes in Computational Block Control are active
% more commenting
% create launch GUI figure
[pltLaunch,axe] = CreatepltLaunch;
% create uicontrol buttons in pltLaunch
B = makeLaunchButtons(pltLaunch,axe);
% initialize buttons
set(B.GUIControl.IsUniform,'Visible','off');
set(B.P.SamplingLocations,'Visible','off');
set(B.P.Uniform,'Visible','off');
set(B.P.NonUniform,'Visible','off');
set(B.P.Organize,'Visible','off');
set(B.P.SpikeOptions,'Visible','off');
set(B.P.FilterOptions,'Visible','off');
set(B.P.Clean,'Visible','off');
set(B.P.Classify,'Visible','off');
set(B.P.Select,'Visible','off');
set(B.P.run,'Enable','off');
% set callback functions for the different uicontrol buttons
% set the CSVcontrol file names
set(B.P.getfile,'Callback',@hgetfileCallback);
% Computational block control callbacks
set(B.GUIControl.Organize,'Callback',@hOrganizeCallback);
set(B.GUIControl.Clean,'Callback',@hCleanCallback);
set(B.GUIControl.Classify,'Callback',@hClassifyCallback);
% Organization block callbacks
set(B.GUIControl.DefineGeometry,'Callback',@hDefineGeometryCallback);
set(B.GUIControl.Sampling,'Callback',@hSamplingCallback);
set(B.GUIControl.getCalcChannelfile,'Callback',@hgetCalcChannelfileCallback);
set(B.GUIControl.IsUniform,'Callback',@hIsUniformCallback);
set(B.GUIControl.Length,'Callback',@hLengthCallback);
set(B.GUIControl.Width,'Callback',@hWidthCallback);
set(B.GUIControl.Depth,'Callback',@hDepthCallback);
set(B.GUIControl.getCalcXYZfile,'Callback',@hgetCalcXYZfileCallback);
% Clean block callbacks
set(B.GUIControl.Despike,'Callback',@hDespikeCallback);
set(B.GUIControl.Preprocess,'Callback',@hPreprocessCallback);
set(B.GUIControl.SpikeARMA,'Callback',@hSpikeARMACallback);
set(B.P.ARMAopts,'Callback',@hARMAoptsCallback);
set(B.GUIControl.FiltrBW,'Callback',@hFiltrBWCallback);
% Run button callback
set(B.P.run,'Callback',@hrunCallback);
%% Callback functions
%% File and Message Center
% to get CSVControl file through a gui window
function hgetfileCallback(~, ~, ~)
% get the name and path of file
[CSVControlfilename, CSVControlpathname] = uigetfile({'*.csv';'*.txt'},'Get control text file');
% set field values equal to name and path of file
set(B.GUIControl.CSVControlpathname,'String',CSVControlpathname);
set(B.GUIControl.CSVControlfilename,'String',CSVControlfilename);
% set and create output directory (odir)
odir = [CSVControlpathname,'MITT'];
% check for existance of odir
chk1 = dir(odir);
% if odir does not exist
if isempty(chk1)
% make it
mkdir(odir);
end
% save odir to pltLaunch
setappdata(pltLaunch.id,'odir',odir)
% change message
set(B.P.message,'String','New file selected')
% turn on Select button
set(B.P.Select,'Visible','on');
end
%% Computation block control
% to turn on/off Organization block
function hOrganizeCallback(~, ~, ~)
% get values of buttons on computational block
yOrg = get(B.GUIControl.Organize,'Value');
yClean = get(B.GUIControl.Clean,'Value');
yClassify = get(B.GUIControl.Classify,'Value');
% if organization block is on
if yOrg
% make the panel visible
set(B.P.Organize,'Visible','on');
% turn Run button on
set(B.P.run,'Enable','on');
% change message
set(B.P.message,'String','Select Organization Options')
else
% make the panel invisible
set(B.P.Organize,'Visible','off');
% change message
set(B.P.message,'String','')
% if no block is active
if ~(yClean||yClassify)
% turn Run button off
set(B.P.run,'Enable','off');
end
end
end
% to turn on/off Clean block
function hCleanCallback(~, ~, ~)
% get values of buttons on computational block
yOrg = get(B.GUIControl.Organize,'Value');
yClean = get(B.GUIControl.Clean,'Value');
yClassify = get(B.GUIControl.Classify,'Value');
if yClean
% make the panel visible
set(B.P.Clean,'Visible','on');
% turn Run button on
set(B.P.run,'Enable','on');
% change message
set(B.P.message,'String','Select Cleaning Options')
else
% make the panel invisible
set(B.P.Clean,'Visible','off');
% change message
set(B.P.message,'String','')
% if no block is active
if ~(yOrg||yClassify)
% turn Run button off
set(B.P.run,'Enable','off');
end
end
end
% to turn on/off Classify block
function hClassifyCallback(~, ~, ~)
% get values of buttons on computational block
yOrg = get(B.GUIControl.Organize,'Value');
yClean = get(B.GUIControl.Clean,'Value');
yClassify = get(B.GUIControl.Classify,'Value');
if yClassify
% load default cell quality parameters
faQCdefault = DefaultfaQC; % DefaultfaQC is a separate m file that is used only to load default values
% set default values
B.faQC = subSetValues(B.faQC,faQCdefault);
% make the panel visible
set(B.P.Classify,'Visible','on');
% turn Run button on
set(B.P.run,'Enable','on');
% change message
set(B.P.message,'String','Select Classification Options')
else
% make the panel invisible
set(B.P.Classify,'Visible','off');
% change message
set(B.P.message,'String','');
% if no block is active
if ~(yClean||yOrg)
set(B.P.run,'Enable','off'); % turn Run button off
end
end
end
%% Organization Control Panel
% to control whether geometry is defined as part of organization or not
function hDefineGeometryCallback(~, ~, ~)
% get checkmark value
DG = get(B.GUIControl.DefineGeometry,'Value');
% if it is checked
if DG == 1
% enable uniform/nonuniform channel panel
set(B.GUIControl.IsUniform,'Visible','on');
set(B.P.run,'Enable','off');% turn Run button off
% if it is unchecked
else
% turn off panels
set(B.GUIControl.IsUniform,'Visible','off');
set(B.P.Uniform,'Visible','off');
set(B.P.NonUniform,'Visible','off');
set(B.P.run,'Enable','on');% turn Run button on
end
end
% to control how sampling locations are entered
function hSamplingCallback(~, ~, ~)
Sampling = get(B.GUIControl.Sampling,'Value');
% if custom subprogram is to be used
if Sampling == 1
% enable window for this purpose
set(B.P.SamplingLocations,'Visible','on');
set(B.P.run,'Enable','off');% turn Run button off
% elseif a subprogram is called to calculate xpos, ypos and zpos
else
% disable window
set(B.P.SamplingLocations,'Visible','off');
set(B.P.run,'Enable','on');% turn Run button on
end
end
% to identify whether a uniform or non-uniform channel was used
function hIsUniformCallback(~, ~, ~)
% get checkmark value
IsUni = get(B.GUIControl.IsUniform,'Value');
% if checked (i.e. uniform channel)
if IsUni == 1
% turn off nonuniform panel
set(B.P.NonUniform,'Visible','off');
% turn on uniform panel
set(B.P.Uniform,'Visible','on');
set(B.P.run,'Enable','on');% turn Run button on
% else if unchecked (i.e. non-uniform)
else
% turn off uniform panel
set(B.P.Uniform,'Visible','off');
% turn on nonuniform panel
set(B.P.NonUniform,'Visible','on');
set(B.P.run,'Enable','off');% turn Run button off
end
end
% to get a *.csv file of scattered channel geometry or an *.m file that
% calculates the geometry
function hgetCalcChannelfileCallback(~, ~, ~)
% get value of listbox
Channel = get(B.GUIControl.Channel,'Value');
if Channel == 1 % csv file
% get channel and path name
[channelname, channelpathname] = uigetfile({'*.csv';'*.txt'},'Get channel geometry *.csv file');
elseif Channel == 2 %m file
% get channel and path name
[channelname, channelpathname] = uigetfile('*.m','Get channel geometry subprogram');
end
% set channel and path name values to edit fields
set(B.GUIControl.CalcChannelpathname,'String',channelpathname);
set(B.GUIControl.CalcChannelfile,'String',channelname);
end
% to get an *.m program that calculates the sampling locations
function hgetCalcXYZfileCallback(~, ~, ~)
% get the name and path of file
[xyzname, xyzpathname] = uigetfile({'*.m'},'Get sampling locations subprogram');
% set field values equal to the name and path
set(B.GUIControl.CalcXYZpathname,'String',xyzpathname);
set(B.GUIControl.CalcXYZfile,'String',xyzname);
% turn on Run button
set(B.P.run,'Enable','on');
end
% set of fields that gets data about channel geometry
% to get the length of the test section
function hLengthCallback(~, ~, ~)
% get length (in m)
L = str2num(get(B.GUIControl.Length,'String'));
% calculate and set default grid spacing (in m)
l = L/100;
set(B.GUIControl.Lengthgrid,'String',num2str(l));
end
% to get the width of the test section
function hWidthCallback(~, ~, ~)
% get width (in m)
BB = str2num(get(B.GUIControl.Width,'String'));
% calculate and set default grid spacing (in m)
b = BB/100;
set(B.GUIControl.Widthgrid,'String',num2str(b));
end
% to get the depth of the test section
function hDepthCallback(~, ~, ~)
% get depth (in m)
H = str2num(get(B.GUIControl.Depth,'String'));
% calculate and set default grid spacing (in m)
h = H/100;
set(B.GUIControl.Depthgrid,'String',num2str(h));
end
%% Clean block Control Panel
% to ask if despiking will be done
function hDespikeCallback(~, ~, ~)
% get checkmark value
DG = get(B.GUIControl.Despike,'Value');
% if checked
if DG == 1
%enable spike options popup
set(B.P.SpikeOptions,'Visible','on');
% if unchecked
else
% disable spike options popup
set(B.P.SpikeOptions,'Visible','off');
end
end
% to control how preprocessing
function hPreprocessCallback(~, ~, ~)
Preprocess = get(B.GUIControl.Preprocess,'Value');
% if custom subprogram is to be used
if Preprocess == 3
% enable window for this purpose
set(B.GUIControl.HighPassTime,'Visible','on');
set(B.P.HighPasstext,'Visible','on');
% elseif a subprogram is called to calculate xpos, ypos and zpos
else
% disable window
set(B.GUIControl.HighPassTime,'Visible','off');
set(B.P.HighPasstext,'Visible','off');
end
end
% to ask if SpikeARMA will be run
function hSpikeARMACallback(~, ~, ~)
% get check mark value
DG = get(B.GUIControl.SpikeARMA,'Value');
% if checked
if DG == 1
% enable ARMAopts pushbutton
set(B.P.ARMAopts,'Enable','on');
% get attached ARMAopts info from the pltLaunch figure
ARMAopts = getappdata(pltLaunch.id,'ARMAopts');
% if there is no attached variable called ARMAopts
if isempty(ARMAopts)
% don't allow the run button to be pushed (would cause an
% error to try to run without ARMAopts
set(B.P.run,'Enable','off');
end
% else unchecked
else
% turn off the setARMAopts button
set(B.P.ARMAopts,'Enable','off');
% turn on the Run button
set(B.P.run,'Enable','on');
end
end
% to run setARMAopts when the ARMAopts button is pushed
function hARMAoptsCallback(~, ~, ~)
% get the ARMAopts data from the figure (can be empty if
% setARMAopts has not been run previously)
ARMAopts = getappdata(pltLaunch.id,'ARMAopts');
% run the setARMAopts sub function
setARMAopts(ARMAopts,pltLaunch);
% turn on the Run button
set(B.P.run,'Enable','on');
end
% to ask if filtering will be done
function hFiltrBWCallback(~, ~, ~)
% get check mark value
DG = get(B.GUIControl.FiltrBW,'Value');
% if checked
if DG == 1
% enable filter options popup
set(B.P.FilterOptions,'Visible','on');
% if unchecked
else
% disable filter options popup
set(B.P.FilterOptions,'Visible','off');
end
end
%% Run
% when Run button is pushed
function hrunCallback(~, ~, ~)
%get GUIControl parameters from buttons (B.GUIControl)
GUIControl = subGetValues(B.GUIControl,[]);
% get output directory
GUIControl.odir = getappdata(pltLaunch.id,'odir');
% set output filename
GUIControl.outname = [GUIControl.odir,filesep,GUIControl.CSVControlfilename(1:end-4),'_output.mat']; % output file name
% if SpikeARMA is active
if GUIControl.SpikeARMA
% get ARMAopts from figure
GUIControl.ARMAopts = getappdata(pltLaunch.id,'ARMAopts');
end
% Organize data into Config and Data matrices and save one file for each set of simultaneous data
if GUIControl.Organize
% change message
set(B.P.message,'String','Organizing data')
% pause to allow message change
pause(1)
% send to OrganizeInput subprogram
OrganizeInput(GUIControl);
% change message
set(B.P.message,'String','Finished')
end
% files stored in MITTdir
GUIControl.MITTdir = dir([GUIControl.odir,filesep,'*na*.mat']);
% Clean data using the analysis activated in the C structure
if GUIControl.Clean
% change message
set(B.P.message,'String','Cleaning data')
% pause to allow message change
pause(1)
% send to CleanSeries subprogram
CleanSeries(GUIControl)
% change message
set(B.P.message,'String','Finished')
end
if GUIControl.Classify
% get field names (including subFieldnames using subprogram)
GUIControl.faQC = subGetValues(B.faQC,[]);
% if interactive analysis is selected
if GUIControl.plotArray
% change message
set(B.P.message,'String','Interactive analysis GUI is running')
% pause to allow message change
pause(1)
% send to ClassifyArrayGUI subprogram
ClassifyArrayGUI(GUIControl,[])
% automatic analysis
else
% change message
set(B.P.message,'String','Running automatic quality control analysis')
% pause to allow message change
pause(1)
% send to ClassifyArrayAuto subprogram
ClassifyArrayAuto(GUIControl)
% change message
set(B.P.message,'String','Finished')
end
end
end
end
%%%%%
function [pltLaunch,axe] = CreatepltLaunch
% to create the pltLaunch (initial MITT screen) Figure
% this subprogram only includes the figures and axes, not the buttons
% set figure properties
pltLaunch.id = figure;
% size of figure
pltLaunch.x = 27;
pltLaunch.y = 17;
pltLaunch.nxtot = 3; % number of axes in x direction (equivalent to columns in pltLaunch
pltLaunch.col = ([255 130 0])/255; % color
axe.xi = 1.1; % initial x position
axe.yi = 0.6; % initial y position
axe.scale = 8; % multiplier for axes
axe.x = 1*axe.scale; % size of x axis
axe.space = .4; % space between axes
axe.xin = axe.xi+(0:pltLaunch.nxtot-1)*(axe.x+axe.space); % x positions of axes
axe.yin = axe.yi; % y position of axes
% set figure properties
set(pltLaunch.id,...
'Name','Launch MITT Interactive',...
'Units','centimeters',...
'InvertHardcopy','off',...
'Color',pltLaunch.col,...
'Position',[axe.xi axe.yi pltLaunch.x pltLaunch.y],...
'PaperPositionMode','auto');
end
%%%%%
function B = makeLaunchButtons(pltLaunch,axe)
% to create buttons & fields on input control figure
% set colors for figure
backcol = [220 220 220]/255; % used on level 1 boxes
backcol2 = [190 255 255]/255; % used on axes boxes
% set standard button properties
btn.height = 0.7; % standard button height
btn.width = axe.x/3;
Fsize = 9;
% set panel sizes and location
% order
pan.order = [1 2 3 4 5 6];
% column
pan.col = [1 1 1 1 2 3];
% number of rows in each panel
pan.row = [1 3 3 11 19.5 18];
% space between panels
pan.space = 0.2;
% find panel columns
colmem = unique(pan.col);
% number of columns
ncoltot = length(colmem);
% height
pan.height = (pan.row+1)*btn.height;
% empty matrix for y position of panels
pan.yo = zeros(1,length(pan.order));
% for each panel column
for ncol = 1:ncoltot
% find which panels are in active column
colmemi = find(pan.col == ncol);
% find how many are in the column
nmemtot = length(colmemi);
% if there are more than one
if nmemtot>1
% sort them
[~,idx] = sort(pan.order(colmemi),'descend');
% create spacing
space= ones(1,nmemtot-1)*pan.space;
% find y positions
pan.yo(colmemi(idx(2:end))) = cumsum(pan.height(colmemi(idx(1:end-1)))+space);
end
% if this is the last column
if ncol == ncoltot
% add height to last column for 'run' button
pan.yo(colmemi) = pan.yo(colmemi)+1;
end
end
pannum = 1;
%%%%% Title block
figtitle = uicontrol('Style','text',...
'Units','centimeters',...
'FontSize',32,...
'FontName','Calibri',...
'ForegroundColor','b',...
'Position',[axe.xin(1),axe.yi+pan.yo(pannum),axe.x+0.1,pan.height(pannum)],...
'String','MITT');
pannum = 2;
%%%%% File and Message Center
% ui panel listing all filter array options and parameters
B.P.File = uipanel(pltLaunch.id,'Title','File and message center',...
'Units','centimeters',...
'FontSize',Fsize,...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[axe.xin(1),axe.yi+pan.yo(pannum),axe.x+0.1,pan.height(pannum)]);
% file selection pushbutton
btn.num = pan.row(pannum)-1;
B.P.getfile = uicontrol('Style','pushbutton',...
'Parent',B.P.File,...
'Units','centimeters',...
'Position',[0 btn.num*btn.height btn.width btn.height],...
'FontSize',Fsize,...
'BackgroundColor','w',...
'String','Select File');
% CSVControl filename textbox
B.GUIControl.CSVControlfilename = uicontrol('Style','text',...
'Parent',B.P.File,...
'Units','centimeters',...
'FontSize',Fsize,...
'BackgroundColor',backcol,...
'Position',[btn.width btn.num*btn.height btn.width*1.95 btn.height],...
'String','');
btn.num = btn.num-1;
% CSVControl pathname textbox
B.GUIControl.CSVControlpathname = uicontrol('Style','text',...
'Parent',B.P.File,...
'Units','centimeters',...
'FontSize',Fsize,...
'BackgroundColor',backcol,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height],...
'String','');
btn.num = btn.num-1;
% message textbox
B.P.message = uicontrol('Style','text',...
'Parent',B.P.File,...
'Units','centimeters',...
'FontSize',Fsize,...
'BackgroundColor',backcol2,...
'ForegroundColor','r',...
'Position',[0 0 btn.width*2.95 btn.height],...
'String','');
%% Computational Block Control
pannum = 3;
% computational block panel
B.P.Select = uipanel(pltLaunch.id,'Title','Computational block control',...
'Units','centimeters',...
'FontSize',Fsize,...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[axe.xin(1),axe.yi+pan.yo(pannum),axe.x+0.1,pan.height(pannum)]);
btn.num = pan.row(pannum)-1;
% Organization block checkbox
B.GUIControl.Organize = uicontrol('Style','checkbox',...
'Parent',B.P.Select,...
'String','Organize raw data into Data and Config array',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
btn.num = btn.num-1;
% Clean block checkbox
B.GUIControl.Clean = uicontrol('Style','checkbox',...
'Parent',B.P.Select,...
'String','Clean raw time series',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
btn.num = btn.num-1;
% Classify block checkbox
B.GUIControl.Classify = uicontrol('Style','checkbox',...
'Parent',B.P.Select,...
'String','Classify quality of time series',...
'BackgroundColor','w',...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
%% Organization Panel
pannum = 4;
B.P.Organize = uipanel(pltLaunch.id,'Title','Organization block options',...
'Units','centimeters',...
'FontSize',Fsize,...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[axe.xin(1),axe.yi+pan.yo(pannum),axe.x+0.1,pan.height(pannum)]);
% Define geometry checkbox
btn.num = pan.row(pannum)-1;
B.GUIControl.DefineGeometry = uicontrol('Style','checkbox',...
'Parent',B.P.Organize,...
'String','Define channel geometry',...
'BackgroundColor','w',...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
% Subprogram to calculate sampling locations checkbox
btn.num = btn.num-1;
B.GUIControl.Sampling = uicontrol('Style','checkbox',...
'Parent',B.P.Organize,...
'String','Custom algorithm to define sampling locations',...
'BackgroundColor','w',...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
% uniform/nonuniform popup
btn.num = btn.num-1;
B.GUIControl.IsUniform = uicontrol('Style','popup',...
'Parent',B.P.Organize,...
'String','Uniform|Non-uniform',...
'Value',1,...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
btn.num = 4;
% uniform channel dimensions panel
B.P.Uniform = uipanel(pltLaunch.id,'Title','Uniform channel dimensions',...
'Parent',B.P.Organize,...
'Units','centimeters',...
'FontSize',Fsize,...
'FontAngle','italic',...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[0 btn.num*btn.height btn.width*3 btn.height*4]);
btn.num = 2;
% state channel type (only trapezoidal is available - including rectangular with m = 0
% and triangular with B = 0)
B.P.UniformTypename = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','left',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height],...
'String','Trapezoidal channel with origin at u\s centerline');
btn.num = btn.num-1;
% create series of labels and text boxes for channel dimensions
% S = bedslope, B = bottom width, H = total flow depth, L = length of
% experimental section, m = sideslope (ratio of mH:1V)
miniwidth = 0.3;
mini = 0;
B.P.Slopename = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','S: ');
mini = mini+1;
B.GUIControl.Slope = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(0.0),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
mini = mini+1;
B.P.Widthname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','B: ');
mini = mini+1;
B.GUIControl.Width = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(1.0),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
mini = mini+1;
B.P.Depthname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','Z: ');
mini = mini+1;
B.GUIControl.Depth = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(1.0),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
mini = mini+1;
B.P.Lengthname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','L: ');
mini = mini+1;
B.GUIControl.Length = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(10.0),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
mini = mini+1;
B.P.Sideslopename = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','m: ');
mini = mini+1;
B.GUIControl.Sideslope = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(0.0),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth-0.05 btn.height]);
btn.num = btn.num-1;
% specify grid sizes for 1D and 2D interpolants where the lateral, vertical
% and streamwise grid sizes are represented by b, h, and l, respectively
mini = 2;
B.P.Gridname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','left',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width btn.height],...
'String','Grid Size ');
B.P.Widthgridname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','bg: ');
mini = mini+1;
B.GUIControl.Widthgrid = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(0.01),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
mini = mini+1;
B.P.Depthgridname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','zg: ');
mini = mini+1;
B.GUIControl.Depthgrid = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(0.01),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
mini = mini+1;
B.P.Lengthgridname = uicontrol('Style','text',...
'Parent',B.P.Uniform,...
'BackgroundColor','w',...
'Units','centimeters',...
'HorizontalAlignment','right',...
'FontSize',Fsize,...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height],...
'String','lg: ');
mini = mini+1;
B.GUIControl.Lengthgrid = uicontrol('Style','edit',...
'Parent',B.P.Uniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'String',num2str(0.1),...
'Position',[mini*btn.width*miniwidth btn.num*btn.height btn.width*miniwidth btn.height]);
%% Non-uniform channel properties panel
btn.num = 4;
%
B.P.NonUniform = uipanel(pltLaunch.id,'Title','Specify a non-uniform channel',...
'Parent',B.P.Organize,...
'Units','centimeters',...
'FontSize',Fsize,...
'FontAngle','italic',...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[0 btn.num*btn.height btn.width*3 btn.height*4]);
btn.num = 2;
% text box for csv/subprogram option
B.P.Channeltext = uicontrol('Style','text',...
'Parent',B.P.NonUniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'BackgroundColor','w',...
'Position',[0 btn.num*btn.height btn.width*2 btn.height],...
'String','Channel coordinates defined in:');
% csv/subprogram popup
B.GUIControl.Channel = uicontrol('Style','popup',...
'Parent',B.P.NonUniform,...
'String','Csv file|subprogram',...
'Value',1,...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[btn.width*2 btn.num*btn.height btn.width*.95 btn.height]);
btn.num = btn.num-1;
% select file pushbutton
B.GUIControl.getCalcChannelfile = uicontrol('Style','pushbutton',...
'Parent',B.P.NonUniform,...
'Units','centimeters',...
'Position',[0 btn.num*btn.height btn.width*1.5 btn.height],...
'FontSize',Fsize,...
'BackgroundColor','w',...
'String','Select program/csv file');
% selected file name text box
B.GUIControl.CalcChannelfile = uicontrol('Style','text',...
'Parent',B.P.NonUniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[btn.width*1.5 btn.num*btn.height btn.width*1.4 btn.height],...
'String','');
btn.num = btn.num-1;
% selected file path name text box
B.GUIControl.CalcChannelpathname = uicontrol('Style','text',...
'Parent',B.P.NonUniform,...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height],...
'String','');
%% Custom subprogram to calculate sampling locations panel
btn.num = 1;
% % create panel
B.P.SamplingLocations = uipanel(pltLaunch.id,'Title','Sampling locations algorithm',...
'Parent',B.P.Organize,...
'Units','centimeters',...
'FontSize',Fsize,...
'FontAngle','italic',...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[0 btn.num*btn.height btn.width*3 btn.height*3]);
btn.num = 1;
% select file pushbutton
B.GUIControl.getCalcXYZfile = uicontrol('Style','pushbutton',...
'Parent',B.P.SamplingLocations,...
'Units','centimeters',...
'Position',[0 btn.num*btn.height btn.width*1.5 btn.height],...
'FontSize',Fsize,...
'BackgroundColor','w',...
'String','Select');
% selected file name text box
B.GUIControl.CalcXYZfile = uicontrol('Style','text',...
'Parent',B.P.SamplingLocations,...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[btn.width*1.5 btn.num*btn.height btn.width*1.45 btn.height],...
'String','');
btn.num = btn.num-1;
% selected file path name text box
B.GUIControl.CalcXYZpathname = uicontrol('Style','text',...
'Parent',B.P.SamplingLocations,...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height],...
'String','');
%% Clean block options
% panel
pannum = 5;
B.P.Clean = uipanel(pltLaunch.id,'Title','Clean block options',...
'Units','centimeters',...
'FontSize',Fsize,...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[axe.xin(2),axe.yi+pan.yo(pannum),axe.x+0.1,pan.height(pannum)]);
% reset any existing despiked and/or filtered time series checkbox
btn.num = pan.row(pannum)-1;
B.GUIControl.SpikeReset = uicontrol('Style','checkbox',...
'Parent',B.P.Clean,...
'String','Reset despiked and/or filtered time series',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.955 btn.height]);
% plot time series
btn.num = btn.num-1;
B.GUIControl.plotTimeSeries = uicontrol('Style','checkbox',...
'Parent',B.P.Clean,...
'String','Plot all time series',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
% perform despiking
btn.num = btn.num-1;
B.GUIControl.Despike = uicontrol('Style','checkbox',...
'Parent',B.P.Clean,...
'String','Despike',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
% perform filtering
btn.num = btn.num-1;
B.GUIControl.FiltrBW = uicontrol('Style','checkbox',...
'Parent',B.P.Clean,...
'String','Frequency filter',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
btn.num = 2.5;
%% Spike options panel
B.P.SpikeOptions = uipanel(pltLaunch.id,'Title','Despike options',...
'Parent',B.P.Clean,...
'Units','centimeters',...
'FontSize',Fsize,...
'FontAngle','italic',...
'ForegroundColor','b',...
'BackgroundColor','w',...
'Position',[0 btn.num*btn.height btn.width*3 btn.height*13]);
% switch to beam velocitites for spike detection rather than orthogonal components
btn.num = 11;
B.GUIControl.switch2beam = uicontrol('Style','checkbox',...
'Parent',B.P.SpikeOptions,...
'String','Use beam velocities?',...
'Units','centimeters',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2.95 btn.height]);
%
btn.num = btn.num-1.3;
B.P.Preprocesstext = uicontrol('Style','text',...
'Parent',B.P.SpikeOptions,...
'String','Pre-processing',...
'HorizontalAlignment','left',...
'Units','centimeters',...
'FontAngle','italic',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[0 btn.num*btn.height btn.width*2 btn.height]);
% preprocess popup
btn.num = btn.num-.7;
B.GUIControl.pctmodetext = uicontrol('Style','text',...
'Parent',B.P.SpikeOptions,...
'HorizontalAlignment','left',...
'String','Classify Mode threshold',...
'BackgroundColor','w',...
'Units','centimeters',...
'FontSize',Fsize,...
'Position',[btn.width*0.1 btn.num*btn.height btn.width*1.5 btn.height]);
B.GUIControl.pctmode = uicontrol('Style','edit',...
'Parent',B.P.SpikeOptions,...
'String','20',...
'Units','centimeters',...
'Visible','on',...
'FontSize',Fsize,...
'Position',[btn.width*1.5 btn.num*btn.height btn.width*.5 btn.height]);
B.P.pctmodelabel = uicontrol('Style','text',...
'Parent',B.P.SpikeOptions,...
'String','(%)',...
'HorizontalAlignment','left',...
'Units','centimeters',...
'FontAngle','italic',...
'BackgroundColor','w',...
'FontSize',Fsize,...
'Position',[btn.width*2.0 btn.num*btn.height btn.width*.45 btn.height]);% preprocess popup
btn.num = btn.num-1;
B.GUIControl.Preprocesstext = uicontrol('Style','text',...