Simulations

Author: Francois Tadel

This tutorial addresses everything that can be called "simulation" in Brainstorm: simulation of simple signals, simulation of full source maps from a few scouts, simulation of MEG/EEG recordings from source maps (real or synthetic). Its goal is to group all the information that was previously spread across multiple tutorials and forum posts, and difficult to access. The examples are based on the introduction tutorials, but can easily be transposed to any study.

Simulate signals

You have no data in your database. The processes in the Simulate menu can generate signals and save them as new files in the database. Because you start from nothing, the Process1 list needs to be empty. Click on Run and try the following processes.

Simulate generic signals

This process allows to define a set of signals with Matlab code and save it in a Brainstorm file. With the text box, you can write a free-form piece of code, which will be evaluated with the function eval(). This code must at least define the variable Data [Nsignals x Ntime], based on in the input time vector t (defined automatically by the process from the number of time points and the sampling frequency). The more rows you add to the Data matrix, the more signals you will have in your file. The example below creates three signals. Another example is available in the tutorial Time-frequency.

simulate_generic.gif

Simulate AR signals [TODO]

For evaluating connectivity metrics, it is useful to create signals that have known connectivity properties. Simulating signals with auto-regressive models for a solution illustrated in the tutorial Connectivity. Two processes are available, using different methods.

Process > Simulate AR signals (ARfit)

simulate_ar.gif

Process > Simulate AR signals (random)

simulate_ar_random.gif

Simulate PAC signals

This process generates synthesized data containing cross-frequency phase-amplitude coupling. It is fully documented in the tutorial Phase-amplitude coupling: Method.

simulate_pac.gif

Simulate MEG/EEG from sources

After estimating the sources from real MEG/EEG recordings with the minimum norm method, you can simulate recordings from the model. This is done simply by multiplying the source time series with the forward model:

EEG_sim [Nelec x Ntime] = Forward_model [Nelec x Nsources] * MN_sources [Nsources x Ntime]

From full source maps

To simulate MEG/EEG recordings from a minimum norm source model: right-click on the source file, then select the menu Model evaluation > Simulate recordings. This can be useful for evaluating the quality of the model. The process is documented in the tutorial Source estimation.

model_eval_menu.gif

From scouts

If you want to limit this simulation to a specific ROI, one easy solution is to set all the sources outside of the ROI to zero, and calculate the MEG/EEG signal exactly as above. This creates a new file which represents the scalp MEG/EEG recordings if only the selected region of the cortex was activated. Double-click on the source file to open it for display, then in the Scout tab select the scout(s) of interested and use the menu Sources > Simulate recordings.

simulate_scout.gif

Generate full source maps from scouts

You have the values corresponding to source activity of one dipole or a few dipoles, and you would like to save this a source file in the Brainstorm. This source file can later be used to simulate MEG/EEG recordings, exporting as a .nii volume or .gii surface, or any other process in Brainstorm.

Select the scouts time series files in the Process1 tab, then run the process Simulate > Full source maps from scouts. Then select the scouts corresponding to the signals in input. Each input file is processed independently and results in the creation of one source file. You need a channel file and a head model file available in the same folder as each input file.

For constrained dipole orientations, you need one signal in the input file for each selected scout.
For unconstrained dipole orientations, you need three signals for each selected scout.

The order of the signals must match the order of the scouts. In the unconstrained case, the signals must be sorted by scout and then by orientation (scout1_orientX, scout1_orientY, scout1_orientZ, scout2_orientX...). In the process options, you cannot change the order of the scouts, however you can still re-arrange them if you generate a script.

This process is the first step executed by the process "Simulate > Simulate recordings from scouts", illustrated in the following section.

simulate_sources.gif

Simulate MEG/EEG from synthetic dipoles

You have the values corresponding to source activity of one dipole or a few dipoles, and you would like to simulate the corresponding MEG/EEG surface recordings. The process Simulate > Simulate recordings from scouts does this as a combination of two mechanisms previously described on this page: 1) it generates a source map with zeros everywhere except for a few scouts where it uses instead the signals provided in the input file (see previous section), 2) it multiplies this source map with the default forward model available in the folder (in green) to simulate MEG/EEG recordings. Noise can be added at each stage.

The input signals can be simulated (as explained in the first sections of this page) or extracted from sources estimated from real MEG/EEG recordings (also explained earlier in this page). You need to provide one signal per scout for constrained sources, or three signals per scout for unconstrained sources. The examples below illustrate three types of source models: cortex surface / constrained orientation, cortex surface / unconstrained orientation, volume grid / unconstrainted orientation.

Surface: Constrained orientation

Simulation of a single dipole located on the cortex surface, oriented along the normal to the cortex surface, pointing outwards.

Surface: Unconstrained orientation

Simulation of three dipoles at the same location on the cortex surface, oriented along three orthogonal axes (X,Y,Z) as defined in the SCS coordinate system.

Volume: Unconstrained orientation

In the first two examples, we showed how to reuse existing recordings already imported and processed. If you don't have any real MEG/EEG recordings to start with, you may not have any channel file a noise covariance to use in your simulation.

In this third example, we will demonstrate how to simulate EEG activity using a template anatomy and a standard 10-10 electrode cap, and from a dipole in a volume grid instead of the cortex surface.

https://neuroimage.usc.edu/brainstorm/Tutorials/TutVolSource#Volume_scouts

https://neuroimage.usc.edu/brainstorm/Tutorials/Statistics#Convert_statistic_results_to_regular_files

Additional documentation

Articles

A simulation article was published by Prof. Debener's neuropsychology lab in Oldenburg. It uses Brainstorm to evaluate and improve the design of ear-EEG devices. All the Matlab/Brainstorm scripts used in this study are available on figshare, together with some videos illustrating the simulations that were done.

Meiser A, Tadel F, Debener S, Bleichner MG
The Sensitivity of Ear-EEG: Evaluating the Source-Sensor Relationship Using Forward Modeling
Brain Topography, Aug 2020

meiser.gif

Forum discussions

Tutorials/Simulations (last edited 2020-09-29 09:07:56 by FrancoisTadel)