Home > vbmeg > demo > test_scripts > sbi > read_sbi_eeg_header.m

read_sbi_eeg_header

PURPOSE ^

eeg_info = read_sbi_eeg_header(sys_dir,sys_id)

SYNOPSIS ^

function eeg_info = read_sbi_eeg_header(sys_dir,sys_id)

DESCRIPTION ^

 eeg_info = read_sbi_eeg_header(sys_dir,sys_id)
 Input: sys_dir  % Root dir  ex. /data1/toyama2/
        sys_id   % System ID  ex. 1000987
 Output: 
 eeg_info : structure with following field
    .nch,       % number of EEG channel
    .nsamp,     % sampling number of measurement
    .nrept,     % repeat number
    .sampf,     % sampling frequency
    .ch_name    % channel name
    .ad_factor  % AD multiplicative factor to convert EEG data to [V]

 require meg_hread

 history
 2001-11-09 S.Kajihara
 2003-07-08 N.Goda
 2005-12-22 M.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 eeg_info = read_sbi_eeg_header(sys_dir,sys_id)
0002 % eeg_info = read_sbi_eeg_header(sys_dir,sys_id)
0003 % Input: sys_dir  % Root dir  ex. /data1/toyama2/
0004 %        sys_id   % System ID  ex. 1000987
0005 % Output:
0006 % eeg_info : structure with following field
0007 %    .nch,       % number of EEG channel
0008 %    .nsamp,     % sampling number of measurement
0009 %    .nrept,     % repeat number
0010 %    .sampf,     % sampling frequency
0011 %    .ch_name    % channel name
0012 %    .ad_factor  % AD multiplicative factor to convert EEG data to [V]
0013 %
0014 % require meg_hread
0015 %
0016 % history
0017 % 2001-11-09 S.Kajihara
0018 % 2003-07-08 N.Goda
0019 % 2005-12-22 M.Sato
0020 %
0021 % Copyright (C) 2011, ATR All Rights Reserved.
0022 % License : New BSD License(see VBMEG_LICENSE.txt)
0023 
0024 % Header file
0025 fid = fopen(sprintf('%shead/%s.hd',sys_dir,sys_id),'r','l');
0026 
0027 if fid==-1, disp('XXX Error : Cannot open head file !!');return; end
0028 
0029 % file info.
0030 H_file = meg_hread('file',fid);
0031 
0032 %
0033 % --- read eeg
0034 %
0035 if H_file.i_eeg_begin>0,
0036     % Read Data dimension
0037     H_eeg = meg_hread('eeg',fid, H_file.i_eeg_begin);
0038     
0039     eeg_info.nch   = H_eeg.i_nch;          % channel number
0040     eeg_info.nsamp = H_eeg.i_nsample;      % sampling number of measurement
0041     eeg_info.nrept = H_eeg.i_nwave;      % repeat number
0042     eeg_info.sampf = H_eeg.i_samp_freq; % sample frequency
0043     eeg_info.ad_factor = H_eeg.f_ad_weight; % AD conversion factor
0044     
0045     ch_name = cell(eeg_info.nch,1);
0046     
0047     for i=1:eeg_info.nch,
0048         H_eeg_ch = meg_hread('eeg_ch',fid, ...
0049                  H_file.i_eeg_ch_begin+H_file.i_eeg_ch_size*(i-1));
0050         ch_name{i} = deblank(H_eeg_ch.c_ch_name);
0051     end
0052     
0053     eeg_info.ch_name = ch_name;
0054 else,
0055     disp('*** Warning : Not measured EEG !!');
0056     eeg_info=[];
0057 end
0058 
0059 fclose(fid); 
0060

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