Home > fmri > utils > spike_report.m

spike_report

PURPOSE ^

spike_report(info, outdata_root);

SYNOPSIS ^

function spike_report(info, outdata_root)

DESCRIPTION ^

 spike_report(info, outdata_root);

 Writes spike detection summary data to screen and plots timeseries with
 labelled spikes to a postscript file

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function spike_report(info, outdata_root)
0002 % spike_report(info, outdata_root);
0003 %
0004 % Writes spike detection summary data to screen and plots timeseries with
0005 % labelled spikes to a postscript file
0006 %
0007 
0008 % 04/07/01 Petr Janata
0009 
0010 if nargin < 1
0011   error('No spike info structure present: run SPIKE_CHECK first')
0012 end
0013 
0014 if nargin < 2
0015   outdata_root = './';
0016 end
0017 
0018 fname = fullfile(outdata_root,sprintf('spikereport_%s_%s.ps', datestr(datenum(now),1), datestr(datenum(now),15)));
0019 
0020 for isub = 1:length(info)
0021   if any(info(isub).numbad)
0022     disp(sprintf('\nSPIKE WARNING: Subject %s', info(isub).id))
0023     nrun = length(info(isub).run);
0024     figure(1), clf
0025     for irun = 1:nrun
0026       if info(isub).numbad(irun)
0027     disp(sprintf('\tRun %d: %d spikes', irun, info(isub).numbad(irun)))
0028       end
0029       % Plot the data
0030       subplot(nrun,1,irun)
0031       plot(info(isub).data{irun})
0032       bi = info(isub).badidx{irun};
0033       hold on
0034       scatter(bi, ones(size(bi))*info(isub).mean(irun)+3*info(isub).std(irun),'*')
0035       
0036       if irun == nrun
0037     ylabel('Signal intensity')
0038     xlabel('Volume #')
0039       end
0040       
0041       title(sprintf('Subject: %s, Exam: %s, Series: %s, Overall EPI run: %d', info(isub).id, info(isub).exam{irun}, info(isub).series{irun}, irun))
0042     end
0043     
0044     print(gcf,'-dps','-append',fname)
0045     
0046   end
0047 end

Generated on Thu 23-May-2019 04:00:50 by m2html © 2003