Home > vbmeg > functions > tool_box > neuromag > neuromag_load_extra_info.m

neuromag_load_extra_info

PURPOSE ^

load channel information from data-fiffile

SYNOPSIS ^

function [extra_info] = neuromag_load_extra_info(fiffile)

DESCRIPTION ^

 load channel information from data-fiffile
 [USAGE]
    [extra_info] = neuromag_load_extra_info(<fiffile>);
 [IN]
    fiffile : neuromag data fiffile.
 [OUT]
    extra_info : includes channel information and transform matrix

 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 [extra_info] = neuromag_load_extra_info(fiffile)
0002 % load channel information from data-fiffile
0003 % [USAGE]
0004 %    [extra_info] = neuromag_load_extra_info(<fiffile>);
0005 % [IN]
0006 %    fiffile : neuromag data fiffile.
0007 % [OUT]
0008 %    extra_info : includes channel information and transform matrix
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 info = fiff_read_meas_info(fiffile);
0014 
0015 %%%% --- load Channel info
0016 % VBMEG channel type
0017 NullChannel         = 0;
0018 MagnetoMeter        = 1;
0019 AxialGradioMeter    = 2;
0020 PlannerGradioMeter  = 3;
0021 %TriggerChannel      = -1;
0022 EegChannel          = -2;
0023 %EcgChannel          = -3;
0024 EtcChannel          = -4;
0025 
0026 ch_name   = info.ch_names';
0027 
0028 % ch_name : STI 001 , EEG 001, MEG 2643
0029 % ch_type : 0 (STI) , 1 (EEG)
0030 % ch_id   :       1 ,       1,     2643
0031 
0032 Nch = length(ch_name);
0033 next = 0;
0034 Channel_name    = [];
0035 Channel_type    = [];
0036 Channel_id      = [];
0037 Channel_pos     = [];
0038 Channel_active  = [];
0039 gain            = [];
0040 
0041 for n=1:Nch
0042     if strcmp(ch_name{n}(1:3),'STI')==1, 
0043         next = next + 1;
0044         Channel_name{next}    = ch_name{n};
0045         Channel_id(next)      = n;
0046         Channel_type(next)    = EtcChannel;
0047         Channel_pos           = [Channel_pos; nan, nan, nan];
0048         Channel_active(next)  = 1;
0049     end
0050         
0051    if strcmp(ch_name{n}(1:3),'EEG')==1, 
0052         next = next + 1;
0053         Channel_name{next}    = ch_name{n};
0054         Channel_id(next)      = n;
0055         Channel_type(next)    = EegChannel;
0056         if ~isempty(info.chs(n).eeg_loc)
0057             Channel_pos       = [Channel_pos; info.chs(n).eeg_loc(:,1)'];
0058         end
0059         Channel_active(next)  = 1;
0060     end
0061 end
0062 
0063 extra_info.Channel_name    = Channel_name';   
0064 extra_info.Channel_type    = Channel_type(:);   
0065 extra_info.Channel_id      = Channel_id(:);        
0066 extra_info.Channel_pos     = Channel_pos;
0067 extra_info.Channel_active  = Channel_active(:);    
0068 extra_info.gain            = gain(:);
0069 
0070 % MEGinfo.ExtraChannelInfo = extra_info;
0071 %    gain            : []
0072 %    Channel_active  : [48x1 double]
0073 %    Channel_name    : {48x1 cell}
0074 %    Channel_type    : [48x1 double]
0075 %    Channel_id      : [48x1 double]

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