0001 function varargout=ui_get_contrasts(D, varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191 xCon = get_contrasts(D);
0192
0193
0194
0195 COLOUR = [.8,.8,1];
0196 PJump = 1;
0197
0198
0199 if (nargin<2) | ismember(varargin{1}, {'T', 'F', 'T|F', 'T&F'})
0200
0201
0202
0203
0204
0205 if nargin<6, OK2chg = 0; else, OK2chg=varargin{5}; end
0206 if nargin<5, Mcstr = ''; else, Mcstr=varargin{4}; end
0207 if nargin<4, Prompt='Select contrast(s)...'; else, Prompt=varargin{3}; end
0208 if nargin<3, n=1; else, n=varargin{2}; end
0209 if nargin<2, STATmode='T|F'; else, STATmode=varargin{1}; end
0210
0211
0212
0213
0214 [F,cF] = ui_get_contrasts(D, 'Initialise','on',STATmode,n,Prompt,Mcstr,OK2chg);
0215 if PJump
0216 PLoc = get(0,'PointerLocation');
0217 FRec = get(F,'Position');
0218 set(0,'PointerLocation',[FRec(1)+FRec(3)/2, FRec(2)+FRec(2)/2])
0219 end
0220
0221
0222 hDone = findobj(F,'Tag','Done');
0223 waitfor(hDone,'UserData')
0224
0225
0226 if ~ishandle(hDone), error('Contrast Manager was quit!'), end
0227
0228
0229 status = get(hDone,'UserData');
0230 hConList = findobj(F,'Tag','ConList');
0231 Q = get(hConList,'UserData');
0232 I = Q(get(hConList,'Value'));
0233 changef = get(findobj(F,'Tag','D_Reset'), 'UserData');
0234
0235
0236 if changef
0237 D = set_contrasts(D, get_contrasts(get(F,'UserData')), 0);
0238 end
0239
0240
0241 ui_get_contrasts(D, 'Initialise','off');
0242
0243
0244 set(0,'CurrentFigure',cF)
0245
0246
0247 if PJump, set(0,'PointerLocation',PLoc), end
0248
0249
0250 if status == -1, error(['reset: ',mfilename,' bailing out!']), end
0251
0252
0253 varargout={I,D,changef};
0254
0255 return
0256 end
0257
0258
0259
0260
0261
0262
0263 switch lower(varargin{1}), case 'initialise'
0264
0265
0266
0267 if nargin<2, Vis='on'; else, Vis=varargin{2}; end
0268
0269
0270 F = findobj(get(0,'Children'),'Flat','Tag','mConMan');
0271
0272 cF = get(0,'CurrentFigure');
0273
0274 switch lower(Vis), case 'close'
0275 close(F)
0276 varargout = {[],cF};
0277 return
0278 case {'off','reset'}
0279 varargout = {F,cF};
0280 if isempty(F), return, end
0281 set(F,'Visible','off')
0282 if strcmp(lower(Vis),'reset')
0283 set(findobj(F,'Tag','Done'),'UserData',-1)
0284 end
0285 return
0286 case 'on'
0287
0288
0289 if nargin<8, OK2chg = 0; else, OK2chg=varargin{7}; end
0290 if nargin<7, Mcstr = ''; else, Mcstr=varargin{6}; end
0291 Mcstr = cellstr(Mcstr); if length(Mcstr)<2, Mcstr{2}=''; end
0292 if nargin<6, Prompt='Select contrast(s)'; else, Prompt=varargin{5}; end
0293 if nargin<5, n=Inf; else, n=varargin{4}; end
0294 if nargin<4, STATmode='T&F'; else, STATmode=varargin{3}; end
0295
0296
0297
0298 if isempty(F)
0299 [F,H] = ui_get_contrasts(D, 'CreateFig');
0300 else
0301 H.hDesMtxAx = findobj(F,'Tag','DesMtxAx');
0302 H.hParEstAx = findobj(F,'Tag','ParEstAx');
0303 H.hConList = findobj(F,'Tag','ConList');
0304 H.hPrompt = findobj(F,'Tag','Prompt');
0305 H.hTFAf = findobj(F,'Tag','TFAf');
0306 H.hSTATmode = findobj(F,'Tag','STATmode');
0307 H.hStatLin = findobj(F,'Tag','StatusLine');
0308 H.hNew = findobj(F,'Tag','New');
0309 end
0310 varargout = {F,cF};
0311
0312
0313
0314 SPM = des_struct(D);
0315 xX = SPM.xX;
0316
0317
0318
0319 tmpD = des_struct(D, struct('xCon', xCon));
0320 sf_SetD(tmpD, 0, F);
0321 set(H.hStatLin, 'UserData', Mcstr)
0322
0323
0324
0325 if isfield(xX, 'Xnames'), xX.name = xX.Xnames; end
0326
0327
0328
0329 set(findobj(F,'Tag','Done'),'UserData',0)
0330 STAT = ui_get_contrasts(D, 'TFA',F,'',STATmode);
0331 set(H.hPrompt,'String',Prompt,'UserData',n)
0332 sf_ImDesMtx(xX, H.hDesMtxAx)
0333 sf_ImParEst(xX, H.hParEstAx)
0334 ui_get_contrasts(D, 'ListCon',H.hConList,STAT,[])
0335 if OK2chg, tmp='on'; else, tmp='off'; end
0336 set(H.hNew,'Enable',tmp)
0337
0338
0339
0340
0341 set(get(findobj(F,'Tag','DefineNew'),'UserData'),'Visible','off')
0342
0343 figure(F)
0344 set(0,'CurrentFigure',cF)
0345 return
0346
0347 otherwise
0348 error('Unrecognised ''Vis'' option')
0349 end
0350
0351
0352
0353 case 'listcon'
0354
0355
0356
0357 hConList = varargin{2};
0358 STAT = varargin{3};
0359 if nargin<5
0360 Q = get(hConList,'UserData');
0361 I = Q(get(hConList,'Value'));
0362 else
0363 I = varargin{4};
0364 end
0365
0366
0367
0368 if isempty(xCon)
0369 Q = [];
0370 elseif isempty(STAT)
0371 Q = 1:length(xCon);
0372 else
0373 Q = find(strcmp({xCon(:).STAT},STAT));
0374 end
0375
0376 q = find(ismember(Q,I));
0377
0378 if ~isempty(Q)
0379 str = cell(0);
0380 for i=1:length(Q)
0381 str{i} = sprintf('%03d {%c} : %s',...
0382 Q(i),xCon(Q(i)).STAT,xCon(Q(i)).name);
0383 end
0384 FontAngle = 'Normal';
0385 FontWeight = 'Normal';
0386 Enable = 'on';
0387 else
0388 str = ['no',deblank([' ',STAT]),' contrasts defined'];
0389 FontAngle = 'Italic';
0390 FontWeight = 'Bold';
0391 Enable = 'off';
0392 end
0393
0394 set(hConList,'String',str,...
0395 'UserData',Q,...
0396 'Value',q,...
0397 'FontAngle',FontAngle,'FontWeight',FontWeight,...
0398 'Enable',Enable)
0399
0400 ui_get_contrasts(D, 'GraphCons',xCon,Q(q),get(hConList,'Parent'))
0401 ui_get_contrasts(D, 'StatusLine',get(hConList,'Parent'))
0402
0403
0404
0405 case 'graphcons'
0406
0407
0408
0409 if nargin>2, xCon=varargin{2}; end
0410 if nargin<4, I=[1:length(xCon)]; else, I=varargin{3}; end
0411 if nargin<5, F=[]; else, F=varargin{4}; end
0412 if isempty(F), F=spm_figure('FindWin','mConMan'); end
0413 if isempty(F), error('can''t find mConMan win'), end
0414
0415 cF = get(0,'CurrentFigure');
0416 set(0,'CurrentFigure',F);
0417
0418 delete(findobj(F,'Tag','ConGrphAx'));
0419
0420
0421
0422
0423 if isempty(I)
0424 axes('Position',[0.65 (0.7 + .1*(1-0.9)) 0.3 .1*.9],...
0425 'Tag','ConGrphAx','Visible','off')
0426 text(0.5,0.5,'no contrast(s)',...
0427 'FontSize',spm('FontSize',8),...
0428 'FontAngle','Italic',...
0429 'HorizontalAlignment','Center',...
0430 'VerticalAlignment','Middle')
0431
0432 else
0433
0434 nPar = size(xCon(1).c,1);
0435 xx = [repmat([0:nPar-1],2,1);repmat([1:nPar],2,1)];
0436 nCon = length(I);
0437 dy = 0.2/max(nCon,2);
0438 hConAx = axes('Position',[0.65 (0.70 + dy*.1) 0.30 dy*(nCon-.1)],...
0439 'Tag','ConGrphAx','Visible','off');
0440 title('contrast(s)')
0441 htxt = get(hConAx,'title'); set(htxt,'Visible','on')
0442
0443 for ii = nCon:-1:1
0444 i = abs(I(ii));
0445 axes('Position',[0.65 (0.7 + dy*(nCon-ii+.1)) 0.3 dy*.9])
0446 if xCon(i).STAT == 'T' & size(xCon(i).c,2)==1
0447
0448 yy = [zeros(1,nPar);repmat(xCon(i).c',2,1);zeros(1,nPar)];
0449 h = patch(xx,yy,[1,1,1]*.5);
0450 set(gca,'Tag','ConGrphAx',...
0451 'Box','off','TickDir','out',...
0452 'XTick',[],...
0453 'XLim', [0,nPar],...
0454 'YTick',[-1,0,+1],'YTickLabel','',...
0455 'YLim', [min(xCon(i).c),max(xCon(i).c)] + ...
0456 [-1 +1] * max(abs(xCon(i).c))/10 )
0457 else
0458
0459 h = image((xCon(i).c'/max(abs(xCon(i).c(:)))+1)*32);
0460 set(gca,'Tag','ConGrphAx',...
0461 'Box','on','TickDir','out',...
0462 'XTick',[],...
0463 'XLim', [0,nPar]+0.5,...
0464 'YTick',[0:size(xCon(i).c,2)]+0.5,'YTickLabel','',...
0465 'YLim', [0,size(xCon(i).c,2)]+0.5 )
0466 end
0467 if I(ii)>0, ylabel(num2str(i)), end
0468 set(h,'ButtonDownFcn','spm_DesRep(''SurfCon_CB'')',...
0469 'UserData', struct( 'i', I(ii),...
0470 'h', htxt,...
0471 'xCon', xCon(i)))
0472 end
0473 end
0474
0475 set(0,'CurrentFigure',cF)
0476
0477
0478
0479 case 'statusline'
0480
0481
0482
0483 if nargin<3, F = findobj(get(0,'Children'),'Flat','Tag','mConMan');
0484 else, F = varargin{2}; end
0485
0486 if nargin<4
0487 n = get(findobj(F,'Tag','Prompt'),'UserData');
0488 m = length(get(findobj(F,'Tag','ConList'),'Value'));
0489
0490 str = sprintf('Selected %d contrast',m);
0491 if m~=1, str=[str,'s']; end
0492
0493 Mcstr = get(findobj(F,'Tag','StatusLine'),'UserData');
0494 if m>1, str=[str,Mcstr{1}]; else, str=[str,Mcstr{2}]; end
0495
0496 if m==0
0497 if n<0
0498 str = [str,', press "Done" when finished.'];
0499 else
0500 str = [str,'.'];
0501 end
0502 else
0503 if n==1
0504 str = [str,', press "Done".'];
0505 else
0506 str = [str,', press "Done" when finished.'];
0507 end
0508 end
0509 else
0510 str = varargin{3};
0511 end
0512
0513 if nargin<5, col='w'; else, col=varargin{4}; end
0514
0515 set(findobj(F,'Tag','StatusLine'),'String',str,'ForegroundColor',col)
0516
0517
0518
0519 case 'done_cb'
0520
0521
0522
0523 F = gcbf;
0524
0525 n = get(findobj(F,'Tag','Prompt'),'UserData');
0526 q = get(findobj(F,'Tag','ConList'),'Value');
0527
0528
0529 if n>0 & isempty(q)
0530 if n==1, str = 'Select a contrast!';
0531 elseif isfinite(n), str = sprintf('Select %d contrasts!',n);
0532 else, str = 'Select at least one contrast!';
0533 end
0534 elseif length(q)>abs(n)
0535 if n<0, tstr='at most'; else, tstr='only'; end
0536 if abs(n)==1, str = ['Select',tstr,' one contrast!'];
0537 else, str = sprintf('Select %s %d contrasts!',tstr,abs(n));
0538 end
0539 elseif n>0 & isfinite(n) & length(q)<n
0540 if n==1, str = 'Select a contrast!';
0541 else, str = sprintf('Select %d contrasts!',n);
0542 end
0543 else
0544 str = '';
0545 end
0546
0547 if ~isempty(str)
0548 spm('Beep')
0549 msgbox(str,sprintf('%s%s: %s...',spm('ver'),...
0550 spm('GetUser',' (%s)'),mfilename),'error','modal')
0551 else
0552 set(findobj(F,'Tag','Done'),'UserData',1)
0553 end
0554
0555
0556
0557 case 'conlist_cb'
0558
0559
0560
0561 F = gcbf;
0562 hConList = gcbo;
0563
0564 Q = get(hConList,'UserData');
0565 I = Q(get(hConList,'Value'));
0566
0567 ui_get_contrasts(D, 'GraphCons',xCon,I,F)
0568 ui_get_contrasts(D, 'StatusLine',get(hConList,'Parent'))
0569
0570 if strcmp(get(F,'SelectionType'),'open'), ui_get_contrasts(D, 'Done_CB'), end
0571
0572
0573
0574 case {'tfa','d_tf'}
0575
0576
0577
0578
0579
0580 DefNew = strcmp(lower(varargin{1}),'d_tf');
0581
0582 if nargin<3, F = gcbf; else, F=varargin{2}; end
0583
0584 if nargin<4
0585
0586 h = gcbo;
0587 if get(h,'Value')==0
0588
0589 set(h,'Value',1)
0590 varargout={get(h,'UserData')};
0591 return
0592 else
0593
0594 STAT = get(h,'UserData');
0595 end
0596 else
0597 STAT = varargin{3};
0598 end
0599
0600 if ~(nargin<5)
0601
0602 STATmode = varargin{4};
0603 b_set = 1;
0604 else
0605 STATmode = get(findobj(F,'Tag','STATmode'),'UserData');
0606 b_set = 0;
0607 end
0608
0609
0610
0611
0612 STATinfo = struct(...
0613 'mode', { 'T', 'F', 'T|F', 'T&F'},...
0614 'vSTAT', {{'T'},{'F'},{'T','F'},{'T','F',''}},...
0615 'defSTAT', { 'T', 'F', 'T', ''},...
0616 'Enable', { {'on', 'off','off'},...
0617 {'off','on' ,'off'},...
0618 {'on', 'on', 'off'},...
0619 {'on', 'on', 'on' }} );
0620 i = find(strcmp(STATmode,{STATinfo.mode}));
0621 if isempty(i), error('unknown STATmode'), end
0622 if DefNew & i==4, i=3; end
0623 if isempty(STAT), STAT=STATinfo(i).defSTAT; end
0624 j = find(strcmp(STAT,{'T','F',''}));
0625 if isempty(j), error('unknown STAT'); end
0626 if ~any(strcmp(STAT,STATinfo(i).vSTAT))
0627 error('Invalid STAT for this STATmode')
0628 end
0629
0630
0631
0632
0633 if ~DefNew, Tag='TFA'; else, Tag='D_TF'; end
0634 H = flipud(findobj(F,'Tag',Tag));
0635 set(H(j), 'Value',1)
0636 set(H(setdiff([1:length(H)],j)),'Value',0)
0637 if b_set
0638
0639 set(findobj(F,'Tag','STATmode'),'UserData',STATmode)
0640 for k=1:length(H), set(H(k),'Enable',STATinfo(i).Enable{k}), end
0641 end
0642
0643
0644 if ~DefNew
0645
0646
0647
0648
0649 if nargin<3
0650 ui_get_contrasts(D, 'ListCon',findobj(F,'Tag','ConList'),STAT)
0651 end
0652
0653 else
0654
0655
0656
0657
0658 hD_ConMtx = findobj(F,'Tag','D_ConMtx');
0659 hD_X1cols = findobj(F,'Tag','D_X1cols');
0660 hD_ConErrs = findobj(F,'Tag','D_ConErrs');
0661 hD_ConInfo = findobj(F,'Tag','D_ConInfo');
0662 HD_Ttxt = findobj(F,'Tag','D_Ttxt');
0663 HD_Ftxt = findobj(F,'Tag','D_Ftxt');
0664
0665
0666
0667 set(hD_ConMtx,'String',{},'UserData',[])
0668 set(hD_X1cols,'String','')
0669 set([hD_ConErrs,hD_ConInfo],'String',{},'Value',[])
0670 ui_get_contrasts(D, 'GraphCons',[],[],F)
0671 ui_get_contrasts(D, 'D_Status',F)
0672
0673 switch STAT
0674 case 'T'
0675 set(hD_ConMtx,'Max',1)
0676 set(HD_Ttxt,'Visible','on')
0677 set([hD_X1cols;HD_Ftxt],'Visible','off')
0678 case 'F'
0679 set(hD_ConMtx,'Max',2)
0680 set(HD_Ttxt,'Visible','off')
0681 set([hD_X1cols;HD_Ftxt],'Visible','on')
0682 otherwise
0683 error('illegal case')
0684 end
0685
0686 end
0687
0688
0689
0690 varargout = {STAT};
0691
0692
0693
0694
0695 case 'fconmenu_cb'
0696
0697
0698
0699 if strcmp(get(findobj(gcbf,'Tag','New'),'Enable'),'off')
0700 set(findobj(gcbo,'Tag','CM_New'),'Enable','off')
0701 set(findobj(gcbo,'Tag','CM_Ren'),'Enable','off')
0702 else
0703 set(findobj(gcbo,'Tag','CM_New'),'Enable','on')
0704 if length(get(findobj(gcbf,'Tag','ConList'),'Value'))==1
0705 set(findobj(gcbo,'Tag','CM_Ren'),'Enable','on')
0706 else
0707 set(findobj(gcbo,'Tag','CM_Ren'),'Enable','off')
0708 end
0709 end
0710
0711
0712
0713
0714 case 'rename_cb'
0715
0716
0717
0718 F = gcbf;
0719
0720 hConList = findobj(F,'Tag','ConList');
0721 Q = get(hConList,'UserData');
0722 i = get(hConList,'Value');
0723
0724
0725
0726 if length(i)~=1
0727 msgbox('Can only rename a single contrast!',...
0728 sprintf('%s%s: %s...',spm('ver'),...
0729 spm('GetUser',' (%s)'),mfilename),'error','modal')
0730 return
0731 end
0732
0733
0734
0735 I = Q(i);
0736
0737
0738
0739 str = sprintf('Enter new name for contrast %d (currently "%s"):',I,xCon(I).name);
0740 nname = inputdlg(str,'SPM: Rename contrast',1,{''},'off');
0741 if isempty(nname), return, end
0742
0743
0744
0745 tmp = get(hConList,'String');
0746 tmp{i} = strrep(tmp{i},xCon(I).name,nname{1});
0747 set(hConList,'String',tmp)
0748
0749
0750
0751 xCon(I).name = nname{1};
0752 D = set_contrasts(D, xCon, 0);
0753 sf_SetD(D, 1, F);
0754
0755
0756
0757 case 'parsecon'
0758
0759
0760
0761
0762
0763
0764 if nargin<5, STAT='F'; else, STAT=varargin{4}; end
0765 cstr = varargin{2};
0766 X = varargin{3};
0767 p = spm_SpUtil('size',X,2);
0768
0769
0770
0771 if isempty(cstr)
0772 varargout = {[],0,{' <- !empty input'},{},{}};
0773 return
0774 elseif iscell(cstr)
0775 if size(cstr,1)~=1, cstr=cstr(:); end
0776 c = cstr;
0777 elseif isstr(cstr)
0778 cstr = cellstr(cstr);
0779 c = cstr;
0780 elseif isnumeric(cstr)
0781 if ndims(cstr)>2, error('matrices only!'), end
0782 c = num2cell(cstr,2);
0783 cstr = cell(size(c));
0784 for i=1:prod(size(c)), cstr{i}=num2str(c{i}); end
0785 else
0786 error('contrast input must be string or number')
0787 end
0788
0789
0790
0791
0792 I = zeros(size(c,1),1);
0793 msg = cell(size(c)); [msg{:}] = deal(' (OK)');
0794 for i=1:size(c,1)
0795 if isstr(c{i})
0796 c{i} = evalin('base',['[',c{i},']'],'''!''');
0797 end
0798 if isstr(c{i})
0799 msg{i} = '!evaluation error';
0800 else
0801 if isempty(c{i})
0802 msg{i}=' (empty line - ignored)';
0803 elseif all(c{i}(:)==0)
0804 if size(c{i},1)==1, str='vector'; else, str='matrix'; end
0805 c{i}=[]; msg{i}=[' (zero ',str,' - ignored)'];
0806 elseif STAT=='T' & size(c{i},1)>1
0807 c{i}='!'; msg{i}='!vector required';
0808 elseif size(c{i},2)>p
0809 c{i}='!'; msg{i}=sprintf('!too long - only %d prams',p);
0810 else
0811 if size(c{i},2)<p
0812 tmp = p-size(c{i},2);
0813 c{i}=[c{i}, zeros(size(c{i},1),tmp)];
0814 if size(c{i},1)>1, str=' column'; else, str=''; end
0815 if tmp>1, str=[str,'s']; end
0816 msg{i} = sprintf(' (right padded with %d zero%s)',tmp,str);
0817 end
0818 if ~spm_SpUtil('allCon',X,c{i}')
0819 c{i}='!'; msg{i}='!invalid contrast';
0820 end
0821 end
0822 end
0823 I(i)=~isstr(c{i});
0824 end
0825
0826
0827
0828 c = cat(1,c{find(I)});
0829 msg = [char(cstr), repmat(' <- ',size(msg,1),1), char(msg)];
0830 emsg = msg(find(~I),:);
0831 imsg = msg(find( I),:);
0832
0833 if all(I) & STAT=='T' & size(c,1)>1
0834 I=zeros(size(I)); emsg={'!vector required'}; imsg={};
0835 end
0836
0837
0838
0839 varargout = {c',I,emsg,imsg,msg};
0840
0841
0842
0843
0844 case 'parseistr'
0845
0846
0847
0848
0849
0850
0851
0852 str = varargin{2};
0853 mx = varargin{3};
0854
0855
0856
0857
0858 I = evalin('base',['[',str,']'],'''!''');
0859
0860 if isstr(I)
0861 varargout = {'!',0,[str,' <- !evaluation error'],''};
0862 return
0863 end
0864
0865
0866
0867 ok = ismember(I(:)',[1:mx]);
0868 iX0 = I(ok);
0869
0870
0871
0872 str = ''; msg='';
0873 if any(ok)
0874 str = strvcat(str,num2str(I(ok)));
0875 msg = strvcat(msg,' <- (OK)');
0876 end
0877 tmp = ( I<1 | I>mx );
0878 if any(tmp)
0879 str = strvcat(str,num2str(I(tmp)));
0880 msg = strvcat(msg,sprintf(' <- (ignored - not in [1:%d]',mx));
0881 end
0882 tmp = ( ~tmp & ~ok );
0883 if any(tmp)
0884 str = strvcat(str,num2str(I(tmp)));
0885 msg = strvcat(msg,' <- (ignored - non-integer)');
0886 end
0887
0888
0889
0890 varargout = {iX0,1,'',cellstr([str,msg])};
0891
0892
0893
0894 case 'reset_cb'
0895
0896
0897
0898 hConList = findobj(gcbf,'Tag','ConList');
0899 STAT = get(findobj(gcbf,'Tag','TFA','Value',1),'UserData');
0900
0901 ui_get_contrasts(D,'ListCon',hConList,STAT,[])
0902
0903
0904
0905 case 'd_setup_cb'
0906
0907
0908
0909 F = gcbf;
0910 STAT = get(findobj(F,'Tag','TFA','Value',1),'UserData');
0911 STATmode = get(findobj(F,'Tag','STATmode'),'UserData');
0912
0913 set(F,'UIContextMenu',[])
0914 H = get(findobj(F,'Tag','DefineNew'),'UserData');
0915 set(findobj(H,'flat','Tag','D_name'),'String','')
0916
0917 set(H,'Visible','on')
0918 ui_get_contrasts(D, 'D_TF',F,STAT,STATmode);
0919
0920
0921
0922 case {'d_conmtx_cb','d_x1cols_cb'}
0923
0924
0925
0926
0927 fcn = find(strcmp(lower(varargin{1}),{'d_conmtx_cb','d_x1cols_cb'}));
0928
0929 F = gcbf;
0930 h = gcbo;
0931 str = get(h,'String');
0932
0933 hD_ConMtx = findobj(F,'Tag','D_ConMtx');
0934 hD_X1cols = findobj(F,'Tag','D_X1cols');
0935
0936
0937
0938
0939 xX = get(findobj(F,'Tag','DesMtxAx'),'UserData');
0940 STAT = get(findobj(F,'Tag','D_TF','Value',1),'UserData');
0941
0942
0943 if fcn==1
0944
0945
0946 set(hD_X1cols,'String','')
0947 [c,I,emsg,imsg] = ui_get_contrasts(D, 'ParseCon',str,xX.xKXs,STAT);
0948 if all(I)
0949 DxCon = spm_FcUtil('Set','',STAT,'c',c,xX.xKXs);
0950 else
0951 DxCon = [];
0952 end
0953
0954 elseif fcn==2
0955
0956 set(hD_ConMtx,'String','')
0957
0958 nPar = spm_SpUtil('size',xX.xKXs,2);
0959 [iX0,I,emsg,imsg] = ui_get_contrasts(D, 'ParseIStr',str,nPar);
0960
0961 if I
0962 try
0963 DxCon = spm_FcUtil('Set','',STAT,'iX0',iX0,xX.xKXs);
0964 if STAT=='T' & size(DxCon.c,2)>1
0965 I = 0; emsg = {'! t-contrasts must be vectors'};
0966 end
0967 catch
0968 I = 0;
0969 emsg = lasterr;
0970 end
0971 end
0972 end
0973
0974
0975
0976
0977 set(findobj(F,'Tag','D_ConErrs'),'String',emsg,'Value',[])
0978 set(findobj(F,'Tag','D_ConInfo'),'String',imsg,'Value',[])
0979 if all(I)
0980 set(hD_ConMtx,'UserData',DxCon);
0981 ui_get_contrasts(D, 'GraphCons',DxCon,-1,F)
0982 else
0983 set(hD_ConMtx,'UserData',[]);
0984 ui_get_contrasts(D, 'GraphCons',[],[],F)
0985 end
0986 ui_get_contrasts(D, 'D_Status',F)
0987
0988
0989
0990 case 'd_reset_cb'
0991
0992
0993
0994 STAT = get(findobj(gcbf,'Tag','TFA','Value',1),'UserData');
0995 set(findobj(gcbf,'Tag','D_name'),'String','')
0996 set(findobj(gcbf,'Tag','D_ConMtx'),'UserData',[])
0997 ui_get_contrasts(D, 'D_TF',gcbf,STAT);
0998
0999
1000
1001 case 'd_cancel_cb'
1002
1003
1004
1005 set(get(findobj(gcbf,'Tag','DefineNew'),'UserData'),'Visible','off')
1006 set(gcbf,'UIContextMenu',findobj(gcbf,'Tag','mConMan_ConMen'))
1007 ui_get_contrasts(D, 'StatusLine')
1008
1009
1010
1011 case 'd_ok_cb'
1012
1013
1014
1015 F = gcbf;
1016
1017 name = get(findobj(F,'Tag','D_name'),'String');
1018 DxCon = get(findobj(F,'Tag','D_ConMtx'),'UserData');
1019 STAT = get(findobj(F,'Tag','D_TF','Value',1),'UserData');
1020
1021 dNam = ~isempty(name);
1022 dCon = ~isempty(DxCon);
1023
1024 if ~(dNam & dCon)
1025 spm('Beep')
1026 str = { 'contrast name not defined!','',...
1027 'no valid contrast defined!',''};
1028 msgbox(str([dNam+1,dCon+3]),...
1029 sprintf('%s%s: %s...',spm('ver'),...
1030 spm('GetUser',' (%s)'),mfilename),'error','modal')
1031 return
1032 end
1033
1034
1035
1036
1037 DxCon.name = name;
1038 if ~strcmp(DxCon.STAT,STAT), error('STAT & DxCon.STAT mismatch!'), end
1039 if isempty(xCon)
1040 xCon = DxCon;
1041 else
1042 xCon = [xCon, DxCon];
1043 end
1044 D = set_contrasts(D, xCon, 0);
1045 sf_SetD(D, 1, F);
1046
1047
1048
1049
1050 hConList = findobj(F,'Tag','ConList');
1051 I = length(xCon);
1052
1053
1054
1055
1056
1057
1058
1059 ui_get_contrasts(D, 'TFA',F,xCon(end).STAT);
1060 ui_get_contrasts(D, 'ListCon',hConList,xCon(end).STAT,I)
1061
1062
1063
1064 set(get(findobj(gcbf,'Tag','DefineNew'),'UserData'),'Visible','off')
1065 set(gcbf,'UIContextMenu',findobj(gcbf,'Tag','mConMan_ConMen'))
1066
1067
1068
1069 case 'd_status'
1070
1071
1072
1073 if nargin<3, F=gcbf; else, F=varargin{2}; end
1074 str = {' not',''};
1075 dNam = ~isempty(get(findobj(F,'Tag','D_name'),'String'));
1076 dCon = ~isempty(get(findobj(F,'Tag','D_ConMtx'),'UserData'));
1077 if dNam & dCon, ok='on'; col='g'; else, ok='off'; col='w'; end
1078 ui_get_contrasts(D, 'StatusLine',F,...
1079 sprintf('name%s defined, contrast%s defined',str{dNam+1},str{dCon+1}),...
1080 col)
1081
1082
1083
1084
1085 case 'createfig'
1086
1087
1088
1089
1090 cF = get(0,'CurrentFigure');
1091
1092
1093
1094 cb = 'conD = get(findobj(''Tag'', ''mConMan''),''UserData''); ';
1095
1096
1097
1098 WS = spm('WinScale');
1099 FS = spm('FontSizes');
1100 PF = spm_platform('fonts');
1101 S0 = get(0,'ScreenSize');
1102
1103 F = figure('IntegerHandle','off',...
1104 'Tag','mConMan',...
1105 'Name','SPM contrast manager','NumberTitle','off',...
1106 'Position',[S0(3)/2,S0(4)/2,0,0] + [-250,-200,500,400].*WS,...
1107 'Resize','off',...
1108 'Color',[1 1 1]*.7,...
1109 'MenuBar','none',...
1110 'DefaultTextColor','k',...
1111 'DefaultTextFontName',PF.helvetica,...
1112 'DefaultTextFontSize',FS(10),...
1113 'DefaultAxesFontName',PF.helvetica,...
1114 'DefaultUicontrolBackgroundColor',[1 1 1]*.7,...
1115 'DefaultUicontrolFontName',PF.helvetica,...
1116 'DefaultUicontrolFontSize',FS(10),...
1117 'DefaultUicontrolInterruptible','on',...
1118 'Colormap',gray(64),...
1119 'Renderer','painters',...
1120 'Visible','off');
1121
1122
1123
1124 hPrompt = uicontrol(F,'Style','Text','Tag','Prompt','UserData',[],...
1125 'String','<Prompt not set yet>',...
1126 'FontName',PF.times,...
1127 'FontWeight','Bold',...
1128 'FontAngle','Italic',...
1129 'FontSize',FS(16),...
1130 'ForegroundColor','k',...
1131 'BackgroundColor',[1,1,1]*.7,...
1132 'HorizontalAlignment','Center',...
1133 'Position',[020 370 280 025].*WS);
1134
1135
1136
1137
1138 hSTATmode = uicontrol(F,'Style','Frame','Tag','STATmode',...
1139 'Position',[040 340 260 028].*WS);
1140 uicontrol(F,'Style','Text','String','show',...
1141 'FontName',PF.times,'FontAngle','Italic','FontSize',FS(8),...
1142 'ForegroundColor','w',...
1143 'Position',[045 365 030 010].*WS);
1144 hT = uicontrol(F,'Style','RadioButton','String','t-contrasts','Tag','TFA',...
1145 'ToolTipString','...to show only contrasts for SPM{t}',...
1146 'FontSize',FS(9),...
1147 'ForegroundColor','k',...
1148 'UserData','T',...
1149 'Position',[044 343 105 020].*WS);
1150 hF = uicontrol(F,'Style','RadioButton','String','F-contrasts','Tag','TFA',...
1151 'ToolTipString','...to show only contrasts for SPM{F}',...
1152 'FontSize',FS(9),...
1153 'ForegroundColor','k',...
1154 'UserData','F',...
1155 'Position',[149 343 105 020].*WS);
1156 hA = uicontrol(F,'Style','RadioButton','String','all','Tag','TFA',...
1157 'ToolTipString','...to show all defined contrasts',...
1158 'FontSize',FS(9),...
1159 'ForegroundColor','k',...
1160 'UserData','',...
1161 'Position',[254 343 041 020].*WS);
1162 set([hT,hF,hA],'CallBack',[cb 'ui_get_contrasts(conD, ''TFA'');'],...
1163 'Interruptible','off','BusyAction','Queue')
1164
1165
1166
1167
1168
1169 uicontrol(F,'Style','Text','Tag','ConListHdr',...
1170 'String','### {type} : name',...
1171 'FontSize',FS(8),'FontAngle','Italic',...
1172 'HorizontalAlignment','Left',...
1173 'BackgroundColor','w',...
1174 'Position',[042 320 256 016].*WS);
1175
1176 hConList = uicontrol(F,'Style','ListBox','Tag','ConList',...
1177 'ToolTipString',['Select contrast(s) - drag/shift-click',...
1178 '/ctrl-click to select multiple contrasts'],...
1179 'String',{'list','not','set','yet'},...
1180 'Max',2,...
1181 'CallBack',[cb 'ui_get_contrasts(conD, ''ConList_CB'')'],...
1182 'Interruptible','off','BusyAction','Queue',...
1183 'BackgroundColor','w',...
1184 'Position',[040 080 260 240].*WS);
1185
1186
1187
1188
1189 hNew = uicontrol(F,'Style','Pushbutton','String','Define new contrast...',...
1190 'Tag','New',...
1191 'ToolTipString','define new contrast',...
1192 'ForegroundColor','b',...
1193 'Callback',[cb 'ui_get_contrasts(conD, ''D_Setup_CB'')'],...
1194 'Enable','on',...
1195 'Position',[040 050 150 022].*WS);
1196
1197 uicontrol(F,'Style','Pushbutton','String','Reset',...
1198 'ToolTipString','reset selection',...
1199 'ForegroundColor','r',...
1200 'Callback',[cb 'ui_get_contrasts(conD, ''Reset_CB'')'],...
1201 'Position',[195 050 050 022].*WS);
1202
1203 uicontrol(F,'Style','Pushbutton','String','Done',...
1204 'ToolTipString','done - press when selected contrast(s)',...
1205 'ForegroundColor','m',...
1206 'Tag','Done','UserData',1,...
1207 'Callback',[cb 'ui_get_contrasts(conD, ''Done_CB'')'],...
1208 'Interruptible','off','BusyAction','Cancel',...
1209 'Position',[250 050 050 022].*WS);
1210
1211 uicontrol(F,'Style','Frame','Tag','StatusArea',...
1212 'Position',[010 010 480 030].*WS);
1213
1214 if exist('spm_help.m')==2
1215 uicontrol(F,'Style','Pushbutton','String','?',...
1216 'ToolTipString','help on contrasts and the contrast manager',...
1217 'ForegroundColor','g',...
1218 'Callback','spm_help(''spm_conman.m'')',...
1219 'Position',[460 015 020 020].*WS);
1220 end
1221
1222 hStatLin = uicontrol(F,'Style','Text','Tag','StatusLine',...
1223 'String','<Not set yet>',...
1224 'FontAngle','Italic',...
1225 'HorizontalAlignment','Center',...
1226 'ForegroundColor','w',...
1227 'Position',[020 015 430 020].*WS);
1228
1229
1230
1231
1232 hDesMtxAx = axes('Parent',F,'Tag','DesMtxAx',...
1233 'Position',[0.65 0.30 0.30 0.40],...
1234 'Color','w',...
1235 'Box','on','XTick',[],'YTick',[]);
1236
1237 hParEstAx = axes('Parent',F,'Tag','ParEstAx',...
1238 'Position',[0.65 0.18 0.30 0.05],...
1239 'Color','w',...
1240 'Box','on','XTick',[],'YTick',[]);
1241
1242
1243
1244
1245 h = uicontextmenu('Tag','mConMan_ConMen');
1246 set(F,'UIContextMenu',h)
1247 uimenu(h,'Label','Define new contrast...',...
1248 'Tag','CM_New',...
1249 'CallBack',[cb 'ui_get_contrasts(conD, ''D_Setup_CB'')'],...
1250 'Interruptible','off','BusyAction','Cancel');
1251 uimenu(h,'Label','Rename selected contrast...',...
1252 'Tag','CM_Ren',...
1253 'CallBack',[cb 'ui_get_contrasts(conD, ''Rename_CB'')'],...
1254 'Interruptible','off','BusyAction','Cancel');
1255 uimenu(h,'Label','Reset','Separator','on',...
1256 'CallBack',[cb 'ui_get_contrasts(conD, ''Reset_CB'')'],...
1257 'Interruptible','off','BusyAction','Cancel');
1258 uimenu(h,'Label','Done',...
1259 'CallBack',[cb 'ui_get_contrasts(conD, ''Done_CB'')'],...
1260 'Interruptible','off','BusyAction','Cancel');
1261 uimenu(h,'Label','help','Separator','on',...
1262 'CallBack','spm_help(''spm_conman'')',...
1263 'Interruptible','off','BusyAction','Cancel');
1264 uimenu(h,'Label','crash out','Separator','on',...
1265 'CallBack',[cb 'ui_get_contrasts(conD, ''Initialise'',''reset'');'],...
1266 'Interruptible','off','BusyAction','Cancel');
1267 set(h,'CallBack',[cb 'ui_get_contrasts(conD, ''FConMenu_CB'')'],...
1268 'Interruptible','off','BusyAction','Cancel');
1269
1270
1271
1272
1273 H = [];
1274
1275 h = uicontrol(F,'Style','Frame','Tag','DefineNew',...
1276 'Position',[010 045 300 350].*WS);
1277 H = [H,h];
1278 h = uicontrol(F,'Style','Text','Tag','D_Prompt','UserData',[],...
1279 'String','define contrast...',...
1280 'FontName',PF.times,...
1281 'FontWeight','Bold',...
1282 'FontAngle','Italic',...
1283 'FontSize',FS(14),...
1284 'ForegroundColor','b',...
1285 'HorizontalAlignment','Center',...
1286 'Position',[020 360 280 030].*WS);
1287 H = [H,h];
1288
1289
1290
1291 h = uicontrol(F,'Style','Frame','Position',[020 335 280 033].*WS);
1292 H = [H,h];
1293 h = uicontrol(F,'Style','Text','String','name',...
1294 'FontSize',FS(10),...
1295 'FontAngle','Italic',...
1296 'ForegroundColor','w',...
1297 'HorizontalAlignment','Center',...
1298 'Position',[025 355 045 020].*WS);
1299 H = [H,h];
1300 h = uicontrol(F,'Style','Edit','Tag','D_name',...
1301 'ToolTipString','enter name for contrast',...
1302 'HorizontalAlignment','Left',...
1303 'BackgroundColor',COLOUR,...
1304 'Callback',[cb 'ui_get_contrasts(conD, ''D_Status'')'],...
1305 'Interruptible','off',...
1306 'Position',[080 340 215 022].*WS);
1307 H = [H,h];
1308
1309
1310
1311 h = uicontrol(F,'Style','Frame','Position',[020 295 280 033].*WS);
1312 H = [H,h];
1313 h = uicontrol(F,'Style','Text','String','type',...
1314 'FontSize',FS(10),...
1315 'FontAngle','Italic',...
1316 'ForegroundColor','w',...
1317 'HorizontalAlignment','Center',...
1318 'Position',[025 315 040 020].*WS);
1319 H = [H,h];
1320
1321 hDT = uicontrol(F,'Style','RadioButton','String','t-contrast','Tag','D_TF',...
1322 'ToolTipString','...to define contrast for SPM{t}',...
1323 'FontSize',FS(9),...
1324 'ForegroundColor','k',...
1325 'UserData','T',...
1326 'Position',[080 300 105 022].*WS);
1327 hDF = uicontrol(F,'Style','RadioButton','String','F-contrast','Tag','D_TF',...
1328 'ToolTipString','...to define contrast for SPM{F}',...
1329 'FontSize',FS(9),...
1330 'ForegroundColor','k',...
1331 'UserData','F',...
1332 'Position',[190 300 105 022].*WS);
1333 set([hDT,hDF],'CallBack',[cb 'ui_get_contrasts(conD, ''D_TF'');'],...
1334 'Interruptible','off','BusyAction','Queue')
1335 H = [H,hDT,hDF];
1336
1337
1338
1339 h = uicontrol(F,'Style','Frame','Position',[020 080 280 208].*WS);
1340 H = [H,h];
1341 h = uicontrol(F,'Style','Text','String','contrast',...
1342 'FontSize',FS(10),...
1343 'FontAngle','Italic',...
1344 'ForegroundColor','w',...
1345 'HorizontalAlignment','Center',...
1346 'Position',[025 275 055 020].*WS);
1347 H = [H,h];
1348 h = uicontrol(F,'Style','Text','String','contrast',...
1349 'FontSize',FS(6),...
1350 'HorizontalAlignment','Right',...
1351 'Position',[030 255 045 008].*WS);
1352 H = [H,h];
1353 h = uicontrol(F,'Style','Text','String','weights',...
1354 'FontSize',FS(6),...
1355 'HorizontalAlignment','Right',...
1356 'Position',[030 245 045 008].*WS);
1357 H = [H,h];
1358 h = uicontrol(F,'Style','Text','String','vector','Tag','D_Ttxt',...
1359 'FontSize',FS(6),...
1360 'HorizontalAlignment','Right',...
1361 'Position',[030 235 045 008].*WS);
1362 H = [H,h];
1363 h = uicontrol(F,'Style','Text','String','matrix','Tag','D_Ftxt',...
1364 'FontSize',FS(6),...
1365 'HorizontalAlignment','Right',...
1366 'Position',[030 235 045 008].*WS);
1367 H = [H,h];
1368 h = uicontrol(F,'Style','Edit','Tag','D_ConMtx',...
1369 'ToolTipString','enter contrast',...
1370 'HorizontalAlignment','Left',...
1371 'BackgroundColor',COLOUR,...
1372 'Max',2,...
1373 'CallBack',[cb 'ui_get_contrasts(conD, ''D_ConMtx_CB'')'],...
1374 'Interruptible','off','BusyAction','Queue',...
1375 'UserData',[],...
1376 'Position',[080 200 215 082].*WS);
1377 H = [H,h];
1378 h = uicontrol(F,'Style','Text','String','or','Tag','D_Ftxt',...
1379 'FontAngle','Italic',...
1380 'FontSize',FS(6),...
1381 'HorizontalAlignment','Left',...
1382 'Position',[025 205 030 008].*WS);
1383 H = [H,h];
1384 h = uicontrol(F,'Style','Text','String','columns for','Tag','D_Ftxt',...
1385 'FontSize',FS(6),...
1386 'HorizontalAlignment','Right',...
1387 'Position',[022 190 070 008].*WS);
1388 H = [H,h];
1389 h = uicontrol(F,'Style','Text','String','reduced design','Tag','D_Ftxt',...
1390 'FontSize',FS(6),...
1391 'HorizontalAlignment','Right',...
1392 'Position',[022 180 070 008].*WS);
1393 H = [H,h];
1394 h = uicontrol(F,'Style','Edit','Tag','D_X1cols',...
1395 'ToolTipString',...
1396 'enter column indicies of reduced design matrix X0',...
1397 'HorizontalAlignment','Left',...
1398 'BackgroundColor',COLOUR,...
1399 'CallBack',[cb 'ui_get_contrasts(conD, ''D_X1cols_CB'')'],...
1400 'Interruptible','off','BusyAction','Queue',...
1401 'Position',[090 180 155 020].*WS);
1402 H = [H,h];
1403 h = uicontrol(F,'Style','Pushbutton','String','...submit',...
1404 'FontSize',FS(8),...
1405 'ForegroundColor','c',...
1406 'Position',[245 180 050 020].*WS);
1407 H = [H,h];
1408
1409
1410 h = uicontrol(F,'Style','ListBox','Tag','D_ConErrs',...
1411 'ToolTipString','contrast parsing errors',...
1412 'FontName',PF.courier,'FontSize',FS(7),...
1413 'ForegroundColor','r',...
1414 'BackgroundColor',[1 1 1]*.7,...
1415 'Enable','on','Max',2,'Value',[],...
1416 'Position',[027 127 268 042].*WS);
1417 H = [H,h];
1418 h = uicontrol(F,'Style','ListBox','Tag','D_ConInfo',...
1419 'ToolTipString','contrast parsing info',...
1420 'FontName',PF.courier,'FontSize',FS(7),...
1421 'ForegroundColor','g',...
1422 'BackgroundColor',[1 1 1]*.7,...
1423 'Enable','on','Max',2,'Value',[],...
1424 'Position',[027 085 268 042].*WS);
1425 H = [H,h];
1426
1427
1428
1429 h = uicontrol(F,'Style','Pushbutton','String','Reset',...
1430 'Tag','D_Reset',...
1431 'ToolTipString','reset definition interface',...
1432 'ForegroundColor','b',...
1433 'Callback',[cb 'ui_get_contrasts(conD, ''D_Reset_CB'')'],...
1434 'Interruptible','off','BusyAction','Cancel',...
1435 'Position',[140 053 050 022].*WS);
1436 H = [H,h];
1437 h = uicontrol(F,'Style','Pushbutton','String','Cancel',...
1438 'Tag','D_Cancel',...
1439 'ToolTipString','cancel contrast definition',...
1440 'ForegroundColor','r',...
1441 'Callback',[cb 'ui_get_contrasts(conD, ''D_Cancel_CB'')'],...
1442 'Interruptible','off','BusyAction','Cancel',...
1443 'Position',[195 053 050 022].*WS);
1444 H = [H,h];
1445 h = uicontrol(F,'Style','Pushbutton','String','OK',...
1446 'Tag','D_OK',...
1447 'ToolTipString','OK - press to accept newly defined contrast',...
1448 'ForegroundColor','m',...
1449 'Callback',[cb 'ui_get_contrasts(conD, ''D_OK_CB'')'],...
1450 'Interruptible','off','BusyAction','Cancel',...
1451 'Position',[250 053 050 022].*WS);
1452 H = [H,h];
1453 set(findobj(H,'flat','Tag','DefineNew'),'UserData',H)
1454
1455
1456
1457
1458 set(0,'CurrentFigure',cF)
1459 varargout = {F,struct( 'hConList', hConList,...
1460 'hDesMtxAx', hDesMtxAx,...
1461 'hParEstAx', hParEstAx,...
1462 'hPrompt', hPrompt,...
1463 'hSTATmode', hSTATmode,...
1464 'hStatLin', hStatLin,...
1465 'hNew', hNew )};
1466
1467
1468
1469 otherwise
1470
1471 error(['Illegal Action string: ',varargin{1}])
1472
1473
1474
1475 end
1476 return
1477
1478
1479
1480
1481
1482
1483 function sf_ImDesMtx(xX, h)
1484
1485
1486 axes(h)
1487 if isfield(xX,'nKX') & ~isempty(xX.nKX)
1488 hDesMtxIm = image((xX.nKX+1)*32);
1489 else
1490 hDesMtxIm = image(...
1491 (spm_DesMtx('sca',xX.xKXs.X,xX.name)+1)*32);
1492 end
1493 set(h,'YTick',[],'XTick',[])
1494 set(h,'Tag','DesMtxAx','UserData',xX)
1495 xlabel('Design matrix')
1496 set(hDesMtxIm,'UserData',...
1497 struct('X',xX.xKXs.X,'Xnames',{xX.name}))
1498 set(hDesMtxIm,'ButtonDownFcn','spm_DesRep(''SurfDesMtx_CB'')')
1499 return
1500
1501 function sf_ImParEst(xX, h)
1502
1503
1504 axes(h)
1505 est = spm_SpUtil('IsCon',xX.xKXs);
1506 nPar = length(est);
1507
1508 hParEstIm = image((est+1)*32);
1509 set(h, 'XLim',[0,nPar]+.5,'XTick',[1:nPar-1]+.5,'XTickLabel','',...
1510 'YLim',[0,1]+.5,'YDir','reverse','YTick',[],...
1511 'Box','on','TickDir','in','XGrid','on','GridLineStyle','-');
1512 xlabel('parameter estimability')
1513 set(h,'Tag','ParEstAx')
1514 set(hParEstIm,'UserData',struct('est',est,'Xnames',{xX.name}))
1515 set(hParEstIm,'ButtonDownFcn','spm_DesRep(''SurfEstIm_CB'')')
1516 return
1517
1518 function sf_SetD(D, changef, F)
1519
1520 if nargin < 2, changef = 0; end
1521 if nargin < 3, F = get(findobj('Tag', 'mConMan'),'UserData'); end
1522
1523 hD_Reset = findobj(F,'Tag','D_Reset');
1524 set(F, 'UserData', D);
1525 set(hD_Reset, 'UserData', changef);
1526 return
1527