Home > functions > job > vb_job_leadfield_extra.m

vb_job_leadfield_extra

PURPOSE ^

Lead field matrix for extra dipole (Biot-Savart)

SYNOPSIS ^

function vb_job_leadfield_extra(proj_root,extra_basis_parm)

DESCRIPTION ^

 Lead field matrix for extra dipole (Biot-Savart)
 
 [syntax]
 vb_job_leadfield_extra(proj_root,extra_basis_parm)

 [input]
 proj_root       : <<string>> VBMEG project root directory. 
 extra_basis_parm: <<struct>> Parameters for leadfield calculation.
 --- fields of extra_basis_parm
  .meg_file  : <<string>> Load 'pick' and 'Vcenter' from this file.
  .mps_file  : <<string>> Extra dipole model file (.mps.mat)
  .basis_file: <<string>> Leadfield matrix is saved as this filename. 
  .sensortype: <optional> <<string>> This value is compared with
               MEGinfo.ChannelInfo.Type.
 ---

 [output]
 Leadfield file for extra-dipole (.basis.mat) is created. It have the
 same file with that for cortical surface model. 

 [example]
 >> proj_root = 'your_project_root_directory';
 >> extra_basis_parm.meg_file   = './testdata/sbj_test_UR.meg.mat';
 >> extra_basis_parm.mps_file   = './testdata/sbj_test_UR_eyes.mps.mat';
 >> extra_basis_parm.basis_file = './testdata/sbj_test_UR_eyes.basis.mat';
 >> vb_job_leadfield_extra(proj_root,extra_basis_parm);

 [history]
 2008-06-27 Taku Yoshioka
 2008-10-15 Taku Yoshioka
  Support '.sensortype' parameter
 2011-02-28 taku-y
  [debug] 'basis_file' is interpreted as a relative path from
  'proj_root'. 

 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 vb_job_leadfield_extra(proj_root,extra_basis_parm)
0002 % Lead field matrix for extra dipole (Biot-Savart)
0003 %
0004 % [syntax]
0005 % vb_job_leadfield_extra(proj_root,extra_basis_parm)
0006 %
0007 % [input]
0008 % proj_root       : <<string>> VBMEG project root directory.
0009 % extra_basis_parm: <<struct>> Parameters for leadfield calculation.
0010 % --- fields of extra_basis_parm
0011 %  .meg_file  : <<string>> Load 'pick' and 'Vcenter' from this file.
0012 %  .mps_file  : <<string>> Extra dipole model file (.mps.mat)
0013 %  .basis_file: <<string>> Leadfield matrix is saved as this filename.
0014 %  .sensortype: <optional> <<string>> This value is compared with
0015 %               MEGinfo.ChannelInfo.Type.
0016 % ---
0017 %
0018 % [output]
0019 % Leadfield file for extra-dipole (.basis.mat) is created. It have the
0020 % same file with that for cortical surface model.
0021 %
0022 % [example]
0023 % >> proj_root = 'your_project_root_directory';
0024 % >> extra_basis_parm.meg_file   = './testdata/sbj_test_UR.meg.mat';
0025 % >> extra_basis_parm.mps_file   = './testdata/sbj_test_UR_eyes.mps.mat';
0026 % >> extra_basis_parm.basis_file = './testdata/sbj_test_UR_eyes.basis.mat';
0027 % >> vb_job_leadfield_extra(proj_root,extra_basis_parm);
0028 %
0029 % [history]
0030 % 2008-06-27 Taku Yoshioka
0031 % 2008-10-15 Taku Yoshioka
0032 %  Support '.sensortype' parameter
0033 % 2011-02-28 taku-y
0034 %  [debug] 'basis_file' is interpreted as a relative path from
0035 %  'proj_root'.
0036 %
0037 % Copyright (C) 2011, ATR All Rights Reserved.
0038 % License : New BSD License(see VBMEG_LICENSE.txt)
0039 
0040 proj_root = vb_rm_trailing_slash(proj_root);
0041 
0042 % Filename
0043 mpsfile = [proj_root filesep extra_basis_parm.mps_file];
0044 megfile = [proj_root filesep extra_basis_parm.meg_file];
0045 
0046 % Prepare extra dipole information
0047 load(mpsfile,'Pointlist');
0048 extra_pos = [];
0049 extra_direction = [];
0050 for i=1:length(Pointlist)
0051   % Three dipoles at each position
0052   extra_pos = [extra_pos; Pointlist{i}.point];
0053   extra_pos = [extra_pos; Pointlist{i}.point];
0054   extra_pos = [extra_pos; Pointlist{i}.point];
0055   extra_direction = [extra_direction; 1 0 0];
0056   extra_direction = [extra_direction; 0 1 0];
0057   extra_direction = [extra_direction; 0 0 1];
0058 end
0059 
0060 % Load MEG sensor
0061 [pick, Qpick, Wsensor, V0] = vb_load_sensor(megfile);
0062 % Wsensor(m,n) = n-th coil weight for m-th channel
0063 
0064 % Select channel (2008-10-15 Taku Yoshioka)
0065 if isfield(extra_basis_parm,'sensortype')
0066   sensortype = extra_basis_parm.sensortype;
0067   if ~isempty(sensortype), 
0068     MEGinfo = vb_load_measurement_info(megfile);
0069     ix_sensor = find(MEGinfo.ChannelInfo.Type==sensortype);
0070     ix_sensor2 = [ix_sensor; ix_sensor+length(ix_sensor)];
0071     pick = pick(ix_sensor2,:);
0072     Qpick = Qpick(ix_sensor2,:);
0073     Wsensor = Wsensor(ix_sensor,ix_sensor2);
0074   end
0075 end
0076 
0077 % Make extra dipole leadfield
0078 B = vb_dipole_magnetic(extra_pos, extra_direction, pick, Qpick );
0079 basis = B * Wsensor';
0080 
0081 % Save data
0082 vb_fsave([proj_root filesep extra_basis_parm.basis_file], ...
0083          'extra_basis_parm','basis','Pointlist');

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