-
Notifications
You must be signed in to change notification settings - Fork 8
/
NeMo_GUI.m
1170 lines (988 loc) · 46.2 KB
/
NeMo_GUI.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 varargout = NeMo_GUI(varargin)
% NEMO_GUI MATLAB code for NEMO_GUI.fig
% NeMo_GUI, by itself, creates a new NEMO_GUI or raises the existing
% singleton*.
%
% H = NEMO_GUI returns the handle to a new NEMO_GUI or the handle to
% the existing singleton*.
%
% NEMO_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in NEMO_GUI.M with the given input arguments.
%
% NEMO_GUI('Property','Value',...) creates a new NEMO_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before NEMO_GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to NEMO_GUI_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 NeMo_GUI
% Last Modified by GUIDE v2.5 31-May-2013 00:36:41
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @NeMo_GUI_OpeningFcn, ...
'gui_OutputFcn', @NeMo_GUI_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 NeMo_GUI is made visible.
function NeMo_GUI_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 NeMo_GUI (see VARARGIN)
% if( ismcc || isdeployed)
% addpath(genpath('mymfiles'));
% end
global dispvar disptype sMRItype atlas outputtype damagefile saveFolder referenceFile
damagefile = 0;
saveFolder = 0;
referenceFile = 0;
if ~(ismcc() || isdeployed())
addpath(genpath(['mymfiles' filesep 'spm8']));
end
% Choose default command line output for NeMo_GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes NeMo_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = NeMo_GUI_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;
% --- Executes during object creation, after setting all properties.
function uipanel1_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanel1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
set(hObject,'Visible','off');
% --- Executes during object creation, after setting all properties.
function uipanel2_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanel2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
set(hObject,'Visible','off');
% --------------------------------------------------------------------
% --- Check if the file is a valid file type %
function [valid_flg] = isValidFileType(filePath)
valid_flg = 0;
[fp, fn, fext] = fileparts(filePath);
switch lower(fext)
case '.nii'
valid_flg = 1;
case '.hdr'
valid_flg = 1;
case '.mat'
valid_flg = 1;
end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%global fullFilePath save_flg saveFolder conventional_flg spatial_flg graph_flg muT1 muT2 muS1 muS2...
% spa_autoparam_flg grf_autoparam_flg autoMCSS autob1cor defaultSaveFolder referenceFile TE_ui isEchoTimeSet noIter autoSS
global dispvar disptype sMRItype barplotoption atlas outputtype damagefile saveFolder referenceFile
if ~isnumeric(damagefile)
if exist(damagefile, 'file')
if isValidFileType(damagefile)
if isnumeric(saveFolder)
if get(handles.checkbox_saveResultDefault, 'Value')
[fp, fn, ext] = fileparts(damagefile);
saveFolder = [fp filesep 'default_output'];
end
if ~isdir(saveFolder)
mkdir(saveFolder);
end
else
if ~isdir(saveFolder)
mkdir(saveFolder);
end
end
fileDim = getFileStat(damagefile);
if (length(fileDim) == 3)
if (fileDim(3) > 1)
if isnumeric(referenceFile)
coregMNI = [];
else
switch sMRItype
case 1
coregMNI.StructImageType = 't1';
case 2
coregMNI.StructImageType = 't2';
case 3
coregMNI.StructImageType = 'epi';
otherwise
end
coregMNI.ImageFileName = referenceFile;
end
ChaCoCalc(damagefile, coregMNI, 'MNI', atlas, saveFolder, 1, 0, 0);
if exist([saveFolder filesep 'ChaCo' num2str(atlas) '_MNI.mat'], 'file')
set(handles.pushbuttonV, 'Enable', 'on');
commPlot.flag = 1;
switch disptype(1)
case 1
commPlot.PlotHemi = 'both';
case 2
commPlot.PlotHemi = 'left';
case 3
commPlot.PlotHemi = 'right';
case 4
commPlot.PlotHemi = 'subcortical';
otherwise
end
commPlot.movie = disptype(2);
switch dispvar(1)
case 1
commPlot.Global = 1;
commPlot.Local.flag = 0;
case 0
commPlot.Global = 0;
commPlot.Local.flag = 1;
if dispvar(2)
commPlot.Local.CP = 1;
else
commPlot.Local.CP = 0;
end
if dispvar(3)
commPlot.Local.EF = 1;
else
commPlot.Local.EF = 0;
end
if dispvar(4)
commPlot.Local.DG = 1;
else
commPlot.Local.DG = 0;
end
if dispvar(5)
commPlot.Local.EC = 1;
else
commPlot.Local.EC = 0;
end
if dispvar(6)
commPlot.Local.MD = 1;
else
commPlot.Local.MD = 0;
end
if dispvar(7)
commPlot.Local.BC = 1;
else
commPlot.Local.BC = 0;
end
if dispvar(8)
commPlot.Local.CC = 1;
else
commPlot.Local.CC = 0;
end
otherwise
end
commPlot.MAP = [];
switch outputtype
case 1
GBPlot = commPlot;
SurfPlot.flag = 0;
BoxPlot.flag = 0;
GraphPlot = commPlot;
if GraphPlot.Global == 1
GraphPlot.Global = 0;
end
case 2
GBPlot.flag = 0;
SurfPlot = commPlot;
BoxPlot.flag = 0;
GraphPlot = commPlot;
if GraphPlot.Global == 1
GraphPlot.Global = 0;
end
case 3
GBPlot.flag = 0;
SurfPlot.flag = 0;
GraphPlot.flag = 0;
if barplotoption(2)
GraphPlot.flag = 1;
GraphPlot.Global = 1;
GraphPlot.Local.flag = 0;
end
if barplotoption(1)
BoxPlot = commPlot;
else
BoxPlot.flag = 0;
end
case 4
GBPlot.flag = 0;
SurfPlot.flag = 0;
BoxPlot.flag = 0;
GraphPlot.flag = 0;
writeExcel(saveFolder, atlas, [saveFolder filesep 'ChaCo' num2str(atlas) '_MNI']);
otherwise
end
figsave = ['_' num2str(atlas) '_AD'];
% PlotChaCoResults([saveFolder filesep 'ChaCo' num2str(atlas) '_MNI'], GBPlot,SurfPlot,BoxPlot,GraphPlot, figsave, 1);
else
set(handles.pushbuttonV, 'Enable', 'off');
end
else
modaldlg('Title','Warning', 'String', 'Can not run, 3-dimensional mult-slice image needed');
end
else
modaldlg('Title','Warning', 'String', 'Can not run, 3-dimensional image needed');
end
else
modaldlg('Title','Warning', 'String', 'Invalid file selected');
end
else
modaldlg('Title','Warning', 'String', 'File selected not found');
end
else
modaldlg('Title','Warning', 'String', 'No file selected');
end
% --------------------------------------------------------------------
function file_menu_Callback(hObject, eventdata, handles)
% hObject handle to file_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function view_menu_Callback(hObject, eventdata, handles)
% hObject handle to view_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function tools_menu_Callback(hObject, eventdata, handles)
% hObject handle to tools_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function help_menu_Callback(hObject, eventdata, handles)
% hObject handle to help_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function about_item_Callback(hObject, eventdata, handles)
% hObject handle to about_item (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function imageView_item_Callback(hObject, eventdata, handles)
% hObject handle to imageView_item (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
spm_image('init', '');
function [valid_flg] = isValidSaveType(filePath)
valid_flg = 0;
[fp, fn, fext] = fileparts(filePath);
switch lower(fext)
case '.nii'
valid_flg = 1;
case '.hdr'
valid_flg = 1;
end
% ---- get file extension -----------
function [ext] = getExtension(filename)
[fp, fn, ext] = fileparts(filename);
% ---- get file statistics ------
function [sz] = getFileStat(filename)
try
ext = getExtension(filename);
switch lower(ext)
case '.mat'
v = load(filename);
sz = size(v);
case '.nii'
v = spm_vol(filename);
sz = v(1).dim;
case '.hdr'
v = spm_vol(filename);
sz = v(1).dim;
end
catch
sz = 0;
end
% --------------------------------------------------------------------
function exit_item_Callback(hObject, eventdata, handles)
% hObject handle to exit_item (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
delete(handles.figure1);
% --- Executes on button press in checkbox_saveResultDefault.
function checkbox_saveResultDefault_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_saveResultDefault (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 checkbox_saveResultDefault
% --- Executes during object creation, after setting all properties.
function checkbox_saveResultDefault_CreateFcn(hObject, eventdata, handles)
% hObject handle to checkbox_saveResultDefault (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function [isEV] = checkFileExistValid(fullFilePath)
isEV = 0;
if ~isnumeric(fullFilePath)
if exist(fullFilePath, 'file')
if isValidFileType(fullFilePath)
isEV = 1;
else
modaldlg('Title','Warning', 'String', 'Invalid file selected');
end
else
modaldlg('Title','Warning', 'String', 'File selected not found');
end
else
modaldlg('Title','Warning', 'String', 'No file selected');
end
% --- Executes when figure1 is resized.
function figure1_ResizeFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
currentFFPos = get(handles.editwm, 'Position');
windowPos = get(hObject, 'Position');
currentFFPos(3) = (84.5/140.66) * windowPos(3);
if currentFFPos(3) >= 84.5
set(handles.editwm, 'Position', currentFFPos);
else
currentFFPos(3) = 84.5;
set(handles.editwm, 'Position', currentFFPos);
end
currentFFPos = get(handles.editsMRI, 'Position');
windowPos = get(hObject, 'Position');
currentFFPos(3) = (52.5/140.66) * windowPos(3);
if currentFFPos(3) >= 52.5
currentFFPos(3) = currentFFPos(3)+(currentFFPos(3)*(32/140.66));
set(handles.editsMRI, 'Position', currentFFPos);
else
currentFFPos(3) = 52.5;
set(handles.editsMRI, 'Position', currentFFPos);
end
% --------------------------------------------------------------------
function OpenImage_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to OpenImage (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function editwm_Callback(hObject, eventdata, handles)
% hObject handle to editwm (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 editwm as text
% str2double(get(hObject,'String')) returns contents of editwm as a double
% --- Executes during object creation, after setting all properties.
function editwm_CreateFcn(hObject, eventdata, handles)
% hObject handle to editwm (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
function editsMRI_Callback(hObject, eventdata, handles)
% hObject handle to editsMRI (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 editsMRI as text
% str2double(get(hObject,'String')) returns contents of editsMRI as a double
% --- Executes during object creation, after setting all properties.
function editsMRI_CreateFcn(hObject, eventdata, handles)
% hObject handle to editsMRI (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
% --- Executes on button press in pushbuttonbrwm.
function pushbuttonbrwm_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonbrwm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile( ...
{'*.hdr','header Files (*.hdr)';
'*.nii', 'NIFTI files (*.nii)'}, ...
'Choose a T1 reference image file');
global damagefile
old_damagefile = damagefile;
damagefile = [pathname filename];
if ~isnumeric(damagefile)
if ~checkFileExistValid(damagefile)
damagefile = 0;
set(handles.editwm, 'String', '');
else
set(handles.editwm, 'String', damagefile);
set(handles.pushbuttonViewWM, 'Enable', 'on');
end
else
damagefile = old_damagefile;
end
% --- Executes on button press in pushbuttonbrsMRI.
function pushbuttonbrsMRI_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonbrsMRI (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global referenceFile
[filename, pathname] = uigetfile( ...
{'*.nii', 'NIFTI files (*.nii)';
'*.hdr','header Files (*.hdr)'}, ...
'Choose a T1 reference image file');
old_referenceFile = referenceFile;
referenceFile = [pathname filename];
if ~isnumeric(referenceFile)
if ~checkFileExistValid(referenceFile)
referenceFile = 0;
set(handles.editsMRI, 'String', 'None');
else
set(handles.editsMRI, 'String', referenceFile);
set(handles.pushbuttonViewsMRI, 'Enable', 'on');
end
else
referenceFile = old_referenceFile;
end
% --- Executes on button press in T1radio.
function T1radio_Callback(hObject, eventdata, handles)
% hObject handle to T1radio (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 T1radio
% --- Executes on button press in T2radio.
function T2radio_Callback(hObject, eventdata, handles)
% hObject handle to T2radio (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 T2radio
% --- Executes on button press in EPIradio.
function EPIradio_Callback(hObject, eventdata, handles)
% hObject handle to EPIradio (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 EPIradio
% --- Executes on button press in radioAAL.
function radioAAL_Callback(hObject, eventdata, handles)
% hObject handle to radioAAL (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 radioAAL
% --- Executes on button press in radiobuttonFS.
function radiobuttonFS_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonFS (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 radiobuttonFS
% --- Executes on button press in radiobuttonGlass.
function radiobuttonGlass_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonGlass (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 radiobuttonGlass
% --- Executes on button press in radiobuttonGummi.
function radiobuttonGummi_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonGummi (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 radiobuttonGummi
% --- Executes on button press in radiobuttonBar.
function radiobuttonBar_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonBar (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 radiobuttonBar
% --- Executes on button press in radiobuttonExcel.
function radiobuttonExcel_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonExcel (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 radiobuttonExcel
% --- Executes on button press in radiobuttonLH.
function radiobuttonLH_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonLH (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 radiobuttonLH
% --- Executes on button press in radiobuttonMV.
function radiobuttonMV_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonMV (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 radiobuttonMV
% --- Executes on button press in radiobuttonWB.
function radiobuttonWB_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonWB (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 radiobuttonWB
% --- Executes on button press in radiobuttonRH.
function radiobuttonRH_Callback(hObject, eventdata, handles)
% hObject handle to radiobuttonRH (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 radiobuttonRH
% --- Executes when selected object is changed in uipanelDV.
function uipanelDV_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelDV
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
%get(eventdata.NewValue, 'Tag')
global dispvar
tmptag = get(eventdata.NewValue, 'Tag');
switch tmptag
case 'radiobuttonCIC'
set(handles.uipanelCha, 'visible', 'off');
dispvar(1) = 1;
otherwise
set(handles.uipanelCha, 'visible', 'on');
dispvar(1) = 0;
end
% --- Executes when selected object is changed in uipanelCha.
function uipanelCha_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelCha
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
% global dispvar
% tmptag = get(eventdata.NewValue, 'Tag');
% switch tmptag
% case 'checkboxASPL'
% dispvar(2) = get(handles.checkboxASPL, 'Value');
% case 'checkboxEff'
% dispvar(3) = get(handles.checkboxEff, 'Value');
% case 'checkboxDeg'
% dispvar(4) = get(handles.checkboxDeg, 'Value');
% case 'checkboxEcc'
% dispvar(5) = get(handles.checkboxEcc, 'Value');
% case 'checkboxMod'
% dispvar(6) = get(handles.checkboxMod, 'Value');
% case 'checkboxBet'
% dispvar(7) = get(handles.checkboxBet, 'Value');
% otherwise
% end
% --- Executes when selected object is changed in uipanelsMRI.
function uipanelsMRI_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelsMRI
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
global sMRItype
tmptag = get(eventdata.NewValue, 'Tag');
switch tmptag
case 'T1radio'
sMRItype = 1;
case 'T2radio'
sMRItype = 2;
case 'EPIradio'
sMRItype = 3;
otherwise
end
% --- Executes when selected object is changed in uipanelCA.
function uipanelCA_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelCA
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
global atlas
tmptag = get(eventdata.NewValue, 'Tag');
switch tmptag
case 'radioAAL'
atlas = 116;
case 'radiobuttonFS'
atlas = 86;
otherwise
end
% --- Executes when selected object is changed in uipanelCOT.
function uipanelCOT_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelCOT
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
global outputtype
tmptag = get(eventdata.NewValue, 'Tag');
switch tmptag
case 'radiobuttonGlass'
set(handles.uipanelPar, 'visible', 'on');
set(handles.uipanelBarplot, 'visible', 'off');
set(handles.radiobuttonLNM, 'Enable', 'on');
outputtype = 1;
case 'radiobuttonGummi'
set(handles.uipanelPar, 'visible', 'on');
set(handles.uipanelBarplot, 'visible', 'off');
set(handles.radiobuttonLNM, 'Enable', 'off');
outputtype = 2;
otherwise
set(handles.uipanelPar, 'visible', 'off');
if strcmp(tmptag, 'radiobuttonBar')
set(handles.uipanelBarplot, 'visible', 'on');
outputtype = 3;
else
outputtype = 4;
end
end
% --- Executes when selected object is changed in uipanelDT.
function uipanelDT_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelDT
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
global disptype
tmptag = get(eventdata.NewValue, 'Tag');
switch tmptag
case 'radiobuttonWB'
disptype(1) = 1;
case 'radiobuttonLH'
disptype(1) = 2;
case 'radiobuttonRH'
disptype(1) = 3;
case 'radiobuttonSub'
disptype(1) = 4;
case 'checkboxMov'
disptype(2) = get(handles.checkboxMov, 'Value');
otherwise
end
% --- Executes during object creation, after setting all properties.
function uipanelDV_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanelDV (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
global dispvar
dispvar = [1 0 0 0 0 0 0 0];
% --- Executes during object creation, after setting all properties.
function radiobuttonLNM_CreateFcn(hObject, eventdata, handles)
% hObject handle to radiobuttonLNM (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
set(hObject, 'Value', 1);
% --- Executes during object creation, after setting all properties.
function uipanelCA_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanelCA (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
global atlas
atlas = 116;
% --- Executes during object creation, after setting all properties.
function uipanelCOT_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanelCOT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
global outputtype
outputtype = 1;
% --- Executes during object creation, after setting all properties.
function uipanelDT_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanelDT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
global disptype
disptype = [1 0];
% --- Executes during object creation, after setting all properties.
function uipanelsMRI_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanelsMRI (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
global sMRItype
sMRItype = 1;
% --------------------------------------------------------------------
function uipushtoolSave_ClickedCallback(hObject, eventdata, handles)
% hObject handle to uipushtoolSave (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global saveFolder
saveFolder_old = saveFolder;
[saveFolder pathname] = uigetdir('', 'Create a file to save processed data');
if isnumeric(saveFolder)
saveFolder = saveFolder_old;
else
saveFolder = [pathname filesep saveFolder];
end
% --- Executes on button press in pushbuttonViewWM.
function pushbuttonViewWM_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonViewWM (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global damagefile
if ~isnumeric(damagefile)
if exist(damagefile, 'file')
if isValidSaveType(damagefile)
%try
spm_image('init', damagefile);
%catch
% modaldlg('Title','Warning', 'String', 'Image file damaged');
%end
else
modaldlg('Title','Warning', 'String', 'Can not view this type of image file');
end
else
modaldlg('Title','Warning', 'String', 'Invalid image file');
end
else
modaldlg('Title','Warning', 'String', 'No image file selected');
end
% --- Executes on button press in pushbuttonViewsMRI.
function pushbuttonViewsMRI_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonViewsMRI (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global referenceFile
if ~isnumeric(referenceFile)
if exist(referenceFile, 'file')
if isValidSaveType(referenceFile)
%try
spm_image('init', referenceFile);
%catch
% modaldlg('Title','Warning', 'String', 'Image file damaged');
%end
else
modaldlg('Title','Warning', 'String', 'Can not view this type of image file');
end
else
modaldlg('Title','Warning', 'String', 'Invalid image file');
end
else
modaldlg('Title','Warning', 'String', 'No image file selected');
end
% --- Executes when selected object is changed in uipanelBarplot.
function uipanelBarplot_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in uipanelBarplot
% eventdata structure with the following fields (see UIBUTTONGROUP)
% EventName: string 'SelectionChanged' (read only)
% OldValue: handle of the previously selected object or empty if none was selected
% NewValue: handle of the currently selected object
% handles structure with handles and user data (see GUIDATA)
% global barplotoption
% tmptag = get(eventdata.NewValue, 'Tag');
% switch tmptag
% case 'radiobuttonDS'
% barplotoption = 1;
% case 'radiobuttonGNM'
% barplotoption = 2;
% otherwise
% end
% --- Executes during object creation, after setting all properties.
function uipanelBarplot_CreateFcn(hObject, eventdata, handles)
% hObject handle to uipanelBarplot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
global barplotoption
barplotoption = [0 0];
% --- Executes on button press in checkboxMov.
function checkboxMov_Callback(hObject, eventdata, handles)
% hObject handle to checkboxMov (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 checkboxMov
global disptype
disptype(2) = get(handles.checkboxMov, 'Value');
% --- Executes on button press in checkboxASPL.
function checkboxASPL_Callback(hObject, eventdata, handles)
% hObject handle to checkboxASPL (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 checkboxASPL
global dispvar
dispvar(2) = get(handles.checkboxASPL, 'Value');
% --- Executes on button press in checkboxEff.
function checkboxEff_Callback(hObject, eventdata, handles)
% hObject handle to checkboxEff (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 checkboxEff
global dispvar
dispvar(3) = get(handles.checkboxEff, 'Value');
% --- Executes on button press in checkboxEcc.
function checkboxEcc_Callback(hObject, eventdata, handles)
% hObject handle to checkboxEcc (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 checkboxEcc
global dispvar
dispvar(5) = get(handles.checkboxEcc, 'Value');
% --- Executes on button press in checkboxMod.
function checkboxMod_Callback(hObject, eventdata, handles)
% hObject handle to checkboxMod (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 checkboxMod
global dispvar
dispvar(6) = get(handles.checkboxMod, 'Value');
% --- Executes on button press in checkboxBet.