Home > functions > estimation > bayes > vb_focal_leadfield_preparation.m

vb_focal_leadfield_preparation

PURPOSE ^

Prepare leadfield of focal and global window

SYNOPSIS ^

function [nG_focal, ix_focal, ix_focal_ex, W_focal, L_focal, bsnorm]= vb_focal_leadfield_preparation(bayes_parm, bsnorm)

DESCRIPTION ^

 Prepare leadfield of focal and global window

 -- Output
 nG_focal    : normalized leadfield of focal window
 bsnorm      : normalizing constant
 
 ix_focal    : vertex indices of focal window
 ix_focal_ex : vertex indices of expandend focal window
 W_focal     : spatial smoothing matrix of focal window
 L_focal     : number of dipole orientation of focal window

 2005/08/16 O.Yamashita
 2005/08/22 O.Yamshita ver.30b
 2006/03/03 Taku Yoshioka, Support patch size normalization
 2006/08/25 M. Sato sepalate leadfield_preparation to focal & global

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [nG_focal, ix_focal, ix_focal_ex, W_focal, L_focal, bsnorm] ...
0002     = vb_focal_leadfield_preparation(bayes_parm, bsnorm)
0003 % Prepare leadfield of focal and global window
0004 %
0005 % -- Output
0006 % nG_focal    : normalized leadfield of focal window
0007 % bsnorm      : normalizing constant
0008 %
0009 % ix_focal    : vertex indices of focal window
0010 % ix_focal_ex : vertex indices of expandend focal window
0011 % W_focal     : spatial smoothing matrix of focal window
0012 % L_focal     : number of dipole orientation of focal window
0013 %
0014 % 2005/08/16 O.Yamashita
0015 % 2005/08/22 O.Yamshita ver.30b
0016 % 2006/03/03 Taku Yoshioka, Support patch size normalization
0017 % 2006/08/25 M. Sato sepalate leadfield_preparation to focal & global
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 if ~isfield(bayes_parm, 'patch_norm')
0023     bayes_parm.patch_norm = ON;
0024 end
0025 
0026 % fields of 'bayes_parm' used in this function
0027 vb_struct2vars(bayes_parm,{'brainfile', 'areafile', 'reduce', 'Rfilt', ...
0028     'expand_spatial_filter', 'basisfile', 'area_key', 'patch_norm'});
0029 
0030 %% Leadfield matrix of focal window
0031 fprintf('--- Lead field matrix of focal window \n');
0032 [G_focal, L_focal, W_focal, ix_focal, ix_focal_ex] = vb_prepare_leadfield(...
0033     basisfile, brainfile, areafile, area_key, reduce, ...
0034     Rfilt, expand_spatial_filter, patch_norm);
0035 
0036 Nsession = length(G_focal);  % Number of sessions
0037 
0038 %% leadfield normalization
0039 if ~exist('bsnorm','var') | isempty(bsnorm)
0040     Bnorm = zeros(Nsession,1);
0041     
0042     for n = 1: Nsession
0043         GG_focal = sum(G_focal{n}.^2, 2);
0044         Bnorm(n) = sum(GG_focal)/length(GG_focal); 
0045     end
0046 
0047     % Normalization constant of lead fields
0048     bsnorm = sqrt(mean(Bnorm)); 
0049 end
0050 
0051 % Normalization of lead fields
0052 for n=1:Nsession
0053   nG_focal{n} = G_focal{n}/bsnorm;
0054 end;
0055

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005