Home > rest_20090422 > rest_spm5_files > nic_spm_hrf.m

nic_spm_hrf

PURPOSE ^

returns a hemodynamic response function

SYNOPSIS ^

function [hrf,p] = nic_spm_hrf(RT,P);

DESCRIPTION ^

 returns a hemodynamic response function
 FORMAT [hrf,p] = spm_hrf(RT,[p]);
 RT   - scan repeat time
 p    - parameters of the response function (two gamma functions)

                            defaults
                            (seconds)
    p(1) - delay of response (relative to onset)       6
    p(2) - delay of undershoot (relative to onset)    16
    p(3) - dispersion of response               1
    p(4) - dispersion of undershoot               1
    p(5) - ratio of response to undershoot           6
    p(6) - onset (seconds)                   0
    p(7) - length of kernel (seconds)          32

 hrf  - hemodynamic response function
 p    - parameters of the response function
_______________________________________________________________________
 @(#)spm_hrf.m    2.8 Karl Friston 02/07/31

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

nic_spm_hrf.m

SOURCE CODE ^

0001 function [hrf,p] = nic_spm_hrf(RT,P);
0002 % returns a hemodynamic response function
0003 % FORMAT [hrf,p] = spm_hrf(RT,[p]);
0004 % RT   - scan repeat time
0005 % p    - parameters of the response function (two gamma functions)
0006 %
0007 %                            defaults
0008 %                            (seconds)
0009 %    p(1) - delay of response (relative to onset)       6
0010 %    p(2) - delay of undershoot (relative to onset)    16
0011 %    p(3) - dispersion of response               1
0012 %    p(4) - dispersion of undershoot               1
0013 %    p(5) - ratio of response to undershoot           6
0014 %    p(6) - onset (seconds)                   0
0015 %    p(7) - length of kernel (seconds)          32
0016 %
0017 % hrf  - hemodynamic response function
0018 % p    - parameters of the response function
0019 %_______________________________________________________________________
0020 % @(#)spm_hrf.m    2.8 Karl Friston 02/07/31
0021 
0022 % global parameter
0023 %-----------------------------------------------------------------------
0024 global defaults
0025 if ~isempty(defaults),
0026     fMRI_T = defaults.stats.fmri.t;
0027 else,
0028     fMRI_T = 16;
0029 end;
0030 
0031 % default parameters
0032 %-----------------------------------------------------------------------
0033 p     = [6 16 1 1 6 0 32];
0034 if nargin > 1
0035       p(1:length(P)) = P;
0036 end
0037 
0038 % modelled hemodynamic response function - {mixture of Gammas}
0039 %-----------------------------------------------------------------------
0040 dt    = RT/fMRI_T;
0041 u     = [0:(p(7)/dt)] - p(6)/dt;
0042 hrf   = nic_spm_Gpdf(u,p(1)/p(3),dt/p(3)) - nic_spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5);
0043 hrf   = hrf([0:(p(7)/RT)]*fMRI_T + 1);
0044 hrf   = hrf'/sum(hrf);

Generated on Wed 29-Apr-2009 01:06:38 by m2html © 2005