This is a gateway function to job_eeg. [usage] vb_job_eeg_gateway(proj_root, meg_parm) [input] proj_root : <required> path for imported VBMEG files [''] : this is not used. meg_parm : <required> <<struct>> : .Measurement : measurement type ['EEG'] : .device : device name ['BIOSEMI'] : .measurement_file : input (BDF) file (.bdf) : .pos_file : position file (.pos.mat) : .output_file : output file (.eeg.mat) : : ['(yyyymmdd_HHMMSS).eeg.mat'] : .bin_data_dir : output directory for binary data files : : this is a relative path from output_file : .eeginfo_version : version of EEGinfo - unused [] : .verbose_swt : <<boolean>> [false] [output] none [note] @see vb_job_meg.m @see vb_job_eeg_biosemi.m @see vb_job_eeg_brainamp.m read_bdf_spec is a struct for the destination function vb_job_eeg_biosemi.m which has fields as follows .bdf_file : BDF file with valid path .pos_file : POS-MAT file with valid path .device : device name. 'BIOSEMI' .output_dir : output directory for EEG-MAT files ['.'] .eeg_file : ['<date>.eeg.mat'] EEG-MAT file name .bin_data_dir : output directory for binary data files : this is a relative path from output_dir .eeginfo_version : <optional> [] version of EEGinfo - unused yet [history] 2008-02-14 (Sako) initial version 2008-02-26 (Sako) supported POS-MAT file 2008-03-26 (Sako) modified how to apply proj_root 2008-05-28 (Sako) changed format of meg_parm for EEG 2010-02-02 (Sako) modified default value of meg_parm.output_file Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function vb_job_eeg_gateway(proj_root, meg_parm) 0002 % This is a gateway function to job_eeg. 0003 % [usage] 0004 % vb_job_eeg_gateway(proj_root, meg_parm) 0005 % [input] 0006 % proj_root : <required> path for imported VBMEG files [''] 0007 % : this is not used. 0008 % meg_parm : <required> <<struct>> 0009 % : .Measurement : measurement type ['EEG'] 0010 % : .device : device name ['BIOSEMI'] 0011 % : .measurement_file : input (BDF) file (.bdf) 0012 % : .pos_file : position file (.pos.mat) 0013 % : .output_file : output file (.eeg.mat) 0014 % : : ['(yyyymmdd_HHMMSS).eeg.mat'] 0015 % : .bin_data_dir : output directory for binary data files 0016 % : : this is a relative path from output_file 0017 % : .eeginfo_version : version of EEGinfo - unused [] 0018 % : .verbose_swt : <<boolean>> [false] 0019 % [output] 0020 % none 0021 % [note] 0022 % @see vb_job_meg.m 0023 % @see vb_job_eeg_biosemi.m 0024 % @see vb_job_eeg_brainamp.m 0025 % read_bdf_spec is a struct for the destination function vb_job_eeg_biosemi.m 0026 % which has fields as follows 0027 % .bdf_file : BDF file with valid path 0028 % .pos_file : POS-MAT file with valid path 0029 % .device : device name. 'BIOSEMI' 0030 % .output_dir : output directory for EEG-MAT files ['.'] 0031 % .eeg_file : ['<date>.eeg.mat'] EEG-MAT file name 0032 % .bin_data_dir : output directory for binary data files 0033 % : this is a relative path from output_dir 0034 % .eeginfo_version : <optional> [] version of EEGinfo - unused yet 0035 % [history] 0036 % 2008-02-14 (Sako) initial version 0037 % 2008-02-26 (Sako) supported POS-MAT file 0038 % 2008-03-26 (Sako) modified how to apply proj_root 0039 % 2008-05-28 (Sako) changed format of meg_parm for EEG 0040 % 2010-02-02 (Sako) modified default value of meg_parm.output_file 0041 % 0042 % Copyright (C) 2011, ATR All Rights Reserved. 0043 % License : New BSD License(see VBMEG_LICENSE.txt) 0044 0045 % --- CHECK ARGUMENTS --- % 0046 if ~exist('proj_root', 'var'), proj_root = []; end 0047 if ~exist('meg_parm', 'var'), meg_parm = []; end 0048 [proj_root, meg_parm] = inner_check_arguments(proj_root, meg_parm); 0049 0050 % --- MAIN PROCEDURE --------------------------------------------------------- % 0051 % 0052 switch(meg_parm.device) 0053 case 'BIOSEMI' 0054 % ----- make read_bdf_spec from meg_parm 0055 read_bdf_spec.bdf_file = meg_parm.measurement_file; 0056 read_bdf_spec.pos_file = meg_parm.pos_file; 0057 read_bdf_spec.device = meg_parm.device; 0058 read_bdf_spec.output_dir = proj_root; 0059 read_bdf_spec.eeg_file = meg_parm.output_file; 0060 read_bdf_spec.bin_data_dir = meg_parm.bin_data_dir; 0061 read_bdf_spec.eeginfo_version = meg_parm.eeginfo_version; 0062 vb_job_eeg_biosemi(read_bdf_spec, meg_parm.verbose_swt); 0063 eegfile = fullfile(proj_root, meg_parm.output_file); 0064 vb_save(eegfile, 'meg_parm'); 0065 case 'BRAINAMP' 0066 % ---- make brain_amp_spec from meg_parm 0067 read_brain_amp_spec.bamp_file = meg_parm.measurement_file; 0068 read_brain_amp_spec.pos_file = meg_parm.pos_file; 0069 read_brain_amp_spec.device = meg_parm.device; 0070 read_brain_amp_spec.output_dir = proj_root; 0071 read_brain_amp_spec.eeg_file = meg_parm.output_file; 0072 read_brain_amp_spec.bin_data_dir = ''; 0073 read_brain_amp_spec.eeginfo_version = meg_parm.eeginfo_version; 0074 vb_job_eeg_brainamp(read_brain_amp_spec, meg_parm.verbose_swt); 0075 eegfile = fullfile(proj_root, meg_parm.output_file); 0076 vb_save(eegfile, 'meg_parm'); 0077 end 0078 return; 0079 % 0080 % --- END OF MAIN PROCEDURE -------------------------------------------------- % 0081 0082 % --- INNER FUNCTIONS -------------------------------------------------------- % 0083 % 0084 % --- inner_check_arguments() 0085 % 0086 function [proj_root, meg_parm] = inner_check_arguments(proj_root, meg_parm) 0087 func_ = mfilename; 0088 if isempty(meg_parm) 0089 error('(%s)meg_parm is a required parameter', func_); 0090 end 0091 0092 proj_root = vb_rm_trailing_slash(proj_root); 0093 0094 % ----- set default values as needed 0095 % meg_parm : <required> <<struct>> 0096 % : .Measurement : measurement type ['EEG'] 0097 % : .device : device name ['BIOSEMI'] 0098 % : .measurement_file : input (BDF) file (.bdf) 0099 % : .pos_file : position file (.pos.mat) 0100 % : .output_file : output file (.eeg.mat) 0101 % : .bin_data_dir : output directory for binary data files 0102 % : : this is a relative path from output_file 0103 % : .eeginfo_version : version of EEGinfo - unused [] 0104 % : .verbose_swt : <<boolean>> [false] 0105 0106 % if ~isfield(meg_parm, 'Measurement') || isempty(meg_parm.Measurement) 0107 % meg_parm.Measurement = 'EEG'; 0108 % end 0109 0110 if ~isfield(meg_parm, 'device') || isempty(meg_parm.device) 0111 meg_parm.device = 'BIOSEMI'; 0112 end 0113 0114 if ~isfield(meg_parm, 'measurement_file') || isempty(meg_parm.measurement_file) 0115 error('(%s)meg_parm.measurement_file is a required field', func_); 0116 end 0117 0118 if ~isfield(meg_parm, 'pos_file') || isempty(meg_parm.pos_file) 0119 meg_parm.pos_file = []; 0120 end 0121 0122 if ~isfield(meg_parm, 'output_file') || isempty(meg_parm.output_file) 0123 meg_parm.output_file = ''; 0124 end 0125 0126 if ~isfield(meg_parm, 'bin_data_dir') || isempty(meg_parm.bin_data_dir) 0127 meg_parm.bin_data_dir = ''; 0128 end 0129 0130 if ~isfield(meg_parm, 'eeginfo_version') 0131 meg_parm.eeginfo_version = []; 0132 end 0133 0134 if ~isfield(meg_parm, 'verbose_swt') || isempty(meg_parm.verbose_swt) 0135 meg_parm.verbose_swt = false; 0136 end 0137 return; 0138 % 0139 % --- end of inner_check_arguments() 0140 % 0141 % --- END OF INNER FUNCTIONS ------------------------------------------------- % 0142 0143 %%% END OF FILE %%%