-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpspm_contrast.m
625 lines (518 loc) · 23.6 KB
/
pspm_contrast.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
function varargout = pspm_contrast(varargin)
% ● Description
% PSPM_CONTRAST MATLAB code for pspm_contrast.fig
% PSPM_CONTRAST, by itself, creates a new PSPM_CONTRAST or raises the existing
% singleton*.
% H = PSPM_CONTRAST returns the handle to a new PSPM_CONTRAST or the handle to
% the existing singleton*.
% PSPM_CONTRAST('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PSPM_CONTRAST.M with the given input arguments.
% PSPM_CONTRAST('Property','Value',...) creates a new PSPM_CONTRAST or raises
% the existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before pspm_contrast_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to pspm_contrast_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 pspm_contrast
% ● Format
% pspm_contrast('CALLBACK',hObject,eventData,handles,...)
% pspm_contrast('Property','Value',...)
% ● History
% Introduced in PsPM 3.0
% Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging)
% Maintained in 2022 by Teddy Chao
%% Initialise
global settings
if isempty(settings)
pspm_init;
end
sts = -1;
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @pspm_contrast_OpeningFcn, ...
'gui_OutputFcn', @pspm_contrast_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 pspm_contrast is made visible.
function pspm_contrast_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 pspm_contrast (see VARARGIN)
% Left alignment of text fields
set(handles.textStatus,'HorizontalAlignment','left')
set(handles.editContrastName,'HorizontalAlignment','left')
set(handles.textStatus,'String','Select a model...');
handles.listNamesValues = 1;
handles.colorString = {'red', 'green', 'fuchsia'};
handles.contrastCnt = 0;
handles.currentContrast = 1;
handles.contrastNamesString = [];
handles.enableGroupButtons = false;
% Choose default command line output for pspm_contrast
handles.output = hObject;
% Apply UI
pspm_ui(hObject, handles, 'contrast');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes pspm_contrast wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = pspm_contrast_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 on selection change in listNames.
function listNames_Callback(hObject, eventdata, handles)
% hObject handle to listNames (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listNames contents as cell array
% contents{get(hObject,'Value')} returns selected item from listNames
listValue = get(handles.listNames, 'Value');
lbTop = get(handles.listNames, 'ListboxTop');
radioGroupValue = getGroupValue(handles);
contrastVal = find(handles.conArray{handles.currentContrast}.contrasts(:,listValue));
if isempty(contrastVal)
handles.conArray{handles.currentContrast}.contrasts(radioGroupValue,listValue) = 1;
elseif contrastVal == radioGroupValue
handles.conArray{handles.currentContrast}.contrasts(radioGroupValue,listValue) = ~handles.conArray{handles.currentContrast}.contrasts(radioGroupValue,listValue);
end
contrastVal = find(handles.conArray{handles.currentContrast}.contrasts(:,listValue));
if isempty(contrastVal)
handles.conArray{handles.currentContrast}.namesString{listValue} = handles.names{listValue};
else
handles.conArray{handles.currentContrast}.namesString{listValue} = sprintf('<HTML><FONT bgcolor="%s">%s</Font></html>',handles.colorString{contrastVal},handles.names{listValue});
end
set(handles.listNames,'String',handles.conArray{handles.currentContrast}.namesString);
if numel(handles.conArray{handles.currentContrast}.namesString) >= lbTop
set(handles.listNames, 'ListboxTop', lbTop);
end;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function listNames_CreateFcn(hObject, eventdata, handles)
% hObject handle to listNames (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in buttonLoadModel.
function buttonLoadModel_Callback(hObject, eventdata, handles)
% hObject handle to buttonLoadModel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
filt='.*\.mat$';
[modelfile, sts]=spm_select(1, filt, 'Select model file');
if sts==0, return; end;
handles.modelfile = modelfile;
% Init
handles.conArray = [];
handles.contrastCnt = 0;
handles.currentContrast = 1;
handles.contrastNamesString = [];
handles.names = [];
set(handles.listNames, 'String', handles.names);
set(handles.listNames, 'Value', 1);
set(handles.listNames,'Enable','off');
set(handles.listContrastNames,'String',handles.contrastNamesString);
set(handles.listContrastNames, 'Value', 1);
set(handles.listContrastNames,'Enable','off');
set(handles.buttonNewContrast,'Enable','off');
set(handles.buttonDeleteContrast,'Enable','off');
set(handles.buttonRun,'Enable','off');
set(handles.buttonClearCon,'Enable','off');
set(handles.checkboxDeleteCon,'Enable','off');
disableButtonGroups(handles)
handles.enableGroupButtons = false;
guidata(hObject, handles);
% check model file
set(handles.textStatus,'String','Loading model. Please wait...');
drawnow
[sts, model, modeltype] = pspm_load1(modelfile, 'all', 'any');
if sts == -1 || ~any(strcmp(modeltype,{'glm','dcm','sf'}))
set(handles.textStatus,'String','No modeltype detected');
drawnow
return;
elseif strcmp(modeltype,'sf')
dcm = cellfun(@(field) strcmpi(field(1).modeltype, 'dcm'), model.model);
if numel(dcm) < 1
set(handles.textStatus,'String','No supported modeltype detected');
drawnow
return;
end
end
set(handles.buttonNewContrast,'Enable','on');
set(handles.checkboxDeleteCon,'Enable','on');
set(handles.checkboxDeleteCon,'Value',0);
% detect model
switch modeltype
case 'glm'
set(handles.textStatus,'String','Detected modeltype: GLM');
drawnow
handles.paramnames = model.names;
handles.condnames = {};
% get condition names, code borrowed from pspm_glm_recon
regno = (numel(model.names) - model.interceptno)/model.bf.bfno;
for k = 1:regno
foobar = model.names{((k - 1) * model.bf.bfno + 1)};
foo = strfind(foobar, ', bf');
handles.condnames{k} = foobar(1:(foo-1));
clear foo foobar
end;
case 'dcm'
set(handles.textStatus,'String','Detected modeltype: DCM')
drawnow
handles.paramnames = model.trlnames;
handles.condnames = model.condnames;
case 'sf'
set(handles.textStatus,'String','Detected modeltype: SF')
drawnow
handles.paramnames = model.trlnames;
end
handles.names = handles.paramnames;
handles.modeltype = modeltype;
set(handles.listNames, 'String', handles.names);
setTestGroupValue(handles, 1)
adjustStatsTypeDisplay(handles);
guidata(hObject, handles);
% --- Executes on button press in buttonClearCon.
function buttonClearCon_Callback(hObject, eventdata, handles)
% hObject handle to buttonClearCon (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = clearNamesColor(handles);
guidata(hObject, handles);
% --- Executes on button press in buttonExit.
function buttonExit_Callback(hObject, eventdata, handles)
% hObject handle to buttonExit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
delete(gcbf)
% --- Executes when selected object is changed in panelTestDef.
function panelTestDef_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in panelTestDef
% 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)
testGroupVal = getTestGroupValue(handles);
setContrastGroup(handles, testGroupVal);
if testGroupVal ~= handles.conArray{handles.currentContrast}.testGroupVal
handles = clearNamesColor(handles);
end
handles.conArray{handles.currentContrast}.testGroupVal = testGroupVal;
guidata(hObject, handles);
% --- Executes when selected object is changed in panelStatsType.
function panelStatstype_SelectionChangeFcn(hObject, eventdata, handles)
% hObject handle to the selected object in panelTestDef
% 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 current stats type and assign names --
testStatstype = getStatsTypeValue(handles);
if testStatstype == 1
handles.names = handles.paramnames;
else
handles.names = handles.condnames;
end
if strcmpi(handles.modeltype, 'dcm') && testStatstype ~= 3
set(handles.checkboxZscored, 'Enable', 'on');
else
set(handles.checkboxZscored, 'Enable', 'off');
set(handles.checkboxZscored, 'Value', 0);
end
lbTop = get(handles.listNames, 'ListboxTop');
if lbTop > numel(handles.names)
set(handles.listNames, 'ListboxTop', 1);
end
lbValue = get(handles.listNames, 'Value');
if lbValue > numel(handles.names)
set(handles.listNames, 'Value', 1);
end
set(handles.listNames, 'String', handles.names);
% assign stats type to contrast and initialise contrast vector --
handles.conArray{handles.currentContrast}.namesString = handles.names;
handles.conArray{handles.currentContrast}.statstype = testStatstype;
handles.conArray{handles.currentContrast}.contrasts = zeros(3,numel(handles.names));
guidata(hObject, handles);
% --- Executes on selection change in listContrastNames.
function listContrastNames_Callback(hObject, eventdata, handles)
% hObject handle to listContrastNames (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listContrastNames contents as cell array
% contents{get(hObject,'Value')} returns selected item from listContrastNames
entryNr = get(handles.listContrastNames,'Value');
handles.currentContrast = entryNr;
% reset ListboxTop
set(handles.listNames, 'ListboxTop', 1);
set(handles.listNames,'String',handles.conArray{handles.currentContrast}.namesString);
setTestGroupValue(handles, handles.conArray{handles.currentContrast}.testGroupVal);
setContrastGroup(handles, handles.conArray{handles.currentContrast}.testGroupVal)
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function listContrastNames_CreateFcn(hObject, eventdata, handles)
% hObject handle to listContrastNames (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in buttonNewContrast.
function buttonNewContrast_Callback(hObject, eventdata, handles)
% hObject handle to buttonNewContrast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.contrastCnt = handles.contrastCnt + 1;
handles.currentContrast = handles.contrastCnt;
handles.conArray{handles.contrastCnt}.namesString = handles.names;
handles.conArray{handles.contrastCnt}.contrasts = zeros(3,numel(handles.names));
handles.conArray{handles.contrastCnt}.testGroupVal = getTestGroupValue(handles);
handles.conArray{handles.contrastCnt}.statstype = getStatsTypeValue(handles);
contrastName = get(handles.editContrastName,'String');
if isempty(contrastName)
handles.contrastNamesString{handles.currentContrast} = ' ';
else
handles.contrastNamesString{handles.currentContrast} = contrastName;
end
set(handles.listContrastNames,'String',handles.contrastNamesString);
set(handles.listContrastNames,'Value',handles.currentContrast);
set(handles.listNames,'String',handles.conArray{handles.currentContrast}.namesString);
if handles.enableGroupButtons == false
set(handles.listNames,'Enable','on');
enableButtonGroups(handles)
set(handles.buttonRun,'Enable','on');
set(handles.buttonClearCon,'Enable','on');
set(handles.listContrastNames,'Enable','on');
handles.enableGroupButtons = true;
end
if handles.contrastCnt > 1
set(handles.buttonDeleteContrast, 'Enable', 'on');
end
guidata(hObject, handles);
function editContrastName_Callback(hObject, eventdata, handles)
% hObject handle to editContrastName (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 editContrastName as text
% str2double(get(hObject,'String')) returns contents of editContrastName as a double
% --- Executes during object creation, after setting all properties.
function editContrastName_CreateFcn(hObject, eventdata, handles)
% hObject handle to editContrastName (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 buttonDeleteContrast.
function buttonDeleteContrast_Callback(hObject, eventdata, handles)
% hObject handle to buttonDeleteContrast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.conArray{handles.currentContrast} = [];
handles.conArray(cellfun('isempty',handles.conArray)) = [];
handles.contrastNamesString{handles.currentContrast} = [];
handles.contrastNamesString(cellfun('isempty',handles.contrastNamesString)) = [];
handles.contrastCnt = handles.contrastCnt - 1;
if handles.currentContrast > handles.contrastCnt
handles.currentContrast = handles.contrastCnt;
end
set(handles.listContrastNames, 'Value', handles.currentContrast);
set(handles.listContrastNames, 'String', handles.contrastNamesString);
set(handles.listNames, 'String', handles.conArray{handles.currentContrast}.namesString);
setTestGroupValue(handles, handles.conArray{handles.currentContrast}.testGroupVal);
setContrastGroup(handles, handles.conArray{handles.currentContrast}.testGroupVal)
if handles.contrastCnt < 2
set(handles.buttonDeleteContrast, 'Enable', 'off');
end
guidata(hObject, handles);
% --- Executes on selection change in popupDatatype.
function popupDatatype_Callback(hObject, eventdata, handles)
% hObject handle to popupDatatype (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupDatatype contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupDatatype
% --- Executes during object creation, after setting all properties.
function popupDatatype_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupDatatype (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu 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 checkboxDeleteCon.
function checkboxDeleteCon_Callback(hObject, eventdata, handles)
% hObject handle to checkboxDeleteCon (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 checkboxDeleteCon
% --- Executes on button press in buttonRun.
function buttonRun_Callback(hObject, eventdata, handles)
% hObject handle to buttonRun (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
for i=1:numel(handles.conArray)
norm1 = sum(handles.conArray{i}.contrasts(1,:));
if norm1 == 0
norm1 = 1;
end
norm2 = sum(handles.conArray{i}.contrasts(2,:));
if norm2 == 0
norm2 = 1;
end
norm3 = sum(handles.conArray{i}.contrasts(3,:));
if norm3 == 0
norm3 = 1;
end
switch handles.conArray{i}.testGroupVal
case 1
conVec{i} = handles.conArray{i}.contrasts(1,:)/norm1;
case 2
conVec{i} = handles.conArray{i}.contrasts(1,:)/norm1 - handles.conArray{i}.contrasts(2,:)/norm2;
case 3
conVec{i} = handles.conArray{i}.contrasts(1,:)/norm1 - 2*handles.conArray{i}.contrasts(2,:)/norm2 + handles.conArray{i}.contrasts(3,:)/norm3;
end
end
deletecon = get(handles.checkboxDeleteCon,'Value');
zscored = get(handles.checkboxZscored, 'Value');
datatype = {'param', 'cond', 'recon'};
datatype = datatype{handles.conArray{i}.statstype};
options.zscored = zscored;
pspm_con1(handles.modelfile, handles.contrastNamesString, conVec, datatype, deletecon, options);
%--------------------------------------------------------------------------
% Functions
%--------------------------------------------------------------------------
function val = getGroupValue(handles)
val(1) = get(handles.radioGroup1,'Value');
val(2) = get(handles.radioGroup2,'Value');
val(3) = get(handles.radioGroup3,'Value');
val = find(val);
function val = getTestGroupValue(handles)
val(1) = get(handles.radioIntercept,'Value');
val(2) = get(handles.radioCondDiff,'Value');
val(3) = get(handles.radioQuadEffects,'Value');
val = find(val);
function val = getStatsTypeValue(handles)
val(1) = get(handles.radioParam,'Value');
val(2) = get(handles.radioCond,'Value');
val(3) = get(handles.radioRecon,'Value');
val = find(val);
function setTestGroupValue(handles, val)
switch val
case 1
set(handles.radioIntercept,'Value',1);
case 2
set(handles.radioCondDiff,'Value',1);
case 3
set(handles.radioQuadEffects,'Value',1);
end
function handles = clearNamesColor(handles)
handles.conArray{handles.currentContrast}.namesString = handles.names;
handles.conArray{handles.currentContrast}.contrasts = zeros(size(handles.conArray{handles.currentContrast}.contrasts));
set(handles.listNames,'String',handles.conArray{handles.currentContrast}.namesString);
function setContrastGroup(handles, nr)
set(handles.radioGroup1,'Enable','on');
set(handles.radioGroup1,'Value',1);
if nr > 1
set(handles.radioGroup2,'Enable','on');
set(handles.radioGroup2,'String',sprintf('<HTML><FONT bgcolor="%s">%s</Font></html>',handles.colorString{2},'Group 2'));
else
set(handles.radioGroup2,'Enable','off');
set(handles.radioGroup2,'String','Group 2');
end
if nr > 2
set(handles.radioGroup3,'Enable','on');
set(handles.radioGroup3,'String',sprintf('<HTML><FONT bgcolor="%s">%s</Font></html>',handles.colorString{3},'Group 3'));
else
set(handles.radioGroup3,'Enable','off');
set(handles.radioGroup3,'String','Group 3');
end
function disableButtonGroups(handles)
set(handles.radioGroup1,'Enable','off');
set(handles.radioGroup2,'Enable','off');
set(handles.radioGroup3,'Enable','off');
set(handles.radioGroup1,'String','Group 1');
set(handles.radioGroup2,'String','Group 2');
set(handles.radioGroup3,'String','Group 3');
set(handles.radioIntercept,'Enable','off');
set(handles.radioCondDiff,'Enable','off');
set(handles.radioQuadEffects,'Enable','off');
set(handles.radioParam,'Enable','off');
set(handles.radioCond,'Enable','off');
set(handles.radioRecon,'Enable','off');
set(handles.checkboxZscored, 'Enable', 'off');
function adjustStatsTypeDisplay(handles)
switch handles.modeltype
case {'sf','dcm'}
set(handles.radioParam, 'String', 'show all trials');
set(handles.radioCond, 'String', 'show conditions');
set(handles.radioRecon, 'Visible', 'off');
case 'glm'
set(handles.radioRecon, 'Visible', 'on');
set(handles.radioParam, 'String', 'show all basis functions');
set(handles.radioCond, 'String', 'show only first basis function');
set(handles.radioRecon, 'String', 'show combined basis function');
end;
function enableButtonGroups(handles)
set(handles.radioGroup1,'Enable','on');
set(handles.radioGroup1,'Value',1);
set(handles.radioGroup1,'String',sprintf('<HTML><FONT bgcolor="%s">%s</Font></html>',handles.colorString{1},'Group 1'));
set(handles.radioIntercept,'Enable','on');
set(handles.radioIntercept,'Value',1);
set(handles.radioCondDiff,'Enable','on');
set(handles.radioQuadEffects,'Enable','on');
switch handles.modeltype
case {'sf','dcm'}
set(handles.radioParam, 'Enable', 'on');
set(handles.radioCond, 'Enable', 'on');
set(handles.checkboxZscored, 'Enable', 'on');
if ~strcmpi(handles.modeltype, 'sf')
set(handles.radioCond, 'Enable', 'on');
end
case {'glm'}
set(handles.radioParam, 'Enable', 'on');
set(handles.radioRecon, 'Enable', 'on');
set(handles.radioCond, 'Enable', 'on');
end
% --- Executes on button press in checkboxZscored.
function checkboxZscored_Callback(hObject, eventdata, handles)
% hObject handle to checkboxZscored (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 checkboxZscored
% --- Executes on button press in radioQuadEffects.
function radioQuadEffects_Callback(hObject, eventdata, handles)
% hObject handle to radioQuadEffects (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 radioQuadEffects