[TUTORIAL UNDER CONSTRUCTION: NOT READY FOR PUBLIC USE]


FEM mesh generation

Authors: Takfarinas Medani, Francois Tadel

FEM forward modeling requires the construction of a 3D model of the head tissues. The volume of the head is divided in small geometrical elements with 4 faces (tetrahedrons) or 6 faces (hexahedrons). Each element is associated with a type of biological tissue (e.g. white matter, gray matter, CSF, skull, skin) and electrical conductivity properties.

This page lists the methods integrated with Brainstorm to generate 3D meshes of the head. For a generic introduction to FEM in Brainstorm, refer to the tutorials: Realistic head model: FEM with DUNEuro and FEM median nerve example.

Generate FEM mesh

FEM meshes can be computed from surfaces (as the ones generated for the BEM models) or from MRI volumes (T1w and/or T2w). The methods that are available when using the popup menu Generate FEM mesh depend on the selected inputs.

Surfaces

Select a list of surfaces representing the separation between different tissues (holding the CTRL or SHIFT key), then right-click on any of them. The software Iso2mesh can create a tetrahedral mesh to represent the tissues between these different layers.

callSurf.gif

T1 MRI

Right-click on a T1 MRI available in the databas. Typically, this is the default MRI volume displayed in green in the subject folder. Methods available: Brain2mesh, SimNIBS, ROAST, FieldTrip.

callT1.gif

T1+T2 MRI

Select the T1+T2 volumes, then right-click on any of them. The different files are identified based on the tags "T1" and "T2" the file names (as displayed in the Brainstorm database explorer). If these identification tags are not found in the file names, the default MRI (in green) is used as the T1, the other as the T2. If none of the is the default MRI, the first selected file is used as the T1, the second is used as the T2. Methods available: Brain2mesh, SimNIBS, ROAST.

callT1T2.gif

Anatomy folder

If you right-click on the subject folder > Generate FEM mesh, then Brainstorm offers all the possible options, even the ones that are not applicable to this specific subject.

callAnat.gif

Iso2mesh

Iso2mesh is a Matlab/Octave-based mesh generation and processing toolbox, available as a Brainstorm plugin.

Brainstorm uses it to generate a FEM tetrahedral mesh from a set of nested surfaces representing the separation between different tissues of the head. For example, these surfaces can be the ones generated for the computation of a BEM forward model. A full example is available in the tutorial Realistic head model: FEM with DUNEuro.

iso2meshOptions.gif

Options

Examples

Troubleshooting

Brain2mesh

Brain2mesh is a MATLAB/Octave based 3D mesh generation toolbox dedicated to the creation of high-quality multi-layered brain mesh models. This software is developed by the same team developing Iso2mesh and relies heavily on it. Both are available as a Brainstorm plugins.

Brainstorm runs the SPM12 segmentation routine on the T1 or T1+T2 MRI volumes to obtain a 5-tissue classifcation (white matter, gray matter, CSF, skull and skin), which is then passed to Brain2mesh for 3D meshing. A full example is available in the tutorial FEM tensors estimation. This option runs fast, but does not generate good quality cortex surfaces, which are needed for the full cortically-constrained source estimation pipeline in Brainstorm.

At the moment, Brainstorm can only use the default parameters of Brain2mesh. If you need more options to be available from the interface, please contact us on the user forum.

brain2meshCall.gif

brain2meshMesh.gif

Troubleshooting

SimNIBS

SimNIBS software was developed to calculate the electric fields caused by Transcranial Electrical Stimulation (TES) and Transcranial Magnetic Stimulation (TMS). All its software dependencies (CAT12, Netgen, Gmsh, MeshFix) are embedded in the SimNIBS installation, which ensures a high stability and portability. However, it cannot be managed automatically as a plugin by Brainstorm, and needs to be installed manually. See: Download and install SimNIBS.

In Brainstorm, we use the headreco pipeline to process T1 or T1+T2 MRI volumes (T1 is required, T2 is highly recommended). This pipeline generates the highest-quality tetrahedral FEM mesh we can get from Brainstorm. It calls internally CAT12 for tissue segmentation (white matter, gray matter, CSF, skull and scalp), and therefore gives us access to high-quality cortex surfaces and surface-based atlases. The tetrahedral mesh generation is done with Gmsh, Netgen and MeshFix. Depending on your computer performances, this process will take between 2 to 5 hours.

