Parameter setting of "bayes_parm" --- sample file bayes_parm = vb_set_bayes_parm(proj_root) You should copy 'vb_set_bayes_parm_test.m' to your local directory and modify according to your environment. Alternately, you can make 'bayes_parm' parameter file using GUI. ------- Summary of bayes_parm -------- proj_root : Root directory of your data files. All file names should be relative path from proj_root. Fields of 'bayes_parm' *** *** Basic Parameters *** ****************************** - .megfile (.meg.mat) MEG data file to be analyzed. This is given by cell array of strings. e.g. megfile = {'SESSION1.meg.mat','SESSION2.meg.mat'} - .basisfile (.basis.mat) Lead field file for the high resolution model. e.g. megfile = {'SESSION1.basis.mat','SESSION2.basis.mat'} - .brainfile (.brain.mat) Brain file. - .bayesfile (.bayes.mat) Result file. Estimated parameters will be saved into this file. - .actfile (.act.mat) Activity map file. - .areafile (.area.mat) Area file. - .act_key ID of an activity map in .actfile. The specified activity map is used as the prior information to VB variance estimation. - .area_key ID of an area in .areafile. Possible (focal) dipoles location are restricted to the specified area. - .twin_meg Time window of meg data in .megfile used for analysis. This window is covered by several small time windows specfied by .Tperiod and .Tnext. It is specified by the start and end of the sampling frame, not by the actual measurement time. e.g. twin_meg = [1 600] - .Tperiod Size of the small time windows. Its unit is the number of the sampling frames. .Tperiod and .Tnext mentioned below determine small time windows for analysis. - .Tnext Moving steps of the small time window. If 100 sampling frames are covered by 19 small time windows with the size 10 frames, this parameter should be set to 5 (5x(19-1)+10=100). % e.g. Tperiod = 100, Tnext = 50 --> [1 100; 51 150; 101 200;...] e.g. Tperiod = [100 100 100], Tnext = [1 51 101] --> [1 100; 51 150; 101 200;] - .soft_mode = 0; % = 1: Soft normal constraint Soft normal constraint flag *** *** Estimation Model Parameters *** ******************************** Specify estimation model by forward_model & noise_estimation_model - .forward_model -- 'focal' -- 'focal+global' - .noise_estimation_model How to estimate sensor observation noise & brain background baseline activity *** The following fields are automatically set by noise_estimation_model You can change the time window for estimation - .twin_noise Time window (start and end) used for estimation of the covariance of the observation noise - .twin_global Time window (start and end) used for estimation of the baseline current activity - megnoisefile (.meg.mat) MEG data file for estimating the variance and covariance of the observation noise. *** Do not modify the following fields directory - .noise_model Specifying noise model. -- 1 spherical, same noise variance for all sensors -- 2 ellipsoidal, different noise variances but independent -- 3 full covariance, most general noise model - .update_sx Specifying how to estimate the variance of the observation noise. -- 0 Estimated from MEG data specified by bayes_parm.megnoisefile and bayes_parm.meg_noise. -- 1 Estimated simultaneously with the variances of 'sparse' model. - .update_v Specifying how to estimate the variance parameter of the 'iso' model. -- 0 Estimated from MEG data specified by bayes_parm.megbackfile and bayes_parm.meg_back. -- 1 Estimated simultaneously with the variances of the high resolution model. *** *** Advanced parameters *** ********************************** *** Global window (default value) - .reduce_global (1) Rate to reduce the number of vertex points in global window. This value must range from 0 to 1. - .basisfile_global (.megfile) - .area_key_global ('Cortex') - .Rfilt_global (0) Radius (mm) of the smoothing filter along with the cortical surface for the low resolution model. 6mm (=6e-3) or 9mm is recommended. *** Prior and VB estimation parameters (default value) - .a0 (1) Prior variance value corresponding to the minimum activity. - .a0_act (1000) Prior variance value corresponding to the maximum activity. - .Ta0 (0) The confidence parameter of the prior variance for the high resolution estimation. This value is interpreted as a ratio to the sampling data number. That is, if it is set to 1, the prior is weighted equal to the estimated value based on the likelihood. - .Tv0 (0) The confidence parameter of the prior variance for the low resolution estimation. This value is interpreted as a ratio to the sampling data number as in the case of bayes_parm.Ta0. - .Ntrain (1000) Total number of parameter updates. - .Npre_train (750) Number of parameter updates in the first stage by using VB-update rule. - .skip (10) Number of iterations to calculate the free energy. *** Optional parameters (default value) - .cont_pr (OFF) Flag whether initializing the prior parameters using estimated parameters of previous time window - .temporal_filter (OFF) Flag whether applying temporal smoothing filter to MEG data. - .trial_average (OFF) Flag wheter applying trial average to MEG data. - .expand_spatial_filter (ON) Flag whether using expanding spatial filter - .variance_orientation (OFF) Flag whether variance parameters have orientation - .cosval (-1) Orientation constraint for neighbour dipoles. A recommended value is 1 (=cos(pi)), which means no constraint. - .Rfilt (6e-3) Radius (m) of the smoothing filter along with the cortical surface. 6mm (=6e-3) or 9mm is recommended. - .noise_reg (0.1) Regularization parameter for the normalized covariance matrix of the additive noise. This value should be determined considering that the mean of the diagonal part of the normalized covariance matrix is 1. - .reduce (1) Rate to reduce the number of vertex points. This value must range from 0 to 1. - .Fdmin (1e-50) Criterion of convergence of the VB algorithm. - .a_min (1e-6) Minimum value of alpha. - .a_max (1e6) Maximum value of alpha. --------------------------------------------------------------- *** *** File format of resultfile (.bayes.mat) *** ************************************************ - bayes_parm Input parameters - Model Estimated variance parameters - Cov Additive noise covariance. - Info Convergence information such as FE, Ev and Err ... - vb_parm Parameters used in VB estimation --- 2006/09/20 ver 0.5 by M. Sato 2008-11-05 Taku Yoshioka Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function bayes_parm = vb_set_bayes_parm(proj_root) 0002 % Parameter setting of "bayes_parm" --- sample file 0003 % bayes_parm = vb_set_bayes_parm(proj_root) 0004 % 0005 % You should copy 'vb_set_bayes_parm_test.m' to your local directory 0006 % and modify according to your environment. 0007 % Alternately, you can make 'bayes_parm' parameter file using GUI. 0008 % 0009 % ------- Summary of bayes_parm -------- 0010 % proj_root : Root directory of your data files. 0011 % All file names should be relative path from proj_root. 0012 % 0013 % Fields of 'bayes_parm' 0014 % 0015 % *** 0016 % *** Basic Parameters 0017 % *** 0018 % ****************************** 0019 % - .megfile (.meg.mat) 0020 % MEG data file to be analyzed. This is given by cell array of strings. 0021 % e.g. megfile = {'SESSION1.meg.mat','SESSION2.meg.mat'} 0022 % 0023 % - .basisfile (.basis.mat) 0024 % Lead field file for the high resolution model. 0025 % e.g. megfile = {'SESSION1.basis.mat','SESSION2.basis.mat'} 0026 % 0027 % - .brainfile (.brain.mat) 0028 % Brain file. 0029 % 0030 % - .bayesfile (.bayes.mat) 0031 % Result file. Estimated parameters will be saved into this file. 0032 % 0033 % - .actfile (.act.mat) 0034 % Activity map file. 0035 % 0036 % - .areafile (.area.mat) 0037 % Area file. 0038 % 0039 % - .act_key 0040 % ID of an activity map in .actfile. The specified activity map is 0041 % used as the prior information to VB variance estimation. 0042 % 0043 % - .area_key 0044 % ID of an area in .areafile. Possible (focal) dipoles location are 0045 % restricted to the specified area. 0046 % 0047 % - .twin_meg 0048 % Time window of meg data in .megfile used for analysis. This window 0049 % is covered by several small time windows specfied by .Tperiod and 0050 % .Tnext. It is specified by the start and end of the sampling frame, 0051 % not by the actual measurement time. 0052 % e.g. twin_meg = [1 600] 0053 % 0054 % - .Tperiod 0055 % Size of the small time windows. Its unit is the number of the 0056 % sampling frames. .Tperiod and .Tnext mentioned below determine 0057 % small time windows for analysis. 0058 % 0059 % - .Tnext 0060 % Moving steps of the small time window. If 100 sampling frames 0061 % are covered by 19 small time windows with the size 10 frames, 0062 % this parameter should be set to 5 (5x(19-1)+10=100). % 0063 % 0064 % e.g. Tperiod = 100, Tnext = 50 0065 % --> [1 100; 51 150; 101 200;...] 0066 % e.g. Tperiod = [100 100 100], Tnext = [1 51 101] 0067 % --> [1 100; 51 150; 101 200;] 0068 % 0069 % - .soft_mode = 0; % = 1: Soft normal constraint 0070 % Soft normal constraint flag 0071 % 0072 % *** 0073 % *** Estimation Model Parameters 0074 % *** 0075 % ******************************** 0076 % Specify estimation model by forward_model & noise_estimation_model 0077 % 0078 % - .forward_model 0079 % -- 'focal' 0080 % -- 'focal+global' 0081 % 0082 % - .noise_estimation_model 0083 % How to estimate 0084 % sensor observation noise & brain background baseline activity 0085 % 0086 % *** The following fields are automatically set by noise_estimation_model 0087 % You can change the time window for estimation 0088 % 0089 % - .twin_noise 0090 % Time window (start and end) used for estimation 0091 % of the covariance of the observation noise 0092 % 0093 % - .twin_global 0094 % Time window (start and end) used for estimation 0095 % of the baseline current activity 0096 % 0097 % - megnoisefile (.meg.mat) 0098 % MEG data file for estimating the variance and covariance of 0099 % the observation noise. 0100 % 0101 % *** Do not modify the following fields directory 0102 % 0103 % - .noise_model 0104 % Specifying noise model. 0105 % -- 1 spherical, same noise variance for all sensors 0106 % -- 2 ellipsoidal, different noise variances but independent 0107 % -- 3 full covariance, most general noise model 0108 % 0109 % 0110 % - .update_sx 0111 % Specifying how to estimate the variance of the observation 0112 % noise. 0113 % -- 0 Estimated from MEG data specified by 0114 % bayes_parm.megnoisefile and bayes_parm.meg_noise. 0115 % -- 1 Estimated simultaneously with the variances of 'sparse' 0116 % model. 0117 % 0118 % - .update_v 0119 % Specifying how to estimate the variance parameter of the 'iso' 0120 % model. 0121 % -- 0 Estimated from MEG data specified by 0122 % bayes_parm.megbackfile and bayes_parm.meg_back. 0123 % -- 1 Estimated simultaneously with the variances of the high 0124 % resolution model. 0125 % 0126 % *** 0127 % *** Advanced parameters 0128 % *** 0129 % ********************************** 0130 % 0131 % *** Global window (default value) 0132 % - .reduce_global (1) 0133 % Rate to reduce the number of vertex points in global window. 0134 % This value must range from 0 to 1. 0135 % - .basisfile_global (.megfile) 0136 % - .area_key_global ('Cortex') 0137 % - .Rfilt_global (0) 0138 % Radius (mm) of the smoothing filter along with the cortical 0139 % surface for the low resolution model. 6mm (=6e-3) or 9mm is 0140 % recommended. 0141 % 0142 % *** Prior and VB estimation parameters (default value) 0143 % - .a0 (1) 0144 % Prior variance value corresponding to the minimum activity. 0145 % - .a0_act (1000) 0146 % Prior variance value corresponding to the maximum activity. 0147 % - .Ta0 (0) 0148 % The confidence parameter of the prior variance for the high 0149 % resolution estimation. This value is interpreted as a ratio to 0150 % the sampling data number. That is, if it is set to 1, the prior 0151 % is weighted equal to the estimated value based on the 0152 % likelihood. 0153 % - .Tv0 (0) 0154 % The confidence parameter of the prior variance for the low 0155 % resolution estimation. This value is interpreted as a ratio to 0156 % the sampling data number as in the case of bayes_parm.Ta0. 0157 % - .Ntrain (1000) 0158 % Total number of parameter updates. 0159 % - .Npre_train (750) 0160 % Number of parameter updates in the first stage by using VB-update rule. 0161 % - .skip (10) 0162 % Number of iterations to calculate the free energy. 0163 % 0164 % *** Optional parameters (default value) 0165 % - .cont_pr (OFF) 0166 % Flag whether initializing the prior parameters using estimated parameters 0167 % of previous time window 0168 % - .temporal_filter (OFF) 0169 % Flag whether applying temporal smoothing filter to MEG data. 0170 % - .trial_average (OFF) 0171 % Flag wheter applying trial average to MEG data. 0172 % - .expand_spatial_filter (ON) 0173 % Flag whether using expanding spatial filter 0174 % - .variance_orientation (OFF) 0175 % Flag whether variance parameters have orientation 0176 % 0177 % - .cosval (-1) 0178 % Orientation constraint for neighbour dipoles. A recommended 0179 % value is 1 (=cos(pi)), which means no constraint. 0180 % - .Rfilt (6e-3) 0181 % Radius (m) of the smoothing filter along with the cortical 0182 % surface. 6mm (=6e-3) or 9mm is recommended. 0183 % - .noise_reg (0.1) 0184 % Regularization parameter for the normalized covariance matrix 0185 % of the additive noise. This value should be determined 0186 % considering that the mean of the diagonal part of the 0187 % normalized covariance matrix is 1. 0188 % - .reduce (1) 0189 % Rate to reduce the number of vertex points. This value must 0190 % range from 0 to 1. 0191 % - .Fdmin (1e-50) 0192 % Criterion of convergence of the VB algorithm. 0193 % - .a_min (1e-6) 0194 % Minimum value of alpha. 0195 % - .a_max (1e6) 0196 % Maximum value of alpha. 0197 % 0198 % 0199 % --------------------------------------------------------------- 0200 % 0201 % *** 0202 % *** File format of resultfile (.bayes.mat) 0203 % *** 0204 % ************************************************ 0205 % - bayes_parm 0206 % Input parameters 0207 % - Model 0208 % Estimated variance parameters 0209 % - Cov 0210 % Additive noise covariance. 0211 % - Info 0212 % Convergence information such as FE, Ev and Err ... 0213 % - vb_parm 0214 % Parameters used in VB estimation 0215 %--- 0216 % 0217 % 2006/09/20 ver 0.5 by M. Sato 0218 % 2008-11-05 Taku Yoshioka 0219 % 0220 % Copyright (C) 2011, ATR All Rights Reserved. 0221 % License : New BSD License(see VBMEG_LICENSE.txt) 0222 0223 % Set default parameter 0224 bayes_parm = vb_set_bayes_default_parameters; 0225 0226 % If 'proj_root' is not given, only default parameters are set 0227 if ~exist('proj_root', 'var'), return; end; 0228 0229 % --- Input file(relative path from proj_root) 0230 bayes_parm.brainfile = []; 0231 bayes_parm.areafile = []; 0232 bayes_parm.actfile = []; 0233 bayes_parm.megfile = { [] }; 0234 bayes_parm.basisfile = { [] }; 0235 0236 % --- Output file(relative path from proj_root) 0237 bayes_parm.bayesfile = ''; 0238 0239 % --- Specify current area and fMRI activity 0240 bayes_parm.area_key = 'Cortex'; 0241 bayes_parm.act_key = {'Uniform'}; 0242 0243 % --- Specify time window by sample numbar 0244 bayes_parm.twin_meg = []; % Time window for analysis 0245 bayes_parm.Tperiod = []; % Time period for current estimation 0246 bayes_parm.Tnext = []; % Time step for next period 0247 0248 % --- Soft normal constraint flag 0249 bayes_parm.soft_mode = 0; % = 1: Soft normal constraint 0250 0251 % --- Estimation model 0252 bayes_parm.forward_model = 'focal'; % 'focal' or 'focal+global' 0253 bayes_parm.noise_estimation_model = 1; % 1, ..., 5 0254 0255 % Extra dipole parameters 0256 bayes_parm.extra = []; 0257 0258 % 0259 % Noise estimation model 0260 % 0261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0262 0263 bayes_parm = vb_set_noise_estimation_model(bayes_parm, proj_root);