Tutorial 22: Source estimation


Authors: Francois Tadel, Elizabeth Bock, Rey R Ramirez, John C Mosher, Richard Leahy, Sylvain Baillet

Now you have in your database a forward model matrix that explains how the cortical sources determine the values on the sensors. This is useful for simulations, but what we really need is to build the inverse information: how to estimate the sources when you have the recordings. Many solutions are described in the literature, some of them are implemented in Brainstorm, and only one is presented in this tutorial: the minimum-norm estimation. It is not really the most advanced solution, but it is one of the most robust.

Computing sources for a single data file

  1. Right-click on Subject01 / Right / ERF > Compute sources.

    [ATTACH] --- [ATTACH]

  2. With this window you can select the method you want to use to estimate the cortical currents, and the sensors you are going to use for this estimation. The default "Normal mode" only let you edit the following options:

    • Comment: This field contains what is going to be displayed in the database explorer.

    • Method: Please select wMNE. The other methods dSPM and sLORETA are also based on wMNE. They may give better and/or smoother results depending on the cases.

    • Sensors type: Modalities that are used for the reconstruction. Here we only have one type of MEG sensors (axial gradiometers), so nothing to change.

    • Expert mode: Show other options we do not care about right now.

    • Click on Run.
  3. A new file is available in the database explorer.


    • It is displayed inside the recordings file ERF, because it is related to this file only.

    • Meaning of that weird filename: "MN" stands for "Minimum Norm", and "Constr" stands for "Constrained orientation" of the dipoles (the estimated dipoles orientations are constrained to be normal to the cortex).
    • You can have a look to the corresponding matrix file (right-click > File > View file contents). You would find all the options of forward and inverse modeling, and only one interesting field : ImagingKernel, which contains the inversion kernel. It is a [nVertices x nChannels] matrix that has to be multiplied with the recordings matrix in order to get the activity for each source at all the time samples.

    • The minimum norm solution being a linear operation (the time series for each source is a linear combination of all the time series recorded by the sensors), we make this economy of saving only this linear operator instead of the full source matrix (nVertices x nTime)


  4. Do the same for the Left / ERF file

Sources visualization

There are two main ways to display the sources: on the cortex surface and on the MRI slices.

Sources on cortex surface

  1. Double-click on recordings Right / ERF, to display the time series (always nice to have a time reference).

  2. Double-click on sources Right / ERF / MN: MEG.
    Equivalent to right-click > Cortical activations > Display on cortex.

  3. Go to the main peak around 46ms (by clicking on the times series figure)


  4. Then you can manipulate the sources display exactly the same way as the surfaces and the 2D/3D recordings figures: rotation, zoom, Surface tab(smoothing, sulci, resection...), colormap, sensors, predefined orientations (keys from 0 to 7)...

  5. Three new controls are available in the Surfaces tab, in panel Data options:

    • Amplitude: Only the sources that have a value superior than a given percentage of the colorbar maximum are displayed.

    • Min. size: Hide all the small activated regions, ie. the connected color patches that contain a number of vertices smaller than this "min.size" value.

    • Transparency: Change the transparency of the sources on the cortex.

  6. Take a few minutes to understand what this threshold value represents.

    • The colorbar maximum depends on the way you configured your Sources colormap. In case the colormap is NOT normalized to current time frame, and the maximum is NOT set to a specific value, the colorbar maximum should be around 68 pA.m.

    • On the screenshot above, the threshold value was set to 35%. It means that only the sources that had a value over 0.35*68 = 23.8 pA.m were visible.
    • If you set the threshold to 0%, you display all the sources values on the cortex surface; and as most of the sources have values close to 0, the brain is mainly blue.
    • Move the slider and look for a threshold value that would give you a really focal source.The following figures represent the sources activations at t=46ms respectively with threshold at 0% and 90%.


    • The figure on the right shows the most active area of the cortex 46ms after an electric stimulation of the right thumb. As expected, it is localized in the left hemisphere, in the middle of post central gyrus (projection of the right hand in the primary somatosensory cortex).

Sources on MRI (3D)

  1. Close all the figures (Close all button). Open the time series view for Right / ERF.

  2. Right-click on Right / ERF / MN: MEG > Cortical activations > Display on MRI (3D).

  3. This view was also introduced in the tutorial about MRI and surface visualization. Try to rotate, zoom, move the slices, move in time, change the threshold.


  4. A new menu is available in the popup menu of this figure: MRI Display
    • MIP Anatomy: for each slice, display the maximum value over all the slices instead of the original value in the structural MRI (fig 1)

    • MIP Functional: same thing but with the layer of functional values (fig 2)

    • Smooth level: The sources values are smoothed after being re-interpolated in the volume. These menus define the size of the smoothing kernel (fig2: smooth=2; fig3: smooth=5).


  5. This view can be used to lots of different types of contact sheets: in time or in space, for each orientation. You can try all the menus. Example: Right-click on the figure > Snapshot > Volume contact sheet: axial:


