DUNEuro

DUNEuro is an open-source C++ software library for solving partial differential equations in neurosciences using mesh-based methods. It is based on the DUNE library and its main features include solving electroencephalography (EEG), magnetoencephalography (MEG) forward problems using finite element methods (FEM). We will also soon make available a user-friendly solution for the transcranial electric stimulation (tES) forward problem.

DUNEuro features

  • Applications: currently implemented applications are: EEG, MEG, tDCS
  • CG-FEM: The classical continuous Galerkin (CG-) finite element method (FEM)
  • DG-FEM: Discontinuous Galerkin (DG) finite element method (FEM)
  • Various source models, e.g. (localized) subtraction, St. Venant, partial integration, Whitney
  • The following meshes are implemented:
    • tetrahedral
    • hexahedral meshes with support for geometry adaption
  • multi-dimensional: besides 3d simulations, 2d simulations are supported for visualization purposes
  • scripting: Python and Matlab bindings are provided for a more convenient usage
  • DUNE: The DUNE library is used for solving partial differential equations

If you use DUNEuro, please cite our software publication

Schrader, S., Westhoff, A., Piastra, M.C., Miinalainen, T., Pursiainen, S.,Vorwerk, J., Brinck, H., Wolters, C.H., Engwer, C., DUNEuro- A software toolbox for forward modeling in bioelectromagnetism, PLoS ONE, 16(6):e0252431 (2021). doi: https://doi.org/10.1371/journal.pone.0252431

License

The main library is dual licensed under the GNU Public License version 2 with a special runtime exception, or the Lesser GNU Public License version 3 or any later version of the latter. For specific license information, please see the LICENSE documents in the code repositories.

Downloads

The current development version can be found on GitLab. In order to download, configure and compile DUNEuro, you can use the script and configuration files provided in the supplement of (Schrader et al., 2021), which also contains detailed instructions on the installation process. In the future we plan to provide binary versions of the Python and Matlab bindings, but this is currently work in progress.

Documentation

For a detailed introduction on the software toolbox DUNEuro, see (Schrader et al., 2021). In order to solve the EEG or MEG forward problems with DUNEuro, you can use the MATLAB or Python bindings. A description of the functions that you can call and the parameters can be found in the Wiki. Basic examples for the construction of the driver, the main user interface of DUNEuro, are shown below using the Python and MATLAB bindings.

Python bindings

Python bindings are optional and supported through the additional module duneuro-py. For generating python bindings, we use the pybind11 library ( GitHub ) which is included in duneuro-py as a git submodule.

import duneuro as dp
config = {
  'type' : 'fitted',
  'solver_type' : 'cg',
  'element_type' : 'tetrahedron',
  'volume_conductor' : {
    'grid.filename' : 'path/to/your/grid.msh',
    'tensors.filename' : 'path/to/your/tensors.txt'
  }
}
driver = dp.MEEGDriver3d(config)
Matlab bindings:

Matlab bindings are optional and supported through the additional module duneuro-matlab.

config = []
config.type' = 'fitted';
config.solver_type' = 'cg';
config.element_type' = 'tetrahedron';
config.volume_conductor.grid.filename' = 'path/to/your/grid.msh';
config.volume_conductor.tensors.filename' = 'path/to/your/tensors.txt';
driver = duneuro_meeg(config)