Home > marsbar > @mardo_5 > private > pr_spm_hrf.m

pr_spm_hrf

PURPOSE ^

returns a hemodynamic response function

SYNOPSIS ^

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

DESCRIPTION ^

 returns a hemodynamic response function
 FORMAT [hrf,p] = pr_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
_______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [hrf,p] = pr_spm_hrf(RT,P);
0002 % returns a hemodynamic response function
0003 % FORMAT [hrf,p] = pr_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 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0021 
0022 % Karl Friston
0023 % $Id: spm_hrf.m 387 2005-12-17 18:31:23Z klaas $
0024 
0025 
0026 % global parameter
0027 %-----------------------------------------------------------------------
0028 global defaults
0029 try
0030     fMRI_T = defaults.stats.fmri.t;
0031 catch
0032     fMRI_T = 16;
0033 end;
0034 
0035 % default parameters
0036 %-----------------------------------------------------------------------
0037 p     = [6 16 1 1 6 0 32];
0038 if nargin > 1
0039       p(1:length(P)) = P;
0040 end
0041 
0042 % modelled hemodynamic response function - {mixture of Gammas}
0043 %-----------------------------------------------------------------------
0044 dt    = RT/fMRI_T;
0045 u     = [0:(p(7)/dt)] - p(6)/dt;
0046 hrf   = pr_spm_gpdf(u,p(1)/p(3),dt/p(3)) - pr_spm_gpdf(u,p(2)/p(4),dt/p(4))/p(5);
0047 hrf   = hrf([0:(p(7)/RT)]*fMRI_T + 1);
0048 hrf   = hrf'/sum(hrf);

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019