Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

A flexible workflow for simulating transcranial electric stimulation in healthy and lesioned brains

  • Benjamin Kalloch ,

    Roles Conceptualization, Formal analysis, Investigation, Methodology, Software, Validation, Visualization, Writing – original draft, Writing – review & editing

    kalloch@cbs.mpg.de

    Affiliations Department of Neurology, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Saxony, Germany, Faculty of Computer Science and Media, Leipzig University of Applied Science, Leipzig, Saxony, Germany

  • Pierre-Louis Bazin,

    Roles Methodology, Software, Supervision, Writing – review & editing

    Affiliations Department of Neurology, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Saxony, Germany, Faculty of Social and Behavioural Sciences, University of Amsterdam, Amsterdam, North Holland, The Netherlands

  • Arno Villringer,

    Roles Conceptualization, Resources, Supervision, Writing – review & editing

    Affiliation Department of Neurology, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Saxony, Germany

  • Bernhard Sehm,

    Roles Conceptualization, Resources, Supervision, Writing – review & editing

    Affiliation Department of Neurology, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Saxony, Germany

  • Mario Hlawitschka

    Roles Conceptualization, Methodology, Resources, Supervision, Writing – review & editing

    Affiliations Department of Neurology, Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig, Saxony, Germany, Faculty of Computer Science and Media, Leipzig University of Applied Science, Leipzig, Saxony, Germany

A flexible workflow for simulating transcranial electric stimulation in healthy and lesioned brains

  • Benjamin Kalloch, 
  • Pierre-Louis Bazin, 
  • Arno Villringer, 
  • Bernhard Sehm, 
  • Mario Hlawitschka
PLOS
x

Abstract

Simulating transcranial electric stimulation is actively researched as knowledge about the distribution of the electrical field is decisive for understanding the variability in the elicited stimulation effect. Several software pipelines comprehensively solve this task in an automated manner for standard use-cases. However, simulations for non-standard applications such as uncommon electrode shapes or the creation of head models from non-optimized T1-weighted imaging data and the inclusion of irregular structures are more difficult to accomplish. We address these limitations and suggest a comprehensive workflow to simulate transcranial electric stimulation based on open-source tools. The workflow covers the head model creation from MRI data, the electrode modeling, the modeling of anisotropic conductivity behavior of the white matter, the numerical simulation and visualization. Skin, skull, air cavities, cerebrospinal fluid, white matter, and gray matter are segmented semi-automatically from T1-weighted MR images. Electrodes of arbitrary number and shape can be modeled. The meshing of the head model is implemented in a way to preserve the feature edges of the electrodes and is free of topological restrictions of the considered structures of the head model. White matter anisotropy can be computed from diffusion-tensor imaging data. Our solver application was verified analytically and by contrasting the tDCS simulation results with that of other simulation pipelines (SimNIBS 3.0, ROAST 3.0). An agreement in both cases underlines the validity of our workflow. Our suggested solutions facilitate investigations of irregular structures in patients (e.g. lesions, implants) or new electrode types. For a coupled use of the described workflow, we provide documentation and disclose the full source code of the developed tools.

1. Introduction

The simulation of transcranial electric stimulation (tES) is increasingly employed when designing tES intervention studies [1] and observed behavior or neurophysiological changes are related to the simulated, subject-specific electric field [24]. This development is motivated by increasing evidence that the individual distribution of the electrical field within each subject influences the stimulation effect [57]. In addition, several software pipelines [812], among which SimNIBS [10] and ROAST [12] are currently most actively developed, make the simulation of tES more accessible to researchers.

All these pipelines implement a common, general workflow covering standard use cases, i.e. the tES simulation of healthy subjects based on their individual magnetic resonance imaging (MRI) data using rectangular, circular or ring electrodes. The starting point of this workflow is the segmentation of the MRI data of the subjects into the electrically most important tissue classes. The obtained segmentation image is then used to create the head volume mesh, which is complemented by electrodes that need to be modeled and positioned. The simulation problem is solved using this individual head model, and results are visualized. The implementation of the outlined workflow by current tES simulation pipelines does not entirely cover use cases with suboptimal imaging data, the presence of pathological tissue in patients or alternative electrode shapes.

For instance, MRI data from large-scale imaging studies usually were not primarily acquired for the purpose of computational head modeling. Performing simulation studies based on such data can become difficult due to challenges in the segmentation of low-contrast tissue such as the skull using standard segmentation approaches. Following the image segmentation, a surface-based meshing approach is commonly used to create the head volume mesh. The advantage of this approach is a maximum of control over the approximation of the boundaries of the sub-compartments of the head model, which, on the other hand, must not intersect, restricting the topology of the included structures and complicating the inclusion of irregular tissue such as lesioned tissue. ROAST circumvents this restriction by applying an image-based meshing approach, which is free of any topological constraints [12], with the drawback of less accurate feature edges, for example, of the electrodes. The shape of the electrodes commonly can be selected from a set of standard shapes including rectangular, circular or ring electrodes. Means for modeling non-standard shaped electrodes such triangular electrodes are usually not provided. Finally, the visualization of the simulation results is typically realized in MATLAB [8,11,12], GMSH [10] or a custom tool [9] and thus relatively limited.

In this work, we present approaches to address the above-mentioned non-standard use-cases when simulating tES on an individual basis. Segmentation routines were selected based on the robustness of the structure segmentation of T1-weighted MRI data using JIST [13] a plugin of MIPAV [14] to benefit from a wide range of image manipulation and segmentation algorithms. We introduce an extension to the image-based meshing approach presented in [12] by combining it with a surface-based meshing approach for an accurate electrode representation. The 3D modeling software Blender [15] allows the highly flexible modeling of electrodes of arbitrary shapes. We suggest the use of ParaView [16,17] for a versatile visualization of the simulation results. We describe the information flow among the involved tools, which are arranged around OpenFOAM [18], a comprehensive, finite-volume-method-based framework for the numerical simulations. The simulation was verified analytically and by contrasting the numerical results with those of SimNIBS 3.0 [19] and ROAST 3.0. A general agreement with both pipelines underlines the validity of our suggested solutions. The scripts and the custom source code along with the documentation are readily available (from https://github.com/benjamin-kalloch/tes-simulation-workflow) allowing a coupled use of the entire tool set as well as usage of single tools only.

2. Methods

The process of simulating tES involves the head and the electrode modeling, solving the underlying electrostatic problem, and the visualization.

The head model creation comprises the segmentation of the head MR image and the subsequent volume mesh generation. Here, image segmentation is performed using the Java Image Science Toolkit (JIST) [13] a plugin of the Medical Image Processing, Analysis, and Visualization (MIPAV) toolbox [14]. The volume mesh is generated using a combined image- and surface-based meshing approach implemented as a custom application that uses the Computational Geometry Algorithms Library (CGAL) API, version 4.13.1 [20]. A plugin for the 3D modeling software Blender 2.79 [15] implements the modeling and positioning of the electrodes. OpenFOAM 7.0 [18] provides the tools to define the conductivity values of the mesh compartments. Additionally, information from diffusion-weighted imaging (DWI) data can be incorporated to model the anisotropic conducting behavior of white matter tissue, and are processed in MRTrix 3 [21]. A plugin developed for the visualization software ParaView 5.6 [16,17] manages the calculation of the conductivity tensors derived from the diffusion tensors. The finite volume calculations involved in solving the underlying Maxwell’s equation are performed by a custom solver application implementing the OpenFOAM API. Finally, the resulting electric field may be visualized in ParaView. Fig 1 illustrates the entire workflow.

thumbnail
Fig 1. Data- and workflow.

Schematics depicting the data flow between the individual processing steps and the involved tools as well as the expected input and output data of the individual stages.

https://doi.org/10.1371/journal.pone.0228119.g001

2.1. Set-up of the volume conductor model

2.1.1. MRI head segmentation.

Accurate segmentation of the MR image is crucial since the segmented structures represent the individual compartments of the volume conductor model. Segmentation errors—especially discontinuities of the segmented skull or cerebrospinal fluid (CSF)—impair the simulation results [22]. In our approach, we segment the scalp, the skull, the air-filled sinuses of the skull, the subarachnoid CSF, the CSF in the ventricles, the gray matter (GM) and the white matter (WM) only from T1-weighted MRI data. The involved segmentation process is described in our previous work [23]. In short, we rely on robust, atlas-based segmentation techniques and image-processing capabilities implemented in JIST, a plugin of MIPAV. The segmentation of the scalp and skull structure of the image is achieved through the Simultaneous Truth And Performance Level Estimation algorithm [24]. The intracranial compartments are segmented using the topology-preserving segmentation algorithm Multi-object Geometric Deformable Model [25] and the gyrification of the segmented GM surface is enhanced by the Cortical Reconstruction Using Implicit Surface Evolution method [26]. We use a pseudo-CT template [27] to segment the air cavities in the skull. The quality of the generated segmentation images is improved by morphological image operations. The individual segmentation images are combined to a single image that contains a distinct, unique numeric label per segmented structure and is exported in the ANALYZE file format.

2.1.2. Electrode modeling and positioning.

In our workflow a complete electrode model is implemented, which defines the electrodes geometrically in shape and position as well as their physical conductivity and the applied current, thereby realistically modeling the current shunt [28]. The power source is represented by equipotential surfaces at the outer boundaries of the electrode. An optional gel layer may be modeled.

A custom Blender plugin geometrically models rectangular electrodes and positions them according to the international 10–20 system in a semi-automatic way. Necessary inputs are 1) a geometrical representation of the outer boundary of the scalp segmentation in the Stereolithography (STL) file format, 2) the extents of the electrode and 3) its location in 10–20 coordinates. Furthermore, the user must provide four fiducial points, namely the nasion, inion and the tragi of the ears, on the scalp surface by interactively aligning two reference lines and selecting the corresponding points on these lines. The user interface is shown in Fig 2A.

