Estimate current time course by using VB-filter calculate in vb_job_vb --- USAGE: vb_job_current_feature(proj_root,parm) or vb_job_current_feature(parm) --- Input parameters curr_parm.filterfile : VB filter file (.vbfilt.mat) curr_parm.currfile : output file for estimated current feature (.curr.mat) curr_parm.megfile : MEG/EEG data file curr_parm.freq_range : band frequency for feature extraction [Nband x 2] .freq_range(n ,:) = [freq_low freq_high] Hz (for n-th band) For each time window specified by Tperiod & Tnext, sum of bandpass frequency component power (square of abs) are calculated. The following parameters are independent of bayes_parm used in VB filter If there are multiple time windows in VB filter, average filter is calculated before current calculation curr_parm.twin_meg: Time range of meg/eeg data used for analysis e.g. twin_meg = [1 600] curr_parm.Tperiod : Length of the time windows. curr_parm.Tnext : Moving steps of the time window. e.g. Tperiod = 100, Tnext = 50 --> [1 100; 51 150; 101 200;...] --- Optional Input curr_parm.trial_average = ON : average current over all sessions = [OFF] : current for each session curr_parm.ix_area : Position index to calculate estimated current If 'ix_area' is empty or not given, currents in the active region are calculated ---Output Zact : active current feature Zact(:, n + Nband*(j-1), :) : n-th bandpass component at j-th time window Zact(Nact,Nfeature) for trial_average = ON Zact(Nact,Nfeature,Ntrial) for trial_average = OFF Nact : # of active vertex, Nfeature : # of feature = Nwindow * Nband Ntrial : # of trials in all session] Jinfo.ix_act : Vertex index corresponding to active current 2008/12/2 M. Sato --- Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Zact, Jinfo] = vb_job_current_feature(varargin) 0002 % Estimate current time course by using VB-filter calculate in vb_job_vb 0003 % 0004 % --- 0005 % USAGE: 0006 % vb_job_current_feature(proj_root,parm) 0007 % or 0008 % vb_job_current_feature(parm) 0009 % 0010 % --- Input parameters 0011 % curr_parm.filterfile : VB filter file (.vbfilt.mat) 0012 % curr_parm.currfile : output file for estimated current feature (.curr.mat) 0013 % curr_parm.megfile : MEG/EEG data file 0014 % 0015 % curr_parm.freq_range : band frequency for feature extraction [Nband x 2] 0016 % .freq_range(n ,:) = [freq_low freq_high] Hz (for n-th band) 0017 % For each time window specified by Tperiod & Tnext, 0018 % sum of bandpass frequency component power (square of abs) are calculated. 0019 % The following parameters are independent of bayes_parm used in VB filter 0020 % If there are multiple time windows in VB filter, 0021 % average filter is calculated before current calculation 0022 % curr_parm.twin_meg: Time range of meg/eeg data used for analysis 0023 % e.g. twin_meg = [1 600] 0024 % curr_parm.Tperiod : Length of the time windows. 0025 % curr_parm.Tnext : Moving steps of the time window. 0026 % e.g. Tperiod = 100, Tnext = 50 0027 % --> [1 100; 51 150; 101 200;...] 0028 % --- Optional Input 0029 % curr_parm.trial_average = ON : average current over all sessions 0030 % = [OFF] : current for each session 0031 % 0032 % curr_parm.ix_area : Position index to calculate estimated current 0033 % If 'ix_area' is empty or not given, 0034 % currents in the active region are calculated 0035 % ---Output 0036 % Zact : active current feature 0037 % 0038 % Zact(:, n + Nband*(j-1), :) : n-th bandpass component at j-th time window 0039 % Zact(Nact,Nfeature) for trial_average = ON 0040 % Zact(Nact,Nfeature,Ntrial) for trial_average = OFF 0041 % Nact : # of active vertex, 0042 % Nfeature : # of feature = Nwindow * Nband 0043 % Ntrial : # of trials in all session] 0044 % 0045 % Jinfo.ix_act : Vertex index corresponding to active current 0046 % 0047 % 2008/12/2 M. Sato 0048 % --- 0049 % 0050 % Copyright (C) 2011, ATR All Rights Reserved. 0051 % License : New BSD License(see VBMEG_LICENSE.txt) 0052 0053 fprintf('----- New VBMEG -----\n') 0054 0055 %check input arguments 0056 if length(varargin) == 1 0057 proj_root = []; 0058 curr_parm = varargin{1}; 0059 elseif length(varargin) == 2 0060 proj_root = varargin{1}; 0061 curr_parm = varargin{2}; 0062 else 0063 error('Error: invalid usage of job_current_feature.'); 0064 end 0065 0066 proj_root = vb_rm_trailing_slash(proj_root); 0067 0068 if ~isfield(curr_parm,'filterfile') || isempty(curr_parm.filterfile) 0069 ix_ext = findstr(curr_parm.currfile, '.curr.mat'); 0070 curr_parm.filterfile = [curr_parm.currfile(1:ix_ext-1) '.vbfilt.mat']; 0071 end 0072 0073 if ~isempty(proj_root) 0074 currfile = [proj_root filesep curr_parm.currfile]; 0075 filterfile = [proj_root filesep curr_parm.filterfile]; 0076 else 0077 currfile = curr_parm.currfile; 0078 filterfile = curr_parm.filterfile; 0079 end 0080 0081 if ~isfield(curr_parm,'trial_average'), 0082 curr_parm.trial_average = OFF; 0083 end; 0084 0085 % --- Start current estimation 0086 fprintf('Start current feature estimation\n') 0087 0088 [Zact ,Jinfo, bayes_parm, vb_parm, MEGinfo] ... 0089 = vbmeg_feature_calc_z(proj_root, curr_parm); 0090 0091 % Save result 0092 fprintf(' --- Save estimated current feature:\n %s\n',currfile) 0093 0094 vb_fsave(currfile,'Zact','Jinfo','MEGinfo','bayes_parm','vb_parm'); 0095 0096 return 0097 0098 % project_file save 0099 proj_file = get_project_filename; 0100 if isempty(proj_file) 0101 return; 0102 end 0103 0104 project_file_mgr('load', proj_file); 0105 project_file_mgr('add', 'current_parm', parm); 0106