EEG potential for dipoles in multilayer spherical model eeg = vb_eeg_multi_shell(P, Q, Robs, R, sigma) INPUTS P : current dipole position (in meters) ( NP x 3 ) Q : current dipole moment (direction) ( NP x 3 ) Robs : EEG sensors (in meters) on the scalp ( NS x 3 ) R : Radii of sphere from innermost to outermost ( NL x 1 ) sigma: Conductivity from innermost to outermost ( NL x 1 ) NJ : # of Berg Dipoles (Default: 3) OUTPUT eeg : EEG Lead field matrix ( NP x NS ) Single Dipole in a multilayer sphere can be approximated by multiple dipoles in a single shell. Z. Zhang, Phys. Med. Biol., vol.40, pp. 335-349, 1995. Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function eeg = vb_eeg_multi_shell(P, Q, Robs, R, sigma, NJ) 0002 % EEG potential for dipoles in multilayer spherical model 0003 % eeg = vb_eeg_multi_shell(P, Q, Robs, R, sigma) 0004 % INPUTS 0005 % P : current dipole position (in meters) ( NP x 3 ) 0006 % Q : current dipole moment (direction) ( NP x 3 ) 0007 % Robs : EEG sensors (in meters) on the scalp ( NS x 3 ) 0008 % R : Radii of sphere from innermost to outermost ( NL x 1 ) 0009 % sigma: Conductivity from innermost to outermost ( NL x 1 ) 0010 % NJ : # of Berg Dipoles (Default: 3) 0011 % 0012 % OUTPUT 0013 % eeg : EEG Lead field matrix ( NP x NS ) 0014 % 0015 % Single Dipole in a multilayer sphere can be approximated 0016 % by multiple dipoles in a single shell. 0017 % Z. Zhang, Phys. Med. Biol., vol.40, pp. 335-349, 1995. 0018 % 0019 % 0020 % Copyright (C) 2011, ATR All Rights Reserved. 0021 % License : New BSD License(see VBMEG_LICENSE.txt) 0022 0023 NL = length(R); % # of sphere layers 0024 NV = size(P,1); % # of dipoles 0025 Nobs = size(Robs,1); % # of EEG sensors 0026 0027 sigmaL = sigma(NL); % Conductivity in outermost sphere 0028 eeg = zeros(NV,Nobs); % EEG Lead field matrix 0029 0030 if NL==1, 0031 for n=1:Nobs 0032 Rn = Robs(n,:); % n-th EEG sensor position 0033 eeg(:,n) = vb_eeg_one_shell(P, Q, Rn, sigmaL); 0034 end 0035 0036 return 0037 end 0038 0039 if nargin < 6 0040 % Default # of Berg dipoles 0041 NJ=3; 0042 end 0043 0044 % mu: Berg radial factors ( NJ x 1 ) 0045 % lam: Berg magnitude factors ( NJ x 1 ) 0046 [mu,lam] = vb_berg_param(R, sigma, NJ); 0047 0048 for n=1:Nobs 0049 Rn = Robs(n,:); % n-th EEG sensor position 0050 eeg0 = zeros(NV,1); 0051 0052 % Approximation by NJ dipoles in a single shell 0053 for j=1:NJ 0054 eeg0 = eeg0 + vb_eeg_one_shell(mu(j)*P, lam(j)*Q, Rn, sigmaL); 0055 end; 0056 0057 eeg(:,n) = eeg0; 0058 end 0059