Abstract
Background:
When modeling transcranial magnetic stimulation (TMS) in the brain, a fast and accurate electric field solver can support interactive neuronavigation tasks as well as comprehensive biophysical modeling.
Objective:
We formulate, test, and disseminate a direct (i.e., non-iterative) TMS solver that can accurately determine global TMS fields for any coil type everywhere in a high-resolution MRI-based surface model with ~200,000 or more arbitrarily selected observation points within approximately 5 sec, with the solution time itself of 3 sec.
Method:
The solver is based on the boundary element fast multipole method (BEM-FMM), which incorporates the latest mathematical advancement in the theory of fast multipole methods – an FMM-based LU decomposition. This decomposition is specific to the head model and needs to be computed only once per subject. Moreover, the solver offers unlimited spatial numerical resolution.
Results:
Despite the fast execution times, the present direct solution is numerically accurate for the default model resolution. In contrast, the widely used brain modeling software SimNIBS employs a first-order finite element method that necessitates additional mesh refinement, resulting in increased computational cost. However, excellent agreement between the two methods is observed for various practical test cases following mesh refinement, including a biophysical modeling task.
Conclusion:
The method can be readily applied to a wide range of TMS analyses involving multiple coil positions and orientations, including image-guided neuronavigation. It can even accommodate continuous variations in coil geometry, such as flexible H-type TMS coils. The FMM-LU direct solver is freely available to academic users.
Keywords: Transcranial Magnetic Stimulation, Numerical Modeling, Direct Near Real Time TMS Solution, Boundary Element Fast Multipole Method BEM-FMM, FMM Inverse, FMM-LU, Fast TMS Motor Mapping, Precise TMS Motor Mapping, Biophysical Modeling
1. Introduction
Transcranial magnetic stimulation (TMS) is a non-invasive technique used to stimulate specific regions of the brain. For TMS to be a more effective and personalized therapeutic tool, it is crucial to accurately simulate the induced electric field (E-field) distribution in the brain. For interactive E-field based TMS neuronavigation, the E-field should be updated and displayed fast enough to provide the operator with a sense of real-time interaction.
There are several time scales to consider. First, most real-time visualization applications have a minimum update rate of around 15–30 frames per second (fps) to have a smooth and continuous experience; this allows for approximately 30–60 ms for coil position update, E-field solution update, and image rendering. The second time scale of relevance relates to the pace at which a human or a robot [1],[2] could move a TMS coil from one position to another. Given an estimate for sequential robotic targeting speed of ~1cm/s [1], and if we consider coil position change of a few millimeters to produce a meaningful change in the E-field, then the solution can be updated on the time scale on the order of 100 ms. The final time scale is that of the TMS interstimulus interval, if the E-field solution were to update synchronous with TMS pulse delivery. For conventional motor mapping with single pulses, an approximately ~5 s interstimulus interval is typical to avoid inhibitory effects (cf. [3],[4]).
Over the past two years, significant progress has been made with regard to excellent real-time high-resolution solvers for TMS field modeling [5],[6],[7], which execute in approximately 20–50 ms. These simulation speeds are close to the standard screen refresh rate and should be very useful in practice for continuous smooth field visualization. In general, these solvers do not involve accelerating the main numerical algorithm itself but rather apply highly efficient and “smart” interpolation methods to thousands of precomputed solution sets.
This study aims to introduce a direct accurate TMS solver that can output TMS fields from any coil and anywhere in a high-resolution head model within ~3–5 sec. This solver is based on the boundary element fast multipole method or BEM-FMM [8],[9],[10],[11] and the most recent mathematical advance in the theory of fast multipole methods – an FMM-based LU factorization or FMM-LU [12]. It does not use any interpolation routines or precomputed solutions, but does require initial LU decomposition of a head-model matrix, which takes approximately 40 min.
One motivation for this study is a modern precise motor mapping protocol [13], which would benefit from for fast accurate field calculations while the participant is still in the hospital or facility so that a follow up TMS session could be avoided. In addition, the mapping process could be further optimized through adaptive algorithms that will utilize a sequential approach for estimating the “hot spot” [14]. On the other hand, the fast solver can be readily utilized to precompute a large number of E-field solutions covering “all possible coil positions/orientations” of interest that can be subsequently used to stimulate a desired cortical target derived from anatomical of functional connectivity data (see, e.g., [15]). The precalculated solutions could also be used to guide the operator to the right target in an interactive neuronavigation setting.
In contrast to the finite element method, BEM formulations are restricted to the surface of compartment domains, thereby reducing the dimensionality of the problem for brain modeling in general. There has been a resurgence of interest in these surface-based methods due to the availability of fast algorithms such as fast multipole methods (FMMs) [16],[17]. Assuming N is the number of degrees of freedom used in sampling surfaces and A is the N × N system matrix (Ax = b) obtained after the application of a suitable quadrature rule to an integral representation, these algorithms permit A to be applied to a vector in O(N) or O(N logN) time. For well-conditioned systems, this allows for the rapid iterative solution of very large-scale problems. The recently developed charge-based boundary element fast multipole method (BEM-FMM) [8],[9],[10],[11] utilizes this type of iterative solution. It requires 20–50 iterations on average and executes in 30–60 s depending on the required accuracy. These data are for high-resolution surface-based head models such as those generated by FreeSurfer [19],[20] and SPM/CAT [21].
There is an obvious task where iterative solvers are not satisfactory. This includes near real-time E-field predictions for TMS brain mapping or stimulation planning with a large number of possible coil positions, orientations, or even coil geometry changes. Each such setup gives rise to a unique right-hand side. Here, direct solvers would be preferred to solve the same system matrix with multiple right-hand sides. Along with this, fast direct solvers could be useful when exploring low-rank perturbations of the head geometry (and/or tissue conductivities) and, hence, the system matrix. Updating the solution in such cases requires only a few applications of A−1 or a fast update of the inverse itself [22],[23].
In the last few years, several algorithmic ideas have emerged which permit the construction of a compressed approximation of A−1 at a cost of the order O(N) or O(NlogpN), for modest p. To construct the first fast direct TMS solver, we apply one such scheme [12], which is referred to as the FMM-LU method [12]. It uses FMM-type hierarchical compression strategies to rapidly compute an LU-factorization of the large system matrix.
2. Materials and Methods
2.1. Charge-based BEM in the succinct form
Induced electric charges with a surface charge density ρ(r) will reside on every tissue conductivity interface S once an external electromagnetic stimulus or a primary E-field Ep(r) of a TMS coil is applied. These induced surface charges will alter the primary field to fulfill the law of current conservation across the boundaries. The E-field generated by all surface charges anywhere in space except the charged interfaces themselves is governed by Coulomb’s law. The total E-field E(r) becomes the sum of the primary field and the secondary charge field i.e.,
| (1) |
where ε0 is dielectric permittivity of vacuum (a normalization constant). The E-field in Eq. (1) is discontinuous at the interfaces. When approaching a charged interface S with a certain normal vector n and assigning index into the medium from which n is pointing and index out of the medium toward which n is pointing, the E-field close to the boundary is given by two limiting values [29]
| (2) |
where and r ∓ Δn(r) is not on the surface. The second term on the right-hand side of Eq. (2) is a continuous contribution of all other surface charges while the last term is a discontinuous contribution of a local planar sheet of charge located exactly at r resulting in a jump of the normal E-field by ρ(r)/ε0. The “discrete” interpretation is that the integral on the right-hand side of Eq. (2) is the continuous contribution of surface charges of all facets except the facet located exactly at r while the last term on its right-hand side is a discontinuous contribution of the facet located exactly at r. This facet is a planar sheet of charge.
An integral equation for ρ(r) is obtained after substitution of Eq. (2) into the quasistatic boundary condition which enforces the continuity of the normal component of the electric current across the interface. That is,
| (3) |
Here, σin, σout are the conductivities just inside and outside with respect to the direction of the normal vector. After combining similar terms, a Fredholm equation of the second kind is obtained
| (4) |
where K is the electric conductivity contrast .
2.2. Iterative (BEM-FMM) versus direct (FMM LU) solution of Eq. (4)
Assuming that the charge density ρ(r) has a constant value xm for every triangular facet tm with area Am, Eq. (4) is discretized in standard matrix form ( is the primary field at the m-th facet)
| (5) |
where δmn is Kronecker delta. Matrix A is well conditioned. Therefore, an iterative solution of Eq. (5) with the generalized minimum residual method (GMRES) [18] converges fast, in 20–40 iterations. FMM is used to compute the matrix-vector product in a “matrix free” fashion so that matrix A is never computed/stored [30],[26]. This solution was used previously [8],[9],[10],[11].
Another way to solve Eq. (5) is to apply FMM to a direct LU-decomposition of matrix A. In other words, a compressed approximation of A−1 is found directly so that a direct solution x = A−1b is attempted, without using an iterative method and for multiple right-hand sides, b. While matrix A is determined by the head model, the right-hand sides describe coil fields. This is the compression algorithm of Ref. [12], which is applied in this study. Indeed, the compressed inverse differs from the iterative solution. We will show that this difference is vanishingly small.
2.3. Human models and coil models used to test the algorithm
First, we test the default example of FEM software SimNIBS v3.2.6 [25] – the Ernie head model (~850,000 facets) with the default Magstim 70 mm coil model targeting the M1HAND area of the left hemisphere and thoroughly described in [24]. The MRI segmentation was done with the headreco pipeline [24], which uses the SPM12/CAT [31] toolbox.
Second, we test four Connectome Young Adult [33] subjects and target the M1HAND area of the left hemisphere with the MRiB91 coil of MagVenture using the sulcus-aligned coil positioning [32]. All head models (~830,000 facets each) have been obtained via FreeSurfer segmentation [19],[20]. The coil is approximated by ~30,000-elementary current elements (with the skin effect included) and the coil fields are also computed via the fast multipole method [34].
Finally, we test a healthy subject scanned at Max Planck Inst. for Human Cong. & Brain Sciences Leipzig, Germany with the MagVenture CB65 coil and the same left M1HAND target. However, this model is manually refined in the region of interest (ROI) so that its overall size is 1,8 M facets. In all cases, the default SimNIBS conductivity parameters [24] have been used.
2.4. Testing method
Both accuracy and speed are tested. Two error types are considered: the relative error in the vector E-field, Errortotal, and the error in the magnitude of the E-field, Errormag
| (6) |
over an arbitrary domain of interest where ∥·∥ is a 2-norm for a vector or scalar field. Index t denotes the total E-field in the head which is a sum of the primary field and the secondary field. As a ground truth, an iterative BEM-FMM solution with 54 million facets (a 1:64 uniform mesh refinement of all head compartments for the Ernie model), the FMM precision [26] of 1e-6, and with a terminal residual of 1e-6 has been utilized.
3. Results
3.1. Method accuracy versus SimNIBS FEM accuracy
For the default Ernie model example [24] of the FEM SimNIBS software [25], Table 1 gives the field error values for a mid-surface between the gray and white matter with ~200,000 observation nodes. Three solutions are considered: the default SimNIBS FEM solution, the iterative BEM-FMM solution, and the direct FMM LU solution – the subject of this study. For the iterative BEM-FMM solution, we also provide results for the uniformly refined models.
Table 1.
Field error values from Eq. (6) for the mid-surface between gray and white matter. The default Ernie model of the SimNIBS v3.2.6 FEM software with the default headreco segmentation and the default coil type/position is tested. Three solutions are considered: the default SimNIBS FEM solution, the iterative BEM-FMM solution, and the new BEM-FMM LU solution.
| Error types and their percentage values | SimNIBS Ernie model | 1:4 Uniform Refinement | 1:16 Uniform Refinement |
|---|---|---|---|
| Errortotal for entire midsurface/SimNIBS FEM | 27.1% | - | - |
| Errortotal for entire midsurface/iterative BEM-FMM | 14.7% | 1.7% | 0.5% |
| Errortotal for entire midsurface/BEM-FMM LU | 14.7% | - | - |
| Errortotal for 4 cm ROI under coil/SimNIBS FEM | 25.0% | - | - |
| Errortotal for 4 cm ROI under coil/iterative BEM-FMM | 3.3% | 0.4% | 0.1% |
| Errortotal for 4 cm ROI under coil/BEM-FMM LU | 3.3% | - | - |
| Errormag for entire midsurface/SimNIBS FEM | 17.7% | - | - |
| Errormag for entire midsurface/iterative BEM-FMM | 4.9% | 0.6% | 0.2% |
| Errormag for entire midsurface/BEM-FMM LU | 4.9% | - | - |
| Errormag for 4 cm ROI under coil/SimNIBS FEM | 5.7% | ||
| Errormag for 4 cm ROI under coil/iterative BEM-FMM | 1.6% | 0.2% | 0.06% |
| Errormag for 4 cm ROI under coil/BEM-FMM LU | 1.6% | - | - |
The iterative BEM-FMM solution in Table 1 uses the FMM precision of 1e-4 and the terminal residual of 1e-6. The FMM LU uses the same FMM precision of 1e-4. Two measures of error are given: one is for the entire midsurface between gray and white matter; the second covers a region of interest (ROI) on the midsurface contained within a 4 cm diameter sphere at the target point on the coil axis crossing the gray matter interface.
3.2. Method accuracy at different levels of internal FMM precision
Table 2 gives the field error values for the mid-surface between gray and white matter. Two solutions are compared against each other: the iterative BEM-FMM solution and the BEM-FMM LU solution. The iterative BEM-FMM uses the FMM precision of 1e-4 everywhere, including the field computations, and the terminal residual of 1e-6. It is considered as the ground truth. The FMM LU is tested with different values of FMM accuracy for (i) decomposition; and (ii) field computations. Four Connectome Young Adult models, subjects 101309, 110411, 117122, 120111 [28], are tested when the MRiB91 coil of MagVenture is targeting the M1HAND of the left hemisphere. Along with this, the Ernie model provided with SimNIBS FEM software, segmented with the standard headreco settings, and the default coil type/position is also tested. The superscript denotes standard deviation.
Table 2.
Field error values from Eq. (6) for the mid-surface between gray and white matter. The FMM-LU is tested with different values of FMM precision for (i) LU matrix decomposition; and (ii) field computations. Four Connectome models are tested along with the default Ernie model of the SimNIBS FEM software. The superscript denotes standard deviation.
| Error type and percentage values | SimNIBS Ernie model | Connectome models, averaged |
|---|---|---|
| FMM LU precision: 1e-4: Field FMM precision: 1e-4 | ||
| Errortotal for entire midsurface/BEM-FMM LU vs. iterative sol. | 0.10% | 0.11%0.02% |
| Errortotal for 4 cm ROI under coil/BEM-FMM LU vs. iterative sol. | 0.03% | 0.03%0.003% |
| Errormag for entire midsurface/BEM-FMM LU vs. iterative sol. | 0.08% | 0.08%0.01% |
| Errormag for 4 cm ROI under coil/BEM-FMM LU vs. iterative sol. | 0.03% | 0.02%0.005% |
| FMM LU precision: 1e-4: Field FMM precision: 1e-1 | ||
| Errortotal for entire midsurface/BEM-FMM LU vs. iterative sol. | 0.37% | 0.38%0.02% |
| Errortotal for 4 cm ROI under coil/BEM-FMM LU vs. iterative sol. | 0.15% | 0.16%0.03% |
| Errormag for entire midsurface/BEM-FMM LU vs. iterative sol. | 0.28% | 0.27%0.02% |
| Errormag for 4 cm ROI under coil/BEM-FMM LU vs. iterative sol. | 0.15% | 0.14%0.01% |
| FMM LU precision: 1e-3: Field FMM precision: 1 e-1 | ||
| Errortotal for entire midsurface/BEM-FMM LU vs. iterative sol. | 1.35% | 1.46%0.29% |
| Errortotal for 4 cm ROI under coil/BEM-FMM LU vs. iterative sol. | 0.40% | 0.42%0.16% |
| Errormag for entire midsurface/BEM-FMM LU vs. iterative sol. | 1.05% | 1.04%0.19% |
| Errormag for 4 cm ROI under coil/BEM-FMM LU vs. iterative sol. | 0.39% | 0.37%0.18% |
3.3. Method speed
The method speed was tested using four nearly identical workstations with Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz, 512 GB RAM, 56 cores, OS Windows Server 2022 Standard and the common MATLAB 2021b platform. Fig. 1 outlines the corresponding execution times including precomputations. In Fig. 1, initial computations of the primary coil field and the final field computations for the given domain (steps I and III) take less than 1 sec for the FMM precision levels 1e-1 and 1e-2 while the direct numerical solution (step II) takes 2.4 s for the FMM precision level 1e-3 and 3.0 s for the FMM precision level 1e-4, respectively.
Fig. 1.
Approximate execution times of the method when the parameters from Table 2 are used for the FMM-LU solution (the Ernie model). The data are averaged for four workstations with Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz 512 GB RAM, 56 cores, OS Windows Server 2022 Standard; MATLAB 2021b platform. The entire solution executes in slightly less than 5 sec.
Equivalent SimNIBS v3.2.6/4.0 execution times on high-performance workstations were approximately 40 s. SimNIBS run times on a 2.3 GHz laptop are faster – approximately 30 s.
3.4. Example #1. Cortical and subcortical fields computed in 4.7 sec (MRiB91 coil)
As the first computational example, Fig. 2 shows the simulation output for Connectome Young Adult subject 120111 including: a) the total E-field just inside the gray matter interface; b) the total E-field just outside the white matter interface; c) the total E-field at the cortical midsurface and; d) the total E-field in a transverse plane beneath the coil. The MRiB91 coil of MagVenture is driven with dI/dt = 9.4e7 A/s. The computational sequence for any type of output from Fig. 2 takes approximately 4.7 seconds to run, including graphical rendering in MATLAB.
Fig. 2.
Different forms of the simulation output for Connectome subject 120111: a) Total E-field just inside the gray matter interface; b) Total E-field just outside the white matter interface; c) Total E-field at the cortical midsurface; d) Total E-field in a transverse plane beneath the coil. The entire computational sequence for any type of the output runs in approximately 4.7 s including graphical rendering in MATLAB.
3.5. Example #2. Cortical and subcortical fields computed in 4.8 sec (authentic H1 coil)
As a second example, Fig. 3 shows a simulation output for the same Connectome subject 120111 but when an H1 coil of BrainsWay is used. In this case, the coil is made flexible, and it changes its shape when continuously aligned with the patient’s head. Therefore, step I in Fig. 1 cannot be replaced by an interpolation of the precomputed coil field. The computational sequence for any type of output from Fig. 3 takes approximately 4.8 seconds to run, including graphical rendering in MATLAB.
Fig. 3.
Different forms of the simulation output for Connectome subject 120111 with the H1 flexible coil of BrainsWay, Ltd: a) Total E-field just inside the gray matter interface; b) Total E-field just outside the white matter interface; c) Total E-field at the cortical midsurface; d) Total E-field in a transverse plane beneath the coil. The entire computational sequence for any type of the output runs in approximately 4.8 s including graphical rendering in MATLAB.
4. Discussion
4.1. Iterative and direct FMM solutions produce nearly identical results
Table 2 indicates that the accuracy of FMM LU is non-distinguishable from the accuracy of BEM-FMM given the FMM precision level of 1e-4 or better used for constructing the compressed inverse. In this case, the factorization data stored in MATLAB workspace have the size of approximately 50 Gigabytes; their creation requires approximately 70 min. The direct solution – step II in Fig. 1 – executes in 3.0 s. The FMM precision level used for the field computations – steps I and III in Fig. 1 – may be as low as 1e-1 or 1e-2 without deteriorating the solution accuracy.
When the FMM precision level is reduced to 1e-3, the factorization data will have the size of 30 Gigabytes, their generation requires approximately 40 min, and the direct solution (step II in Fig. 1) executes in 2.4 s. This option could likely be preferred since its accuracy reported in the last four rows of Table 2 is approximately 0.4% on average for the critical ROI fields.
As Table 2 demonstrates, the FMM precision level used for the field computations has little influence on the solution accuracy. This is because in both BEM-FMM and FMM LU, the near-field interaction integrals are computed analytically and then substituted into the FMM pipelines. On the other hand, this level has a substantial influence on the method speed. Therefore, the values of 1e-2 or 1e-1 are preferred.
4.2. Solid agreement with SimNIBS is achieved for a refined head model
The lower 1st-order FEM accuracy from Table 1 can be improved using selective mesh refinement in the ROI domain as illustrated in Fig. 4a,b. Here, the default headreco segmentation [24] of the healthy subject was manually refined for cerebrospinal fluid, gray matter, and white matter (both surface and volume meshes were refined) as shown in Fig. 4b. One thousand different coil positions (using a MagVenture CB65 coil) have been tested while scanning the ROI.
Fig. 4.
Default headreco segmentation of the healthy subject in a) was manually refined for cerebrospinal fluid, gray matter, and white matter within the ROI in a,b). One thousand different coil positions have been tested while scanning the ROI; SimNIBS and BEM-FMM solutions were compared with each other in c,d).
Solutions using the refined meshes from SimNIBS and BEM-FMM were compared with each other as shown in Fig. 4c,d, respectively. The average vector field and magnitude field differences from (Eq. 6) within the ROI in Fig. 4c,d now attain the sub-percent values, which confirms the convergence of both methods to the same result. Due to the differences in the 2D vs. 3D numerical formulations of the problems for the BEM-FMM and SIMNIBS, respectively, some discrepancies remain close to the conductivity boundaries where the normal electric field is discontinuous. The practical implications of these differences require further investigation.
4.3. Solid agreement with SimNIBS is achieved for activating thresholds of intracortical neural cells for a refined head model
Three intracortical neural cells (#4, 6, and 9) from a multi-scale toolbox Neuron Modeling for TMS (NeMo-TMS) [37] were placed 1 mm below the grey matter surface of the refined Ernie model (0.4 nodes per mm2) on the coil axis as shown in Fig. 5a and their activating thresholds were computed as a function of the E-field intensity, dI/dt, of a MagStim 70 mm coil (the SimNIBS coil model is used) for the default NeMo-TMS pulse form. Fig. 5b)-e) below compares the activating thresholds computed with BEM-FMM and SimNIBS, respectively, using the corresponding quasi-potentials. It also illustrates the action potentials at the neuron activation for cells 6 and 9, respectively, at 0.7 ms. The activating thresholds differ by 3.2% (cell 4), 2.6% (cell 6), and 4.2% (cell 9) with BEM-FMM always predicting slightly lower threshold values while the action potentials (membrane voltages) at 0.7 ms are hardly distinguishable. For the non-refined model, the agreement is worse (~20% on average). The results indicate that ‘inside’ the gray matter the BEM-FMM and SIMNIBS based modeling of the neuronal activation thresholds show robust agreement. On the other hand, axonal activation mechanisms may be influenced by the tissue heterogeneity (that causes charge accumulation on the conductivity boundaries) that may require more detailed analysis of the fields close to the gray-white matter boundaries [27]. Of course, the E-fields on the micro- and mesoscopic level are not fully characterized by the macroscopic model and how to merge the anatomical and histological information across multiple scales is a topic of further research.
Fig. 5.
a) Coil position for the Ernie model. b)-e) activating thresholds and action potentials at 0.7 ms after activation.
4.4. Major limitations of the present direct solution
The present method has been tested on four multicore (32 to 56 cores) 2.6 GHz workstations. The minimum required RAM is approximately 64 Gigabytes. The FMM-LU factorization of the head-model specific system matrix requires approximately 40 min. The present method cannot run on a standard laptop.
As of today, neither BEM-FMM nor FMM LU are in position to handle macroscopic medium anisotropy. If the anisotropic part of the volume conductor model would be perfectly aligned and have the matching resolution, the error would be on the order of 10% with respect to the isotropic case as our computations for the healthy subject scanned at Max Planck Inst. for Human Cong. & Brain Sciences Leipzig, Germany show. However, the estimate of the anisotropy conductivity tensor based on the diffusion tensor imaging data is subject to its own challenges.
5. Conclusion
The direct TMS solver suggested in this study can determine global E-fields in modern high-resolution head models in approximately 5 seconds, which approaches the speed of single-pulse TMS motor mapping. There are no limitations on coil positions, coil types, coil deformations, ROI sizes, and ROI locations. For the standard head model, solver’s numerical accuracy is better than the accuracy of the widely used first-order FEM software when the isotropic head models are used. The FMM LU method can thus be employed to accelerate optimization problems in which a large number of coil configurations have to be simulated and a very large number of field values have to be computed. For example, approximately 24 hours would be necessary to accurately compute intracortical fields at 200,000 observation locations anywhere inside the brain volume for 1,000 TMS coil positions and 20 orientations per position.
The method could be readily expanded to other types of brain stimulation. Ref. [38] presents the standalone downloadable FMM LU code which replicates all data from Fig. 2, along with a short user’s manual. The computational platform is standard MATLAB running on Windows. The code accepts surface head meshes in STL format and is compatible with the coil models from the BEM-FMM package [10]. Ref. [38] also includes several movies recorded for examples from Fig. 2 and Fig. 3, respectively, and at the identical computational speed.
Acknowledgements
Authors are thankful to Drs. Samuel Zibman and Gaby Perl of Brainsway, Ltd for providing the authentic H-coil models. This work has been supported by NIH//NIBIB, NIH/NIMH, and NIH grants 5P41EB030006, 1R01MH128421, 1R01DC020891, and 1R01MH130490. Z.-D. Deng is supported by the NIMH Intramural Research Program (ZIAMH002955).
Footnotes
CRediT statements
S. Makaroff: Methodology, Software, Writing, Original draft preparation. M. Rachh: Conceptualization, Methodology, Software, Validation. W. Wartman: Software. K. Weise: Data curation, Investigation. G Noetscher: Writing, Original draft preparation. M. Daneshzand: Software, Validation, Z.-D. Deng: Conceptualization, Writing, Reviewing, and Editing. L. Greengard: Conceptualization, Formal Analysis, Methodology. A. Nummenmaa: Conceptualization, Supervision, Funding acquisition.
Declarations of interest: ‘none’
Supplementary Files
Data availability statement
The standalone executable computer code that supports the findings of this study along with six short real-time movies is available from repository of Ref. [38]: TMS FMM-LU March. 2023: Source code in MATLAB and videos:
DropBox: https://www.dropbox.com/sh/ztra43jfj8afh0z/AAAG8mdqyjkQR9UCWYrJQ14Ha?dl=0
References
- [1].Giuffre A, Kahl CK, Zewdie E, Wrightson JG, Bourgeois A, Condliffe EG, Kirton A. Reliability of robotic transcranial magnetic stimulation motor mapping. J Neurophysiol. 2021 Jan 1;125(1):74–85. Doi: 10.1152/jn.00527.2020. [DOI] [PubMed] [Google Scholar]
- [2].Kahl CK, Giuffre A, Wrightson JG, Zewdie E, Condliffe EG, MacMaster FP, Kirton A. Reliability of active robotic neuro-navigated transcranial magnetic stimulation motor maps. Exp Brain Res. 2022 Dec 16; 241(2):355–64. doi: 10.1007/s00221-022-06523-3. [DOI] [PubMed] [Google Scholar]
- [3].Chen R, Tam A, Bütefisch C, Corwell B, Ziemann U, Rothwell JC, Cohen LG. Intracortical inhibition and facilitation in different representations of the human motor cortex. J Neurophysiol. 1998. Dec;80(6):2870–81. doi: 10.1152/jn.1998.80.6.2870. [DOI] [PubMed] [Google Scholar]
- [4].Wagle-Shukla A, Ni Z, Gunraj CA, Bahl N, Chen R. Effects of short interval intracortical inhibition and intracortical facilitation on short interval intracortical facilitation in human primary motor cortex. J Physiol. 2009 Dec 1;587(Pt 23):5665–78. doi: 10.1113/jphysiol.2009.181446. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [5].Daneshzand M, Makarov SN, de Lara LIN, Guerin B, McNab J, Rosen BR, Hämäläinen MS, Raij T, Nummenmaa A. Rapid computation of TMS-induced E-fields using a dipole-based magnetic stimulation profile approach. NeuroImage. 2021 Aug 15;237:118097. doi: 10.1016/j.neuroimage.2021.118097. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [6].Gomez LJ, Dannhauer M, Peterchev AV. Fast computational optimization of TMS coil placement for individualized electric field targeting. Neuroimage. 2021. Mar;228:117696. doi: 10.1016/j.neuroimage.2020.117696. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [7].Wang D, Hasan NI, Dannhauer M, Yucel AC, Gomez L. Fast Computational E-field Dosimetry for Transcranial Magnetic Stimulation using Adaptive Cross Approximation and Auxiliary Dipole Method (ACA-ADM). NeuroImage. 2023; 267: 119850. Doi: 10.1016/j.neuroimage.2022.119850. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [8].Weise K, Wartman WA, Knösche TR, Nummenmaa AR, Makarov SN. The effect of meninges on the electric fields in TES and TMS. Numerical modeling with adaptive mesh refinement. Brain Stimul. 2022. May-Jun;15(3):654–663. doi: 10.1016/j.brs.2022.04.009. [DOI] [PubMed] [Google Scholar]
- [9].Makarov SN, Wartman WA, Noetscher GM, Fujimoto K, Zaidi T, Burnham EH, Daneshzand M, Nummenmaa A. Degree of improving TMS focality through a geometrically stable solution of an inverse TMS problem. Neuroimage. 2021 Nov 1;241:118437. doi: 10.1016/j.neuroimage.2021.118437. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [10].Makarov SN, Wartman WA, Daneshzand M, Fujimoto K, Raij T, Nummenmaa A. A software toolkit for TMS electric-field modeling with boundary element fast multipole method: An efficient MATLAB implementation. J Neural Eng. 2020 Apr 1; 17(4): 046023. doi: 10.1088/1741-2552/ab85b3. [DOI] [PubMed] [Google Scholar]
- [11].Makarov SN, Noetscher GM, Raij T, Nummenmaa A. A Quasi-Static Boundary Element Approach with Fast Multipole Acceleration for High-Resolution Bioelectromagnetic Models. IEEE Trans Biomed Eng. 2018 Mar 7; 65(12): 2675–83. doi: 10.1109/TBME.2018.2813261. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [12].Sushnikova D, Greengard L, O’Neil M, Rachh M. FMM-LU: A fast direct solver for multiscale boundary integral equations in three dimensions. arXiv pre-print. Aug. 5 2022. Online: https://arxiv.org/pdf/2201.07325.pdf. [Google Scholar]
- [13].Weise K, Numssen O, Kalloch B, Zier AL, Thielscher A, Haueisen J, Hartwigsen G, Knösche TR. Precise motor mapping with transcranial magnetic stimulation. Nat Protoc. 2023; 18(2): 293–318. doi: 10.1038/s41596-022-00776-6. [DOI] [PubMed] [Google Scholar]
- [14].Aonuma S, Gomez-Tames J, Laakso I, Hirata A, Takakura T, Tamura M, Muragaki Y. A high-resolution computational localization method for transcranial magnetic stimulation mapping. Neuroimage. 2018 May 15;172:85–93. doi: 10.1016/j.neuroimage.2018.01.039. [DOI] [PubMed] [Google Scholar]
- [15].Lynch CJ, Elbau IG, Ng TH, Wolk D, Zhu S, Ayaz A, Power JD, Zebley B, Gunning FM, Liston C. Automated optimization of TMS coil placement for personalized functional network engagement. Neuron. 2022 Oct 19;110(20):3263–3277.e4. doi: 10.1016/j.neuron.2022.08.012 [DOI] [PMC free article] [PubMed] [Google Scholar]
- [16].Beatson R. and Greengard L.. A short course on fast multipole methods. In M. A. et al. , editor, Wavelets, Multilevel Methods, and Elliptic PDEs, pages 1–37. Oxford University Press, 1997. [Google Scholar]
- [17].Greengard L., Rokhlin V. A new version of the Fast Multipole Method for the Laplace equation in three dimensions. Acta Numerica, 6:229–269, 1997. [Google Scholar]
- [18].Saad Y. Iterative Methods for Sparse Linear Systems. 2nd Ed., Society for Industrial and Applied Mathematics. 2003. ISBN 978–0-89871–534-7. [Google Scholar]
- [19].Fischl B. FreeSurfer. NeuroImage. 2012;62(2):774–81. doi: 10.1016/j.neuroimage.2012.01.021. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [20].FreeSurfer Software Suite 2022. Online: https://www.zotero.org/freesurfer.
- [21].Structural Brain Mapping Group. Computational Anatomy Toolbox (CAT). Univ. of Jena, Germany. Accessed 04/05/21. Online: http://www.neuro.uni-jena.de/wordpress/publications/ [Google Scholar]
- [22].Greengard L, Gueyffier D, Martinsson P-G, Rokhlin V. Fast direct solvers for integral equations in complex three-dimensional domains. Acta Numerica, 18:243–275, 2009. [Google Scholar]
- [23].Minden V, Damle A, Ho KL, Ying L. A technique for updating hierarchical skeletonization-based factorizations of integral operators. Multiscale Model. Simul., 14:42–64, 2016. [Google Scholar]
- [24].Saturnino GB, Puonti O, Nielsen JD, Antonenko D, Madsen KH, Thielscher A. SimNIBS 2.1: A Comprehensive Pipeline for Individualized Electric Field Modelling for Transcranial Brain Stimulation. 2019. In: Makarov S, Horner M, Noetscher G, editors. Brain and Human Body Modeling: Computational Human Modeling at EMBC 2018 [Internet]. Cham (CH): Springer; 2019. Chapter 1.. [PubMed] [Google Scholar]
- [25].Thielscher A, Antunes A, Saturnino GB. Field modeling for transcranial magnetic stimulation: A useful tool to understand the physiological effects of TMS? Annu Int Conf IEEE Eng Med Biol Soc. 2015;2015:222–5. doi: 10.1109/EMBC.2015.7318340. Online: https://simnibs.github.io/simnibs/build/html/index.html. [DOI] [PubMed] [Google Scholar]
- [26].Gimbutas Z, Greengard L, Magland J, Rachh M, Rokhlin V. fmm3D Documentation. Release 0.1.0. 2019–2022. Online: https://github.com/flatironinstitute/FMM3D & https://github.com/flatironinstitute/FMM3D/blob/master/fmm3d_manual.pdf. [Google Scholar]
- [27].Miranda PC, Correia L, Salvador R, Basser PJ. Tissue heterogeneity as a mechanism for localized neural stimulation by applied electric fields. Phys Med Biol. 2007 Sep 21;52(18):5603–17. doi: 10.1088/0031-9155/52/18/009. [DOI] [PubMed] [Google Scholar]
- [28].Van Essen DC, Ugurbil K, Auerbach E, Barch D, Behrens TE, Bucholz R, Chang A, Chen L, Corbetta M, Curtiss SW, Della Penna S, Feinberg D, Glasser MF, Harel N, Heath AC, Larson-Prior L, Marcus D, Michalareas G, Moeller S, Oostenveld R, Petersen SE, Prior F, Schlaggar BL, Smith SM, Snyder AZ, Xu J, Yacoub E. The Human Connectome Project: A data acquisition perspective. NeuroImage. 2012; 62(4):2222–2231. Online (Jan. 2020): http://www.humanconnectomeproject.org/ [DOI] [PMC free article] [PubMed] [Google Scholar]
- [29].Vladimirov V. S., 1971, Equations of Mathematical Physics, Marcel Dekker, New York, ISBN-10 0824717139. [Google Scholar]
- [30].Greengard L, Rokhlin V. A fast algorithm for particle simulations. J. Comput. Phys. 1987;73(2):325–348. doi: 10.1016/0021-9991(87)90140-9. [DOI] [Google Scholar]
- [31].Penny W., Friston K., Ashburner J., Kiebel S., and Nichol T.. Statistical parametric mapping: The analysis of functional brain images. 2007. Elsevier; London, UK. [Google Scholar]
- [32].Raffin E, Pellegrino G, Di Lazzaro V, Thielscher A, Siebner HR. Bringing transcranial mapping into shape: Sulcus-aligned mapping captures motor somatotopy in human primary motor hand area. Neuroimage. 2015 Oct 15;120:164–75. doi: 10.1016/j.neuroimage.2015.07.024. [DOI] [PubMed] [Google Scholar]
- [33].Van Essen DC, Ugurbil K, Auerbach E, Barch D, Behrens TE, Bucholz R, Chang A, Chen L, Corbetta M, Curtiss SW, Della Penna S, Feinberg D, Glasser MF, Harel N, Heath AC, Larson-Prior L, Marcus D, Michalareas G, Moeller S, Oostenveld R, Petersen SE, Prior F, Schlaggar BL, Smith SM, Snyder AZ, Xu J, Yacoub E. The Human Connectome Project: A data acquisition perspective. NeuroImage. 2012; 62(4):2222–2231. Online (Jan. 2020): http://www.humanconnectomeproject.org/ [DOI] [PMC free article] [PubMed] [Google Scholar]
- [34].Makarov SN, Navarro de Lara L, Noetscher GM, Nummenmaa A. Modeling Primary Fields of TMS Coils with the Fast Multipole Method. bioRxiv. 2019. doi: 10.1101/514919. [DOI] [Google Scholar]
- [35].Htet AT, Saturnino GB, Burnham EH, Noetscher G, Nummenmaa A, Makarov SN. Comparative performance of the finite element method and the boundary element fast multipole method for problems mimicking transcranial magnetic stimulation (TMS). J Neural Eng. 2019. Apr;16(2):024001. doi: 10.1088/1741-2552/aafbb9. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [36].Gomez LJ, Dannhauer M, Koponen LM, Peterchev AV. Conditions for numerically accurate TMS electric field simulation. Brain Stimul. 2019 Oct 3; 13(1): 157–166. doi: 10.1016/j.brs.2019.09.015. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [37].Shirinpour S, Hananeia N, Rosado J, Tran H, Galanis C, Vlachos A, Jedlicka P, Queisser G, Opitz A. Multi-scale modeling toolbox for single neuron and subcellular activity under Transcranial Magnetic Stimulation. Brain Stimul. 2021. Nov-Dec;14(6):1470–1482. doi: 10.1016/j.brs.2021.09.004. [DOI] [PMC free article] [PubMed] [Google Scholar]
- [38].TMS FMM-LU Jan-Feb. 2023: Source code in MATLAB and videos. DropBox: https://www.dropbox.com/sh/ztra43jfj8afh0z/AAAG8mdqyjkQR9UCWYrJQ14Ha?dl=0
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The standalone executable computer code that supports the findings of this study along with six short real-time movies is available from repository of Ref. [38]: TMS FMM-LU March. 2023: Source code in MATLAB and videos:
DropBox: https://www.dropbox.com/sh/ztra43jfj8afh0z/AAAG8mdqyjkQR9UCWYrJQ14Ha?dl=0





