Home > functions > common > loadfunc > vb_load_area_basis.m

vb_load_area_basis

PURPOSE ^

get leadfield for MEG reconstraction

SYNOPSIS ^

function [sbasis] = vb_load_area_basis(proj_root,bayes_parm,ix_area)

DESCRIPTION ^

 get leadfield for MEG reconstraction
   G = vb_load_area_basis(proj_root,bayes_parm,ix_area)
 --- Input
 proj_root
 bayes_parm.basisfile{Nfile}
 bayes_parm.brainfile
 bayes_parm.patch_norm = ON or OFF
 ix_area : vertex index for leadfield calculation
 --- Output
 G{n} : leadfield for n-th session (n=1:Nsession)
      : Nsensor x (# of vertex in 'ix_area')

 - example of MEG signal reconstraction

 [Jinfo,Jact] = vb_load_current(current_file);
 G = vb_load_area_basis(proj_root, bayes_parm, Jinfo.ix_act);
 MEG = G{1} * Jact; % Nsensor x TimeSample 
 
 2007-12-25 Masa-aki Sato

 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    [sbasis] = vb_load_area_basis(proj_root,bayes_parm,ix_area)
0002 % get leadfield for MEG reconstraction
0003 %   G = vb_load_area_basis(proj_root,bayes_parm,ix_area)
0004 % --- Input
0005 % proj_root
0006 % bayes_parm.basisfile{Nfile}
0007 % bayes_parm.brainfile
0008 % bayes_parm.patch_norm = ON or OFF
0009 % ix_area : vertex index for leadfield calculation
0010 % --- Output
0011 % G{n} : leadfield for n-th session (n=1:Nsession)
0012 %      : Nsensor x (# of vertex in 'ix_area')
0013 %
0014 % - example of MEG signal reconstraction
0015 %
0016 % [Jinfo,Jact] = vb_load_current(current_file);
0017 % G = vb_load_area_basis(proj_root, bayes_parm, Jinfo.ix_act);
0018 % MEG = G{1} * Jact; % Nsensor x TimeSample
0019 %
0020 % 2007-12-25 Masa-aki Sato
0021 %
0022 % Copyright (C) 2011, ATR All Rights Reserved.
0023 % License : New BSD License(see VBMEG_LICENSE.txt)
0024 
0025 Nfile = length(bayes_parm.basisfile);
0026 basisfile = cell(Nfile,1);
0027 
0028 for n = 1:Nfile
0029     basisfile{n}  = [proj_root '/' bayes_parm.basisfile{n}];
0030 end
0031 
0032 brainfile  = [proj_root '/' bayes_parm.brainfile];
0033 patch_norm = bayes_parm.patch_norm;
0034 
0035 
0036 %%%% Patch size
0037 if patch_norm==ON, 
0038   [tmp1,tmp2,tmp3,tmp4,xxA] = vb_load_cortex(brainfile);
0039   clear tmp1 tmp2 tmp3 tmp4
0040 end
0041 
0042 % number of dipole vertex
0043 [basis,L]=vb_load_basis(basisfile{1});
0044 Nj = size(basis,1);
0045 Nv = Nj/L; 
0046 
0047 %%%% Load lead field matrix
0048 sbasis = cell(Nfile,1);
0049 
0050 for n = 1:Nfile
0051 
0052   % Load leadfield
0053   fprintf('Basis file for session %d: %s\n',n,basisfile{n});
0054   [basis,L]=vb_load_basis(basisfile{n});
0055   basis = basis';
0056   
0057   % Patch norm normalization constant
0058   if patch_norm==ON, 
0059       S = repmat(xxA(ix_area)',[size(basis,1) 1]);
0060 
0061       switch L
0062        case 1, 
0063         basis = (basis(:,ix_area).*S);
0064        case 2, 
0065         basis = [(basis(:,ix_area).*S) (basis(:,Nv+ix_area).*S)];
0066        case 3,
0067         basis = [(basis(:,ix_area).*S) (basis(:,Nv+ix_area).*S) ...
0068              (basis(:,2*Nv+ix_area).*S)];
0069       end
0070   else
0071       switch L
0072        case 1, 
0073         basis = basis(:,ix_area);
0074        case 2, 
0075         basis = [basis(:,ix_area) basis(:,Nv+ix_area)];
0076        case 3,
0077         basis = [basis(:,ix_area) basis(:,Nv+ix_area) basis(:,2*Nv+ix_area)];
0078       end
0079   end
0080   
0081   sbasis{n} = basis; 
0082 end

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