Home > vbmeg > functions > device > active_check > vb_select_act_basis.m

vb_select_act_basis

PURPOSE ^

select leadfield for active sensor from leadfield for all channels

SYNOPSIS ^

function vb_select_act_basis(basis_file,new_file,data_file,bias_mode)

DESCRIPTION ^

 select leadfield for active sensor from leadfield for all channels
   vb_select_act_basis(basis_file,new_file,data_file)
   vb_select_act_basis(basis_file,new_file,data_file,bias_mode)
 basis_file : leadfield file name for all channels
 new_file   : output leadfield file name for selected channels
 data_file  : MEG/EEG/INFO file which have active channel info
 bias_mode  : Common refference bias subtraction mode
            = 0 : No subtraction [default]
            = 1 : Common refference bias subtraction for leadfield

 2008-10-31 Masa-aki Sato
 2009-08-21 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    vb_select_act_basis(basis_file,new_file,data_file,bias_mode)
0002 % select leadfield for active sensor from leadfield for all channels
0003 %   vb_select_act_basis(basis_file,new_file,data_file)
0004 %   vb_select_act_basis(basis_file,new_file,data_file,bias_mode)
0005 % basis_file : leadfield file name for all channels
0006 % new_file   : output leadfield file name for selected channels
0007 % data_file  : MEG/EEG/INFO file which have active channel info
0008 % bias_mode  : Common refference bias subtraction mode
0009 %            = 0 : No subtraction [default]
0010 %            = 1 : Common refference bias subtraction for leadfield
0011 %
0012 % 2008-10-31 Masa-aki Sato
0013 % 2009-08-21 Masa-aki Sato
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 if ~exist('bias_mode','var'), bias_mode = 0; end;
0019 
0020 fprintf('Load basis file [%s]\n',basis_file)
0021 load(basis_file,'basis','basis_parm');
0022 
0023 fprintf('# of sensor in original basis = %d\n',size(basis,2))
0024 
0025 % channel info for data_file (MEG/EEG/INFO)
0026 ch_info = vb_load_channel_info(data_file);
0027 
0028 % active channel index
0029 channel_id = ch_info.ID;
0030 
0031 % basis( Norient * Nvertex , Nsensor)
0032 % basis( n, k )  : k-th sensor field for dipole current at n
0033 basis = basis(:, channel_id);
0034 
0035 if bias_mode == 1,
0036     fprintf('Common refference bias subtraction\n')
0037     basis = vb_repadd(basis, - mean(basis,2));
0038 end
0039 
0040 fprintf('# of sensor in selected basis = %d\n',size(basis,2))
0041 % Output file path
0042 fprintf('Save basis file [%s]\n',new_file)
0043 
0044 basis_parm.channel_id = channel_id;
0045 
0046 vb_fsave(new_file,'basis','basis_parm');

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