thumbnail
Fig 2. Electrode modeling.

(A) The user interface of our Blender plugin for electrode positioning and modeling purposes. Necessary input parameters constitute the electrode dimensions, the position according to the 10–20 system, and a geometrical representation of the outer boundary of the scalp segmentation in the STL file format. A stepwise workflow to define the fiducial points (nasion, inion, tragi of the ears) for the computation of the 10–20 coordinate grid on the individual head is provided by the GUI. The rectangular cube is generated according to the defined dimension and position of the electrode and will be used to create the electrode by the means of constructive solid geometry (CSG). (B) Result obtained with our plugin: a standard rectangular patch electrode located at C3. A smooth representation of the skin is generated, and the electrode is extruded based on the result of the CSG operation of the cube and this smoothed skin surface. (C) A ring electrode shape created by a non-standard workflow. The cube was replaced by a cylinder with a hole. (D) Triangular electrode obtained by a non-standard workflow. The cube was replaced by a triangular prism.

https://doi.org/10.1371/journal.pone.0228119.g002

To create the geometrical surface representation of the outer scalp boundary from the binary scalp segmentation image the Marching Cubes-based (MC) [29] “Contour Filter” in ParaView is used. In Blender, the plugin initially performs a Laplacian smoothing of the input scalp surface to mitigate its relatively coarse structure due to the MC algorithm. Then, the location of the 10–20 coordinates on the smoothed scalp surface is computed using the user-defined fiducial points. The smooth scalp surface is clipped by the means of constructive solid geometry (CSG) at the specified location with a cube of the specified extent. The position of this cube may be manually varied if the location of the electrode falls outside the standard 10–20 grid. An arbitrary shape of the electrode (see Fig 2B–2D) can be achieved by replacing that cube with a volume of the desired shape. The clipped surface patch is extruded in 1 mm steps to the desired electrode thickness. This avoids long, thin triangles at the sidewalls of the electrode representation, which are unfavorable for the subsequent volume meshing. To model a gel layer this process is executed twice, and the electrode representation is moved on top of the gel layer. The geometry of the electrodes, the gel layer, and the smooth skin surface are exported to STL files.

The CSG operation may result in small, unfavorably clipped triangles at the edges of the electrode and the gel layer impeding the subsequent volume mesh generation. Therefore, their geometry must be cleaned in Meshlab [30] by unifying duplicate vertices and applying the “Quadratic Edge Collapse Decimation” simplification filter. The smoothed skin surface, the cleaned electrodes, and the gel layer are converted to the Object File Format (OFF).

2.1.3. Volume meshing

An unstructured tetrahedral mesh constitutes the computational domain, i.e. the head model. We approach the task of generating this mesh by applying a combination of an image-based meshing and a surface-based meshing algorithm, both relying on Delaunay triangulation that is implemented in the Computational Geometry Algorithms Library (CGAL), version 4.13.1 [20]. The surface-based meshing is applied to the electrodes and the scalp structure and can be further utilized for any following internal structure that does not impede a strictly nested arrangement of the mesh compartments. Structures that violate a nested arrangement, such as the ventricles or lesioned tissue, can be meshed using the image-based algorithm. Apart from the electrodes, the head mesh can be generated purely by image-based meshing as well as it is possible to create it solely using the surface-based approach.

We created a C++ tool based on the mesh_hybrid_mesh_domain example of the CGAL library. The tool combines the CGAL domain classes Labeled_mesh_domain_3 and Polyhedral_mesh_domain_with_features_3 into a single hybrid domain to simultaneously employ an image-based meshing together with a feature-preserving, surface-based meshing. Both classes represent so-called domain oracles that provide access to the domain to be discretized for the mesh generation algorithm in CGAL. As such, they include methods to identify subdomains including their boundaries, surface-patches and 0- and 1-dimensional features. In a polyhedral domain, the boundaries of the subdomains are explicitly described by the input surface. In the labeled mesh domain, boundaries between two labeled regions are determined by the bisection method [31]. As input, the tool requires an ANALYZE file with the labeled image of the subject comprising only structures, for which the image-based meshing should be used, as well as the surface descriptions of the electrodes, the scalp and any structure, for which the surface-based meshing approach is favored, in the OFF file format. The feature edges of the electrodes are only preserved if the scalp is provided as a surface too. Both types of input are used for their respective domain classes. The input image constitutes the label image domain and each input surface represents a separate polyhedral domain. All domains are combined into a single hybrid domain. Any query (e.g. subdomain point containment) to the hybrid domain is first forwarded to the polyhedral domains in the order in which they were entered into the hybrid domain and lastly to the image domain. The last domain, i.e. the innermost domain, that positively responds to the query determines the subdomain of the resulting mesh. While technically not required, it is recommended to provided surfaces that are entirely nested into each other to avoid ambiguities in the case of overlapping boundaries. The arrangement of the structures in the label image can be completely arbitrary, however, depending on the target resolution of the tetrahedral mesh, very small or thin structures of only a few voxels may not be meshed. Furthermore, due to the chosen order of response of the individual domains in the hybrid domain to domain queries, certain restrictions apply. For example, it is currently not possible to perform surface-based meshing in an area of the domain that is already defined by the label image, i.e. nested tissues cannot be meshed surface-based and image-based interchangeably. However, if required it would be easily possible to implement a prioritization mechanism for certain subdomains.

To create the boundary surfaces for the surface-based volume meshing, we suggest a three-stage process. The initial boundary surface descriptions are generated from the segmentation label image by employing the Contour filter in ParaView, which is based on the Marching-cubes algorithm [29]. Second, to take full advantage of the accurate preservation of boundaries of the surface-based meshing, the coarse output surfaces of the Contour filter must be smoothed in Meshlab using the Taubin smoothing algorithm (λ = 0.5,μ = −0.53,#smoothing steps = 50) [32]. The smoothed scalp surface as a result of the electrode placement procedure does not require additional smoothing. Finally, the quality of the smoothed surface meshes must be improved by clearing defects (e.g. self-intersecting triangles) using the MeshFix tool (v.2.1) [33] and by employing a custom tool leveraging the isotropic remeshing functionality of CGAL’s Polygon_mesh_processing class.

To minimize the deviations from the boundaries of the labeled structures during the image-based meshing a small tolerance parameter (10−6≅0.00044 mm at 1 mm voxel size) for the bisection is used. Following the initial mesh generation, four optimizations can be optionally enabled. Two global optimizers (Optimized Delaunay Triangulation smoother, Lloyd smoother) minimize the total mesh energy. Two local optimizers improve the dihedral angles of the worst cells in the mesh or eliminate triangles with a poor radius-edge ratio, so-called slivers, respectively. For further information on these four optimizers, please refer to the CGAL documentation (https://doc.cgal.org/latest/Mesh_3/group__PkgMesh3Functions.html). We use the API of GMSH v.4.3 [34] to export the resulting volume mesh to the GMSH file format version 2.

The generated mesh is subsequently converted to the OpenFOAM format and optimized for the later computations using the OpenFOAM utilities gmshToFoam, transformPoints, and renumberMesh (details in Fig 1).

2.1.4. Conductivity values

We use the OpenFOAM setFields tool to uniformly set a distinct isotropic tensor value for all elements of each sub-compartment of the mesh. This value is computed as the product of the unitary matrix and the corresponding scalar conductivity value

To incorporate anisotropic conductivity information of the white matter, we adopted the volume-constraint method [35]. This approach assumes a shared principal direction between a diffusion tensor and its corresponding conductivity tensor but different eigenvalues representing a fixed anisotropy ratio between the principal and auxiliary directions. The calculation of the eigenvalues is based on the scalar conductivity value of the white matter σWM, an anisotropy ratio of 1:10 and must satisfy the conditions 1) , 2) to ensure that no unreasonable conductivity values are estimated. The conductivity tensor is determined by the both-sided multiplication of the matrix S of the eigenvectors of the diffusion tensor and a diagonal matrix σT = Sdiag(σmain,σaux,σaux)⋅ST.

