Home > vbmeg > demo > tutorial_for_vbmeg2 > easy_VBMEG > prepare_leadfield_eeg.m

prepare_leadfield_eeg

PURPOSE ^

Prepare leadfield matrix

SYNOPSIS ^

function prepare_leadfield_eeg(p)

DESCRIPTION ^

 Prepare leadfield matrix

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function prepare_leadfield_eeg(p)
0002 % Prepare leadfield matrix
0003 %
0004 % Copyright (C) 2011, ATR All Rights Reserved.
0005 % License : New BSD License(see VBMEG_LICENSE.txt)
0006 %
0007 % disp(mfilename);
0008 %
0009 
0010 %% Make directory to save leadfield
0011 
0012 leadfield_dir = fullfile(p.proj_root, p.eeg_dirname, p.leadfield_dirname);
0013 if exist(leadfield_dir, 'dir') ~= 7
0014     mkdir(leadfield_dir);
0015 end
0016 
0017 %% Set input files (relative path from proj_root)
0018 
0019 basis_parm.device = 'BRAINAMP';% EEG device name
0020 basis_parm.bem_mode   = 4;% EEG 3-shell BEM
0021 basis_parm.Basis_mode = 1;% Single dipole perpendicular to the cortical surface
0022 basis_parm.meg_file = fullfile(p.proj_root, p.eeg_dirname, p.trial_dirname, 'cribr_s1.eeg.mat');
0023 
0024 %Set output file (Relative path from proj_root)
0025 basis_parm.basis_file = fullfile(p.eeg_dirname, p.leadfield_dirname, ['standard_' p.struct_name '.basis.mat']);
0026 standard_basis_file = fullfile(p.proj_root, basis_parm.basis_file);
0027 
0028 
0029 
0030 %% Matching names between standard brain channel and subject brain channel
0031 
0032 [pick, Qpick, CoilWeight, Vcenter, result, channel_info] = vb_load_sensor(basis_parm.meg_file);
0033 load('mni_icbm152_t1_tal_nlin_asym_09c_10000.basis.mat', 'ChannelName','basis','basis_parm');
0034 ch=size(channel_info.Name,1);
0035 
0036 match=0;
0037 for i=1:ch
0038     
0039     match(i)=strmatch(channel_info.Name{i},ChannelName,'exact');
0040     
0041 end
0042 
0043 match=sort(match);
0044 
0045 basis=basis(:,match);
0046 
0047 for v = 1:size(basis, 1);
0048     basis(v, :) = basis(v, :)-mean(basis(v,:), 2);
0049 end
0050 
0051 vb_save(standard_basis_file, 'basis', 'basis_parm');
0052 % save(['/home/cbi/austin/easyVBMEG/vb7/data/' p.sub '/' 'day' num2str(day) mfilename p.sub '.basis.mat'],'basis','basis_parm')
0053 
0054 end

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