[TUTORIAL UNDER CONSTRUCTION]

https://neuroimage.usc.edu/brainstorm/Tutorials/tutoFEMadvancedFinal#preview

FEM tutorial: MEG/EEG Median nerve stimulation

Authors: Takfarinas Medani, Juan Garcia-Prieto, Wayne Mead

This tutorial introduces the FEM modeling in the Brainstorm environment.

Note that the operations used here are not detailed, the goal of this tutorial is not to introduce Brainstorm to new users. For in-depth explanations of the interface and theoretical foundations, please refer to the introduction tutorials.

In this tutorial, we describe the full FEM process as described in the SPIE paper

License (to check with Juan/John)

This tutorial dataset (MEG/EEG and MRI data) remains proprietary of xxxxyyyy. Its use and transfer outside the Brainstorm tutorial, e.g. for research purposes, is xxxx yyy. (allowed /prohibited /request)

Requirements

You have already followed all the introduction tutorials and you have a working copy of Brainstorm installed on your computer. If you want to reproduce this tutorial on your computer you need also to have these tools installed on your computer: SimNibsand BrainSuite. Check this tutorial for further information about these tools.

Description of the experiment (todo: Juan) only one file?

The experiment consists of two stimulation protocols being conducted during a single scanning session in a MEG laboratory with an Elekta Triux (Megin, Finland) scanner. The subject is a right-handed 46 years old male. The two stimulation protocols consist of unilateral median nerve stimulation and an eyes-closed resting-state recording.

Median nerve stimulation:

Resting-State protocol:

Download and installation (todo Francois upload data)

Import the MRIs

[ATTACH]

[ATTACH]

Brainstorm will ask you to register the T2 to the T1, select the SPM option (require to have SPM installed), then reslice the T2, select "Yes". This process will take few minutes, just be patient.

Head model construction

FEM head model

The first step requires the generation of the FEM head model, where the MRIs are segmented into the main issues and then tesselated into hexahedral or tetrahedral elements. The available methods within Brainstorm are listed in this page.

Note: In the following, the SimNibs method is used. If you don't have this software installed you can import the SimNibs results (TODO: add the simNibsOutput to the data)

In order to use the call SimNibs you need to have it installed on your computer, please follow the instruction as explained in here.

Keep all the options to their default values.

Depending on your computer performance, this process can take 2 to 4 hours, so be patient.

[ATTACH]

At the end of this computation, Brainstorm will populate the windows with the following nodes

At the end of the process, make sure that the file "cortex_15002V" is selected (downsampled pial surface, which will be used for the source estimation). If it is not, double-click on it to select it as the default cortex surface.

Advanced

Remesh the head model

In some cases, from our experiences, the FEM mesh generated with SimNibs may have some issues with the DUNEuro FEM solver, this issue is mainly related to the air cavities in the head model as well as the hole. In order to avoid these possible issues in the next steps, we will correct the mesh using the FEM mesh tools integrated within Brainstorm.

remeshHeadIso2mesh.jpg

The following figure shows the two model, left is the initial model obtained with SimNibs, right is the second model obtained from the Iso2Mesh re-mesh

femMeshSimNibsVSiso2mesh2.jpg

You can also use this process to generate FEM model with high mesh densities.

FEM tensors