The DWI data are preprocessed using MRtrix 3 [21]. First, the signal to noise ratio of the DWI data is improved (dwidenoise [36,37]). Subsequently, artifacts due to eddy currents and due to motion are corrected (dwipreproc [38,39]). For skull-stripping, a binary mask of the intracranial tissue is generated (dwi2mask [40]). Tensor estimation is realized through dwi2tensor [41]. The resulting tensor image is used to compute the fractional anisotropy (FA) map (tensor2metric [42,43]). Both the FA map as well as the tensor image are cleaned from possible NaN values using fslmaths. The FA map is registered to the T1-weighted brain image of the subject linearly using FSL FLIRT [44,45] and non-linearly with FSL FNIRT [39,46]. The calculated transformations are utilized to co-register the diffusion tensor image using the tool vecreg, which preserves the relative orientation of the tensors upon transformation. The computation of the conductivity tensors is implemented as a ParaView plugin. They are subsequently transferred to the OpenFOAM mesh of the respective head model in ParaView and finally exported in the OpenFOAM field format using another custom plugin. The field values are transferred to the already prepared field of isotropic conductivity tensors, overwriting the values of the white matter compartment.

2.1.5. Boundary conditions

A Dirichlet boundary condition for the electrical potential of +/- 5 V is assigned to the outer boundaries of the anode and cathode respectively regardless of the desired current strength. During post-processing, the electrical field strength magnitude is corrected according to the actual current density integrated at the contact surfaces of both electrodes with the scalp. The outer boundaries of the electrodes are, thus, modeled as equipotential surfaces. Since the surrounding air is not explicitly modeled and virtually acts as an insulator, a zero gradient Neumann boundary condition is applied for the electrical potential at the scalp surface.

2.2. Solving the electrostatic problem

The electrical field strength E and the field of the electrical current density J are computed according to the quasi-static form of Maxwell’s equations, which provide a sufficient approximation for tDCS, tACS, and tRNS [47]. Their solution is derived by our solver application using the OpenFOAM API.

2.2.1. Quasi-static form of Maxwell’s equations.

The electrical potential field ϕ induced by the electrodes subject to the conductivity σ of the volume conductor is described by Laplace’s equation ∇(σ⋅∇⋅ϕ) = 0. E is obtained by the component-wise partial derivation of ϕ, E = −∇⋅ϕ. A linear relationship between E and J by σ exists as J = σE.

2.2.2. The solver application.

Our solver application computes the electrical current density J and the electrical field strength E using the finite-volume method (FVM).

First, ϕ is computed using a Gauss discretization scheme with linear interpolation for the Laplace operator at a residual of 10−6. The solution is iterated to correct for non-orthogonality in the mesh until the residual of the whole solution falls below 10−5. Next, the gradient field E of ϕ is determined using the least-squares gradient scheme. J is the product of E and the electrical conductivity σ.

Finally, E and J are scaled by the ratio of the user-defined input current strength Itarget and the actual current strength Imeasured as determined by the summation of the current density across the surface area where the electrodes contact with the scalp surface.

2.3. Visualization

Post-processing is handled by ParaView, for which OpenFOAM provides a plugin to read the results. All figures relating to simulation results have been created in ParaView.

3. Results

We demonstrate a three-step verification attempt of the proposed workflow. First, our solver application was tested using an analytically verifiable, 3-layered sphere model [48]. Second, we utilized two reference head models, which were generated in SimNIBS 3.0, to conduct tDCS simulations in both, OpenFOAM and SimNIBS to compare the results using identical head models. While other simulation pipelines are equally valid for comparing purposes, we chose the SimNIBS pipeline because of the availability of test data sets. Finally, both head models were reproduced from their original MR image, respectively, using our modeling workflow and a tDCS simulation in OpenFOAM was performed. The simulation result obtained using these custom head models were compared to the results obtained by SimNIBS 3.0 and ROAST 3.0 using the same imaging data.

In addition, we demonstrate the capability to model anisotropic conductivity, the modeling of alternative electrode shapes, namely small circular electrodes that are used for Laplacian-tDCS, as well as the inclusion of irregular structures, lesions of the white matter, into the head model.

3.1. Analytical test case: 3-layer sphere model

We implemented the analytical solution to the tES problem with point electrodes in a 3-layered sphere according to [48,49] in Python and contrasted the result with the numerical simulation results obtained by our solver application. Table 1 provides an overview of the model parameters. Since the analytical case assumes a point electrode, which cannot be modeled in OpenFOAM, we simulated a 2 mm smaller sphere in OpenFOAM and used the analytical values greater than the 85th percentile of the boundary of this sphere as the Dirichlet boundary condition of the numerical simulation. The spherical domain consisted of 15.1 M. tetrahedra.

thumbnail
Table 1. Parameters of the 3-layered spherical head model.

https://doi.org/10.1371/journal.pone.0228119.t001

We found an overall agreement in the distribution of the electrical potential between the analytical (Fig 3A) and numerical solution resulting in a normalized root-mean-square deviation of only 2.1% across the entire domain. The norm of the numerically calculated electrical potential tends to decline slightly stronger as compared to the analytically derived potential (Fig 3B).

thumbnail
Fig 3. Analytical 3-layered sphere model.

(A) Center slice of the analytical result field, illustrating the distribution of the electrical potential between the two opposing point electrodes. (B) Comparison of the electrical potential calculated analytically according to [48] (blue graph) with the numerical solution derived by OpenFOAM (red graph).

https://doi.org/10.1371/journal.pone.0228119.g003

3.2. Comparison to other tES simulation pipelines

Our workflow was evaluated using the Almi5 and Ernie test data sets from SimNIBS. Simulation results were compared to that of SimNIBS and ROAST.

3.2.1. Comparison of the solver application to SimNIBS using the same head model.

We utilized SimNIBS 3.0 to create the head models of the two test data sets from their T1- and T2-weighted imaging data. Each head model included the tissues skin, skull, CSF, GM, and WM. Compartments representing air were treated as a perfect insulator and were thus not part of the computational domain. For each head model, we tested three electrode setups, a bi-hemispheric setup over the primary motor cortices of both hemispheres, referred to as the dual setup, (10–20 positions: C3 and C4), an anodal setup (10–20 positions: C3, right supraorbital close to Fp2) and an occipital setup (10–20 positions: Cz, Oz) (Fig 4). Square-shaped electrodes with 25 cm2 (occipital montage) and 16 mm2 (dual and anodal montage) dimensions and 2 mm thickness were modeled as a complete electrode model with equipotential surfaces at the outer boundaries. Isotropic conductivities were adopted from the SimNIBS GUI (Table 2). The input current strength was 1 mA.

thumbnail
Fig 4. Electrode configuration.

Display of the anodal, dual and occipital electrode configuration of both head models, Almi5 and Ernie, used for comparison with SimNIBS.

https://doi.org/10.1371/journal.pone.0228119.g004

The conductivity values of the different head model compartments used for tDCS simulations in OpenFOAM, SimNIBS and ROAST. The conductivity value for air only applies to our head models and the head models generated by ROAST as the air compartment in SimNIBS is considered but not part of the head volume mesh.

