0001 function ui_report_fmri(D,s,i)
0002
0003
0004
0005
0006
0007
0008
0009
0010 SPM = des_struct(D);
0011 Sess = SPM.Sess;
0012
0013
0014
0015 for j = 1:length(Sess)
0016 if ~length(Sess(j).U)
0017 spm('alert*','User-specifed regressors only!',mfilename,sqrt(-1));
0018 return
0019 end
0020 end
0021
0022
0023
0024 if nargin < 3
0025 s = 1;
0026 i = 1;
0027
0028
0029
0030 Finter = spm_figure('GetWin','Interactive');
0031 delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI'))
0032
0033
0034
0035 hC = uimenu(Finter,'Label','Explore fMRI design',...
0036 'Separator','on',...
0037 'Tag','DesRepUI',...
0038 'UserData',D,...
0039 'HandleVisibility','on');
0040 for j = 1:length(Sess)
0041 h = uimenu(hC,'Label',sprintf('Session %.0f ',j),...
0042 'HandleVisibility','off');
0043 for k = 1:length(Sess(j).Fc)
0044 cb = ['tmp = get(get(gcbo,''UserData''),',...
0045 '''UserData''); ',...
0046 sprintf(['ui_report_fmri(',...
0047 'tmp,%d,%d);'],j,k)];
0048 uimenu(h,'Label',Sess(j).Fc(k).name,...
0049 'CallBack',cb,...
0050 'UserData',hC,...
0051 'HandleVisibility','off')
0052 end
0053 end
0054 end
0055
0056
0057
0058
0059
0060
0061
0062 Fgraph = spm_figure('GetWin','Graphics');
0063 spm_results_ui('Clear',Fgraph,0)
0064
0065
0066
0067
0068 sX = SPM.xX.X(Sess(s).row,Sess(s).col);
0069 rX = sX(:,Sess(s).Fc(i).i);
0070 subplot(2,2,1)
0071 plot(Sess(s).row,rX)
0072 xlabel('scan')
0073 ylabel('regressor[s]')
0074 title({'Time domain',['regressors for ' Sess(s).Fc(i).name]})
0075 grid on
0076 axis tight
0077
0078
0079
0080 subplot(2,2,2)
0081 gX = abs(fft(rX)).^2;
0082 gX = gX*diag(1./sum(gX));
0083 q = size(gX,1);
0084 Hz = [0:(q - 1)]/(q*SPM.xY.RT);
0085 q = 2:fix(q/2);
0086 plot(Hz(q),gX(q,:))
0087 patch([0 1 1 0]/128,[0 0 1 1]*max(max(gX)),[1 1 1]*.9)
0088 xlabel('Frequency (Hz)')
0089 ylabel('relative spectral density')
0090 title({'Frequency domain','128 second High-pass filter'})
0091 grid on
0092 axis tight
0093
0094
0095
0096
0097 if length(Sess(s).U) >= i
0098
0099
0100
0101 subplot(2,2,3)
0102 dt = Sess(s).U(i).dt;
0103 RT = SPM.xY.RT;
0104 t = [1:size(SPM.xBF.bf,1)]*dt;
0105 pst = Sess(s).U(i).pst;
0106 plot(t,SPM.xBF.bf,pst,0*pst,'.','MarkerSize',16)
0107 str = sprintf('TR = %0.2fsecs',RT);
0108 xlabel({'time (secs)' str sprintf('%0.0fms time bins',1000*dt)})
0109 title({'Basis set and peristimulus sampling' SPM.xBF.name})
0110 axis tight
0111 grid on
0112
0113
0114
0115 for p = 1:length(Sess(s).U(i).P)
0116
0117 if Sess(s).U(i).P(p).h
0118
0119
0120
0121 subplot(2,2,4)
0122 ons = Sess(s).U(i).ons;
0123 plot(ons,Sess(s).U(i).P(p).P,'.','MarkerSize',8)
0124 xlabel('time {secs}')
0125 title('parameters')
0126 grid on
0127 hold on
0128
0129 end
0130 end
0131 end
0132
0133
0134
0135 figure(Fgraph);