0001 function varargout = pr_spm_ui(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end
0013
0014
0015 img_flt = mars_veropts('get_img_ext');
0016
0017 switch lower(Action), case 'cfg'
0018
0019
0020
0021
0022 if nargin<2, D = []; else, D = varargin{2}; end
0023
0024
0025
0026 SPMid = spm('SFnBanner',mfilename,marsbar('ver'));
0027 [Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0);
0028 spm_help('!ContextHelp',mfilename)
0029
0030
0031
0032
0033 sF = {'sF1','sF2','sF3','sF4'};
0034
0035
0036 sCFI = {'<none>';...
0037 'with sF1';'with sF2';'with sF3';'with sF4';...
0038 'with sF2 (within sF4)';'with sF3 (within sF4)'};
0039
0040
0041
0042 CFIforms = { '[]', 'C', '{}';...
0043 'I(:,1)', 'FxC', '{D.sF{1}}';...
0044 'I(:,2)', 'FxC', '{D.sF{2}}';...
0045 'I(:,3)', 'FxC', '{D.sF{3}}';...
0046 'I(:,4)', 'FxC', '{D.sF{4}}';...
0047 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';...
0048 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' };
0049
0050
0051
0052 sCC = { 'around overall mean';...
0053 'around sF1 means';...
0054 'around sF2 means';...
0055 'around sF3 means';...
0056 'around sF4 means';...
0057 'around sF2 (within sF4) means';...
0058 'around sF3 (within sF4) means';...
0059 '<no centering>';...
0060 'around user specified value';...
0061 '(as implied by AnCova)';...
0062 'GM';...
0063 '(redundant: not doing AnCova)'}';
0064
0065 CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}';
0066
0067
0068
0069 sGloNorm = { 'AnCova';...
0070 'AnCova by sF1';...
0071 'AnCova by sF2';...
0072 'AnCova by sF3';...
0073 'AnCova by sF4';...
0074 'AnCova by sF2 (within sF4)';...
0075 'AnCova by sF3 (within sF4)';...
0076 'proportional scaling';...
0077 '<no global normalisation>'};
0078
0079
0080 sGMsca = { 'scaling of overall grand mean';...
0081 'scaling of sF1 grand means';...
0082 'scaling of sF2 grand means';...
0083 'scaling of sF3 grand means';...
0084 'scaling of sF4 grand means';...
0085 'scaling of sF2 (within sF4) grand means';...
0086 'scaling of sF3 (within sF4) grand means';...
0087 '(implicit in PropSca global normalisation)';...
0088 '<no grand Mean scaling>' };
0089
0090
0091
0092
0093 sGXcalc = { 'omit';...
0094 'user specified';...
0095 'mean voxel value (within per image fullmean/8 mask)'};
0096
0097
0098
0099
0100
0101
0102
0103
0104 if isempty(D)
0105
0106 D = pr_spm_ui( ...
0107 char(spm_input('Select design class...','+1','m',...
0108 {'Basic stats','Standard PET designs','SPM96 PET designs'},...
0109 {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2)));
0110 end
0111
0112 D = D(spm_input('Select design type...','+1','m',{D.DesName}'));
0113
0114
0115
0116
0117 sCC = sf_estrrep(sCC,[sF',D.sF']);
0118 sCFI = sf_estrrep(sCFI,[sF',D.sF']);
0119 sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']);
0120 sGMsca = sf_estrrep(sGMsca,[sF',D.sF']);
0121
0122
0123
0124 [P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime);
0125 nScan = size(I,1);
0126
0127
0128
0129 bL = any(diff(I,1),1);
0130
0131
0132 bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)];
0133
0134
0135
0136
0137
0138
0139 eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');'])
0140 if rank(H)==nScan, error('unestimable condition effects'), end
0141 eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');'])
0142 if rank(B)==nScan, error('unestimable block effects'), end
0143
0144
0145 if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B))
0146 H = []; Hnames = {};
0147 warning('Dropping redundant constant H partition')
0148 end
0149
0150
0151
0152
0153 nC = D.nC;
0154 C = {[],[]}; Cnames = {{},{}};
0155 xC = [];
0156
0157
0158 dcname = {'CovInt','NusCov'};
0159 dstr = {'covariate','nuisance variable'};
0160
0161 GUIpos = spm_input('!NextPos');
0162 nc = [0,0];
0163 for i = 1:2
0164
0165 if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end
0166
0167 while nc(i) < nC(i)
0168
0169
0170
0171 if nC(i)==1, str=dstr{i}; else, str=sprintf('%s %d',dstr{i},nc(i)+1); end
0172 c = spm_input(str,GUIpos,'r',[],[nScan,Inf]);
0173 if any(isnan(c(:))), break, end
0174 nc(i) = nc(i)+1;
0175 if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i));
0176 else, tstr = dcname{i}; end
0177 cname = spm_input([str,' name?'],'+1','s',tstr);
0178 rc = c;
0179 rcname = cname;
0180
0181
0182
0183 if size(c,2) == 1
0184 if length(D.iCFI{i})>1
0185
0186
0187 iCFI = intersect(abs(D.iCFI{i}),find([1,bFI]));
0188 dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]);
0189 iCFI = spm_input([str,': interaction?'],'+1','m',...
0190 sCFI(iCFI),iCFI,find(iCFI==dCFI));
0191 else
0192 iCFI = abs(D.iCFI{i});
0193 end
0194 else
0195 iCFI = 1;
0196 end
0197
0198
0199
0200
0201 DiCC = D.iCC{i};
0202 if size(c,2)>1, DiCC = union(DiCC,-8); end
0203 if length(DiCC)>1
0204
0205
0206 iCC = intersect(abs(DiCC),find([1,bFI,1]) );
0207
0208 if iCFI == 1, dCC = -DiCC(DiCC<0); else, dCC = iCFI; end
0209 dCC = max([1,intersect(iCC,dCC)]);
0210 iCC = spm_input([str,': centre?'],'+1','m',...
0211 sCC(iCC),iCC,find(iCC==dCC));
0212 else
0213 iCC = abs(DiCC);
0214 end
0215
0216 if any(iCC == [1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end
0217
0218
0219
0220 if iCFI > 1
0221 tI = [eval(CFIforms{iCFI,1}),c];
0222 tConst = CFIforms{iCFI,2};
0223 tFnames = [eval(CFIforms{iCFI,3}),{cname}];
0224 [c,cname] = spm_DesMtx(tI,tConst,tFnames);
0225 elseif size(c,2)>1
0226 [null,cname] = spm_DesMtx(c,'X',cname);
0227 else
0228 cname = {cname};
0229 end
0230
0231
0232
0233
0234
0235 str = {sprintf('%s: %s',str,rcname)};
0236 if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',...
0237 str{:},size(rc,2))}; end
0238 if iCC < 8, str=[str;{['used centered ',sCC{iCC}]}]; end
0239 if iCFI> 1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end
0240
0241 tmp = struct( 'rc',rc, 'rcname',rcname,...
0242 'c',c, 'cname',{cname},...
0243 'iCC',iCC, 'iCFI',iCFI,...
0244 'type',i,...
0245 'cols',[1:size(c,2)] + ...
0246 size([H,C{1}],2) + ...
0247 size([B,C{2}],2)*(i-1),...
0248 'descrip',{str} );
0249 if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
0250 C{i} = [C{i},c];
0251 Cnames{i} = [Cnames{i}; cname];
0252
0253 end
0254
0255 end
0256 clear c tI tConst tFnames
0257 spm_input('!SetNextPos',GUIpos);
0258
0259
0260 G = C{2}; Gnames = Cnames{2};
0261 C = C{1}; Cnames = Cnames{1};
0262
0263
0264
0265
0266
0267
0268 if length(D.iGloNorm)>1
0269
0270
0271 iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1]));
0272 dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]);
0273 iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',...
0274 sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm));
0275 else
0276 iGloNorm = abs(D.iGloNorm);
0277 end
0278
0279
0280
0281
0282 if iGloNorm==8
0283 iGMsca=8;
0284 elseif length(D.iGMsca)==1
0285 iGMsca = abs(D.iGMsca);
0286 else
0287
0288
0289 iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1]));
0290
0291 if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end
0292 dGMsca = max([0,intersect(iGMsca,dGMsca)]);
0293 iGMsca = spm_input('GMsca: grand mean scaling','+1','m',...
0294 sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca));
0295 end
0296
0297
0298
0299
0300 if iGMsca == 9
0301 GM = 0;
0302 else
0303 if iGloNorm==8
0304 str = 'PropSca global mean to';
0305 else
0306 str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to'];
0307 end
0308 GM = spm_input(str,'+1','r',D.GM,1);
0309
0310 if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end
0311 end
0312
0313
0314
0315 sGloNorm = sGloNorm{iGloNorm};
0316 sGMsca = sGMsca{iGMsca};
0317 if iGloNorm==8
0318 sGloNorm = sprintf('%s to %-4g',sGloNorm,GM);
0319 elseif iGMsca<8
0320 sGMsca = sprintf('%s to %-4g',sGMsca,GM);
0321 end
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338 if ~any(iGloNorm == [1:7])
0339 iGC = 12;
0340 gc = [];
0341 else
0342
0343
0344
0345 sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')'];
0346
0347 sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',...
0348 GM,strrep(sCC{iGMsca},'around ',''));
0349
0350
0351
0352
0353 iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1]));
0354
0355 if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end
0356
0357 if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end
0358
0359
0360
0361 if length(iGC)>1
0362 dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]);
0363 str = 'Centre global covariate';
0364 if iGMsca<8, str = [str,' (after grand mean scaling)']; end
0365 iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC));
0366 elseif isempty(iGC)
0367 error('Configuration error: empty iGC')
0368 end
0369
0370
0371
0372 if iGC==9
0373 gc = spm_input('Centre globals around','+0','r',D.GM,1);
0374 sCC{9} = sprintf('%s of %g',sCC{iGC},gc);
0375 else
0376 gc = 0;
0377 end
0378 end
0379
0380
0381
0382
0383 GUIpos = spm_input('!NextPos');
0384
0385
0386
0387
0388
0389 M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end
0390 M_T = { 'none', M_T(min(find(isinf(M_T))));...
0391 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));...
0392 'relative', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) };
0393
0394
0395
0396
0397 q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})];
0398
0399 if all(q(2:3))
0400 tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q));
0401 q(setdiff([1:3],tmp))=0;
0402 end
0403
0404
0405
0406 if ~any(q)
0407 M_T = -Inf;
0408 elseif all(q==[1,0,0])
0409 M_T = -Inf;
0410 else
0411 if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})};
0412 else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end
0413 if q(2)
0414 M_T = spm_input('threshold',GUIpos,args{:});
0415 elseif q(3)
0416 M_T = spm_input('threshold (relative to global)',GUIpos,...
0417 args{:});
0418 if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end
0419 else
0420 error('Shouldn''t get here!')
0421 end
0422 end
0423
0424
0425
0426 if isinf(M_T)
0427 xsM.Analysis_threshold = 'None (-Inf)';
0428 elseif isreal(M_T)
0429 xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T);
0430 else
0431 xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',...
0432 'times global'],imag(M_T));
0433 end
0434
0435
0436
0437
0438
0439 type = mars_vol_utils('type', spm_vol(P{1,1}));
0440 if ~spm_type(type,'nanrep')
0441 switch D.M_.I
0442 case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',...
0443 '+1','y/n',[1,0],1);
0444 case {0,1}, M_I = D.M_.I;
0445 otherwise, error('unrecognised D.M_.I type')
0446 end
0447
0448 if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing';
0449 else, xsm.Implicit_masking = 'No'; end
0450 else
0451 M_I = 1;
0452 xsM.Implicit_masking = 'Yes: NaN''s treated as missing';
0453 end
0454
0455
0456
0457
0458 switch(D.M_.X)
0459 case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2);
0460 case {0,1}, M_X = D.M_.X;
0461 otherwise, error('unrecognised D.M_.X type')
0462 end
0463 if M_X, M_P = spm_get(Inf,img_flt,{'select mask images'}); else, M_P = {}; end
0464
0465
0466
0467
0468 iGXcalc = abs(D.iGXcalc);
0469
0470 if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T)))
0471 iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]);
0472 end
0473 if isempty(iGXcalc)
0474 error('no GXcalc options')
0475 elseif length(iGXcalc)>1
0476
0477 dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]);
0478 iGXcalc = spm_input('Global calculation','+1','m',...
0479 sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc));
0480 else
0481 iGXcalc = abs(D.iGXcalc);
0482 end
0483
0484 if iGXcalc==2
0485 g = spm_input('globals','+0','r',[],[nScan,1]);
0486 end
0487 sGXcalc = sGXcalc{iGXcalc};
0488
0489
0490
0491
0492
0493
0494
0495 if length(find(max(I) > 1)) > 1
0496 xVi.iid = spm_input('non-sphericity correction?','+1','y/n',[0,1],1);
0497 else
0498 xVi.iid = 1;
0499 end
0500
0501
0502 if xVi.iid
0503
0504
0505
0506 xVi.V = speye(nScan);
0507
0508 else
0509
0510
0511 nL = max(I);
0512 mL = find(nL > 1);
0513 xVi.I = I;
0514 xVi.sF = D.sF;
0515 xVi.var = sparse(1,4);
0516 xVi.dep = sparse(1,4);
0517
0518
0519
0520
0521 for i = 1:4
0522 mstr{i} = sprintf('%s (%i)',D.sF{i},nL(i));
0523 end
0524 str = 'replications are over?';
0525 rep = spm_input(str,'+1','m',mstr(mL),1:length(mL));
0526
0527
0528
0529 str = 'correlated repeated measures';
0530 dep = spm_input(str,'+1','b',{'yes','no'},[1 0],1);
0531
0532
0533
0534
0535 mL(rep) = [];
0536 xVi.var(mL) = 1;
0537 xVi.dep(mL) = dep;
0538 xVi = spm_non_sphericity(xVi);
0539
0540 end
0541
0542
0543
0544
0545
0546 spm('FigName','Stats: configuring',Finter,CmdLine);
0547 spm('Pointer','Watch');
0548
0549
0550
0551
0552
0553 fprintf('%-40s: ','Mapping files')
0554 VY = spm_vol(char(P));
0555
0556
0557
0558
0559 [samef msg] = mars_vol_check(VY);
0560 if ~samef, disp(char(msg)),error('Cannot use images'),end;
0561
0562 fprintf('%30s\n','...done')
0563
0564
0565
0566
0567
0568
0569 switch iGXcalc, case 1
0570
0571 g = [];
0572 case 2
0573
0574 case 3
0575
0576 g = zeros(nScan,1 );
0577 fprintf('%-40s: %30s','Calculating globals',' ')
0578 for i = 1:nScan
0579 str = sprintf('%3d/%-3d',i,nScan);
0580 fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)
0581 g(i) = spm_global(VY(i));
0582 end
0583 fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done')
0584 otherwise
0585 error('illegal iGXcalc')
0586 end
0587 rg = g;
0588
0589
0590 fprintf('%-40s: ','Design configuration')
0591
0592
0593
0594
0595
0596
0597 switch iGMsca, case 8
0598
0599 if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end
0600 gSF = GM./g;
0601 g = GM*ones(nScan,1);
0602 case {1,2,3,4,5,6,7}
0603
0604 gSF = GM./spm_meanby(g,eval(CCforms{iGMsca}));
0605 g = g.*gSF;
0606 case 9
0607
0608 gSF = ones(nScan,1);
0609 otherwise
0610 error('illegal iGMsca')
0611 end
0612
0613
0614
0615
0616 for i = 1:nScan
0617 VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i);
0618 end
0619
0620
0621
0622
0623 if any(iGloNorm == [1:7])
0624
0625
0626
0627 switch iGC, case {1,2,3,4,5,6,7}
0628 gc = spm_meanby(g,eval(CCforms{iGC}));
0629 case 8
0630 gc = 0;
0631 case 9
0632
0633 case 10
0634 gc = spm_meanby(g,eval(CCforms{iGloNorm}));
0635 case 11
0636 gc = GM;
0637 otherwise
0638 error('unexpected iGC value')
0639 end
0640
0641
0642
0643
0644 rcname = 'global';
0645 tI = [eval(CFIforms{iGloNorm,1}),g - gc];
0646 tConst = CFIforms{iGloNorm,2};
0647 tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}];
0648 [f,gnames] = spm_DesMtx(tI,tConst,tFnames);
0649 clear tI tConst tFnames
0650
0651
0652
0653 str = {sprintf('%s: %s',dstr{2},rcname)};
0654 if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end
0655 if iGC ~= 8, str=[str;{['used centered ',sCC{iGC}]}]; end
0656 if iGloNorm > 1
0657 str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}];
0658 end
0659 tmp = struct( 'rc',rg.*gSF, 'rcname',rcname,...
0660 'c',f, 'cname' ,{gnames},...
0661 'iCC',iGC, 'iCFI' ,iGloNorm,...
0662 'type', 3,...
0663 'cols',[1:size(f,2)] + size([H C B G],2),...
0664 'descrip', {str} );
0665
0666 G = [G,f]; Gnames = [Gnames; gnames];
0667 if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
0668
0669
0670 elseif iGloNorm==8 | iGXcalc>1
0671
0672
0673
0674 if iGloNorm==8
0675 str = { 'global values: (used for proportional scaling)';...
0676 '("raw" unscaled globals shown)'};
0677 elseif isfinite(M_T) & ~isreal(M_T)
0678 str = { 'global values: (used to compute analysis threshold)'};
0679 else
0680 str = { 'global values: (computed but not used)'};
0681 end
0682
0683 rcname ='global';
0684 tmp = struct( 'rc',rg, 'rcname',rcname,...
0685 'c',{[]}, 'cname' ,{{}},...
0686 'iCC',0, 'iCFI' ,0,...
0687 'type', 3,...
0688 'cols', {[]},...
0689 'descrip', {str} );
0690
0691 if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
0692 end
0693
0694
0695
0696
0697 xGX = struct(...
0698 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,...
0699 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,...
0700 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,...
0701 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm);
0702
0703
0704
0705
0706
0707
0708 if isreal(M_T), M_TH = M_T * ones(nScan,1);
0709 else, M_TH = imag(M_T) * (rg.*gSF); end
0710
0711 if ~isempty(M_P)
0712 VM = spm_vol(char(M_P));
0713 xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}'];
0714 else
0715 VM = [];
0716 xsM.Explicit_masking = 'No';
0717 end
0718 xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM);
0719
0720
0721
0722
0723 X = [H C B G];
0724 tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]);
0725 xX = struct( 'X', X,...
0726 'iH', [1:size(H,2)],...
0727 'iC', [1:size(C,2)] + tmp(1),...
0728 'iB', [1:size(B,2)] + tmp(2),...
0729 'iG', [1:size(G,2)] + tmp(3),...
0730 'name', {[Hnames; Cnames; Bnames; Gnames]},...
0731 'I', I,...
0732 'sF', {D.sF});
0733
0734
0735
0736
0737 tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',...
0738 size(H,2),size(C,2),size(B,2),size(G,2));...
0739 sprintf('%d total, having %d degrees of freedom',...
0740 size(X,2),rank(X));...
0741 sprintf('leaving %d degrees of freedom from %d images',...
0742 size(X,1)-rank(X),size(X,1)) };
0743 xsDes = struct( 'Design', {D.DesName},...
0744 'Global_calculation', {sGXcalc},...
0745 'Grand_mean_scaling', {sGMsca},...
0746 'Global_normalisation', {sGloNorm},...
0747 'Parameters', {tmp} );
0748
0749
0750 fprintf('%30s\n','...done')
0751
0752
0753
0754
0755
0756 SPM.xY.P = P;
0757 SPM.xY.VY = VY;
0758 SPM.nscan = size(xX.X,1);
0759 SPM.xX = xX;
0760 SPM.xC = xC;
0761 SPM.xGX = xGX;
0762 SPM.xVi = xVi;
0763 SPM.xM = xM;
0764 SPM.xsDes = xsDes;
0765 SPM.SPMid = SPMid;
0766
0767 varargout = {SPM};
0768
0769
0770
0771 spm_clf(Finter)
0772 spm('Pointer','Arrow')
0773 fprintf('%-40s: %30s\n','Completed',spm('time'))
0774 spm('FigName','Stats: configured',Finter,CmdLine);
0775 spm('Pointer','Arrow')
0776 fprintf('\n\n')
0777
0778
0779
0780 case 'files&indices'
0781
0782
0783
0784
0785
0786 if nargin<5, nV = 1; else, nV = varargin{5}; end
0787 if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end
0788 if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end
0789 if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end
0790
0791
0792
0793 i4 = [];
0794 i3 = [];
0795 i2 = [];
0796 i1 = [];
0797 P = {};
0798
0799
0800
0801 bMV = nV>1;
0802 if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1');
0803 else, n4 = Dn(4); end
0804 bL4 = n4>1;
0805
0806 ti2 = '';
0807 GUIpos = spm_input('!NextPos');
0808 for j4 = 1:n4
0809 spm_input('!SetNextPos',GUIpos);
0810 sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end
0811 if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1');
0812 else, n3 = Dn(3); end
0813 bL3 = n3>1;
0814
0815 if DbaTime & Dn(2)>1
0816
0817
0818 GUIpos2 = spm_input('!NextPos');
0819 for j3 = 1:n3
0820 sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
0821 str = [sF4P,sF3P];
0822 tP = {};
0823 n21 = Dn(2)*Dn(1);
0824 for v=1:nV
0825 vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
0826 ttP = spm_get(n21,img_flt,{[str,'select images',vstr]});
0827 n21 = length(ttP);
0828 tP = [tP,ttP];
0829 end
0830 ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2));
0831
0832 [tl2,null,j] = unique(ti2);
0833 tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2));
0834 for i=1:length(tl2)
0835 tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end
0836 if isfinite(Dn(1)) & any(tn1~=Dn(1))
0837
0838 error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1)))
0839 end
0840 P = [P;tP];
0841 i4 = [i4; j4*ones(n21,1)];
0842 i3 = [i3; j3*ones(n21,1)];
0843 i2 = [i2; ti2];
0844 i1 = [i1; ti1];
0845 end
0846
0847 else
0848
0849 if isinf(Dn(2))
0850 n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1');
0851 else
0852 n2 = Dn(2);
0853 end
0854 bL2 = n2>1;
0855
0856 if n2==1 & Dn(1)==1
0857
0858 str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)];
0859 tP = {};
0860 for v=1:nV
0861 vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
0862 ttP = spm_get(n3,img_flt,{[str,vstr]});
0863 tP = [tP,ttP];
0864 end
0865 P = [P;tP];
0866 i4 = [i4; j4*ones(n3,1)];
0867 i3 = [i3; [1:n3]'];
0868 i2 = [i2; ones(n3,1)];
0869 i1 = [i1; ones(n3,1)];
0870 else
0871
0872
0873 for j3 = 1:n3
0874 sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
0875 if Dn(1)==1
0876
0877
0878 str = [sF4P,sF3P,'select images: ',DsF{2},...
0879 ' 1-',int2str(n2)];
0880 tP = {};
0881 for v=1:nV
0882 vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
0883 ttP = spm_get(n2,img_flt,{[str,vstr]});
0884 tP = [tP,ttP];
0885 end
0886 P = [P;tP];
0887 i4 = [i4; j4*ones(n2,1)];
0888 i3 = [i3; j3*ones(n2,1)];
0889 i2 = [i2; [1:n2]'];
0890 i1 = [i1; ones(n2,1)];
0891 else
0892
0893
0894 for j2 = 1:n2
0895 sF2P='';
0896 if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end
0897 str = [sF4P,sF3P,sF2P,' select images...'];
0898 tP = {};
0899 n1 = Dn(1);
0900 for v=1:nV
0901 vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
0902 ttP = spm_get(n1,img_flt,{[str,vstr]});
0903 n1 = length(ttP);
0904 tP = [tP,ttP];
0905 end
0906 P = [P;tP];
0907 i4 = [i4; j4*ones(n1,1)];
0908 i3 = [i3; j3*ones(n1,1)];
0909 i2 = [i2; j2*ones(n1,1)];
0910 i1 = [i1; [1:n1]'];
0911 end
0912 end
0913 end
0914 end
0915 end
0916 end
0917 varargout = {P,[i1,i2,i3,i4]};
0918
0919
0920 case 'desdefs_stats'
0921
0922
0923
0924
0925
0926
0927
0928
0929
0930
0931 D = struct(...
0932 'DesName','One sample t-test',...
0933 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},...
0934 'Hform', 'I(:,2),''-'',''mean''',...
0935 'Bform', '[]',...
0936 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
0937 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
0938 'iGloNorm',9,'iGC',12,...
0939 'M_',struct('T',-Inf,'I',Inf,'X',Inf),...
0940 'b',struct('aTime',0));
0941
0942 D = [D, struct(...
0943 'DesName','Two sample t-test',...
0944 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},...
0945 'Hform', 'I(:,2),''-'',''group''',...
0946 'Bform', 'I(:,3),''-'',''\mu''',...
0947 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
0948 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
0949 'iGloNorm',9,'iGC',12,...
0950 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
0951 'b',struct('aTime',1))];
0952
0953 D = [D, struct(...
0954 'DesName','Paired t-test',...
0955 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},...
0956 'Hform', 'I(:,2),''-'',''condition''',...
0957 'Bform', 'I(:,3),''-'',''\gamma''',...
0958 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
0959 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
0960 'iGloNorm',9,'iGC',12,...
0961 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
0962 'b',struct('aTime',0))];
0963
0964 D = [D, struct(...
0965 'DesName','One way Anova',...
0966 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
0967 'Hform', 'I(:,2),''-'',''group''',...
0968 'Bform', '[]',...
0969 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
0970 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
0971 'iGloNorm',9,'iGC',12,...
0972 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
0973 'b',struct('aTime',0))];
0974
0975 D = [D, struct(...
0976 'DesName','One way Anova (with constant)',...
0977 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
0978 'Hform', 'I(:,2),''-'',''group''',...
0979 'Bform', 'I(:,3),''-'',''\mu''',...
0980 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
0981 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
0982 'iGloNorm',9,'iGC',12,...
0983 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
0984 'b',struct('aTime',0))];
0985
0986 D = [D, struct(...
0987 'DesName','One way Anova (Within-subjects)',...
0988 'n', [1 Inf Inf 1],'sF',{{'repl','condition','subject',''}},...
0989 'Hform', 'I(:,2),''-'',''cond''',...
0990 'Bform', 'I(:,3),''-'',''subj''',...
0991 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
0992 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
0993 'iGloNorm',9,'iGC',12,...
0994 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
0995 'b',struct('aTime',0))];
0996
0997 D = [D, struct(...
0998 'DesName','Simple regression (correlation)',...
0999 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
1000 'Hform', '[]',...
1001 'Bform', 'I(:,2),''-'',''\mu''',...
1002 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1003 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
1004 'iGloNorm',9,'iGC',12,...
1005 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
1006 'b',struct('aTime',0))];
1007
1008
1009 D = [D, struct(...
1010 'DesName','Multiple regression',...
1011 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
1012 'Hform', '[]',...
1013 'Bform', '[]',...
1014 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1015 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
1016 'iGloNorm',9,'iGC',12,...
1017 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
1018 'b',struct('aTime',0))];
1019
1020 D = [D, struct(...
1021 'DesName','Multiple regression (with constant)',...
1022 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
1023 'Hform', '[]',...
1024 'Bform', 'I(:,2),''-'',''\mu''',...
1025 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1026 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
1027 'iGloNorm',9,'iGC',12,...
1028 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
1029 'b',struct('aTime',0))];
1030
1031 D = [D, struct(...
1032 'DesName','AnCova',...
1033 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
1034 'Hform', 'I(:,2),''-'',''group''',...
1035 'Bform', 'I(:,3),''-'',''\mu''',...
1036 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},...
1037 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
1038 'iGloNorm',9,'iGC',12,...
1039 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
1040 'b',struct('aTime',0))];
1041
1042 varargout = {D};
1043
1044
1045 case 'desdefs_pet'
1046
1047
1048
1049
1050
1051
1052
1053
1054 D = struct(...
1055 'DesName','Single-subject: conditions & covariates',...
1056 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
1057 'Hform', 'I(:,2),''-'',''cond''',...
1058 'Bform', 'I(:,3),''-'',''\mu''',...
1059 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},...
1060 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
1061 'iGloNorm',[1,8,9],'iGC',10,...
1062 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1063 'b',struct('aTime',1));
1064
1065 D = [D, struct(...
1066 'DesName','Single-subject: covariates only',...
1067 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
1068 'Hform', '[]',...
1069 'Bform', 'I(:,3),''-'',''\mu''',...
1070 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},...
1071 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
1072 'iGloNorm',[1,8,9],'iGC',10,...
1073 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1074 'b',struct('aTime',1))];
1075
1076
1077
1078 D = [D, struct(...
1079 'DesName','Multi-subj: conditions & covariates',...
1080 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
1081 'Hform', 'I(:,2),''-'',''cond''',...
1082 'Bform', 'I(:,3),''-'',''subj''',...
1083 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
1084 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
1085 'iGloNorm',[4,8,9],'iGC',10,...
1086 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1087 'b',struct('aTime',1))];
1088
1089 D = [D, struct(...
1090 'DesName','Multi-subj: cond x subj interaction & covariates',...
1091 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
1092 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',...
1093 'Bform', 'I(:,3),''-'',''subj''',...
1094 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
1095 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
1096 'iGloNorm',[4,8,9],'iGC',10,...
1097 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1098 'b',struct('aTime',1))];
1099
1100 D = [D, struct(...
1101 'DesName','Multi-subj: covariates only',...
1102 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
1103 'Hform', '[]',...
1104 'Bform', 'I(:,3),''-'',''subj''',...
1105 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},...
1106 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
1107 'iGloNorm',[4,8:9],'iGC',10,...
1108 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1109 'b',struct('aTime',0))];
1110
1111
1112
1113 D = [D, struct(...
1114 'DesName','Multi-group: conditions & covariates',...
1115 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},...
1116 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
1117 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
1118 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},...
1119 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
1120 'iGloNorm',[7,8,9],'iGC',10,...
1121 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1122 'b',struct('aTime',1))];
1123
1124 D = [D, struct(...
1125 'DesName','Multi-group: covariates only',...
1126 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},...
1127 'Hform', '[]',...
1128 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
1129 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},...
1130 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
1131 'iGloNorm',[7,8,9],'iGC',10,...
1132 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1133 'b',struct('aTime',0))];
1134
1135
1136
1137 D = [D, struct(...
1138 'DesName',...
1139 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',...
1140 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},...
1141 'Hform', 'I(:,2),''-'',''cond''',...
1142 'Bform', 'I(:,3),''-'',''\mu''',...
1143 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1144 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
1145 'iGloNorm',[8,9],'iGC',10,...
1146 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1147 'b',struct('aTime',0))];
1148
1149 D = [D, struct(...
1150 'DesName',...
1151 'Dodgy population main effect: >2 cond''s, 1 scan/cond',...
1152 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
1153 'Hform', 'I(:,2),''-'',''cond''',...
1154 'Bform', 'I(:,3),''-'',''\mu''',...
1155 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1156 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
1157 'iGloNorm',[8,9],'iGC',10,...
1158 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1159 'b',struct('aTime',0))];
1160
1161 D = [D, struct(...
1162 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',...
1163 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
1164 'Hform', 'I(:,2),''-'',''group''',...
1165 'Bform', 'I(:,3),''-'',''\mu''',...
1166 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1167 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
1168 'iGloNorm',[8,9],'iGC',10,...
1169 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1170 'b',struct('aTime',0))];
1171
1172 D = [D, struct(...
1173 'DesName','Compare-populations: 1 scan/subject (AnCova)',...
1174 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
1175 'Hform', 'I(:,2),''-'',''group''',...
1176 'Bform', 'I(:,3),''-'',''\mu''',...
1177 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},...
1178 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
1179 'iGloNorm',[1,8,9],'iGC',10,...
1180 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
1181 'b',struct('aTime',0))];
1182
1183
1184
1185 D = [D, struct(...
1186 'DesName','The Full Monty...',...
1187 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},...
1188 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
1189 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
1190 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},...
1191 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,...
1192 'iGloNorm',[1:9],'iGC',[1:11],...
1193 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
1194 'b',struct('aTime',1))];
1195
1196
1197 varargout = {D};
1198
1199 case 'desdefs_pet96'
1200
1201
1202
1203
1204
1205
1206
1207 D = struct(...
1208 'DesName','SPM96:Single-subject: replicated conditions',...
1209 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
1210 'Hform', 'I(:,2),''-'',''cond''',...
1211 'Bform', 'I(:,3),''-'',''\mu''',...
1212 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1213 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1214 'iGloNorm',[1,8,9],'iGC',10,...
1215 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1216 'b',struct('aTime',0));
1217
1218 D = [D, struct(...
1219 'DesName','SPM96:Single-subject: replicated conditions & covariates',...
1220 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
1221 'Hform', 'I(:,2),''-'',''cond''',...
1222 'Bform', 'I(:,3),''-'',''\mu''',...
1223 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
1224 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1225 'iGloNorm',[1,8,9],'iGC',10,...
1226 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1227 'b',struct('aTime',0))];
1228
1229 D = [D, struct(...
1230 'DesName','SPM96:Single-subject: covariates only',...
1231 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
1232 'Hform', '[]',...
1233 'Bform', 'I(:,3),''-'',''\mu''',...
1234 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
1235 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1236 'iGloNorm',[1,8,9],'iGC',10,...
1237 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1238 'b',struct('aTime',0))];
1239
1240
1241
1242 D = [D, struct(...
1243 'DesName','SPM96:Multi-subject: different conditions',...
1244 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
1245 'Hform', 'I(:,2),''-'',''scancond''',...
1246 'Bform', 'I(:,3),''-'',''subj''',...
1247 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1248 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1249 'iGloNorm',[1,4,8,9],'iGC',10,...
1250 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1251 'b',struct('aTime',0))];
1252
1253 D = [D, struct(...
1254 'DesName','SPM96:Multi-subject: replicated conditions',...
1255 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
1256 'Hform', 'I(:,2),''-'',''cond''',...
1257 'Bform', 'I(:,3),''-'',''subj''',...
1258 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1259 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1260 'iGloNorm',[1,4,8,9],'iGC',10,...
1261 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1262 'b',struct('aTime',0))];
1263
1264 D = [D, struct(...
1265 'DesName','SPM96:Multi-subject: different conditions & covariates',...
1266 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
1267 'Hform', 'I(:,2),''-'',''cond''',...
1268 'Bform', 'I(:,3),''-'',''subj''',...
1269 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},...
1270 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1271 'iGloNorm',[1,4,8,9],'iGC',10,...
1272 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1273 'b',struct('aTime',0))];
1274
1275 D = [D, struct(...
1276 'DesName','SPM96:Multi-subject: replicated conditions & covariates',...
1277 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
1278 'Hform', 'I(:,2),''-'',''condition''',...
1279 'Bform', 'I(:,3),''-'',''subj''',...
1280 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},...
1281 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1282 'iGloNorm',[1,4,8,9],'iGC',10,...
1283 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1284 'b',struct('aTime',0))];
1285
1286 D = [D, struct(...
1287 'DesName','SPM96:Multi-subject: covariates only',...
1288 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
1289 'Hform', '[]',...
1290 'Bform', 'I(:,3),''-'',''subj''',...
1291 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},...
1292 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1293 'iGloNorm',[1,4,8,9],'iGC',10,...
1294 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1295 'b',struct('aTime',0))];
1296
1297
1298
1299 D = [D, struct(...
1300 'DesName','SPM96:Multi-study: different conditions',...
1301 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
1302 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
1303 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
1304 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1305 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
1306 'iGloNorm',[1,5,7,8,9],'iGC',10,...
1307 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1308 'b',struct('aTime',0))];
1309
1310 D = [D, struct(...
1311 'DesName','SPM96:Multi-study: replicated conditions',...
1312 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},...
1313 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
1314 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
1315 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1316 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
1317 'iGloNorm',[1,5,7,8,9],'iGC',10,...
1318 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1319 'b',struct('aTime',0))];
1320
1321 D = [D, struct(...
1322 'DesName','SPM96:Multi-study: different conditions & covariates',...
1323 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
1324 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
1325 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
1326 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
1327 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
1328 'iGloNorm',[1,5,7,8,9],'iGC',10,...
1329 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1330 'b',struct('aTime',0))];
1331
1332 D = [D, struct(...
1333 'DesName','SPM96:Multi-study: replicated conditions & covariates',...
1334 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
1335 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
1336 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
1337 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
1338 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
1339 'iGloNorm',[1,5,7,8,9],'iGC',10,...
1340 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1341 'b',struct('aTime',0))];
1342
1343 D = [D, struct(...
1344 'DesName','SPM96:Multi-study: covariates only',...
1345 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},...
1346 'Hform', '[]',...
1347 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
1348 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},...
1349 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
1350 'iGloNorm',[1,5,7,8,9],'iGC',10,...
1351 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1352 'b',struct('aTime',0))];
1353
1354
1355
1356 D = [D, struct(...
1357 'DesName','SPM96:Compare-groups: 1 scan per subject',...
1358 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},...
1359 'Hform', 'I(:,2),''-'',''group''',...
1360 'Bform', '[]',...
1361 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
1362 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
1363 'iGloNorm',[1,8,9],'iGC',10,...
1364 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
1365 'b',struct('aTime',0))];
1366
1367 varargout = {D};
1368
1369
1370 otherwise
1371
1372
1373
1374 warning(['Illegal Action string: ',Action])
1375
1376
1377
1378
1379
1380 end
1381
1382
1383
1384
1385
1386
1387
1388
1389 function str = sf_estrrep(str,srstr)
1390
1391 for i = 1:size(srstr,1)
1392 str = strrep(str,srstr{i,1},srstr{i,2});
1393 end