Visual comparison of the computed electrical field strength with the field obtained by SimNIBS revealed a comparable field pattern including hotspots at the same locations across both head models and all electrode montages (Fig 5). The magnitude of the electrical field within the gray matter mesh compartment was on average higher in our results across both models and all electrode montages (Table 3: 2 mm electrode thickness–SN mesh). See Tables 4 & 5 and Figs 69 for a more detailed overview of the relative difference in the magnitude of the electrical field strength as well as the angle difference across all conditions. The deviation in the local field direction was more pronounced in the area of the gray matter mesh compartment underneath the electrodes in all cases with a 99th percentile peak value in angle difference of 40.56° in the occipital electrode configuration of the Almi5 test case. We contrasted the magnitude of the electrical field along a sampling line between the respective electrode pair of each condition through the entire head model (Figs 10 & 11). This assessment confirmed that our simulation slightly overestimates the magnitude of the electrical field in the intracranial compartments. Interestingly, this trend reverses for skin and skull, where a small underestimation can be observed. No major difference between head models and electrode conditions was noticeable. The simulation time was approximately 4 minutes in all cases on an Intel® Core i7 6700 workstation.

thumbnail
Fig 5. Electrical field pattern.

Comparison of the distribution pattern of the electrical field strength in both head models and all electrode montages between the OpenFOAM result and the SimNIBS result. Areas above the 90th percentile of the electrical field strength are defined as hotspots and marked in black.

https://doi.org/10.1371/journal.pone.0228119.g005

thumbnail
Fig 6. Relative difference in the electrical field strength magnitude—Almi5.

Heatmap of the relative difference in the magnitude of the electrical field strength between OpenFOAM and SimNIBS in all three electrode configurations. A red color indicates a higher electrical field strength in the OpenFOAM result whereas blue indicates a higher value in the SimNIBS result. Histograms depict differences in percent of all tetrahedra within the gray matter mesh compartment.

https://doi.org/10.1371/journal.pone.0228119.g006

thumbnail
Fig 7. Angle difference in the electrical field strength—Almi5.

Heatmap of the angle difference of the electrical field strength between OpenFOAM and SimNIBS of all electrode configurations. Histograms depict angle differences in degrees of all tetrahedra within the gray matter mesh compartment.

https://doi.org/10.1371/journal.pone.0228119.g007

thumbnail
Fig 8. Relative difference in electrical field strength magnitude—Ernie.

Heatmap of the relative difference in the magnitude of the electrical field strength between OpenFOAM and SimNIBS in all three electrode configurations. A red color indicates a higher electrical field strength in the OpenFOAM result whereas blue indicates a higher value in the SimNIBS result. Histograms depict differences in percent of all tetrahedra within the gray matter mesh compartment.

https://doi.org/10.1371/journal.pone.0228119.g008

thumbnail
Fig 9. Angle difference in electrical field strength—Ernie.

Heatmap of the angle difference of the electrical field strength between OpenFOAM and SimNIBS of all electrode configurations. Histograms depict angle differences in degrees of all tetrahedra within the gray matter mesh compartment.

https://doi.org/10.1371/journal.pone.0228119.g009

thumbnail
Fig 10. Electrical field magnitude—Almi5.

Comparison of the magnitude of the electrical field strength along a sampling line between both electrodes between OpenFOAM (green) and SimNIBS (blue). A dashed line depicts the mesh regions with distinct conductivity values.

https://doi.org/10.1371/journal.pone.0228119.g010

thumbnail
Fig 11. Electrical field magnitude—Ernie.

Comparison of the magnitude of the electrical field strength along a sampling line between both electrodes between OpenFOAM (green) and SimNIBS (blue). A dashed line depicts the mesh regions with distinct conductivity values.

https://doi.org/10.1371/journal.pone.0228119.g011

thumbnail
Table 3. Comparison electrical field strength (SimNIBS [SN] vs. OpenFOAM [OF] vs. ROAST [RO]).

https://doi.org/10.1371/journal.pone.0228119.t003

thumbnail
Table 4. The absolute value of the relative difference of the electrical field strength (SimNIBS vs OpenFOAM).

https://doi.org/10.1371/journal.pone.0228119.t004

thumbnail
Table 5. Angle difference of the electrical field strength (SimNIBS vs. OpenFOAM).

https://doi.org/10.1371/journal.pone.0228119.t005

3.2.2. Full workflow verification with SimNIBS and ROAST.

As a next step, we reproduced the Almi5 and Ernie head models from their original T1-weighted MR data (available from SimNIBS) both using ROAST 3.0 and our head modeling workflow to allow a comparison between the two simulation pipelines and our approach.

To match all simulations parameters among the three approaches the electrode thickness was increased to 3 millimeters as ROAST required a minimum thickness of in total 3 mm for the electrodes and the gel layer, which could not be omitted. To exclude the gel layer from further computations the same electrical conductivity as for the electrode material was specified for the gel.

Fig 12 displays the segmentation result achieved by our approach using only the T1-weighted image in comparison to SimNIBS 3.0 employing the CAT12 segmentation routines and ROAST 3.0 both using the T1-weighted as well as the T2-weighted image of the exemplary data set “Ernie”. The computed head models were caudally more truncated in our approach. The Mesh quality (Table 6) was well suitable for OpenFOAM. The conductivity values and the three electrode montages remained unchanged. Computation times for each head model on an Intel® Core i7 6700 workstation were approximately 6 hours (segmentation), 3 hours (meshing), 100 seconds (simulation).

thumbnail
Fig 12. Head segmentation.

Comparison of our segmentation result (D) of the T1-weighted MR image of the Ernie test data set (A) with the SimNIBS segmentation result (B) and the ROAST segmentation result (C) computed from the T1- and T2-weighted imaging data. Labels are defined as follows: blue = skin, yellow = skull, purple = CSF, dark green = gray matter, light green = white matter, red = internal air. The resulting electrical field of the anodal electrode configuration using a head model generated from our image segmentation is displayed in Panel (E).

https://doi.org/10.1371/journal.pone.0228119.g012

The magnitude of the resulting electrical field strength computed by each of the simulation approaches was contrasted by sampling along a straight sampling line between the centers of the respective electrodes through the head models. Across all conditions, the mean and percentile-peak values of the electrical field strength in the gray matter mesh compartment were slightly overestimated in our approach compared to the results from ROAST even more than compared to the SimNIBS results (Table 3) while the field distribution (Fig 12E) remained comparable (Figs 13 & 14).

thumbnail
Fig 13. Simulation results of OpenFOAM with custom mesh vs SimNIBS vs ROAST—Ernie.

Comparison of the magnitude of the electrical field strength computed by SimNIBS, ROAST and our modeling and simulation workflow (SimNIBS result: blue, ROAST result: dark purple, Our result: light purple).

https://doi.org/10.1371/journal.pone.0228119.g013

thumbnail
Fig 14. Simulation results of OpenFOAM with the custom mesh vs SimNIBS vs ROAST- Almi5.

Comparison of the magnitude of the electrical field strength computed by SimNIBS, ROAST and our modeling and simulation workflow (SimNIBS result: blue, ROAST result: dark purple, Our result: light purple).

https://doi.org/10.1371/journal.pone.0228119.g014

The mean as well as the 90th, 95th and 99th percentile of the magnitude of the electrical field strength in the gray matter computed by SimNIBS in the test cases using an electrode thickness of 3 mm were consistently lower than the results in the test cases with 2 mm electrode thickness (Table 3). This observation suggests an inverse relationship between the electrode thickness and the change in the magnitude of the electrical field strength in the gray matter compartment.

3.3. Extended capabilities

In this section, we demonstrate extended processing capabilities that can be combined with our standard workflow. We included the anisotropic conductivity of the white matter in the custom Almi5 test case. Furthermore, we conducted a simulation using an alternative electrode model in the form of small circle-like electrodes in a multi-electrode setup. Finally, we demonstrate the inclusion of lesioned tissue in a head model.

3.3.1. Modeling anisotropic conductivity.

To model the anisotropic conductivity of white matter, the conductivity tensors from the diffusion-weighted imaging data of the Almi5 data set were computed. In this process, we assumed a fixed ratio of 1:10 between the main and the auxiliary eigenvectors of the tensor and a conductivity of for the white matter. We assigned the same isotropic conductivity values to the individual mesh compartments as before except the white matter compartment, to which we assigned the computed conductivity tensors. Refer to Fig 15 for a depiction of the conductivity profile of the data set. We simulated the anodal electrode setup with two 5 cm x 5 cm patch-like electrodes placed over C3 and supraorbital, close to Fp2. The input current strength was set to 1 mA. Additionally, to demonstrate the image-based meshing capabilities of our meshing tool we generated the head model only using image-based meshing (except for the electrodes and the scalp to ensure the feature-preservation of the electrodes). The characteristics of the resulting mesh were as follows: 5.2 million tetrahedra, 239 non-orthogonal faces, maximum non-orthogonality of 81°, maximum skewness of 2.4.