The FEM has the ability to incorporate anisotropic conductivity, es[acially for the white matter. Brainstorm offers the known methods to estimate the tensors from the DWI data. For a more detailed example please refere to this page.

There are two main phases to compute the tensors, the first is the computation of the DTI from the DWI. The second is the estimation of the conductivity tensors from the DTI on each of the FEM mesh elements.

Step one:

[ATTACH]

BrainStorm will call internally the Brainsuite Software to compute the DTI. This process can take up to 20 minutes. At the end of this process, a node will appear in the Brainstorm database explorer under the name "DTI-EIG", this is a volume data that contains the 12 values of the eigenvalues and eigenvectors at each voxel.

Explanation of the options:

Brainstorm recognizes the tissue listed on the FEM had and assigns the default isotropic conductivities, as shown on the panel, users can change and use their own values.

When the DWI data are computed, the conductivity tensors can be estimated on the white matter tissues using the Effective Medium Approach (EMA), Brainstorm offers two option, the EMA with a fixed factor k=0.736, or the EMA with the volume constraint (EMA+VC), please refer to this tutorial and the cited publication for further information.

Step two:

Once the DTIs are computed,

[ATTACH]

This process can take up to 5min, depending on the resolution of the FEM mesh.

Visualisation of the FEM volume conductor

Brainstorms include the possibilities to display the FEM head models and the tensors, users can also overlay the display with the MRI as well as with the different surfaces.

overlayModalities.png

The FEM tensors can be also displayed either on the mesh or on the MRI, to do so, right-click on the FEM mesh, then "Display FEM tensors", you can choose the displaying mode, the tensors can be displayed either as arrows (line) on the main eigenvector or as ellipsoids, on each FEM element (tetrahedron).

dispTensorMenu.png

tensorsOnBrain.jpg

tensorsOnMRI.jpg

The size of the displayed tensors can be changed from the keyboard with the "Up" or "Down " arrows keys. You can also switch the display mode (from lines to ellipsoids to line or inversely) by using the shortcut "Shift + Space".


Advanced

On the hard disc

The "DTI-EIG" is saved structure as the Brainstorm MRI format, but it contains 12 values, from 1 to 9: components of the three eigenvectors, and from 10 to 12, the values of their norm to the eigenvalue.

The FEM mesh, as shown in the figure, contains the following fields

the 12 values are the eigenvalues and eigenvectors interpolated on each element of the mesh.

femDataOnHardDisc.png

BEM head model

For the purpose of comparison between the FEM and the BEM, we will generate also the BEM surfaces for this subject and we will follow the same step as explained in this page. The obtained surfaces will be used later for the BEM source computation.

Richt-click on the subject01, then "MRI Segmentation" and then "Generate BEM surfaces", then keep the default options, Brainstorm, (1922 vertices) for each layer and 4mm for the skull.

Three new nodes appear in the database explorer, bem_head_1922V, bem_outerskull_1922V, and bem_innerskull_1922V. These surfaces will be used for the BEM forward computation.

Now we have two head geometry available for this subject, BEM and FEM fem&bemModels.jpg

Access the recordings

The new file "Link to raw file" lets you access directly the contents of the MEG/EEG recordings. The "Neuromag channels(374)" contains the name of the channels and the position of the corresponding sensors (MEG/EEG)

[ATTACH]

The channel file

Refine the MRI registration

[ATTACH]

Pre-processing

psd.jpg

Frequency filters

freqFilters.jpg

spectreClean.jpg

EEG: Average reference

avgRef.jpg

At the end, the window "Select active projectors" is open to show the new re-referencing projector. Just close this window. To get it back, use the menu Artifacts > Select active projectors.

To keep the interface clean and eeasy to follow, you may need also to remove the previous and keep only the last folder that inlude all the post-processing.

Epoching

In this experiment, the electric stimulation is sent with a frequency of 2Hz, meaning that the inter-stimulus interval is 500ms. We are going to import epochs of 300ms around the stimulation events (-100 to 200ms).

importEpochs.jpg

In the end, you are asked whether you want to ignore one epoch that is shorter than the others. This happens because the acquisition of the MEG signals was stopped less than 300ms after the last stimulus trigger was sent. Therefore, the last epoch cannot have the full [-100,200]ms time definition. This shorter epoch would prevent us from averaging all the trials easily. As we already have enough repetitions in this experiment (240), we can just ignore it. The total number of epochs is then 239.

Averaging

avrgEpochs.jpg

Review the average for the MEG and EEG as a topography plot -Right-click on the averaged signal -EEG (then MEG) > 2D disc

megEegTopography.jpg

AT the selected time, an ERP is visible with a nice dipolar pattern on the sensors, both for the EEG and MEG.

Source estimation

We are going to use the realistic FEM head model, the one previously generated from the MRI as explained in sections above.

Go to the "Anatomy" view, and make sure that the FEM head model is highlighted in green color (it should be the case if you have only one model). You may also highlight the cortex to use for the computation (select the cortex_15002V).

IMPORTANT: You can compute the forward model both for EEG and MEG simultaneously, however, using the high mesh resolution model we recommend to compute separately the head model for each modality(EEG and then MEG). The time required for EEG is aound one hour for ~70 channles, for the MEG with 306 sensors it can take up to 4 hours or more (with the integrations points).

The EEG/MEG FEM computation depends on the computation of the FEM transfer matrix, and the computation of this matrix is related to the resolution of the FEM head mesh (number of vertices) and the number of sensors. In most of the case, the number of EEG sensors is lower than the number of MEG sensors. Furthermore, internally the MEG sensors modeling uses the integrations points, which increase the number of computation points (~ multiplied by 4 for the magnetometers and by 8 for the gradiometers). Therefore the MEG requires more time than the EEG.

To reduce the MEG computation time, there are some tips :

  1. Use only the inners tissues (wm, gm, and CSF) ==> reduce the number of vertices

  2. Do not use the integration points ==> reduce the number of virtual sensors

  3. These parameters can be tuned from the DUNEuro Options panel (see the advanced panel)

In this tutorial, we will separate the modalities.

EEG Head model with DTI tensors

eegDuneuroPanels.jpg

The FEM EEG head modeling will start and depending on the performance and the workload of your computer, it can last between 30min to 2 hours. Once the computation is done, a new node with the name "DUNEuro FEM EEG DTI tensors"

appear on the Brainstorm database navigator, which can be used for the source localization process.

MEG Head model with DTI tensors

megDuneuroPanelsDTI.jpg

The FEM MEG head modeling will start and depending on the performance and the workload of your computer, it can last between 1hour to 4 hours (even more if you select all the tissues).

Once the computation is done, a new node with the name "DUNEuro FEM MEG DTI tensors" appears on the Brainstorm database navigator, which can be used for the source localization process.

EEG Head model with isotropic conductivity

In the case where the DTIs are not available, or if the users want to use the isotropic conductivity, the following section explains how to do it.

eegDuneuroPanelsIso.jpg

MEG Head model with isotropic conductivity

Same step as before, first you need to make sure that the tensors are not computed,

megDuneuroPanelsIso.jpg

In this tutorial, for each modelity we have computed two forward models (isotropic and anisotrpic). This is a good option to compare if there is any difference between the isotropic model and the anisotropic model.

Noise covariance matrix

Enter the same baseline interval we used for removing the DC offset: [-100, -10] ms noiseCovariance.jpg

Inverse model

Repeat the same operation for MEG and make sure to select the appropriate head model at each step.

computeDipolesInverseAll.jpg

It is better to study separately the two modalities because the method for combining MEG and EEG are not working well yet within Brainstorm.

This operation creates a shared inversion kernel and one source link for each block of recordings in the folder.

[ATTACH]

Drag and drop the Dipoles kernels in the Process table and select the process > Run> Dipole Scanning>

dipoleScanningProcess.jpg

If you are not familiar with those concepts, please refer to the Source estimation tutorial.

Once the dipoles are computed, we display both EEG and MEG separately in the following figures. We merge the MEG ISO and the MEG DTI dipoles as well as the EEG dipoles.

dipolesMergeEEG&MEG.jpg

P20/N20 source localization

The following figures (left EEG, right MEG), show the localization of the dipoles on the MRI at the 21ms. The ISO model is colored in greeen wherease the DTI model is colored in red.

eegMegDipolesSagittal.jpg eegMegDipolesAxial.jpg eegMegDipolesCoronal.jpg

In this experiment, the anisotropy does not show a significant effect on the source localization, whereas it shows a slich difference in the orientation.

When we compare between the EEG and the MEG, there is a difference of 20mm between the localization between the MEG and the EEG as well as a difference in the orientation in the coronal view.

If we compare the difference between the EEG and MEG dipoles, the following figures (left anisotropy, right isotropic), show the localization of the dipoles on the MRI at the 21ms. The EEG dipole is colored in green wherease the MEG dipole is colored in red.

eegMegDipolesSagittal2.jpg eegMegDipolesAxial2.jpg eegMegDipolesCoronal2.jpg

Aniso: Eeg [-7.5 -35.7 89.8] vs Meg [-0.2 -33.6 88.6] ==> distance = 7.7mm

Iso: Eeg [-7.5 -35.7 89.8] vs Meg [-0.2 -33.6 88.6] ==> distance = 7.7mm

In both modalities, the dipoles are located exactely in the same positions, and there is 7.7mm between the two dipoles. Further more, we notice a difference on the orientation on the coronal and sagital views

Comparaison with BEM for EEG and with OS for the MEG

In order to compare qualitatively the results of the FEM models, we will use the previous methods already implemented in Brainstorm.

For the EEG: compute the forward using the BEM For the MEG: compute the forward using overlapping spheres,

For all the methods, we will perform the dipole scanning as done previously but with the new forward models, the results are shown in the following figures:

In the following figures, left is the dipoles computed from the EEG (BEM in red and FEM in green), right are the dipoles computed from the MEG (OS in red and FEM in green)

eegMegDipolesSagittal3.jpg eegMegDipolesAxial3.jpg eegMegDipolesCoronal3.jpg

EEG: fem [-7.5 -35.7 89.8] ; bem [-10.7 -35.0 89.5] ==> 3.3mm

MEG: fem [-0.2 -33.6 88.6] ; os [-10.7 -39.3 83.2] ==> 13.1 mm

As expeced, the slight difference on the localization can be explained by the difference on the head shape, the conductivity values as well as the resolution method.

Advanced

Resect the neck and the bottom part of the head model

The FEM computation can be time and memory-consuming, on way to reduce this issue is to remove the part of the FEM mesh that is not required.

In some cases where the field of the MRI is large, you can have the mesh of the neck and even the shoulders. In Brainstorm, it is possible to remove these parts. You can this by following these steps : right-click on the FEM-mesh => Resect Neck ==> keep the default value ==> Ok


[ATTACH]


Once the process is finished, a new FEM head model appears in the database with the same name and a prefix "resect" which is the resected head. The following figure shows the model before and after re-section.

[ATTACH]

Note that the initial model has 743828 nodes and 4079587 and the resected model has 613955 nodes and 3400957 elements.

Scripting

This section is under devellopement

DUNEuro advanced options

This section is under development

A set of advanced options are made available and can be easily changed. Here a short explanation is given for each option.

In this version, only the Fitted FEM approaches are integrated, that require the FEM mesh of the head model. Unfitted methods are also available within DUNEuro, and will be integrated soon in Brainstorm.

For more information about these methods, users can check this thesis (Vorwek thesis).

All these parameters are stored and passed to the DUNEuro as a text file. This file is the main interface that passes the parameters from Brainstorm to DUNEuro. More details about the integration can be found in these links:

Troubleshooting and solution(TODO)

Dipoles outside of the grid for the MEG: remove this dipole or replace it with its spatial neighbors (not the neighbor in the list) ==> not easy to handle write small tuto?

Tutorials/FemMedianNerve (last edited 2021-07-02 00:23:23 by TakfarinasMedani)