Home > vbmeg > functions > estimation > bayes > vb_global_leadfield_preparation.m

vb_global_leadfield_preparation

PURPOSE ^

Prepare leadfield of focal and global window

SYNOPSIS ^

function [nG_global, bsnorm, ix_global, ix_global_ex, W_global, L_global]= vb_global_leadfield_preparation(bayes_parm, bsnorm, remove_area)

DESCRIPTION ^

 Prepare leadfield of focal and global window

 -- Output
 nG_global   : normalized leadfield of global window
 bsnorm      : normalizing constant

 ix_global    : vertex indices of global window
 ix_global_ex : vertex indices of expandend global window
 W_global     : spatial smoothing matrix of global window
 L_global     : number of dipole orientation of global 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_global, bsnorm, ix_global, ix_global_ex, W_global, L_global]...
0002     = vb_global_leadfield_preparation(bayes_parm, bsnorm, remove_area)
0003 % Prepare leadfield of focal and global window
0004 %
0005 % -- Output
0006 % nG_global   : normalized leadfield of global window
0007 % bsnorm      : normalizing constant
0008 %
0009 % ix_global    : vertex indices of global window
0010 % ix_global_ex : vertex indices of expandend global window
0011 % W_global     : spatial smoothing matrix of global window
0012 % L_global     : number of dipole orientation of global 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,{'basisfile_global','area_key_global', ...
0028    'reduce_global', 'Rfilt_global','brainfile','areafile', ...
0029    'expand_spatial_filter',  'area_key','patch_norm', 'basis_smoother'});
0030 
0031 %% Leadfield matrix of global window
0032 fprintf('--- Lead field matrix of global window \n');
0033 if exist('remove_area','var') & remove_area == ON,
0034     % Remove focal area from global area
0035     [G_global, L_global, W_global, ix_global, ix_global_ex] = ...
0036         vb_prepare_leadfield(basisfile_global, brainfile, areafile,...
0037         area_key_global, reduce_global, Rfilt_global, expand_spatial_filter,...
0038         patch_norm, area_key, basis_smoother);
0039 else
0040     [G_global, L_global, W_global, ix_global, ix_global_ex] = ...
0041         vb_prepare_leadfield(basisfile_global, brainfile, areafile,...
0042         area_key_global, reduce_global, Rfilt_global, expand_spatial_filter,...
0043         patch_norm, [], basis_smoother);
0044 end
0045 
0046 Nsession = length(G_global);  % Number of sessions
0047 
0048 %% leadfield normalization
0049 if ~exist('bsnorm','var') | isempty(bsnorm)
0050     Bnorm = zeros(Nsession,1);
0051     
0052     for n = 1: Nsession
0053         GG_global = sum(G_global{n}.^2, 2);
0054         Bnorm(n)  = sum(GG_global)/length(GG_global); 
0055     end
0056 
0057     % Normalization constant of lead fields
0058     bsnorm = sqrt(mean(Bnorm)); 
0059 end
0060 
0061 for n=1:Nsession
0062   nG_global{n} = G_global{n}/bsnorm;
0063 end;
0064

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005