Home > vbmeg > functions > leadfield > vb_job_leadfield_meg_bem.m

vb_job_leadfield_meg_bem

PURPOSE ^

actual worker function for MEG-BEM

SYNOPSIS ^

function [basis, basis_parm] = vb_job_leadfield_meg_bem(proj_root, basis_parm)

DESCRIPTION ^

 actual worker function for MEG-BEM
 [usage]
   [basis, basis_parm] = vb_job_leadfield_meg_bem(proj_root, basis_parm)
 [input]
    proj_root : <required> project root directory
   basis_parm : <required> <<struct>>
              :  data set in which the specification of calculation is defined
 [output]
   none
 [note]
   <<prior conditions>>
     1) proj_root is valid
     2) basis_parm is commonly valid
 [history]
   2007-01-29 (Sako) initial version

 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [basis, basis_parm] = vb_job_leadfield_meg_bem(proj_root, basis_parm)
0002 % actual worker function for MEG-BEM
0003 % [usage]
0004 %   [basis, basis_parm] = vb_job_leadfield_meg_bem(proj_root, basis_parm)
0005 % [input]
0006 %    proj_root : <required> project root directory
0007 %   basis_parm : <required> <<struct>>
0008 %              :  data set in which the specification of calculation is defined
0009 % [output]
0010 %   none
0011 % [note]
0012 %   <<prior conditions>>
0013 %     1) proj_root is valid
0014 %     2) basis_parm is commonly valid
0015 % [history]
0016 %   2007-01-29 (Sako) initial version
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 % --- CHECK ARGUMENTS --- %
0022 [proj_root, basis_parm, headfile] = inner_check_arguments(proj_root, basis_parm);
0023 
0024 % --- MAIN PROCEDURE --------------------------------------------------------- %
0025 %
0026 % pre-processing
0027 [Basis_mode, pick, Qpick, Wsensor, V0, V, xx] = ...
0028   vb_lf_preprocess(proj_root, basis_parm);
0029 
0030 % Calculate current direction according to 'Basis_mode'
0031 [V,xx] = vb_current_vector(V, xx, Basis_mode);
0032 
0033 % Prepare BEM parameter and calculate solid angle matrix
0034 
0035 % load head file - be loaded Vhead, Fhead ... etc.
0036 load([headfile]);
0037 fprintf('# of vertices = %d\n',size(Vhead,1));
0038     
0039 if  ~exist('Omega','var') | basis_parm.Recalc == ON,
0040   tic;
0041   fprintf('--- Solid angle calculation ');
0042     
0043   % 境Œ¢ä°è—計算
0044   % (Normal vectors (XXhead) are outwarded here)
0045   [Omega, Sout]= vb_solid_angle_grk(Vhead,Fhead,XXhead);
0046     
0047   fprintf('%f[sec]\n',toc);
0048   vb_save([headfile],'Omega','Sout');
0049 end
0050     
0051 fprintf('--- MEG BEM-linear-Galerkin ');
0052 
0053 BB = vb_bem_meg(Omega, Sout, Vhead, Fhead, V, xx, pick, Qpick);
0054     
0055 basis = Wsensor * BB;
0056 basis = basis';
0057 %
0058 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0059 
0060 
0061 % --- INNER FUNCTIONS -------------------------------------------------------- %
0062 %
0063 function [proj_root, basis_parm, head_file] = ...
0064   inner_check_arguments(proj_root, basis_parm)
0065 if ~isfield(basis_parm, 'head_file')
0066   error('head_file is a required field of basis_parm');
0067 end
0068 
0069 head_file = fullfile(proj_root, basis_parm.head_file);
0070 if exist(head_file, 'file') ~= 2
0071   error('cannot read head_file : %s', head_file);
0072 end
0073 
0074 % if you have other check points, you can do them here ...
0075 return;
0076 %
0077 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0078 
0079 %%% END OF FILE %%%

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