= Realistic head model: FEM with DUNEuro = '''[TUTORIAL UNDER REVISION/CORRECTION: NOT READY FOR PUBLIC USE]''' ''Authors: [[https://neuroimage.usc.edu/brainstorm/AboutUs/tmedani|Takfarinas Medani]], Juan Garcia-Prieto, Francois Tadel, Sophie Schrader, Anand Joshi, Christian Engwer, Carsten Wolters, John Mosher and Richard Leahy '' {{attachment:logo_duneuro.png||align="right",height="82",width="187"}} This tutorial explains how to use [[http://duneuro.org/|DUNEuro]] to compute the forward model using the '''finite element method''' ('''FEM'''). The FEM methods use the realistic volume mesh of the head generated from the segmentation of the MRI. The FEM models provides more accurate results than the spherical forward models, and more realistic geometry and tissue propriety than the [[Tutorials/TutBem|BEM]] methods. The scope of this page is limited to a '''basic example''' (head model with 3 layers), more advanced options for head model generation and forward model options are discussed in the tutorial about [[Tutorials/FemMesh|FEM mesh generation]]. We assume that you have already followed the [[Tutorials|introduction tutorials]] (or at least the [[Tutorials/HeadModel|head modeling tutorial]]), we will not discuss the general principles of forward modeling here. <> == DUNEuro == '''[[http://duneuro.org/|DUNEuro]] '''is an open-source C++ software library for solving partial differential equations (PDE) in neurosciences using mesh bases methods. It is based on the''' [[https://www.dune-project.org/|DUNE library]] '''and its main features include solving the EEG and MEG forward problem and providing simulations for brain stimulation. As distributed on the [[http://gitlab.dune-project.org/duneuro/duneuro|DUNEuro GitLab]], the source code works only on Linux operating systems. Interfaces to Matlab and Python are possible, but you need to install and compile duneuro by yourself ([[http://www.sci.utah.edu/~wolters/ChengduSummerschool/DUNEuroPresentation/|more documentation]]). For Brainstorm, we adapted this code and were able to generate '''binaries''' for the main operating systems ('''Windows''', '''Linux''' and '''MacOS'''), which are '''downloaded automatically''' when needed ($HOME/.brainstorm/bst-duneuro). This project is available on our [[https://github.com/brainstorm-tools/bst-duneuro|GitHub repository bst-duneuro]]. We would like to '''thank the '''DUNEuro''' team''' for their help with this integration work: Carsten Wolters, Christian Engwer, Sophie Schrader, Andreas Nuessing, Tim Erdbruegger, Marios Antonakakis, Johannes Vorwerk & Maria Carla Piastra. ''' {{attachment:duneuroFromDune.JPG||height="187",width="546"}} ''' Please '''cite the following papers''' if you use this software in your work: ''' ''' * Please cite the corresponding papers from the [[http://duneuro.org/|duneuro website]]. * ''Takfarinas Medani'', Juan Garcia-Prieto, Francois Tadel, Sophie Schrader, Anand Joshi, Christian Engwer, Carsten H. Wolters, John C. Mosher, and Richard M. Leahy : '''''"Realistic head modeling of electromagnetic brain activity: An integrated Brainstorm pipeline from the MRI data to the FEM solution"''''' ''under writing'' ''' ''' == Download and installation == * '''Requirements''' * You have already followed all the introduction tutorials * You have a working copy of Brainstorm installed on your computer. * '''Download the dataset''' * Get the open access reference data set from''' '''here''' : '''[[https://urldefense.com/v3/__https://zenodo.org/record/3888381__;!!LIr3w8kk_Xxm!6KhbFOL7K9swpYSnYrC6ZOtj6uGhoULw9qgkmW75irYricc0ITrt_Do95QkqIQ$|https://zenodo.org/record/3888381]] == FEM head model == In order to use the FEM computations of the electromagnetic field (EEG/MEG), the volume mesh of the head is required. Brainstorm integrates most of the modern open-source tools to generate realistic head mesh, either from nested surface mesh or from individual MR images (T1 or T1 and T2). ''' ''' The minimal requirement for FEM mesh generation is the [[http://iso2mesh.sourceforge.net/cgi-bin/index.cgi?Download|iso2mesh]] toolbox, which is automatically added when it's required (needs internet connexion). For advanced mesh, the list of the available methods are listed and explained in [[https://neuroimage.usc.edu/brainstorm/Tutorials/FemMesh|this tutorial]]'''. ''' ''' ''' The FEM mesh visualization and mesh processing options are integrated with Brainstorm. The use of these options requires also the installation of the [[http://iso2mesh.sourceforge.net/cgi-bin/index.cgi?Download|iso2mesh]]'''.''' Brainstorm will download the last release from this [[https://neuroimage.usc.edu/brainstorm/http://iso2mesh.sourceforge.net/cgi-bin/index.cgi?Download|webpage]]''' '''and install it when it is needed. However, you can also download the iso2mesh from the''' '''[[https://github.com/fangq/iso2mesh|github]]''' '''and add it to your Matlab path. === Volume mesh generation === The basic model is the three realistic layers extracted from the subject's MRI (scalp, inner skull, outer skull), plus the source space (cortical surface). ''' ''' The process of the generation of these surfaces is interactively integrated with a brainstorm. In the case you do not have any way to calculate the inner skull and outer skull surfaces, Brainstorm can generate rough approximations based on the subject's cortex and head surfaces and ICBM152's inner and outer skull surfaces. The surfaces created with Brainstorm are by construction non-intersecting. Thus, from these surfaces, you can generate the FEM mesh. ''' ''' Right-click on the subject and then "Generate FEM Mesh", then select the 'iso2mesh' method with the option "MergMesh". Keep the default values for the mesh resolution option (for more documentation please visite iso2mesh [[http://iso2mesh.sourceforge.net/cgi-bin/index.cgi?Doc/FunctionList|webpage]]). ''' ''' ''' {{attachment:fem_mesh_generation.JPG||height="300",width="230"}} {{attachment:meshMethods.JPG||height="300",width="230"}} {{attachment:iso2meshMergeMethodOptions.JPG||height="200",width="200"}} ''' ''' ''' The other mesh generation's methods are explained on this''' [[https://neuroimage.usc.edu/brainstorm/meshGeneration#preview|tutorial]]. ''' ''' ''' === Volume mesh visualisation === In this tutorial, we use the ICBM head model template distributed with brainstorm. When the FEM mesh generation is correctly completed, a new node will appear on the anatomy window. ''' {{attachment:view_default_subject.JPG||height="180",width="250"}} ''' ''' ''' Brainstorm offers also an interactive option to display FEM mesh. The following figure represents the surface mesh on the left (inner, outer and head) and on the right, the final FEM mesh generated by iso2mesh. ''' ''' ''' {{attachment:dispIcbmMesh.JPG||height="300",width="580"}} ''' If intersections are present on the surfaces mesh, the iso2mesh FEM mesh generation fails (tetgen) and an error will be displayed on the screen. If you face this problem, you need to check the surfaces and/or regenerate new surfaces from the MRI. ''' ''' If you still want to use the intersecting surfaces, you can try with the "MergSurf" option. This option will correct the intersection and create new nodes and elements. We do not recommend to use these models for EEG/MEG forward head computations. This is a research topic and it's still under investigation by the FEM communities. ''' ''' == FEM Forward model == To compute the forward model (Gain Matrix) with the FEM method, we assume that you have followed the [[https://neuroimage.usc.edu/brainstorm/Tutorials/TutBem?highlight=(bem)|introduction tutorials]] and all the relative [[https://neuroimage.usc.edu/brainstorm/Tutorials/HeadModel|data are available]](channels files, ...). ''' ''' First, on the anatomy view, you need to select the head model. In the case where you have multiple FEM head models, brainstorm uses the model displayed on green color. You need also to select the cortex to use as the source space. ''' ''' ''' {{attachment:femNode.JPG||height="200",width="250"}} {{attachment:modelAndCortex.JPG||height="350",width="300"}} ''' ''' ''' Then, switch to the view "Functional data (sorted by subjects)", 2nd button above the database explore. Right-click on the subject > Compute head model. Select DUNEuro FEM on the list. ''' ''' ''' {{attachment:ComputeHeadModelDuneuro.JPG||height="350",width="330"}} ''' ''' ''' For the 'Source space,' we recommend using the 'Cortex surface'. For the forward modeling method, the combined EEG/MEG is possible (depending on your data), and you can mixe between the available forward methods. ''' ''' When you press OK, the panel related to DUNEuro options is displayed and you have the possibilities to change the options. {{attachment:duneuro_options_basic.PNG||height="350",width="330"}} * '''FEM conductivities:''' brainstorm detects automatically the number of layers on your model and assigns the default isotropic value for each layer. However, you have the possibility to change these values according to your model. ''' ''' * '''FEM tissues:''' You can select the layers that you want to use for the FEM computation. The possible options are related to the number of the layer on the FEM head model. In our case, there is Scalp (=head), Skull (=outer skull), and Brain (=inner skull). ''' ''' According to the modalities, the recommended selections are: * For EEG: Use all the layers ''' ''' * For MEG: You can use only the inner layers (here brain) ''' ''' * For SEEG: Only the inner layers ''' ''' * For ECOG: Only the inner layers ''' ''' At this level, we recommend you use the default values. For advanced users, check the advanced section and more detailed example at this '''''page'''.'' Explanations of the options: ''' ''' * '''DUNEuro options:''' If the FEM is not familiar to you, we recommend you to use the default options. The advanced options give you the possibility to change the FEM source model, parameter of the sources, and also a set of options related to the FEM method ('''''page'''''). ''' ''' * '''FEM conductivities:''' brainstorm detects automatically the number of layers on your model and assigns the default isotropic value for each layer. However, you have the possibility to change these values according to your model. ''' ''' * '''FEM tissues :''' You can select the layers that you want to use for the FEM computation. The possible options are related to the number of the layer on the FEM head model model. In our case, there are Scalp (=head), Skull (=outer skull), and Brain (=inner skull). ''' ''' * For EEG: Use all the layers ''' ''' * For MEG: You can use only the inner layers (here brain) ''' ''' * For SEEG: Only the inner (WM) ''' ''' * For ECOG: Only the inner layers ''' ''' Then the calculation of the head model will automatically start. You may wait for a very long time, that depend on the mesh resolution. ''' ''' So, be patient, it's worth it... ''' ''' . ''(for this model it's quite fast ... less than 10 min)'' ''' ''' The dipole model is one of the most challenging parameters for the FEM. The source space (cortex) should be within the grey matter volume. In this example all the dipoles are located within the innerskull. We will discuss this issu on the advaced model ('''''on this page''''') ''' ''' <> == DUNEuro advanced options == === Head model === Number of layers, conductivity value, isotropy/anisotropy/ mesh resolution/ === Electrode model === Check the position of the electrodes and align to the head model (projection if needed) === Source model === Similarly to the spherical and BEM head model, the source position are defined on the cortex surface vertices. We can either define a constrained or not constrained orientation. However, for the FEM model, more paramters could be tuned for the source model. Choice of the source model : PI, Venant, Subtraction, Whitney Panel of the options choice that the user can select. (other wise we will set to default )''' ''' === Advanced parameters === - Solver parameters - Electrodes projection - maybe explain here the relevant option of the mini file ?? <> == Tissue anisotropy == Among the advantages of the FEM, the use of tissue anisotropy (conductivity). The estimation of the tissue anisotropy is performed with the Brainsuite diffusion pipeline ([[http://brainsuite.org/processing/diffusion/|BDP]]). The diffusion tensor images (DTI) are estimated with Brainsuite from the diffusion-weighted images (DWI) and then converted to conductivity tensor using the [[https://www.pnas.org/content/98/20/11697|Tuch process]]. In order to use this option, you need to install [[http://forums.brainsuite.org/download/|Brainsuite]] software, the rest of the process is distributed within bst-duneuro.''' ''' The''' [[https://simnibs.github.io/simnibs/build/html/documentation/documentation.html|SimNibs]] '''(for FEM mesh generation from MR images) and''' [[http://brainsuite.org/|Brainsuite]] '''(for anisotropy tensor estimation from DWI) should be installed manually on the user's computer. == Additional documentation == '''DUNEuro''' * DUNEuro wiki: https://gitlab.dune-project.org/duneuro/duneuro/wikis/home * DUNEuro website: http://duneuro.org/ '''Brainstorm-DUNEuro integration (technical discussions)<
>''' * https://github.com/brainstorm-tools/bst-duneuro/issues/1 * https://github.com/brainstorm-tools/brainstorm3/issues/242 * https://github.com/brainstorm-tools/brainstorm3/issues/185