Sources on MRI (MRI Viewer)

  1. Right-click on Right / ERF / MN: MEG > Cortical activations > Display on MRI (MRI Viewer).

  2. This view was also introduced in the tutorial about MRI and surface visualization. Try to move the slices (sliders, mouse wheel, click on the views), move in time, change the threshold.


Minimum norm values are not only positive

You should pay attention to a property of the current amplitudes that are given by the wMNE method: they can be positive of negative, and they oscillate around zero. It's not easy to figure out what is the exact meaning of a negative value respect with a positive value, and most of the time we are only interested in knowing what is activated at what time, and therefore we look only at the absolute values of the sources.

In some other cases, mainly when doing frequency analysis, we need to pay attention to the sign of these values. Because we cannot do a frequency decomposition of the absolute values of the sources, we need to keep the sign all along our processes.

Display again the sources for Right / ERF on the cortex surface (double-click on the source file), and uncheck the Absolute option for the colormap "Sources" (right-click on the figure > Colormap Sources > Absolute values). Decrease the threshold to observe the pattern of alternance between positive and negative values on the surface. Then double click on the colorbar to reset it to its default.


Minimum norm units

For information about the units used to represent the minimum norm source activation, pA.m (pico Ampere meter), please refer to the following forum post:


Computing sources for multiple data files

The sources file we are observing was computed as an inversion kernel. It means that we can apply it to any similar recordings file (same subject, same run, same positions of sensors). But in our TutorialCTF database, the MN: MEG node only appears in the the ERF file, not in the Std one. What is it necessary to share an inversion kernel between different recordings ?

  1. Compute another source estimation: but instead of clicking on the Compute sources from the ERF recordings popup menu (which would mean that you only want sources for this particular recordings file), get this menu from the Right condition. This means that you want the inversion model to be applied to all the data in the condition.

  2. Select "Minimum Norm Imaging", click on Run.
  3. Three new nodes are available in the tree:


  4. The actual inversion kernel you have just computed (1), contains the same information as the one from the previous section (Computing sources for a single data file). Note that you cannot do anything with this file: if you right-click on it, you can see that there are no Display menu for it.

    • Two links (2) that allow you apply this inversion kernel to the data files available in this condition (ERF and Std). In their popup menus, there are all the display options introduced in the previous section.

    • These links are not saved as files but as specific strings in the database: "link|kernel_file|data_file". This means that to represent them, one should load the shared kernel, load the recordings, and multiply them.
    • The sources for the Std file do not have any meaning, do not even try to open it. It was just to illustrate the way a kernel is shared

  5. Double-click on both sources files available for Right / ERF (link and non-link), and verify at many different times that the cortical maps are exactly the same in both cases.

  6. You can estimate the sources for many subjects or conditions at once, as it was explained for the head models in previous tutorial: the Compute sources menu is available on all the subjects and conditions popup menus.

  7. Delete the shared kernel (1), we don't need redundant and confusing information for the next steps. Observe that both links disappear at the same time.

Minimum norm options

Let's introduce briefly the other options offered for the source estimation. Right-click again on Right / ERF > Compute sources. Click on "Expert mode", you see more options appearing in the window. If you click on Run, you have access to all the options of the wMNE algorithm.



Output mode

Source orientation

Signal properties

Noise covariance matrix

Depth weighting

The minimum-norm estimates have a bias towards superficial currents. This tendency can be alleviated by adjusting these parameters. To understand how to set these parameters, please refer to the MNE manual (options --depth, --weightexp and --weightlimit).

Do it yourself

Typically, the only options you want to change is the type of estimator that is computed (wMNE, dSPM, sLORETA) and the orientation of the dipoles (constrained, unconstrained). Don't try to play with the other options if you are not really comfortable with what they represent. Now, compute and compare the following combinations of options for Right / ERF:

  1. wMNE, Kernel only, Constrained (already computed)

    • Check the contents of the file (right-click > File > View file contents): The inverse operator is saved in the field ImagingKernel [nVertices x nSensors]

  2. wMNE, Full results, Constrained:

    • Check the contents of the file: The full results matrix is saved in the field ImageGridAmp [nVertices x nTime]

    • Open solutions #1 and #2 at the same time and check visually at different time points that the results are exactly the same
  3. wMNE, Kernel only, Unconstrained:

    • Check the contents of the file: The inverse operator contains now the information for three dipoles (three orientations) per vertex, [3*nVertices, nSensors]
    • Open solutions #1 and #3 at the same time, and observe that the unconstrained solution is much smoother
  4. dSPM, Kernel only, Unconstrained

  5. sLORETA, Kernel only, Unconstrained

    • Open solutions #3 (wMNE), #4 (dSPM) and #5 (sLORETA), all unconstrained.
    • Notice that the units are different: wMNE values are in pAm, dSPM and sLORETA are in arbitrary units (never try to compare these values to anything but the exact same type of inverse solution)
    • Observe around 46ms the respective behavior of these three solutions:
    • 3) wMNE tends to highlight the top of the gyri and the superficial sources,
    • 4) dSPM tends to correct that behavior and may give higher values in deeper areas,
    • 5) sLORETA produces a very smooth solution where all the potentially activated area of the brain (given to the low spatial resolution of the source localization with MEG/EEG) is shown as connected, regardless of the depth of the sources.

