0001 function ui_report_fmri(D,s,i)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 SPM = des_struct(D);
0012 xX = SPM.xX;
0013 Sess = SPM.Sess;
0014
0015
0016
0017 cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); ';
0018
0019
0020
0021 for j = 1:length(Sess)
0022 if ~length(Sess{j}.name)
0023 spm('alert*','User-specifed regressors only!',mfilename,sqrt(-1));
0024 return
0025 end
0026 end
0027
0028
0029
0030
0031 if nargin < 3
0032 s = 1;
0033 i = 1;
0034
0035
0036
0037 Finter = spm_figure('GetWin','Interactive');
0038 delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI'))
0039
0040
0041
0042 if ~isfield(xX,'nKX'), xX.nKX = spm_DesMtx('Sca',xX.X,xX.Xnames); end
0043
0044
0045
0046 hC = uimenu(Finter,'Label','Explore fMRI design',...
0047 'Separator','on',...
0048 'Tag','DesRepUI',...
0049 'UserData',D,...
0050 'HandleVisibility','on');
0051 for j = 1:length(Sess)
0052 h = uimenu(hC,'Label',sprintf('Session %.0f ',j),...
0053 'HandleVisibility','off');
0054 for k = 1:length(Sess{j}.name)
0055 cb = ['tmp = get(get(gcbo,''UserData''),',...
0056 '''UserData''); ',...
0057 sprintf(['ui_report_fmri(',...
0058 'tmp,%d,%d);'],j,k)];
0059 uimenu(h,'Label',Sess{j}.name{k},...
0060 'CallBack',cb,...
0061 'UserData',hC,...
0062 'HandleVisibility','off')
0063 end
0064 end
0065 end
0066
0067
0068
0069
0070
0071
0072
0073 Fgraph = spm_figure('GetWin','Graphics');
0074 spm_results_ui('Clear',Fgraph,0)
0075
0076
0077
0078
0079 axes('Position',[0.125,0.700,0.155,0.225])
0080 if isfield(xX,'nKX')
0081 hDesMtxIm = image(xX.nKX*32+32);
0082 else
0083 hDesMtxIm = imagesc(spm_en(xX.X));
0084 end
0085 xlabel('effect')
0086 ylabel('scan')
0087 title('Design Matrix','FontSize',16)
0088
0089
0090
0091 set(hDesMtxIm,'UserData',struct('X',xX.X,'Xnames',{xX.Xnames}))
0092 set(hDesMtxIm,'ButtonDownFcn',[cb 'ui_report(tmp, ''SurfDesMtx_CB'')'])
0093
0094
0095
0096
0097
0098 axes('Position',[0.550,0.700,0.155,0.225])
0099 sX = xX.X(Sess{s}.row,Sess{s}.col);
0100 imagesc(spm_en(sX)')
0101 set(gca,'YTick',[1:size(sX,1)])
0102 set(gca,'YTickLabel',xX.Xnames(Sess{s}.col)')
0103 title({sprintf('Session %d',s) Sess{s}.DSstr})
0104
0105
0106
0107 tmp = sqrt(sum(sX.^2));
0108 O = sX'*sX./kron(tmp',tmp);
0109 tmp = abs(sum(sX))<eps*1e5;
0110 bC = kron(tmp',tmp);
0111 tmp = 1-abs(O); tmp(logical(tril(ones(size(sX,2)),-1))) = 1;
0112 hDesO = axes('Position',[0.750,0.700,0.155,0.225]);
0113 hDesOIm = image(tmp*64);
0114 tmp = [1,1]'*[[0:size(sX,2)]+0.5];
0115 line('Xdata',tmp(1:end-1)','Ydata',tmp(2:end)')
0116 set(hDesO,'Box','off','TickDir','out',...
0117 'XaxisLocation','top','XTick',[],...
0118 'YaxisLocation','right','YTick',[],'YDir','reverse')
0119 axis square
0120 xlabel('design orthogonality')
0121 set(hDesOIm,...
0122 'UserData',struct('O',O,'bC',bC,'Xnames',{xX.Xnames}),...
0123 'ButtonDownFcn',[cb 'ui_report(tmp, ''SurfDesO_CB'')'])
0124
0125
0126
0127 rX = sX(:,Sess{s}.ind{i});
0128 axes('Position',[0.125,0.405,0.325,0.225])
0129 plot(Sess{s}.row,rX)
0130 xlabel('scan')
0131 ylabel('regressor[s]')
0132 title({['Regressors for ' Sess{s}.name{i}] })
0133 axis tight
0134
0135
0136
0137 axes('Position',[0.580,0.405,0.325,0.225])
0138 gX = abs(fft(rX)).^2;
0139 gX = gX*diag(1./sum(gX));
0140 q = size(gX,1);
0141 Hz = [0:(q - 1)]/(q*xX.RT);
0142 q = 2:fix(q/2);
0143 plot(Hz(q),gX(q,:))
0144 xlabel('Frequency (Hz)')
0145 ylabel('spectral density')
0146 title('Frequency domain')
0147 grid on
0148 axis tight
0149
0150
0151
0152
0153 if length(Sess{s}.ons) >= i
0154
0155
0156
0157 axes('Position',[0.125,0.110,0.325,0.225])
0158 t = [1:size(Sess{s}.bf{i},1)]*xX.dt;
0159 pst = Sess{s}.pst{i};
0160 plot(t,Sess{s}.bf{i},pst,0*pst,'.','MarkerSize',16)
0161 str = sprintf('TR = %0.0fsecs',xX.RT);
0162 xlabel({'time (secs)' str sprintf('%0.0fms time bins',1000*xX.dt)})
0163 title({'Basis set and peristimulus sampling' Sess{s}.BFstr})
0164 axis tight
0165 grid on
0166
0167
0168
0169 if length(Sess{s}.Pv{i})
0170
0171
0172
0173 axes('Position',[0.580,0.110,0.325,0.225])
0174 plot(Sess{s}.ons{i},Sess{s}.Pv{i},'.','MarkerSize',8)
0175 title({'trial specific parameters' Sess{s}.Pname{i}})
0176 xlabel('time (secs}')
0177 ylabel(Sess{s}.Pname{i})
0178 grid on
0179 end
0180 end
0181
0182
0183
0184 figure(Fgraph);