Given the high quality and exhaustivity of its outputs, SimNIBS/headreco is the recommended method for FEM mesh generation in Brainstorm. A full example is available in the tutorial: FEM median nerve example.

simnibs.gif

simnibs2.gif

simnibs3.gif

Options

Troubleshooting

ROAST

ROAST

comming soon under development and integration.

For more information, please visit: https://www.parralab.org/roast/ and https://github.com/andypotatohy/roast

Troubleshooting

SPM-related errors: If you've been trying multiple methods successively, errors mentioning a spm_*.m function could be due to incompatible versions of SPM12 functions in the Matlab path. Brain2mesh, FieldTrip and ROAST all run different versions of SPM12 from the same instance of Matlab. Solution: Restart Matlab to get a fresh workspace.

Fieldtrip

- Fieldtrip: this option calls the volume segmentation function from FieldTrip's pipeline. It generates an hexahedral mesh.

This option call the process of fieldtrip MRI segmentation (function ft_volumesegment) and hexahedral mesh generation (ft_meshprepare) develloped by the SimBio team.

Requirement

To use this option, the Fieldtrip and SPM toolbox should be in your matlab. See the Plugins tutorial.

When and how to use it

This option can be called by two processes, either from the MRI or from any segmented tissue available on the Brainstorm database.

The mesh generation with the method is faster. It converts all the voxels to hexahedral mesh.

Only the hexahedral mesh is available for this method. You can either call this option from the MRI data or from any segmentation data available on the subject. If you call it from the MRI, a segmentation is processed first, then the mesh. If you call from the tissues, only the mesh process will be performed.

[ATTACH]

Right-click on the MRI (or the tissues), then "Generate FEM Mesh" then select Fieldtrip option. There are two parameters that the user needs to set, the downsampling of the volume and the node shift ratio.

fieldTripMeshCall.jpg

The option "Downsamp volume before meshing" will reduce the number of voxel by this factor.

The "Shift node" option calls the adaptative mesh generation. The process moves the nodes located on the interface either inward or outward in order to fit the geometry as explained here. This figure shows an example (from Fieldtrip webpage), left the unshifted and on the right the shifted.

nodeShiftFigure.JPG

This method is fast compare to the previous options, the following figures show examples of the mesh obtained with fieldtrip option from the ICBM model.

fieldTripMeshICBM.JPG

Troubleshooting

SPM-related errors: If you've been trying multiple methods successively, errors mentioning a spm_*.m function could be due to incompatible versions of SPM12 functions in the Matlab path. Brain2mesh, FieldTrip and ROAST all run different versions of SPM12 from the same instance of Matlab. Solution: Restart Matlab to get a fresh workspace.

BrainSuite

BrainSuite is a collection of open source software tools that enable largely automated processing of magnetic resonance images (MRI) of the human brain.

Brainstorm calls BrainSuite tools in order to compute the diffusion tensors from the diffusion wiethed inaging (DWI) data. The diffusion tensor are then converted to conductivity tensors by the linear transformation described by David Tuch et al (ref).

The conductivity tensors are are associated with the FEM mesh of the head model. Where ecah mesh element have it's own tensors.

The tensors are used to represnet the anisotropic conductivity of a tissue. The anisotropy means the change on the conductivity by changing the direction. For more information regarding tensors please refers to this page (add link).

Requirement

BrainSuite is an independant softeware, Brainstoem calls its functions from the core source code, therefore the installation of BrainSuite is required.

Please follow the instructions as explained in this webpage.

Once the instalation is completed, The BrainSuite installation folder must be informed in the Brainstorm preferences (From the Brainsuitrom interface, click on 'File' and then 'Edite preferences').

image

When and how to use it

[For this version June 2020, only the tetra mesh are supported and tested.]

The BrainSuite pipline is used to estimate the anisotropy of the brain tissues. This process is associated with the DUNEuro FEM computation. The conductivity tensors will be assigned to each mesh elements.

In order to use this functionnality the DWI data are required. The Niftii files and the assocaited bvec and bval are required. Further more we assume that you have already generated the FEM mesh from the MRI as explained in the previous sections.

Tissue anisotropy estimation

Advanced

From Brainstorm, BrainSuite is used for the skull stripping, bias field correction and then the diffusion pipline is used to compute the diffusion tensors.

ref to the maon function : likToGit

On the hard drive

Right-click on a FEM mesh > File > View file contents:

[ATTACH]

TODO

Tutorials/FemMesh (last edited 2021-08-18 15:41:49 by FrancoisTadel)