thumbnail
Fig 15. Conductivity tensors.

(A) Conductivity profile of the augmented Almi5 test case in grayscale with the conductivity tensors overlaid. Conductivity tensors are visualized in red using spherical tensor glyphs. Their size depicts the magnitude of the conductivity. The shape reflects the degree of anisotropy, from isotropic (ball shape) to highly anisotropic (ellipsoidal, rod-like). (B) Zoomed cutout of the conductivity profile. The anisotropic white matter compartment is visualized by small ellipsoidal conductivity tensors as opposed to the ball-like shape of the tensors in all other isotropic tissues. (C) Conductivity profile without overlaid conductivity tensors. Darker compartments exhibit higher conductivity.

https://doi.org/10.1371/journal.pone.0228119.g015

We sampled the magnitude of the electrical field strength along a straight sampling line between both electrodes through the head model and compared the magnitude of the anisotropic test case to a version of the test case using only isotropic conductivity values. The difference in the magnitude was most noticeable in the intracranial compartments, where the changes in the magnitude (both in the negative and positive direction) along the sampling line were generally higher in the anisotropic case as compared to the isotropic case (Fig 16A). Furthermore, the area underneath the electrodes experienced higher differences both in the local field angle and field magnitude of the electrical field (Fig 16B & 16C). The mean angle difference between the isotropic and anisotropic case within the gray matter mesh compartment was 9.4° (99th percentile: 33.1°) and the mean value of the relative difference of the absolute field magnitude was 12.25% (99th percentile: 29.16%).

thumbnail
Fig 16. Anisotropic test case–comparison to isotropic test case.

(A) Comparison of the magnitude of the electrical field strength along the sampling line (yellow) between the custom version of the Alim5 head model with isotropic and anisotropic white matter conductivity. (B) Relative difference (in percent) in the local electrical field magnitude in the gray matter mesh compartment. (C) Local angle difference (in degrees) of the electrical field strength in the gray matter mesh compartment.

https://doi.org/10.1371/journal.pone.0228119.g016

3.3.2. Simulating multi-electrode tDCS.

In this test case, we changed the electrode setup to a 4 x 1 multi-electrode tDCS setup with five circular electrodes with a diameter of 5 mm. The anode was positioned approximately at C3. The four cathodes were positioned in 10 cm distance from the anode in a square arrangement around the cathode. A Dirichlet boundary condition of -5 V at the four cathodes and +5 V at the central anode was defined. We set the input current strength to 1 mA. Again, the image-based meshing algorithm was used for the head model generation (surface-based only for the scalp and the electrodes). The same isotropic conductivity values as before were assigned.

The computation of the electrical field finished after 148 seconds. The resulting electrical field pattern is much more focal (Fig 17) with only a negligible fraction of the inbound current reaching the contralateral hemisphere as compared to the field induced by two large conventionally shaped electrodes as simulated before. This is an expected observation for multi-electrode tDCS montages [50]. The average electric field strength across the cortex was reduced to 0.02 V/m. The 99th percentile peak electric field strength was lowered to 0.161 V/m. A larger portion of the cortex that received non-negligible field strength is covered by a field strength above the 99th percentile.

thumbnail
Fig 17. Multi-electrode test case.

Exemplary extension of the standard workflow by multi-electrode tDCS. Five round electrodes with a diameter of 5 mm were positioned approximately at C3 and resulted in a much more focal field distribution than achieved with conventional square-shaped, patch electrodes.

https://doi.org/10.1371/journal.pone.0228119.g017

3.3.3. Inclusion of lesioned tissue.

In this test case, we created a head model from the T1-weighted magnetization prepared rapid gradient echo (MRAGE) and T2-weighted fluid-attenuated inversion recovery (FLAIR) imaging data of a single subject from the local, large-scale, cross-sectional study of the Leipzig Research Centre for Civilization Diseases (LIFE) [51]. Imaging parameters used for the MPRAGE image were: flip angle 9°, repetition time 2300 ms, inversion time 900 ms, echo time 2.98 ms, 1 mm isotropic resolution, acquisition time 5.1 min. The parameters of the FLAIR image were: repetition time 5000 ms, inversion time 1800 ms, echo time 395 ms, 1 mm isotropic resolution, acquisition time 7.02 min. The images were acquired on a MAGNETOM Verio scanner (Siemens, Erlangen, Germany) with a 32-channel head receive coil and a body transmit coil. The head model was generated by our robust standard segmentation workflow using the T1-weighted imaging data. Additionally, we included white-matter lesions into the head model that were segmented before using the T2-FLAIR data. Details of the white matter lesion segmentation procedure, which relied on an adapted version of the lesion-TOADS algorithm [52], can be found in [53]. We employed image-based meshing for the lesioned tissue, the ventricles, and the air cavities of the skull and applied the surface-based meshing to all other structures (scalp, skull, CSF, GM, WM, electrodes).

To illustrate the robustness of our segmentation and meshing approach, we compared the generated compartments of the head mesh between our approach, SimNIBS 3.0 and ROAST 3.0 (Fig 18). Our approach strongly smooths the scalp structure but maintains typical characteristics of the shape of the scalp (Fig 18A). The skull boundary exhibits the least irregularities using our approach, which, however, tends to overestimate the thickness of the skull occipitally, along the superior sagittal sinus (Fig 19B), and caudally. All three approaches yield a comparable gray matter compartment (Fig 18E). SimNIBS creates the visually most complete white matter compartment (Fig 18F). Note that we included the white matter lesions as a separate compartment only in our head model (highlighted in orange) (Fig 18E, Fig 19A).

thumbnail
Fig 18. Mesh compartments of the head model generated using imaging data of the LIFE study [51].

The T1-weighted imaging data (A) of a subject from the local, large-scale cross-sectional imaging study, LIFE, were used to create the head model using our approach, SimNIBS 3.0 and ROAST 3.0. Our skull segmentation approach induced the least irregularities on the outer skull boundary (C). The skin compartment (B) is highly smoothed while maintaining the basic shape. The cerebrospinal fluid (D) and gray matter (E) mesh compartments are comparable across all three approaches. We included white matter lesions (F, orange), which were segmented from an additional T2-FLAIR image, into the white matter compartment of our head model.

https://doi.org/10.1371/journal.pone.0228119.g018

thumbnail
Fig 19. Visualization of the white matter lesions and skull thickness.

The white matter lesions of a subject exhibiting a high lesion load are highlighted in orange (A). Our atlas-based approach for skull segmentation tends to overestimate the thickness of the skull occipitally, along the superior sagittal sinus (B).

https://doi.org/10.1371/journal.pone.0228119.g019

We conducted a tDCS simulation using the generated white matter lesion head model with the following parameters: a bi-hemispheric setup of quadratic 5 cm by 5 cm electrodes with 2 mm thickness as before, a 2 mA input current strength, the default conductivity values from Table 2 for the standard tissues and 0.05 S/m conductivity for the lesioned tissue, a value at the lower end of the conductivity range of white matter (mean: 0.2 S/m +/- 0.17 S/m) according to a recent literature review [54]. A low white matter conductivity was chosen to model a calcification of the tissue. We then simulated the test case again assigning the conductivity of healthy white matter to the lesioned tissue. Comparing both computed electrical fields reveals a local perturbation in the area of the lesions (Fig 20). A low average relative percentage difference between both solutions in the gray (-0.93%, SD: 4.81%) and white matter mesh compartments (-0.97%, SD: 8.92%) indicates that there is no major global difference between the simulations with and without lesions. However, the comparably high standard deviation suggests larger local differences.

thumbnail
Fig 20. Simulation results using a white matter lesion head model.

From the individual MR-image of a subject (A) with a high white matter lesion load we segmented the standard tissues (highlighted in blue = skin, yellow = skull, purple = csf, dark green = gray matter, light green = white matter, red = air) and the white matter lesions (in orange) (B). We simulated (C) a bi-hemispheric electrode setup with quadratic 5 cm x 5 cm electrodes and low conductivity of 0.05 S/m for the lesioned tissue while all other tissues were set to their default values (Table 2). For comparison, we simulated again with the conductivity of the lesioned tissue set to that of healthy white matter (D). A local perturbation of the electrical field in the area of the lesions can be observed.

https://doi.org/10.1371/journal.pone.0228119.g020

4. Discussion