wMNE: constrained (kernel and full), and unconstrained




Now delete all these files when you're done, and keep only the initial solution: wMNE, Constrained.

Additional discussions on the forum

From continuous tutorials

Inverse model

Right-click on (Common files), on the head model or on the subject node, and select "Compute sources". A shared inversion kernel is created in (Common files); a link node is now visible for each recordings file, single trials and averages. For more information about what these links mean and the operations performed to display them, please refer to the tutorial #8 "Source estimation".


Explore the sources

Right-click on the sources for the left average > Cortical activations > Display on cortex, or simply double click on the file. Go to the main response peak at t = 30ms, and increase the amplitude threshold to 100%. You see a strong activity around the right primary somatosensory cortex, but there are still lots of brain areas that are shown in plain red (value >= 100% maximum of the colorbar ~= 280 pA.m).


The colorbar maximum is set to an estimation of the maximum source amplitude over the time. This estimation is done by finding the time instant with the highest global field power on the sensors (green trace GFP), estimating the sources for this time only, and then taking the maximum source value at this time point. It is a very fast estimate, but not very reliable; we use it because calculating the full source matrix (all the time points x all the sources) just for finding the maximum value would be too long.

In this case, the real maximum is probably higher than what is used by default. To redefine the colorbar maximum: right-click on the 3D figure > Colormap: sources > Set colorbar max value. Set the maximum to 480 pA.m, or any other value that would lead to see just one very focal point on the brain at 30ms.


Go back to the first small peak at t=16ms, and lower the threshold to 10%. Then do what you did with at the sensor level: follow the information processing in the brain until 100ms, millisecond by millisecond, adapting the threshold and the camera position when needed:

sources16.gif sources30.gif

sources60.gif sources70.gif

From auditory

Inverse model

Average in source space

Rey on sLORETA

Yes in sLORETA the noise covariance is not used at all for the standardization process. It can be used modeling correlated noise and whitening, but that is optional.

I have noticed that a lot of folks are confused about this and I have seen many statements in papers spreading this awful confusion. The sLORETA is standardized by the resolution matrix (diagonal for dipole orientations constraints, or block diagonals for free orientations).

That is why sLORETA has zero localization bias for ALL point-spread functions, and why I always prefer sLORETA over dSPM, MNE, or any beamformer. This is all in the math .... but ..... just so that you know Fas Hsuan Lin's paper comparing sLORETA with dSPM, and MNE has a big mistake, the assumed source covariance matrix is not the identity matrix, and that violates the beauty of the math and results in non-zero localization bias. That's why in Brainstorm the prior source covariance matrix used for sLORETA automatically uses no depth bias compensation (identity matrix). sLORETA accomplishes depth bias compensation via the resolution matrix, NOT via the prior source covariance matrix. Trying to use a depth exponent of 0.7 or 0.8 like we do for MNE and dSPM will mess up sLORETA.You will not find this in a paper, but I checked it all out many years ago. This is critical.

Explain sLORETA units (see email exchanges from Feb 2015)

Issues with dSPM average

Average(dSPM) is NOT equal to dSPM(Average).

There is no problem for the MNE and sLORETA solutions, because the scaling of the noise covariance matrix doesn't impact the results.
    wMNE(Data, NoiseCov) = wMNE(Data, NoiseCov / N)
So when we average we get:
    Average(wMNE(Trials, NoiseCov)) = wMNE(Average, NoiseCov) = wMNE(Average, NoiseCov / N)

But for dSPM we have:
    dSPM(Data, NoiseCov) = dSPM(Data, NoiseCov / N) ./ sqrt(N)
So when we average we get:
    Average(dSPM(Trials, NoiseCov)) = dSPM(Average, NoiseCov) = dSPM(Average, NoiseCov / N) ./ sqrt(N)

Rey: "dSPM is really a source mapping of SNR, not of activity. Hence, it's not all so surprising that the single trial SNR maps are smaller...

"Rey: "Perhaps, dSPM should be used only for averaged data (i.e., ERF, ERP), at least until it's all figure out. In a way, dSPM is just MNE followed by the noise normalization. Thus, you could do all the single trial processing with the MNE algorithm, and only do the noise normalization when needed (e.g., after averaging or on single trials only if they are not going to be averaged)."

On the hard drive

Document file tags

Document file structure

Additional documentation

Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):

Tutorials/SourceEstimation (last edited 2015-07-22 20:21:22 by FrancoisTadel)