__'''Warning'''__: The developments described below have been abandonned. Please refer to the [[https://neuroimage.usc.edu/brainstorm/Tutorials/SourceEstimation?highlight=%28beamformer%29#Advanced_options:_LCMV_beamformer|source estimation tutorial]]. ... = Beamforming methods = ''Authors: Hui-Ling Chan, Francois Tadel, Sylvain Baillet '' The estimation of source distribution is an important step to understand the brain activity from EEG and MEG data. Dipole fitting, minimum norm estimation and beamformer are three commonly used methods. It has been proved that beamforming methods provide good spatial resolution. This tutorial will show how to apply beamforming methods to MEG data and obtain the statistic map of source activation. '''IMPORTANT''': The LCMV beamformer is now part of the main Brainstorm distribution. We recommend you refer instead to the new documentation in the introduction tutorials: [[Tutorials/SourceEstimation|Source estimation]]. <> == Installation == This tutorial requires you download the two processes below and copy them to your personal process folder ($HOME/.brainstorm/process): * [[attachment:process_beamformer_lcmv.m]] * [[attachment:process_beamformer_mcb.m]] == Introduction == Beamforming methods scan each targeted source position <> and estimate the spatial filter <>. By multiplying with the MEG recordings <>, the spatial filter <> outputs the temporal waveform <> of the dipole source at that position with the dipole orientation <> as below: <> where 'T' indicates the transpose of a matrix or vector. The beamforming spatial filter can be vector-type or scalar-type. === Vector-type beamformer === For each position <>, three orthogonal spatial filters <> are computed by applying the unit-gain constraint as well as the minimum norm and minimum variance criteria as below [Liu and Van Veen, 1992; Van Veen et al., 1997]: <> where <> is the covariance matrix of MEG recordings during window <>, <> is the identity matrix, <> is the gain matrix for the dipole located at position <>, and <> is the regularization parameter which compromises the minimum norm and minimum variance criteria. === Scalar-type beamformer === For each position <>, the source orientation <> is first estimated to enable the spatial filter to output the source activity with maximum power or fitting some other criteria. The dipole orientation can be obtained by exhaustive search, non-linear search [Robinson and Vrba, 1999], or analytical solution [Chen et al., 2006]. The estimated dipole orientation <> is then applied to calculate the spatial filter as follows [Robinson and Vrba, 1999]: <> == LCMV beamformer == LCMV stands for''' linearly-constrained minimum variance'''. LCMV beamformer is vector-type beamformer [Van Veen et al., 1997]. For each position <>, this method calculates the neural activity index, which is interpreted as the estimate of source to noise variance. === Neural activity index === For each position <>, the variance of source activity during active state <> is calculated as follows [Liu and Van Veen, 1992; Van Veen et al., 1997]: <> or <> where <> is the covariance matrix computed from MEG recordings during active state <>. Alternatively, the variance of beamformer outpout along the dominant direction can be calculated by using the singular value decomposition [Gross et al., 2001]: <> or <> where <> indicates the maximum eigenvalue of the expression in braces. When the location <> is far from sensors, the elements of lead field matrix <> are small. So the elements of <> are generally large and the estimated variance for the deep source becomes large. When the location <> is close to sensors, the elements of lead field matrix <> are large. It results in small values of the elements of <> and small estimated variance for the superficial source. To reduce the effect caused by the depth of source location, the estimated source variance <> is normalized by the noise variance <> as follows: <> or <> where <> is the covariance matrix computed from MEG recordings during control state <>. The normalized variance <> is called neural activity index (NAI). In the Brainstorm, the noise covariance will be used as the covariance matrix for control state. Please refer to [[http://neuroimage.usc.edu/brainstorm/Tutorials/TutNoiseCov|Tutorial 7: Noise covariance matrix]] for the details of noise covariance computation. === LCMV process === 1. Drag and drop all of the epochs in ''Subject01 / right / right | timeoffset (98 files)'' into Process1. 1. Click on [RUN] and select the process "'''Sources > Beamformer: LCMV'''".<
>Configure the options as follows:<
><
> {{attachment:LCMV_parameter_setting_right.png|LCMV_options.png}} <
> 1. With this window you can select the method you want to use to estimate the source variance and noise variance, the time window of active state, the regularization parameter, and the sensors you are going to use for this estimation. You can edit the following options:<
><
> * '''Comment''': This field contains what is going to be displayed in the database explorer. * '''Method''':<
> * '''Unconstrained (max singular value)''': Calculates the variances of source activity and noise by using the maximum singular value. * '''Unconstrained (trace)''': Calculates the variances by using the trace. * '''Constrained''' '''(normal to cortex)''': The dipole orientation for each vertex is set to the normal vector to the cortex surface (not available for volume head models). This method may give less smooth results than the unconstrained methods. * '''Time window of active state''': The neural activity index is computed using the source activity variance during the active state <>. * '''Time range of interest''': Total time period over which we want to calculate the neural activity index. * '''Active window size''': Defines the duration of the active state. The active window is slided all along the time range of interest. A large active window size is recommended, at least larger than the number of sensors in number of time samples. * '''Temporal resolution''': Defines the time lapse between two estimations of the neural activity index. If this "''active size window''" or "''temporal resolution''" are set to '''zero''', the active window size is set to the entire time range of interest. The ''temporal resolution'' becomes irrelevant because only one neural activity index will be estimated. If there are multiple active state windows, the time label of the neural activity index will be set as the middle time of each active state window, that is, <> in the following figure. You are going to obtain the spatiotemporal dynamics of neural activity index bewteen <> and <>. <
><
> {{attachment:slidingwindow.png||width="542",height="273"}} * '''Regularization parameter''': This value will be multiplied with the maximum eigenvalue of the covariance matrix computed from the recordings during Time range of interest. A larger value of regularization parameter would give smoother results. Large regularization parameter value is more suitable for noisy data. When analyzing simulation data sets, the regularization parameter value can be reduced. * '''Sensors type''': Modalities that are used for the reconstruction. Here we only have one type of MEG sensors, so nothing to change. * '''Save spatial filters''': Check this option if you want to save the spatial filters. Checking this option if you want to observe the temporal profile of source or compute functional connectivity. Note that the amplitudes of these temporal profiles are not meaningful because the spatial filter is caluclated for one voxel at a time without the holistic consideration on whole brain activity. So, the amplitude of beamformer outpout can not represent the source amplitude and the relationship of the amplitude between each grid point is meaningless. However, the beamformer outpouts can further be used to calculate correlation or coherence between each region because these two estimations include the normalization of amplitude and thus the ampltidue of source waveforms doesn't effect the results. 1. Two new files are available in the database explorer.<
><
> * '''right: LCMV (Unconstr/svd, 5-296ms)''': This file saves the neural activity index for every dipole position. <
><
> {{attachment:LCMV_right_svd.png|LCMV_results_list_svd_source.png}} <
> <
> Double click on this file. Right click on anywhere of the pop-out window. From the pop-out menu, select'' Colormap:Sources > Maximum: Custom...''. Set Minimum to be '''1.2''' and Maximum to be '''2.0'''. Click Ok. <
> <
> {{attachment:Colormaplimit.png}} <
><
> Set the time to be anytime between 0 and 296 ms. Then click ''Surface'' tab on the right panel of database explorer. Set ''Data options > Amplitude'' to be '''50%''' and ''Data options > Min Size'' to be '''5'''. <
><
> {{attachment:LCMV_right_NAImap.png||width="572",height="213"}} <
><
>The maps of neural activity index estimated using ''Unconstrained'' ''(max sigular value)'', ''Unconstrained (trace)'', and ''Constrained (normal to cortex)'' are shown from left to right. All maps display strong activations in the left primary somatosensory area (S1). * '''right: LCMV/filter (Unconstr/svd, 5-296ms)''': This file saves the three spatial filters along the x, y, and z directions for each dipole position. These spatial filters are normalized by the standard deviation of noise. Note that there is one spatial filter for each dipole location if the method ''Cortically Constrained ''(normal to cortex) is used. <
><
> {{attachment:LCMV_right_svd_filter.png|LCMV_results_list_svd_filter.png}} <
> 1. Explore spatiotemporal dynamics of anatomically constrained beamformer outputs in the right condition. <
><
> {{attachment:DatabaseExploreRightAvgConstr.png}} <
><
>Double click on this file. Set the time to be '''15.8 ms''', '''30 ms''', or '''60 ms'''. Right click on anywhere of the pop-out window. From the pop-out menu, select ''Colormap:Sources > Maximum: Local...''. Then click ''Surface'' tab on the right panel of database explorer. Set ''Data options > Amplitude'' to be '''70%''' and ''Data options > Min Size'' to be '''5'''.<
><
> * '''16 ms''' (left): left S1 * '''30 ms''' (middle): left S1 * '''60 ms '''(right): left S2 <
><
> {{attachment:LCMV_right_constr_16ms.png||width="204",height="200"}} {{attachment:LCMV_right_constr_30ms.png||width="206",height="200"}} {{attachment:LCMV_right_constr_60ms.png||width="205",height="200"}} <
><
> * '''70 ms''': bilateral S2 <
><
> Set the time to be 70 ms. Then click ''Surface'' tab on the right panel of database explorer. Set'' Data options > Amplitude'' to be '''41%''' and ''Data options > Min Size'' to be '''5'''. <
><
> {{attachment:LCMV_right_constr_70ms.png||width="614",height="228"}} <
><
> 1. Explore spatiotemporal dynamics of anatomically constrained beamformer outputs in the right condition. <
><
> {{attachment:LCMV_left_Constr_filter.png}} <
><
>Double click on this file. Set the time to be '''20 ms''', '''30 ms''', or '''60 ms'''. Right click on anywhere of the pop-out window. From the pop-out menu, select ''Colormap:Sources > Maximum: Local..''.. Then click ''Surface'' tab on the right panel of database explorer. Set ''Data options > Amplitude'' to be '''60%''' and ''Data options > Min Size'' to be '''5'''. <
><
> * '''20 ms''' (left): right S1 * '''30 ms''' (middle): right S1 * '''60 ms''' (right): right S2 <
><
> {{attachment:LCMV_left_constr_20ms.png||width="166",height="184"}} {{attachment:LCMV_left_constr_30ms.png||width="163",height="183"}} {{attachment:LCMV_left_constr_60ms.png||width="163",height="182"}} <
><
> * '''73.3 ms''': bilateral S2. Set the time to be '''73.3 ms'''. Then click ''Surface'' tab on the right panel of database explorer. Set ''Data options > Amplitude'' to be '''45%''' and ''Data options > Min Size'' to be '''5'''. <
><
> {{attachment:LCMV_left_constr_73.3ms.png}} <
><
> == Maximum constrast beamformer == Maximum constrast beamformer (MCB) is scalar-type beamformer [Chen et al., 2006]. For each position <>, it provides an analytical solution of dipole orientation <>, which maximizes the constrast of beamformer outputs between active state and control state as bellow: <> where <> is the covariance matrix computed from the measurements during active state and <> is the covariance matrix computed from the measurements during control state. === Solution of dipole orientation === The solution of spatial filter can be rewritten as <> where both <> and <> depend only on the dipole location <>. Then the objective function for obtaining the dipole orientation <> can be rewritten as <> where both of the 3-by-3 matrices <> and <> does not depend on the dipole orientation <>. The solution of dipole orientation <> is the eigenvector corresponding to the maximum eigenvalue of the matrix <>. === Statistical mapping === After obtaining the dipole orientation <> and the spatial filter <> for dipole position <>, the F-statistic value at time <> can be obtained using the following formula: <> where <> is the covariance matrix computed from the measurements during window <>, <> is the size of <>, and the range of <> is <> . <> is a segment of active state <>. The meaning of F-statistic is the same as the normalized variance <> used in LCMV beamforming method. If the number of <> is small, the peak of temporal dynamics of F-statistic value may shift. In this case, it is more appropriate to replace the covariance matrix <> with <> or <> where <> represents the window of baseline and its size is <>. When <> is used, the F-statistic value represents the estimate of source power to noise variance. === MCB process === 1. Drag and drop all of the epochs in ''Subject01 / right / right | timeoffset (98 files)'' into Process1. 1. Click on [RUN] and select the process "''Sources > Maximum Contrast Beamformer''". <
><
> {{attachment:MCBPipelineEditorFmap2.png}} <
><
>With this window you can select the dipole orientation you want to use, the time window of active state, the window size you are going to use for the computation of F-statistics, the regularization parameter, and the sensors you are going to use for this estimation. You can edit the following options:<
> * '''Comment''': This field contains what is going to be displayed in the database explorer. * '''Dipole orientation''': Please select ''Unconstrained'', which calculates the dipole orientation using the maximum contrast criterion. The method ''Constrained (normal to cortex) ''uses the orientation of cortical surface as dipole orientation. Note that the method ''Constrained (normal to cortex)'' is only available when the Head Model provides the orientation for each grid location. The unconstrained method may give more smooth results than the cortically constrained method. * '''Time windows''': Three parameters have to be set: ''Time range of active window'', ''F statistic window size'', and ''Temporal resolution''. The dipole orientation and spatial filter is estimated using the variance of source activity during active state <>. ''F-statistic window size'' defines the length of the window for the computation of F-statistics, that is, <>. The time window for computing F-statistics is going to be slided in ''Time range of active state'' with the interval set to be ''Temporal resolution''. If there are more than one F-statistic windows, the time label of the F statistics will be set as the middle time of each window, that is, <> in the following figure. And you will obtain the spatiotemporal F-statistics bewteen <> and <>.<
><
> {{attachment:MCBSlidingWindow.png||width="582",height="292"}} * '''Regularization parameter''': This value will be multiplied with the maximum eigenvalue of the covariance matrix computed from the recordings during Time range of interest. The larger value of regularization parameter may give the more smooth results. * '''Sensors type''': Modalities that are used for the reconstruction. Here we only have one type of MEG sensors, so nothing to change. * '''Method for F statistic computation''': The default is set to be ''Variance (use user define baseline) / Variance'' to compute F-statistic values. The other two methods are ''Power / Variance'' and ''Variance / Variance''. When the methiod ''Variance (use user defined baseline) / Variance'' is selected, the field of ''Baseline time window for F-ststistic calculation'' must be given. In this example, we set the baseline to be -104.2 to -10 ms. 1. Click on [Run]. Two new files are available in the database explorer. * '''right:MCB: SpatilFilter(Unconstr)|0.0_295.8ms''': This file saved the spatial filter for each grid point. The spatial filters are normalized using the standard deviation of beamformer outpouts during control state. <
><
> {{attachment:MCBSF.png}} * '''right:MCB: F-statistics var(b)/var(Unconstr)|0.0_295.8ms''': This file saved the F-statistic value for each grid point during 0-295.8 ms. <
><
> {{attachment:MCBDatabaseExplorerFmaps.png}} <
><
> Double click on this file. Set the time to be anytime between 0 and 295.8 ms. Then click ''Surface'' tab on the right panel of database explorer. Set ''Data options > Amplitude'' to be '''95%'''. <
><
> {{attachment:MCBFmaps3Methods.png||width="617",height="219"}} <
><
>From left to right, the figures display the F statistics computed using Power / Variance, Variance / Variance, and Variance (use user defined baseline) / Variance. The baseline used in this example was set to be -104.2 ~ -10 ms. 1. Process Subject01 / left / left | timeoffset (101 files) using the same procedure. <
><
> {{attachment:MCBFmapsleft.png||width="596",height="205"}} <
><
>From left to right, the figures display the F statistics computed using ''Power / Variance'', ''Variance / Variance'', and ''Variance (use user defined baseline) / Variance''. The'' baseline'' used in this example was set to be '''-104.2 ~ -10 ms'''. <
><
> 1. Process Subject01 / right / right | timeoffset (98 files) using the following parameter values to obtain the spatiotemporal dynamics of F-statistics.<
><
> {{attachment:MCBPipelineEditorFDynamics2.png}} <
><
>Two new files are available in Database explorer: * '''right:MCB: SpatilFilter(Unconstr)|0.0_295.8ms''': This file saves the spatial filter for each grid points. The filename shows the time range used to compute spatial filters, that is, 0.0 to 295.8 ms in this case. * '''right:MCB: F-statistics var(b)/var(Unconstr)|10.0_290.0ms(ws:20.0ms,tr:10.0ms,bs:-104.2_-10.0ms)''': This file saved the spatiotemporal dynamics of F-statistics between''' 10.0''' and '''290.0 ms'''. The abbreviations for F-statistics window size, temporal resolution, and baseline is ''ws'', ''tr'', and ''bs''. Click on this file. Choose ''Surface'' tab and set ''Data options > Amplitude'' to be '''50%'''. Right click on the pop-out window. Select ''Snapshot > Time contact sheet: Figure.''<
><
> {{attachment:MCBSnapshotSettting.png}} <
><
>In this window, set ''Start time (ms)'' to be '''10''', ''End time (ms)'' to be '''290''', and ''Number of snapshots'' to be '''29'''. Click on Ok. You will obtain the following figures. <
><
> {{attachment:MCBFdynamicsRight.png||width="783",height="604"}} <
><
>These figures display the F-statistics maps between 10 ms and 290 ms with 10-ms time interval. The baseline used in this example is set to be -104.2 ~ -10 ms. 1. Process "''Subject01 / left / left | timeoffset (101 files)''" with the same parameter values used in the previous step to obtain the spatiotemporal dynamics of F-statistics. <
><
> {{attachment:MCBFdynamicsLeft.png||width="796",height="494"}} == References == 1. Liu TC and Van Veen BD, (1992) <
> Multiple window based minimum variance spectrum estimation for multidimensional random fields <
> IEEE Transactions on Signal Processing, 40(3): 578-589 1. Van Veen BD, Van Drongelen W, Yuchtman M, Suzuki A (1997)<
>Localization of brain electrical activity via linearly constrained minimum variance spatial filtering<
>IEEE Transactions on Biomedical Engineering 44(9): 867-880. 1. Gross J, Kujala J, Hamalainen M, Timmermann L, Schnitzler A, Salmelin R (2001) <
> Dynamic imaging of coherent sources: Studying neural interactions in the human brain <
> Proc Natl Acad Sci U S A 98(2): 694-699. 1. Robinson SE and Vrba J (1999) <
>Functional neuroimaging by synthetic aperture magnetometry<
>Recent Advances in Biomagnetism. Tohoku University Press 1999: 302-305. 1. Chen YS, Cheng CY, Hsieh JC, Chen LF (2006)<
>Maximum contrast beamformer for electromagnetic mapping of brain activity<
>IEEE Transactions on Biomedical Engineering 53(9): 1765-1774. <>