We presented a set of approaches for an individualized simulation of transcranial electric stimulation. The entire workflow from segmentation, meshing, electrode modeling, simulation, and visualization is built around OpenFOAM, a finite-volume based framework for numerical simulations. A coupled use as well as the use of single features are equally possible. Essential features are: 1) Individual head models are created solely from T1-weighted MRI data. Despite the limited T1-contrast we robustly segment scalp, skull, subarachnoid CSF, the ventricles, GM, WM, and the air cavities in the skull, as demonstrated using an exemplarily head image from a local, large-scale imaging study [51]. 2) Combining image-based meshing with the surface-based meshing preserves the feature edges of the electrodes while avoiding any restrictions concerning the topology of tissue structures of the head model. 3) Arbitrary electrode shapes can be modeled, and their positioning is standardized according to the international 10–20 system. 4) Anisotropic tissue conductivity can be incorporated into the simulation. We demonstrated an overall agreement with an analytical three-layer sphere model and the simulation results obtained by the simulation pipelines SimNIBS, especially when the simulations are based on the same head model, and ROAST allowing comparability of the simulation results across simulation studies.

The combination of an image-based and a surface-based meshing algorithm realizes the head model generation. The image-based meshing holds two advantages. First, there is no restriction concerning the topology of the sub-compartments of the mesh. As the boundaries are determined directly from a labeled image, there is no requirement of overlap-free boundaries of sub-compartments [55]. Therefore, the inclusion of structures that do not obey a strictly nested arrangement, for example, tumorous or lesioned tissue or holes in the skull, is facilitated [12]. Second, image-based meshing is less sensitive to the quality of the input data which avoids extensive postprocessing of the segmentation images. However, boundaries may be less accurately approximated which we mitigated by setting a strict tolerance of the involved bisection algorithm. Surface-based meshing approximates boundaries most accurately and can preserve feature edges, which is, therefore, beneficial for representing any structure that does not require the flexibility of the image-based meshing, especially for the electrodes. As a consequence of the combination of both approaches, a tetrahedral volume mesh of high quality with maximum flexibility concerning the topology and maximum geometrical accuracy is obtained.

Comparing the results of our solver application and the solver employed in SimNIBS using an identical head model indicated an overall agreement in the global distribution and changes of the electrical field strength. However, peak differences of up to 66.2% and peak deviations in the local electrical field direction of up to 40.6° were revealed in sparse locations close to the electrodes while on average the differences with the gray matter mesh compartments remained relatively small (approximately 15% difference in the field magnitude and 11° in local field direction). Since the volume mesh, the boundary conditions, and the conductivity values for the individual mesh compartments were identical, we conclude that differences arose due to the fundamentally different numerical approaches used for solving Maxwell’s equation (SimNIBS: finite-element method, OpenFOAM: finite-volume method). Most importantly, the discretization of the involved differential operators (i.e. the gradient operator and the Laplacian operator) responsible for the calculation of the electrical potential as well as its partial differential derivative, i.e. the electrical field strength, differ between the two methods. The finite-volume method operates on cell volumes and relies for the discretization of the Laplacian operator on the relationship between the volume integral of a control volume and its surface integral, which is characterized by the Gauss theorem. This process involves the interpolation of cell values onto the cell faces, which is highly affected by the mesh quality especially the mesh orthogonality. Non-orthogonality between two mesh cells violates the assumption that the face area vector at the face between two cells and the vector connecting the two cell centers coalign [56]. A higher overall mesh non-orthogonality requires a correction term impacting the computed result. The Galerkin discretization method used by SimNIBS 3.0 is not relying on field values from the cell volumes and their faces and is, therefore, less sensitive to mesh non-orthogonality.

Indeed, we observed the finite-volume method implemented in OpenFOAM to be more sensitive to the quality of the volume mesh than the finite-element method in SimNIBS. Only by applying a gradient limited interpolation scheme for the Laplacian term of the underlying equation of the electrical potential, correcting for mesh non-orthogonality, the solution converged slowly when solving the tES problem in the head models created by SimNIBS. This choice of the discretization scheme resulted in a decreased convergence and thereby an increased solution time of approximately 4 minutes as compared to 100 seconds when using no gradient limiters in our head models. Most notably our volume mesh contained in the worst-case approximately 25 non-orthogonal cells whereas the SimNIBS volume meshes exhibited more than 1000 non-orthogonal cells in the best case and had problematic cells with negative cell volume, high skew, wrong orientation and a high aspect ratio as detected by the checkMesh utility of OpenFOAM. These differences in mesh quality can partly be attributed to the underlying image segmentation result. Using our head segmentation result as input to the SimNIBS mesh creation process, the fraction of non-orthogonal cells in the entire mesh was reduced approximately twofold to only 0.0014% in the Almi5 head model, which is still 23-times higher than achieved by our meshing approach, but the mesh does not exhibit any other problematic cells anymore. The still higher mesh quality of our approach in terms of mesh orthogonality is the result of an extensive mesh optimization phase in our meshing approach, which increases the time for the volume meshing to up to 3 hours as compared to 5 minutes without optimization.

Deviations in the electrical field strength when simulating with our version of the Almi5 and Ernie head models instead of the ready-to-use head models might originate from differences in the caudal extent of the head model and a different segmentation of the white matter and especially of the skull (Fig 9). Based on in-vivo measurements, Huang et al. [57] evidence a significantly better prediction of the current flow using extended head models that include the anatomy of the lower head. However, Indahlastari et al. [58] demonstrate a difference in the median current density in various cortical and subcortical structures within a 10% range for a truncation similar to ours (truncation below the foramen magnum of the skull) using repeated simulations and a single head model with decreasing caudal extent. More recent work [59] supports this finding reporting a 11% difference between an upper-head model and a whole-body model. In general, Indahlastari et al. found that the error introduced by a reduced head model extent depends on the location of the electrodes and the stimulation target respectively. Simulations of electrode montages close to the caudal cutoff of the head model with a reduced extent are more prone to deviations in the magnitude of the electrical field strength because of the lacking caudal current pathways. Similarly, the current density magnitude in inferior and deeper subcortical structures is more affected by a reduced head model extent. The foramen magnum was identified as another decisive factor for comparisons across head models. To yield a more comparable spread of the electrical field strength, the opening of the skull should be consistently closed or consistently opened in all head models under comparison. In our head models and the SimNIBS head models the magnum foramen was closed but not in the ROAST head models, possibly explaining the observed higher difference between our approach and ROAST. While our approach for skull segmentation tends to overestimate the skull caudally and occipitally, along the superior sagittal sinus, it slightly underestimates the thickness dorsally where the electrodes are attached. The thinner skull in that region may yield an overall higher electrical field magnitude [55]. However, the general agreement in the change of the magnitude of the electrical field strength indicates that our modeling workflow does not introduce unexpected alterations to the head model.

The Blender plugin provides powerful means for the positioning and the modeling of the electrodes. After manually defining four fiducial points (nasion, inion, tragi of the ears), electrodes are placed automatically according to the 10–20 system. Any position outside the 10–20 system can be manually defined by moving the electrode across the scalp surface. A standard rectangular electrode is automatically modeled at the specified position. Other electrode types such as ring electrodes or triangular electrodes as applied in [60] and [61] are respectively possible, but require an adaptation of the automated workflow.

Our solver application was verified using an analytical three-layered sphere model and by comparison of the simulation results with the established simulation pipelines SimNIBS and ROAST. However, a verification of the obtained simulation results with in-vivo recordings of the electrical field remains an open task. Promising approaches are electrical current density measurements obtained by the means of magnetic resonance electrical impedance tomography [62] or in-vivo recordings of the electrical potential by intracranial electrodes. TDCS simulations have been validated using intracranial recordings of epilepsy patients before [57,63].

Since our workflow mainly focuses on addressing individual problems that we faced during the simulation of tDCS, it only provides a loose framework for the coupling of the suggested tools. While we documented the information flow between the individual steps of the workflow, we did not couple the involved tools in an overarching script yet as our main focus was the easy interchangeability of the involved tools and the extendibility of the workflow. As a result, familiarization with the individual tools and knowledge about the information flow between the tools (Fig 1) is necessary to apply the workflow as a whole and potentially results in a higher initial effort for the setup and application as compared to fully automatized pipelines [10,12]. We, therefore, consider our proposed workflow in the current state more suitable for methods-oriented researchers interested in adapting and refining the presented approaches. Developing our workflow further towards a highly automated pipeline is an ongoing process and will entail replacing certain components. For example, the semi-automated segmentation pipeline implemented in JIST currently requires the interaction of the user with the graphical user interface of MIPAV. We are working on the development of Nighres [64], a Python library for the processing of neuroimaging data. Several algorithms formerly implemented as JIST plugins have already been transferred to Nighres, which will allow us to eventually replace the MIPAV/JIST based pipeline.

