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