|
|
The MEEG-Driver is a coarse grained interface for solving EEG and MEG forward problems. It ca be used for the computation and application of the transfer matrix as well as the direct forward computation. The driver can be used natively in C++ or via the Python or Matlab bindings.
|
|
|
|
|
|
Depending on the choice of discretization, there are different ways to construct a driver object which are explained in the following.
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
# Python and Matlab interface
|
|
|
|
|
|
From the Python and Matlab bindings, the interfaces are very similar. In Python, parameters are passed using a configurations dictionary, an example is shown below:
|
|
|
|
|
|
```
|
|
|
import duneuropy as dp
|
|
|
config = {
|
|
|
'type' : 'fitted',
|
|
|
'solver_type' : 'cg',
|
|
|
'element_type' : 'tetrahedron',
|
|
|
'volume_conductor' : {
|
|
|
'grid.filename' : 'path/to/grid.msh',
|
|
|
'tensors.filename' : 'path/to/tensors.dat'
|
|
|
}
|
|
|
}
|
|
|
driver = dp.MEEGDriver3d(config)
|
|
|
```
|
|
|
|
|
|
In Matlab, the parameters are passing using Matalb structure arrays, see this example:
|
|
|
|
|
|
```
|
|
|
cfg = [];
|
|
|
cfg.type = 'fitted';
|
|
|
cfg.solver_type = 'cg';
|
|
|
cfg.element_type = 'tetrahedron';
|
|
|
cfg.volume_conductor.grid.filename = 'path/to/grid.msh';
|
|
|
cfg.volume_conductor.tensors.filename = 'path/to/tensors.dat';
|
|
|
driver = duneuro_meeg(cfg);
|
|
|
```
|
|
|
|
|
|
# Parameters
|
|
|
The driver requires information about the volume conductor model which differs between fitted (CG, DG) finite element methods and unfitted (UDG) methods. In the following, these options are discussed in more detail.
|
|
|
|
|
|
## General Parameters
|
|
|
First, the general discretization type needs to be indicated.
|
|
|
- **type : {‘fitted’, ‘unfitted’}**
|
|
|
fitted implies that a mesh will be provided and standard CG- or DG-FEM can be used, while unfitted implies that the mesh does not resolve the geometry and UDG-FEM can be used
|
|
|
- **'solver_type': {‘cg’, ‘dg’, ‘udg’}**
|
|
|
the FEM discretization, either (standard) Continuous, Discontinuous or Unfitted Disontinuous Galerkin Methods are supported
|
|
|
|
|
|
## Volume conductor parameters
|
|
|
### Fitted volume conductor (CG, DG)
|
|
|
- **'element_type' = {‘tetrahedron, 'hexahedron'}**
|
|
|
The element type of the mesh
|
|
|
|
|
|
For the creation of the volume conductor, there are 2 possible ways:
|
|
|
1. **volume_conductor.grid.filename = path to .msh, .dgf, or .geo**
|
|
|
**volume_conductor.tensors.filename = path to .cond or .knw**
|
|
|
|
|
|
2. **'volume_conductor.grid.elements' = elements**
|
|
|
**'volume_conductor.grid.nodes' = nodes**
|
|
|
**'volume_conductor.tensors.labels' = labels**
|
|
|
**'volume_conductor.tensors.conductivities' = list**
|
|
|
**'volume_conductor.tensors.tensors' = list**
|
|
|
|
|
|
### Unfitted volume conductor (UDG)
|
|
|
- **'compartments' = int**
|
|
|
The number of compartments (tissue types)
|
|
|
|
|
|
- **'grid.cells = list'**
|
|
|
- **'grid.lower_left' = coordinate**
|
|
|
- **'grid.upper_right' = coordinate**
|
|
|
- **'grid.refinements' = int**
|
|
|
|
|
|
- **'domain.domains' = string**
|
|
|
List of domain names, e.g. 'skin skull brain'
|
|
|
- **'domain.'domain in domains'.positions' = string**
|
|
|
Arrangement of each domain in comparison to other domains.
|
|
|
|
|
|
- **'domain.level_sets = strings**
|
|
|
List of surface names, e.g., 'outer_skin, 'skin_skull, skull_brain'
|
|
|
- **'domain.'level_set in leve_sets'.type' : {'sphere', 'image'}'**
|
|
|
The type of the level set: sphere or image (in case of realistic data).
|
|
|
|
|
|
If 'sphere is chosen, the characteristics of the sphere are indicated:
|
|
|
- **'domain.'level_set in leve_sets'.center' : double**
|
|
|
Coordinates of the sphere center.
|
|
|
- **'domain.'level_set in leve_sets'.radius' : double**
|
|
|
Radii of each spherical layer.
|
|
|
|
|
|
If 'image' is chosen, the level set information is passed:
|
|
|
- **'domain.'level_set in leve_sets'.data' : double**
|
|
|
Signed distance function indicating the distance to each surface.
|
|
|
|
|
|
## Solver parameters
|
|
|
|
|
|
For both DG and UDG, the solver requires additional parameters:
|
|
|
- **'solver.edge_norm_type' : {'structured', 'face', 'cell', 'houston', 'fundamentalcell'}**
|
|
|
- **'solver.penalty' : double**
|
|
|
- **'solver.weights' : {'constant', 'tensorOnly', 'annavarapu', 'barrau'}**
|
|
|
- **'solver.scheme' : {'sipg', 'nipg', 'obb'}**
|
|
|
|
|
|
For UDG, the conductivities the dollowing parameters are necessary as well:
|
|
|
- **'solver.conductivities' = double (#compartmentsx1)'**
|
|
|
The conductivity values for each tissue in the same order as the compartments.
|
|
|
- **'solver.intorderadd' = int**
|
|
|
The integration order, e.g., '2'.
|
|
|
|
|
|
And optionally, for all methods, the solver can take additional arguments:
|
|
|
- **'solver.reduction' = double**
|
|
|
The relative reduction of the solver, e.g., '1e-10'.
|
|
|
|
|
|
\ No newline at end of file |