First simulation studies suggest that damaged brain tissue due to a stroke influences the field distribution [65]. Considering pathological tissue in the head model is, therefore, a vital extension to apply tES simulations to stroke patients. Our workflow is prepared for this application as demonstrated by the inclusion of white matter lesions into the head model. However, a fully automated and reliable segmentation of these irregular structures, especially stroke lesions, is still an open task for future research. Recent machine-learning-based algorithms constitute promising approaches for general brain lesion segmentation [66], or more specialized white matter lesion and stroke lesion segmentation [67] as well as tumor segmentation [68].

The advantageous properties of our suggested approaches for head and electrode modeling, as well as segmentation, facilitate simulation studies investigating alternative electrode shapes or irregular structures of the head model such as lesions and tumors in patients, impla nts, holes in the skull or vascular tissue.

References

  1. 1. Wang H, Wang X, Jin J, Zhang W, Li Y, Liu Z, et al. Simultaneous stimulation using rTMS and tDCS produces the most effective modulation of motor cortical excitability in healthy subjects: A pilot study. Neuroscience letters. 2019; 694: 46–50. pmid:30342993
  2. 2. Antonenko D, Thielscher A, Saturnino GB, Aydin S, Ittermann B, Grittner U, et al. Towards precise brain stimulation: Is electric field simulation related to neuromodulation? Brain stimulation. 2019.
  3. 3. Laakso I, Mikkonen M, Koyama S, Hirata A, Tanaka S. Can electric fields explain inter-individual variability in transcranial direct current stimulation of the motor cortex? Scientific reports. 2019; 9: 626. pmid:30679770
  4. 4. Nitsche MA, Paulus W. Sustained excitability elevations induced by transcranial DC motor cortex stimulation in humans. Neurology. 2001; 57: 1899–1901. pmid:11723286
  5. 5. Kim JH, Kim DW, Chang WH, Kim YH, Kim K, Im CH. Inconsistent outcomes of transcranial direct current stimulation may originate from anatomical differences among individuals: electric field simulation using individual MRI data. Neuroscience letters. 2014; 564: 6–10. pmid:24508704
  6. 6. Bikson M, Truong DQ, Mourdoukoutas AP, Aboseria M, Khadka N, Adair D, et al. Modeling sequence and quasi-uniform assumption in computational neurostimulation. Progress in brain research. 2015; 222: 1–23. pmid:26541374
  7. 7. Datta A, Baker JM, Bikson M, Fridriksson J. Individualized model predicts brain current flow during transcranial direct-current stimulation treatment in responsive stroke patient. Brain stimulation. 2011; 4: 169–174. pmid:21777878
  8. 8. Vorwerk J, Magyari L, Ludewig J, Oostenveld R, Wolters C. The FieldTrip-SimBio pipeline for finite element EEG forward computations in MATLAB: Validation and application. In the International Conference on Basic and Clinical Multimodal Imaging; 2013.
  9. 9. Dannhauer M, Khan A, White D, Guler S, Frisby S, MacLeod RS, et al. Brainstimulator: A Flexible Extensible Software Tool for Modeling and Optimizing Transcranial Brain Stimulation. Brain Stimulation: Basic, Translational, and Clinical Research in Neuromodulation. 2017; 10: e12—e13.
  10. 10. Thielscher A, Antunes A, Saturnino GB. Field modeling for transcranial magnetic stimulation: A useful tool to understand the physiological effects of TMS? In Engineering in Medicine and Biology Society (EMBC), 2015 37th Annual International Conference of the IEEE; 2015. p. 222–225
  11. 11. Lee C, Jung YJ, Lee SJ, Im CH. COMETS2: An advanced MATLAB toolbox for the numerical analysis of electric fields generated by transcranial direct current stimulation. Journal of Neuroscience Methods. 2017; 277: 56–62. pmid:27989592
  12. 12. Huang Y, Datta A, Bikson M, Parra LC. Realistic volumetric-approach to simulate transcranial electric stimulation—ROAST—a fully automated open-source pipeline. Journal of neural engineering. 2019; 16: 056006. pmid:31071686
  13. 13. Lucas BC, Bogovic JA, Carass A, Bazin PL, Prince JL, Pham DL, et al. The Java Image Science Toolkit (JIST) for rapid prototyping and publishing of neuroimaging software. Neuroinformatics. 2010; 8: 5–17. pmid:20077162
  14. 14. Mcauliffe M, Lalonde F, McGarry DP, Gandler W, Csaky K, Trus B. Medical Image Processing, Analysis & Visualization in Clinical Research. In Proceedings of the 14th IEEE Symposium on Computer-Based Medical Systems; 2001 Feb. p. 381–386.
  15. 15. Foundation B. Blender.; 2017 [last access: 23.10.2017, https://www.blender.org].
  16. 16. Ahrens J, Geveci B, Law C. Paraview: An end-user tool for large data visualization. The visualization handbook. 2005; 717.
  17. 17. Ayachit U. The ParaView guide: Kitware; 2007.
  18. 18. The OpenFOAM Foundation. OpenFOAM.; 2017 [last access: 23.10.2017, http://www.openfoam.org/].
  19. 19. Saturnino GB, Madsen KH, Thielscher A. Electric field simulations for transcranial brain stimulation using FEM: an efficient implementation and error analysis. Journal of Neural Engineering. 2019 November; 16(6).
  20. 20. Fabri A, Pion S. CGAL: The computational geometry algorithms library. In Proceedings of the 17th ACM SIGSPATIAL international conference on advances in geographic information systems; 2009. p. 538–539.
  21. 21. Tournier JD, Calamante F, Connelly A. MRtrix: diffusion tractography in crossing fiber regions. International Journal of Imaging Systems and Technology. 2012; 22: 53–66.
  22. 22. Huang Y, Su Y, Rorden C, Dmochowski J, Datta A, Parra LC. An automated method for high-definition transcranial direct current stimulation modeling. In Engineering in Medicine and Biology Society (EMBC), 2012 Annual International Conference of the IEEE; 2012. p. 5376–5379.
  23. 23. Kalloch B, Bode J, Kozlov M, Pampel A, Hlawitschka M, Sehm B, et al. Semi-automated generation of individual computational models of the human head and torso from MR images. Magnetic resonance in medicine. 2018.
  24. 24. Warfield SK, Zou KH, Wells WM. Simultaneous truth and performance level estimation (STAPLE): an algorithm for the validation of image segmentation. Medical Imaging, IEEE Transactions on. 2004; 23: 903–921.
  25. 25. Bogovic JA, Prince JL, Bazin PL. A multiple object geometric deformable model for image segmentation. Computer Vision and Image Understanding. 2013; 117: 145–157. pmid:23316110
  26. 26. Han X, Pham DL, Tosun D, Rettmann ME, Xu C, Prince JL. CRUISE: cortical reconstruction using implicit surface evolution. NeuroImage. 2004; 23: 997–1012. pmid:15528100
  27. 27. Rorden C, Bonilha L, Fridriksson J, Bender B, Karnath HO. Age-specific CT and MRI templates for spatial normalization. Neuroimage. 2012; 61: 957–965. pmid:22440645
  28. 28. Wagner S, Lucka F, Vorwerk J, Herrmann CS, Nolte G, Burger M, et al. Using reciprocity for relating the simulation of transcranial current stimulation to the EEG forward problem. Neuroimage. 2016; 140: 163–173. pmid:27125841
  29. 29. Lorensen WE, Cline HE. Marching cubes: A high resolution 3D surface construction algorithm. In ACM siggraph computer graphics; 1987. p. 163–169.
  30. 30. Cignoni P, Callieri M, Corsini M, Dellepiane M, Ganovelli F, Ranzuglia G. MeshLab: an Open-Source Mesh Processing Tool. In Scarano V, Chiara RD, Erra U, editors. Eurographics Italian Chapter Conference; 2008: The Eurographics Association.
  31. 31. Quarteroni A, Sacco R, Saleri F. Numerical mathematics: Springer Science & Business Media; 2010.
  32. 32. Taubin G. A signal processing approach to fair surface design. In Proceedings of the 22nd annual conference on Computer graphics and interactive techniques; 1995. p. 351–358.
  33. 33. Attene M. A lightweight approach to repairing digitized polygon meshes. The visual computer. 2010; 26: 1393–1406.
  34. 34. Geuzaine C, Remacle JF. Gmsh: A 3-D finite element mesh generator with built-in pre-and post-processing facilities. International journal for numerical methods in engineering. 2009; 79: 1309–1331.
  35. 35. Wolters CH, Anwander A, Tricoche X, Weinstein D, Koch MA, MacLeod RS. Influence of tissue conductivity anisotropy on EEG/MEG field and return current computation in a realistic head model: a simulation and visualization study using high-resolution finite element modeling. NeuroImage. 2006; 30: 813–826. pmid:16364662
  36. 36. Veraart J, Fieremans E, Novikov DS. Diffusion MRI noise mapping using random matrix theory. Magnetic resonance in medicine. 2016; 76: 1582–1593. pmid:26599599
  37. 37. Veraart J, Novikov DS, Christiaens D, Ades-Aron B, Sijbers J, Fieremans E. Denoising of diffusion MRI using random matrix theory. NeuroImage. 2016; 142: 394–406. pmid:27523449
  38. 38. Andersson JLR, Sotiropoulos SN. An integrated approach to correction for off-resonance effects and subject movement in diffusion MR imaging. Neuroimage. 2016; 125: 1063–1078. pmid:26481672
  39. 39. Smith SM, Jenkinson M, Woolrich MW, Beckmann CF, Behrens TEJ, Johansen-Berg H, et al. Advances in functional and structural MR image analysis and implementation as FSL. Neuroimage. 2004; 23: S208—S219. pmid:15501092
  40. 40. Dhollander T, Raffelt D, Connelly A. Unsupervised 3-tissue response function estimation from single-shell or multi-shell diffusion MR data without a co-registered T1 image. In ISMRM Workshop on Breaking the Barriers of Diffusion MRI; 2016.
  41. 41. Veraart J, Sijbers J, Sunaert S, Leemans A, Jeurissen B. Weighted linear least squares estimation of diffusion MRI parameters: strengths, limitations, and pitfalls. NeuroImage. 2013; 81: 335–346. pmid:23684865
  42. 42. Basser PJ, Mattiello J, LeBihan D. MR diffusion tensor spectroscopy and imaging. Biophysical journal. 1994; 66: 259–267. pmid:8130344
  43. 43. Westin CF, Peled S, Gudbjartsson H, Kikinis R, Jolesz FA. Geometrical Diffusion Measures for MRI from Tensor Basis Analysis. In ISMRM '97; 1997 Apr; Vancouver Canada. p. 1742.
  44. 44. Jenkinson M, Bannister P, Brady M, Smith S. Improved optimization for the robust and accurate linear registration and motion correction of brain images. Neuroimage. 2002; 17: 825–841. pmid:12377157
  45. 45. Jenkinson M, Smith S. A global optimisation method for robust affine registration of brain images. Medical image analysis. 2001; 5: 143–156. pmid:11516708
  46. 46. Andersson JLR, Jenkinson M, Smith S, others. Non-linear registration, aka Spatial normalisation FMRIB technical report TR07JA2. FMRIB Analysis Group of the University of Oxford. 2007; 2: 1–21.
  47. 47. Ruffini G, Wendling F, Merlet I, Molaee-Ardekani B, Mekonnen A, Salvador R, et al. Transcranial current brain stimulation (tCS): models and technologies. IEEE Transactions on Neural Systems and Rehabilitation Engineering. 2013; 21: 333–345. pmid:22949089
  48. 48. Rush S, Driscoll DA. Current distribution in the brain from surface electrodes. Anesthesia & Analgesia. 1968; 47: 717–723.
  49. 49. Rush S, Driscoll DA. EEG electrode sensitivity-an application of reciprocity. IEEE transactions on biomedical engineering. 1969;: 15–22. pmid:5775600
  50. 50. Alam M, Truong DQ, Khadka N, Bikson M. Spatial and polarity precision of concentric high-definition transcranial direct current stimulation (HD-tDCS). Physics in Medicine & Biology. 2016; 61: 4506.
  51. 51. Loeffler M, Engel C, Ahnert P, Alfermann D, Arelin K, Baber R, et al. The LIFE-Adult-Study: objectives and design of a population-based cohort study with 10,000 deeply phenotyped adults in Germany. BMC public health. 2015; 15: 691. pmid:26197779
  52. 52. Shiee N, Bazin PL, Ozturk A, Reich DS, Calabresi PA, Pham DL. A topology-preserving approach to the segmentation of brain images with multiple sclerosis lesions. NeuroImage. 2010; 49: 1524–1535. pmid:19766196
  53. 53. Lampe L, Kharabian-Masouleh S, Kynast J, Arelin K, Steele CJ, Löffler M, et al. Lesion location matters: the relationships between white matter hyperintensities on cognition in the healthy elderly. Journal of Cerebral Blood Flow & Metabolism. 2019; 39: 36–43.
  54. 54. McCann H, Pisano G, Beltrachini L. Variation in reported human head tissue electrical conductivity values. Brain topography. 2019; 32: 825–858. pmid:31054104
  55. 55. Nielsen JD, Madsen KH, Puonti O, Siebner HR, Bauer C, Madsen CG, et al. Automatic skull segmentation from MR images for realistic volume conductor models of the head: Assessment of the state-of-the-art. NeuroImage. 2018; 174: 587–598. pmid:29518567
  56. 56. Jasak H. Error analysis and estimation for the finite volume method with applications to fluid flows. 1996.
  57. 57. Huang Y, Liu AA, Lafon B, Friedman D, Dayan M, Wang X, et al. Measurements and models of electric fields in the in vivo human brain during transcranial electric stimulation. eLife. 2017; 6: e18834. pmid:28169833
  58. 58. Indahlastari A, Chauhan M, Schwartz B, Sadleir RJ. Changing head model extent affects finite element predictions of transcranial direct current stimulation distributions. Journal of neural engineering. 2016; 13: 066006. pmid:27705955
  59. 59. Thomas C, Huang Y, Datta A. Proceedings# 35: Influence of model extent in forward simulations of tDCS: towards standardizing model extent. Brain Stimulation: Basic, Translational, and Clinical Research in Neuromodulation. 2019; 12: e103—e105.
  60. 60. Sehm B, Hoff M, Gundlach C, Taubert M, Conde V, Villringer A, et al. A novel ring electrode setup for the recording of somatosensory evoked potentials during transcranial direct current stimulation (tDCS). Journal of neuroscience methods. 2013; 212: 234–236. pmid:23103376
  61. 61. Riedel P, Ragert P, Schelinski S, Kiebel SJ, Kriegstein K. Visual face-movement sensitive cortex is relevant for auditory-only speech recognition. Cortex. 2015; 68: 86–99. pmid:25650106
  62. 62. Kasinadhuni AK, Indahlastari A, Chauhan M, Schär M, Mareci TH, Sadleir RJ. Imaging of current flow in the human head during transcranial electrical therapy. Brain stimulation. 2017; 10: 764–772. pmid:28457836
  63. 63. Opitz A, Falchier A, Yan CG, Yeagle EM, Linn GS, Megevand P, et al. Spatiotemporal structure of intracranial electric fields induced by transcranial electric stimulation in humans and nonhuman primates. Scientific reports. 2016; 6: 31236. pmid:27535462
  64. 64. Huntenburg JM, Steele CJ, Bazin PL. Nighres: processing tools for high-resolution neuroimaging. GigaScience. 2018; 7: giy082.
  65. 65. Minjoli S, Saturnino GB, Blicher JU, Stagg CJ, Siebner HR, Antunes A, et al. The impact of large structural brain changes in chronic stroke patients on the electric field caused by transcranial brain stimulation. NeuroImage: Clinical. 2017; 15: 106–117.
  66. 66. Kamnitsas K, Ledig C, Newcombe VFJ, Simpson JP, Kane AD, Menon DK, et al. Efficient multi-scale 3D CNN with fully connected CRF for accurate brain lesion segmentation. Medical image analysis. 2017; 36: 61–78. pmid:27865153
  67. 67. Guerrero R, Qin C, Oktay O, Bowles C, Chen L, Joules R, et al. White matter hyperintensity and stroke lesion segmentation and differentiation using convolutional neural networks. NeuroImage: Clinical. 2018; 17: 918–934.
  68. 68. Saouli R, Akil M, Kachouri R, others. Fully automatic brain tumor segmentation using end-to-end incremental deep neural networks in MRI images. Computer methods and programs in biomedicine. 2018; 166: 39–49. pmid:30415717