Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2025 Sep 10.
Published in final edited form as: Brain Stimul. 2025 Jun 5;18(4):1174–1183. doi: 10.1016/j.brs.2025.05.136

Realistic electric field characterization of clinically used deformable large TMS coils in a large cohort

Torge Worbs a,b,1, Bianka Rumi b,c,d,1, Kristoffer H Madsen b,c,*,1, Axel Thielscher a,b,1
PMCID: PMC12419802  NIHMSID: NIHMS2102284  PMID: 40482811

Abstract

Background:

Transcranial Magnetic Stimulation (TMS) therapies use both focal and unfocal coil designs. Unfocal designs often employ bendable windings and moveable parts, making realistic simulations of their electric fields in inter-individually varying head sizes and shapes challenging. This hampers comparisons of the various coil designs and prevents systematic evaluations of their dose-response relationships.

Objective:

Introduce and validate a novel method for optimizing the position and shape of flexible coils taking individual head anatomies into account. Evaluate the impact of realistic modeling of flexible coils on the electric field simulated in the brain.

Methods:

Accurate models of four coils (Brainsway H1, H4, H7; MagVenture MST-Twin) were derived from computed tomography data and mechanical measurements. A generic representation of coil deformations by concatenated linear transformations was introduced and validated. This served as basis for a principled approach to optimize the coil positions and shapes, and to optionally maximize the electric field strength in a region of interest (ROI).

Results:

For all four coil models, the new method achieved configurations that followed the scalp anatomy while robustly preventing coil-scalp intersections on 1100 head models. In contrast, setting only the coil center positions without shape deformation regularly led to physically impossible configurations. This also affected the electric field calculated in the cortex, with a median peak difference of ~16 %. In addition, the new method outperformed grid search-based optimization for maximizing the electric field of a standard Fig. 8 coil in a ROI with a comparable computational complexity.

Conclusion:

Our approach alleviates practical hurdles that so far hampered accurate simulations of bendable coils. This enables systematic comparison of dose-response relationships across the various coil designs employed in therapy.

Keywords: TMS, Electric field calculations, Personalized dosing, Brainsway H-Coils, MagVenture MST-Twin coil

1. Introduction

Transcranial Magnetic Stimulation (TMS) has been approved by several medical agencies as therapy against specific psychiatric diseases, including major depressive disorder and obsessive-compulsive disorder [1]. Interestingly, the clinically employed coil designs vary substantially and range from standard rigid figure-of-eight coil geometries to large and deformable coils [2-4]. Despite being used for the same clinical indications, the different designs induce electric fields in the brain that vary strongly in their spatial distribution and focality. The individual head and brain anatomies additionally influence the induced electric field (E-field) [5]. Accurate modeling for these different coil designs is therefore important to enable future investigations of how the electric field differences affect the therapeutic effects across coil types.

Personalized E-field simulations informed by structural magnetic resonance imaging (MRI) [5,6] can be useful tools to explore these questions, for example during clinical trials. However, while this is straightforward for standard flat figure-of-eight coil coils, this was so far practically difficult or infeasible for most large coils with complex shapes that are used in therapy as well. So far accurate computational models of these large coils for use in the simulations were mostly lacking. More importantly, the available simulation software does not have automatic means to prevent intersections between the coil model and the head model which will create physically impossible coil configurations and field distributions. Instead, time-consuming and practically tedious manual positioning of non-flat coil geometries on the head model is required. So far, shape adjustments of deformable coils were not supported, preventing realistic simulations of those coils.

The SimNIBS software package is an open-source tool for personalized E-field simulations [7] of transcranial magnetic and electric stimulation. While SimNIBS already includes many validated coil models [8], so far, it lacked support for coils with deformable and movable parts. In this paper, we introduce geometrically accurate models of the clinically used Brainsway H1, H4, and H7 coils and the MagVenture MST-twin coil [9]. We further describe a computationally efficient approximation of non-linear deformations of coil shapes by concatenated linear transformations. We use this to establish a principled optimization approach for fitting the coil position and shape to individual head shapes while avoiding intersections between the coil and the head models and, in case of the MST-twin coil, also between the two individually movable coil parts. The approach is generic and can be easily extended to further coil designs. This will particularly benefit the modeling of non-flat coils, such as figure-of-eight coil coils where the two halves are bent in relation to each other, as these coil models can be challenging to position in a realistic way in the simulations.

We assess two application scenarios, in which we evaluate the stability of our approach by reporting the average E-field distribution induced in the brain for 1100 head models. In the first scenario, the coil casing is fitted as close as possible to the head surface, to reach a physically feasible coil configuration close to an initial position provided by the user. In the second scenario, the coil position and shape are optimized to maximize the E-field in a cortical region of interest (ROI). For further validation, we apply the approach to a flat figure-of-eight coil and compare the optimized E-field with the results of a standard grid search.

2. Methods

2.1. Modeling of the Brainsway H1, H4 and H7 coils and the MagVenture MST-twin coil

Physical samples of the Brainsway H1, H4 and H7 coil models were scanned in a clinical computerized tomography (CT) scanner, whereby the coils were carefully placed to avoid deformations. The wire paths were then traced manually in the scans (Suppl. Material A). Calculations of the magnetic fields and magnetic vector potentials of the coils were then implemented based on numerical solutions of line integrals [10] using the fast multipole method for improved efficiency [11]. A wire was approximated by a single line element placed in its center with a resolution of two line elements per millimeter. This resulted in a numerical error below 0.04 % compared to reference cases with very dense sampling. This choice enabled good numerical accuracy (Suppl. Material A) while maintaining computational efficiency. When positioning the H1, H4 and H7 coils physically on heads, the resulting deformations occurred as bends of specific wire paths, which could be well approximated in the models by rotations around “bending axes” or, more generally, affine transformations. If needed, more complex deformations were represented by chaining affine transformations that are successively applied to different sub-parts of the wire paths. By this procedure, coil deformations can be efficiently expressed as a small number of affine transformations. Based on pilot tests on various head shapes, we visually identified the deforming wire paths and defined appropriate bending axes and physically feasible transformation ranges. The coil wires are attached to a fabric cap and include soft padding. After fitting the coils firmly on a head using the integrated straps, we measured the minimal gap between skin and wires caused by the cap and padding materials. For modeling this gap, we then created surfaces around the wire paths (Fig. 1A) to account for the padding when computationally fitting the coil model on head models. We assessed the accuracy of the modelled deformations and gaps by performing a CT scan of the H1 coil fitted on a ball with a 200 mm diameter, confirming that the computational coil model approximated the physically occurring deformation well (Suppl. Material B).

Fig. 1.

Fig. 1.

A) Initial placements on the MNI head for the distance optimization of the Brainsway H1, H4 and H7 coils, and MagVenture MST-Twin coil. B) Initial coil placements on the MNI head for optimization of the average electric field magnitude (abbr.: mean(E) within a bilateral prefrontal ROI (shown in red) for MagVenture MST-Twin coil. C) Left precentral ROI covering the handknob for use with the MagVenture Cool-B65 coil. The masks are defined on the "fsaverage" cortical surface and transformed to the subject space via surface-based registration [34].

The MagVenture MST-twin coil has two “sub-coils” that are connected to a guide rail, which determines the range of feasible positions of the two sub-coils. Using an existing computational model of an MST subcoil [8] and measurements on a physical coil sample, we created a model of the complete MST coil consisting of representations of the two sub-coils and the guide rail (Fig. 1A). The feasible positions of the sub-coils were tested on the physical coil sample and represented by defining suited linear transformations and parameter ranges.

A new Json-based file format (“.tcd” – TMS coil definition, Suppl. Material C) was created for the generic representation of the four coil models in the SimNIBS simulation environment, also substantially simplifying addition of further coil models with complex shapes.

2.2. Optimization of coil position and shape: cost functions

We implemented automatic optimizations of the coil position and shape, supporting two different application scenarios. In the first scenario, the objective is to smoothly fit the coil casing on the head surface, starting from an initial position provided by the user and then adjusting the position and deformation of the coil. Thereby, a minimal distance to the head surface is ensured and self-intersections (e.g. intersections of the two sub-coils of the MST-twin coil) are avoided. This was formalized in a cost function

fdist=d+pi+ps,

where the distance d is determined as the average distance of predefined positions on the relevant coil wires or casing parts that are close to the head (Suppl. Fig. S4). The intersection penalty variable pi is based on the calculation of the intersection volume between the coil casing volume and the head volume, whereby deeply intersecting parts are weighted more to support faster convergence of the optimization. The selfintersection penalty variable ps is the total intersection volume between sub-parts of a coil.

The second scenario aims at the maximization of the electric field strength in an ROI in the brain while preventing intersections between the coil and head and coil self-intersections. The corresponding cost function has the form:

fE=Eroi+pi+ps,

The variable Eroi is the average electric field strength in the ROI. Appropriate weighting constants for the different parts of the cost functions were set in pilot tests to ensure robust convergence of the optimization and avoidance of intersections. Additional information about the definition and implementation of the different parts of the cost functions is stated below and in Supplementary Material D.

2.3. Optimization framework

The optimization was performed with a combination of global optimization (DIRECT or the faster locally-biased DIRECT-L [12]) followed by additional local optimization using a quasi-Newton method (L-BFGS-B [13]). Unless stated otherwise, DIRECT-L and L-BFGS-B were chosen as the default methods for the results reported in the main paper, which provided a good tradeoff between the number of function evaluations and the optimization result. The default method was compared to DIRECT and L-BFGS-B as reference.

Parameter bounds were set according to the physically feasible coil deformation ranges. In addition, the coil center positions and orientations were restricted to reasonable ranges, as determined in pilot tests. The ranges for coil translations, rotations, and deformations are listed in Supplementary Table S4.

To evaluate the general performance of our approach, we compared our E-field optimization results for the non-flexible MagVenture Cool-B65 coil to a standard grid search approach [14]. As local optimization turned out to be sufficient to ensure adequate optimization, the MagVenture Cool-B65 results reported in the main paper only utilized local optimization with L-BFGS-B, while further results are shown in Supplementary Material E.

2.4. Selection of initial coil positions and orientations, and definition of target ROIs

The initial coil placements for optimization were set according to the coil model and optimization goal. Unless stated otherwise, the coil positions and orientations were manually defined in MNI space (Fig. 1A), in an effort to minimize the coil-head intersections, and then non-linearly transformed to the individual subject spaces using SimNIBS functions. Please see Suppl. Fig. S5-S8 for additional visualizations of the initial coil positions, including the coil centers. These coil settings are included as the “baseline” in the results to illustrate how well non-deformable coil models optimized once on a template would work.

  • Distance optimization of the Brainsway H1 coil: The initial position of the coil center (see Suppl. Fig. S5 for details) was chosen to be above the center of area BA46 of the MNI template head (MNI coordinates [−44, 40, 29]), a common target in the treatment of MDD [15]. The orientation of the coil was manually adjusted along the left-right and anterior-posterior axes to minimize the intersection of the coil with the MNI template.

  • Distance optimization of the Brainsway H4 coil: The initial coil position was selected to mimic the clinical guidelines for coil placement as provided by Brainsway. The coil center was placed on the MNI template head above the group-average activation site of the FDI muscle (MNI coordinates [−41, −7, 63] [16]), then moved medially to a position above the interhemispheric cleft and finally projected 6 cm anteriorly, resulting in the MNI position [0, 53, 63] (Suppl. Fig. S6). The orientation of the coil along the left-right axis was manually optimized to minimize coil-head intersections. The rotations along the other two axes were chosen to ensure symmetric placement of the coil above both sides of the head.

  • Distance optimization of the Brainsway H7 coil: A position between the medial parts of the primary motor areas that contain the leg representations was visually determined and the closest scalp position was chosen (MNI coordinates [−5, −20, 99]). The treatment position was then found by moving 4 cm in the anterior direction (MNI coordinates [−5, 20, 87]; Suppl. Fig. S7), according to clinical guidelines of the company.

  • Distance and E-field optimization of the MagVenture MST-Twin coil: Clinical applications aim to place the two coil halves above the F3/F4 electrode positions, respectively [17,18]. The coil center was thus placed at the Fz electrode position between F3/F4 (Suppl. Fig. S8), and the coil model was additionally moved in inferior-superior direction to achieve a placement of the two sub-coils approximately on the skin surface. As the MST-Twin coil is designed for seizure induction by stimulating frontal areas, a large bi-lateral frontal ROI was used as target for the E-field optimizations (Fig. 1B).

  • E-field optimization of the MagVenture Cool-B65 coil: As the Cool-B65 coil is used for focal stimulation, we defined the hand knob area of the left precentral gyrus as an example target ROI (Fig. 1C). The coil position was directly initialized in subject space by automatically determining the skin position closest to the brain ROI (termed “auto-init” in the following). Alternatively, the coil position was centered over the hand knob (MNI coordinate [−32, −26, 59]), and orthogonally projected to a 4 mm skin distance from the scalp after transformation to subject space. The coil handle was oriented backwards and approximately 45° lateral from the mid-line thereby ensuring that it pointed in the direction opposite to EEG 10-10 position FCz. The results for the “auto-init” option are reported in the main part of the paper, while the subject-specific settings serve as comparison and are reported in Supplementary Fig. S10C and Supplementary Table S2.

2.5. Software implementation

The methods and coil models presented in this paper have been published as open source software as a part of SimNIBS version 4.5. Also examples on how to define additional custom coil models will be included. The intersection tests are based on voxel masks (1 mm3 isotropic) of the coil and head surfaces that are automatically voxelized during runtime [19]. Intersection volumes between two masks are then efficiently determined by interpolating one mask to the voxel space of the second mask (using the map_coordinates function in SciPy 1.13.1 [20]), according to the linear transformation representing the shape deformation, and summing overlapping voxels. The evaluation of the distance term was implemented in a similar way, but weighted by the intersection distance (Suppl. Material D). The speed of the FEM calculations of the E-field in the brain ROIs was optimized for computational efficiency using a similar approach as outlined in Cao, Madsen et al. [21]. The implementations of DIRECT, DIRECT-L and L-BFGS-B in SciPy 1.13.1 [20] were used. Visualizations were created with Matplotlib 3.9.2 [22] and PyVista 0.44.1 [23].

2.6. Evaluations of the optimization performance

To evaluate the stability of the optimization approach for varying head shapes, results were assessed on the Human Connectome Project database of young healthy adults (N = 1100) [24]. SimNIBS charm [25] was used for the creation of the head models from the T1-and T2-weighted structural MRI images, incorporating reconstructions of the pial and white matter surfaces from FreeSurfer [26] for more accurate representations of narrow sulci in the head models. The resulting head meshes consisted of ~4.6 million tetrahedral elements representing seven tissue types (white matter, gray matter, cerebrospinal fluid, compact bone, spongy bone, scalp, and eye balls), and their default conductivity values were used in the simulations (0.126 S/m, 0.275 S/m, 1.654 S/m, 0.008 S/m, 0.025 S/m, 0.465 S/m, and 0.5 S/m). All simulations were performed for a rate of change of the coil current of 1 A/μs, and the E-field strength was evaluated on the central gray matter surfaces of two hemispheres halfway between the pial and white matter surfaces. All head meshes were visually inspected for quality assurance. In addition to the results obtained on the large dataset, speed tests were performed on a desktop computer (Ubuntu 22.04, Intel i7-11700, 16 cores, 32 GB RAM) using the public SimNIBS ernie dataset with standard conductivities to demonstrate expected run times in practical settings. The target ROIs for the E-field optimizations were defined in the fsaverage surface space and automatically transformed to the individual subject spaces using SimNIBS functionality.

The evaluations were based on the following criteria.

  • Distance optimizations: The effect of the optimization on coil position and shape was indexed using the d metric (distance, as defined above) before and after optimization. In addition, a signed distance measure was calculated between the head mesh and the coil casing, whereby negative values indicated the maximal (or deepest) intersections of the coil with the head, while positive values correspond to the minimal distance between the coil casing and the scalp in case of no intersections.

For evaluating the effect of the optimization on the calculated electric fields, simulations were performed for the baseline configuration and after optimization. The electric field strengths on the central gray matter surfaces of both hemispheres (i.e. on surfaces midway between the pial surface and gray-white matter boundary) were determined and the differences between baseline and the optimized coil configuration were calculated and scaled relative to the 99.9 percentile of the electric fields after optimization. The results were mapped to the fsaverage surface space to obtain group difference maps.

The computational efficiency of the optimization was determined using the average ( ± standard deviation) number of function evaluations. In addition, the runtime on the test desktop computer for the SimNIBS ernie dataset was evaluated.

  • E-field optimizations of the MagVenture MST-Twin coil: The average electric field strength in the ROI (Fig. 2A) at baseline and after optimization was compared. In addition, signed distance measures were calculated for both cases.

  • E-field optimizations of the MagVenture Cool-B65 coil: Signed distance measures were calculated to confirm the absence of intersections after optimization. In addition, we compared the average electric field strength in the ROI achieved with the new optimization to the results of standard grid search implemented in SimNIBS [14]. The latter was feasible for this coil as the Cool-B65 is flat and does not deform. Grid search was performed on the full dataset (N = 1100) with a grid spacing of 5 mm and 12 orientations per position with an angular spacing of 15° (585 simulations per grid). In addition, a higher-resolution grid search was performed on a random subset of N = 48 subjects with a spacing of 2 mm and 36 orientations per position with an angular spacing of 5° (11285 simulations per grid). The grid search only optimizes the position of the coil center on the skin surface and the orientation of the coil handle, while the coil is always selected to be parallel to skin surface under the coil center to simplify the search. However, this resulted in skin intersections for several of the grid search results due to irregular head shapes. To enable a fair comparison, the final coil position was moved orthogonally away from head in these cases until the intersections were resolved, and the electric field in the ROI was reevaluated.

Fig. 2.

Fig. 2.

E-fields of the H1, H4, H7 and MST-Twin coils after coil distance optimizations. A) Median across N = 1100 head models of the induced electric field strength. B) IQR across the 1100 head models.

2.7. Statistical tests of the optimization performance

For selected criteria, we used paired t-tests to evaluate the statistical significance of the differences between the initial and optimized coil positions.:

  • For the distance optimization of the H1, H4, H7 and MST coils, the d metric before and after optimization was compared. In addition, in order to test whether the optimization led to more similar distances across all head models, the spread of the d metric was assessed by calculating
    s=dd¯
    for each head model (whereby d¯ indicates the average d across all models), and paired t-tests were again used to test for differences of s before and after optimization. Finally, the signed distance measures before and after optimization were compared.
  • For the E-field optimizations of the MagVenture MST-Twin coil, the signed distance measures and the E-fields before and after optimization were compared.

  • For the E-field optimizations of the MagVenture Cool-B65 coil, the differences of the new optimization approach compared to grid search were tested.

In total, this led to 16 paired t-tests, which were all significant at a threshold of p = 0.01 after Bonferroni correction. The results of these tests can be found in Supplementary Table S5.

3. Results

3.1. Distance optimization

The median electric field distributions across the 1100 head models and the interquartile ranges (IQR) after distance optimization are shown in Fig. 2 for the H1, H4, H7 and MST coils. Table 1 lists the peak E-field strengths in the cortex (defined as the 99.9 percentile), focality measures (defined as the gray matter volume where the E-field strength exceeds 50 % of the peak strength) and depth measures (defined as the radial distance from the brain surface to the deepest point in gray matter where the E-field strength is half of the peak strength) [27,28]. Visual inspection shows that the IQR exceeds 20 % of the peak E-field strength over large parts of the prefrontal cortices for all coils.

Table 1.

Fields summary of the optimization results for distance optimization (H1, H4, H7, MST-Twin) and electric field optimization (MST-Twin and Cool-B65). The values are shown as the medians ± the interquartile range across the subject pool.

Distance optimization E-field optimization


H1 DIRECT-L +
L-BFGS-B
H4 DIRECT-L +
L-BFGS-B
H7 DIRECT-L +
L-BFGS-B
MST-Twin DIRECT-L +
L-BFGS-B
MST-Twin DIRECT-L +
L-BFGS-B
Cool-B65 L-BFGS-B
Peak E (V/m) 1.9 ± 0.1 2.2 ± 0.2 1.8 ± 0.2 2.1 ± 0.2 2.1 ± 0.2 1.14 ± 0.2
Focality (cm3) 108.0 ± 18.1 89.0 ± 16.6 37.8 ± 9.0 41.5 ± 8.3 43.1 ± 8.1 12.8 ± 3.8
Depth (mm) 22.6 ± 2.1 21.5 ± 1.9 22.9 ± 2.4 21.5 ± 2.0 21.3 ± 2.0 16.7 ± 1.6

The optimization reduced the interindividual spread of the mean coil-scalp distances compared to the initial positions (Fig. 3A, Table S5). It also successfully removed all intersections of the coils with the heads and achieved consistent minimal distances to the skin surfaces (Fig. 3B). In combination, these results indicate that the algorithm achieved consistent coil placements across all head models. In contrast, the results shown for the initial positions demonstrate that using coil positions transformed from a group template space and ignoring deformations regularly results in impossible positions (due to head-coil intersections) on the individual heads. The mean distances for the H1 and H7 (Fig. 3A) were lower before optimization. However, this resulted simply from the coils being partly inside the head model for the initial position.

Fig. 3.

Fig. 3.

A) Coil-scalp distances before and after optimization. The distance is calculated as the mean distance between the pre-defined sets of positions on the coil casings and their nearest scalp position for each subject. The distances are significantly different between the initial and optimized positions for all coils. The interindividual spreads of the distances are significantly lower after optimization. B) Maximally occurring intersections of the coil with the head before and after distance optimization. Signed distances are reported, with negative values indicating intersections, and positive values the minimal distance between coil casing and scalp in case of no intersections. Specifically, for each individual optimization result, the minimal value of the signed distances between the scalp and any of the predefined positions on the coil casing is shown. This corresponds to the deepest intersection or, in case no intersection occurred, positive values indicate the minimal distance between coil casing and scalp. The signed distances are significantly different between the initial and optimized positions for all coils. C) Median of the relative differences between the electric field strengths for the optimized and initial coil settings.

The median of the differences between the E-field strengths induced in the cortex for the optimized vs initial positions reach 12 % (MST coil) and 16 % (H1, H4 & H7 coils) of the maximal E-field strength (Fig. 3C). Of note, strong differences occur also in brain regions that are implicated in the therapeutic effects, such as the prefrontal cortex for the H1 and H4 coils. Looking at the 90 percentile (Suppl. Fig. S9) reveals differences exceeding 20 % for all coils in 110 of the 1100 head models. Overall, these results suggest that distance optimization is important to reach plausible coil configurations and that this has clear effects on the E-field distribution on the cortex.

Comparison of the employed optimization method (DIRECT_L&L-BFGS-B) with a more extensive optimization (DIRECT with stricter convergence settings, followed by L-BFGS-B) reveals mostly equal performance, with the differences in the distance cost function being centered around zero (Suppl. Fig. S10A). The more extensive optimization reaches cost function values that are better by 10 % or more only in a few outlier cases. On the other hand, DIRECT_L&L-BFGS-B required on average far less function evaluations compared to DIRECT&L-BFGS-B (e.g., 2137 vs 7816 for the H1 coil; see Suppl. Table S1 for all results). The total time for the distance optimizations on the desktop computer stayed below 3 min for all four coil models and the memory requirements stayed below 4 GB (DIRECT_L&L-BFGS-B and ernie head model; Suppl. Table S3).

3.2. Electric field optimization

The median electric field distributions and their IQR maps for the MST-Twin coil after optimization are shown in Fig. 4A and B, with the IQR again exceeding 20 % of the peak E-field strength in many prefrontal areas. Table 1 lists the corresponding peak electric fields and focality results. Fig. 4E and F shows that the optimization led to an increase of the average E-field strength in the bilateral prefrontal ROI from ~0.72 V/m (median across subjects) to ~0.75 V/m while robustly avoiding coil-scalp intersections. The median of the differences between the E-field strengths in the cortex reaches 14 % of the peak E-field strength (Fig. 4C). The medians between E-field strength from the position optimization and electric field optimizations differ with up to ±0.1 V/m across subjects (Fig. 4D).

Fig. 4.

Fig. 4.

Results of the optimization of the mean electric field strength in the bilateral prefrontal ROI for the MST-Twin coil. A) Median across N = 1100 head models of the electric field strength after optimization. B) IQR across 1100 head models. C) Median of the relative differences between the electric field strengths for the optimized and initial coil settings. D) Average difference in electric field strength between electric field strength-optimized and position-optimized MST-Twin coils (Figs. 4A and 3A) E) Maximal intersections of the coil with the head before and after optimization. Signed distances are reported, with negative values indicating the maximal depth of the intersection, and positive values the minimal distance between coil casing and scalp in case of no intersections. The signed distances are significantly different between the initial and optimized positions. F) Mean electric field strengths in the ROI before and after optimization. The field strengths are significantly higher for the optimized positions.

Comparison of the DIRECT_L&L-BFGS-B optimization with the more extensive DIRECT&L-BFGS-B optimization again reveals similar performance, with the differences in the achieved costs centered around zero and only a few cases where the DIRECT&L-BFGS-B optimization is better by 10 % or more (Suppl. Fig. S10B). However, DIRECT_L&L-BFGS-B required on average substantially less function evaluations (2508 vs 4921; Suppl. Table S1). The total time for the E-field optimization with the ernie head model was around 30 min on the desktop computer and the memory requirements were below 8 GB (Suppl. Table S3).

The E-field strength induced by a Magventure Cool-B65 coil in a left precentral gyrus ROI covering the primary motor hand area (handknob) was additionally optimized using only the local L-BFGS-B search and compared to the results of naïve grid searches. Fig. 5A shows the differences of the achieved E-field strength in the ROI when compared to a lower-resolution grid search for all 1100 head models. Fig. 5B shows the corresponding results compared to a high-resolution grid search for a sub-group of 48 head models. Our optimization approach reliably prevented coil-scalp intersections (data not shown) and generally performed slightly better than the grid search. This can be explained by the fact that the grid search enforces a tangential coil orientation relative to the skin surface under the coil center while our approach optimizes all 6 degrees of freedom of the coil position.

Fig. 5.

Fig. 5.

Results of the optimization of the mean electric field strength in the handknob ROI for the MagVenture Cool-B65 coil. The differences of the mean electric field magnitudes in the ROI obtained by our optimization approach versus a grid search are shown. A) Comparison to results of a “coarse” grid search and N = 1100 subjects. B) Comparison to results of a higher-resolution grid search (N = 48). The differences are significant in both comparisons.

Using only local L-BFGS-B search was generally sufficient to reach stable optimization results for the Cool-B65 coil, which did on average not improve further for more extensive search strategies (Suppl. Fig. S10C). Using the most extensive search with DIRECT&L-BFGS-B seemed to slightly reduce the already very low number of outliers where grid search was better by 1 % or more. Optimization with L-BFGS-B and automated initial position required on average 423 function evaluations compared to the low- and high-resolution grid searches with 585 and 11285 evaluations (Suppl. Table S2). The total time for the E-field optimization for the Cool-B65 coil and the ernie head model stayed below 8 min on the desktop computer and the memory requirements were below 8.5 GB (Suppl. Table S3). Overall, the results for the Magventure Cool-B65 coil suggest that the new optimization approach can serve as a general approach for all coil types including standard flat and rigid coils.

4. Discussion

4.1. Summary of findings

We introduced the first method to automatically optimize the shape of deformable TMS coils and validated its performance on a large dataset of 1100 head models and four new models of large TMS coils that are used in approved therapies or clinical trials. We demonstrated that it robustly avoided coil-scalp intersections while achieving coil configurations that fitted closely to the head surface or maximized the E-field strength in a target ROI. The number of function evaluations and total runtime on a normal desktop computer were low enough to allow for standard practical use. The reported group median and IQR maps for H1, H4, H7 and MST coils will be provided as online resources. The observed IQR levels suggest that there are substantial individual dose differences for these coils. Whether these dose differences contribute to variations in clinical outcomes is an open question that could be tested using personalized simulations in future clinical trials. Our method can be helpful in this regard by ensuring realistic coil positions in the simulations that avoid intersections with the head models. We also showed that the use of coil positions that were determined via transformations from a group template space and did not include deformations regularly resulted in physically impossible positions on the individual heads. This resulted in notable differences in the E-field distributions between the two cases that also occurred in potential therapeutically relevant brain areas. We additionally compared our approach to a previously published grid search approach, with the aim to maximize the E-field strength induced by a flat and rigid coil (Magventure Cool-B65) in a small target ROI. Our approach performed at least as good as the grid search and required fewer function evaluations on average. This suggests that the new optimization method can serve as a general-purpose approach for all coil types.

4.2. Comparison to published work

We compared the performance of our method to standard grid search. Alternative optimization approaches are the auxiliary dipole method (ADM, [29]) that can maximize the average E-field in a ROI and its recent extension [30] which determines the full E-field distribution in the ROI. In principle, the FEM-based E-field calculations in our approach could be replaced by these methods. As both methods use precalculations, it would depend on the number of function evaluations whether this would result in a speedup of the overall time required for optimization.

Existing methods such as grid search or the ADM approach work well for optimizations of flat figure-of-eight coil coils that are placed tangential to the scalp, they are restricted to E-field calculations and do not support coil-scalp intersection testing, the handling of deformable coils, or realistic placement of non-flat coil models. While we here evaluated our method for large and flexible coils, it generally enables the position optimization of any non-flat coil. As examples, models of Magstim DCC, Magventure DB80, Magventure MC-B70, Magventure MMC140 and Deymed 120BFV coils are currently available in SimNIBS and benefit from the new method.

The electric field distributions of the Brainsway H1, H4&H7 coils and the MagVenture MST twin coils were characterized by a few prior publications [27,31-33] using a variety of approaches such as measurements in simplified saline-filled phantoms [33], simulations using a spherical multi-layer model to coarsely mimic the head anatomy [27] or a low number of anatomically detailed head models [31,32]. The coils were modelled based on geometric information provided by the manufacturers and fitted manually to the skin surfaces. Our study complements these findings by ensuring the accuracy of the coil models, systematically optimizing the fit of the coils on the skin surfaces and assessing the E-field characteristics in a large sample of anatomically detailed head models. Differences in the applied metrics make a direct comparison with these prior findings difficult. However, our focality and depth estimates for the H1 coil were found to be comparable to a previous approximation based on a spherical head model [27]. Another study using two anatomically detailed head models reports notably larger depth estimates, but also included the electric field in white matter in the estimations [32].

4.3. Limitations

To the best of our knowledge, the presented method is so far the only automatic approach to realistically place deformable coil models and to systematically avoid coil-head intersections. Our approach well approximated the true shape of an H1 coil put on a ball, which led to stronger coil deformations than when placing it on heads in our pilot tests. The H4 generally deformed less in our tests. The H7 and MST-Twin coils consist of two sub-coils that do not or hardly deform but only change their relative positions, which could be accurately modelled by linear transformations. We thus suggest that the tested H1 deformations serve as a reasonable worst-case scenario and are confident that our modeling approach captures practically feasible coil configurations with good accuracy. However, coil deformations in practice also depend on, e.g. how strongly the straps of the H-coils are tightened, so that the exact correspondence between the modelled and real coil configurations would need additional experimental assessment.

This work focused on simulations of Brainsway H1, H4 and H7 and MagVenture MST twin coils. These coils are unfocal compared to the smaller figure-of-eight coil coils that are used in many therapies. Whether precise coil positioning or optimization of their E-field strength in a target area is therapeutically relevant for unfocal coils is an open question that could be explored with our approach. However, our main focus was on facilitating explorations of dose–response relationships by ensuring realistic coil positions without intersections with the head model.

Our approach allows for flexibility in terms of the optimization methods utilized and their parameter settings. The results in the main paper are based on settings that balance accuracy and computational efficiency. More exhaustive search strategies gave little additional gain, except for slightly reducing the already very low numbers of outlier cases in which the balanced settings performed worse to a notable extent. However, we recommend choosing the optimization settings and by that the tradeoff between runtime and avoidance of putative outliers with the specific research question in mind.

The reported electric field distributions might deviate from those achieved in clinical practice due to differences in coil positioning strategies. We place the coil centers at average positions defined in MNI space that might lead to deviations compared to positions that are defined using features of the individual brain or head anatomy. Specifically, for the H1 coil, we chose its center to be above area BA46 in MNI space, while it is placed relative to the motor hot spot of the finger muscles in practice.

4.4. Future objectives

We presented a new framework for the simulation of large and deformable TMS coils that systematically prevents coil-scalp intersections. We tested it with accurate computational models of four therapeutically employed coils and a dataset of 1100 head models. We suggest that our framework will facilitate evaluations of the dose–response relationships for these coils. As the interindividual differences of the simulated E-fields were substantial, exploring their contribution to variations in the clinical treatment response could be relevant. Additionally, our approach can be used for the principled optimization of coil positions and configurations to maximize the stimulation of a target brain area. The method and coil models are provided as part of SimNIBS together with comprehensive example scripts demonstrating their usage. Examples for creating custom computational models of rigid and deformable coils are also included.

Supplementary Material

1

Supplementary data to this article can be found online at https://doi.org/10.1016/j.brs.2025.05.136.

Acknowledgements

We thank BrainsWay Ltd (Jerusalem, Israel) for providing physical samples of the H1, H4 and H7 coils and MagVenture A/S (Farum, Denmark) for providing a sample of the MST-Twin coil.

Funding

AT was supported by Innovation Fund Denmark (Grand Solutions grant 9068-00025B “Precision-BCT”) and the Lundbeck Foundation (grants R313-2019-622 and R244-2017-196). TW and AT received support from the National Institute of Health (grant R01MH128422). BR was supported by a PhD scholarship from the Sino-Danish Center for Education and Research, and KHM was supported by the Pioneer Centre for AI (DNRF grant number P1).

Footnotes

CRediT authorship contribution statement

Torge Worbs: Writing – review & editing, Writing – original draft, Visualization, Validation, Software, Project administration, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Bianka Rumi: Writing – review & editing, Writing – original draft, Visualization, Validation, Software, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Kristoffer H. Madsen: Writing – review & editing, Writing – original draft, Visualization, Validation, Supervision, Software, Resources, Project administration, Methodology, Investigation, Funding acquisition, Formal analysis, Data curation, Conceptualization. Axel Thielscher: Writing – review & editing, Writing – original draft, Visualization, Validation, Supervision, Software, Resources, Project administration, Methodology, Investigation, Funding acquisition, Formal analysis, Data curation, Conceptualization.

Declaration of competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

References

  • [1].Cohen SL, Bikson M, Badran BW, George MS. A visual and narrative timeline of US FDA milestones for Transcranial Magnetic Stimulation (TMS) devices. Brain Stimul 2022;15:73–5. 10.1016/j.brs.2021.11.010. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [2].Harmelech T, Hanlon CA, Tendler A. Transcranial magnetic stimulation as a tool to promote smoking cessation and decrease drug and alcohol use. Brain Sci 2023;13:1072. 10.3390/brainsci13071072. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [3].Levkovitz Y, Isserles M, Padberg F, Lisanby SH, Bystritsky A, Xia G, et al. Efficacy and safety of deep transcranial magnetic stimulation for major depression: a prospective multicenter randomized controlled trial. World Psychiatry 2015;14:64–73. 10.1002/wps.20199. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [4].Harmelech T, Roth Y, Tendler A. Deep TMS H7 coil: features, applications & future. Expet Rev Med Dev 2021;18:1133–44. 10.1080/17434440.2021.2013803. [DOI] [PubMed] [Google Scholar]
  • [5].Thielscher A, Opitz A, Windhoff M. Impact of the gyral geometry on the electric field induced by transcranial magnetic stimulation. Neuroimage 2011;54:234–43. 10.1016/j.neuroimage.2010.07.061. [DOI] [PubMed] [Google Scholar]
  • [6].Opitz A, Windhoff M, Heidemann RM, Turner R, Thielscher A. How the brain tissue shapes the electric field induced by transcranial magnetic stimulation. Neuroimage 2011;58:849–59. 10.1016/j.neuroimage.2011.06.069. [DOI] [PubMed] [Google Scholar]
  • [7].Thielscher A, Antunes A, Saturnino GB. Field modeling for transcranial magnetic stimulation: a useful tool to understand the physiological effects of TMS? 2015 37th Annu. Int Conf IEEE Eng Med Biol Soc EMBC 2015:222–5. 10.1109/EMBC.2015.7318340. [DOI] [PubMed] [Google Scholar]
  • [8].Drakaki M, Mathiesen C, Siebner HR, Madsen K, Thielscher A. Database of 25 validated coil models for electric field simulations for TMS. Brain Stimul Basic Transl Clin Res Neuromodulation 2022;15:697–706. 10.1016/j.brs.2022.04.017. [DOI] [PubMed] [Google Scholar]
  • [9].Deng Z-D, Luber B, McClintock SM, Weiner RD, Husain MM, Lisanby SH. Clinical outcomes of magnetic seizure therapy vs electroconvulsive therapy for major depressive episode: a randomized clinical trial. JAMA Psychiatry 2024;81:240. 10.1001/jamapsychiatry.2023.4599. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [10].Strang G, Herman E. “Jed.” 6.2 line integrals - calculus. OpenStax 2016;3. “Jed,” Strang G, Herman E, https://openstax.org/books/calculus-volume-3/pages/6-2-line-integrals. [Accessed 20 September 2024]. [Google Scholar]
  • [11].Cheng H, Greengard L, Rokhlin V. A fast adaptive multipole algorithm in three dimensions. J Comput Phys 1999;155:468–98. 10.1006/jcph.1999.6355. [DOI] [Google Scholar]
  • [12].Jones DR, Perttunen CD, Stuckman BE. Lipschitzian optimization without the Lipschitz constant. J Optim Theor Appl 1993;79:157–81. [Google Scholar]
  • [13].Byrd RH, Lu P, Zhu C. A limited memory algorithm for bound constrained optimization. SIAM J Sci Comput 1995;16. [Google Scholar]
  • [14].Weise K, Numssen O, Thielscher A, Hartwigsen G, Kn TR. A novel approach to localize cortical TMS effects. Neuroimage 2020;209:116486. 10.1016/j.neuroimage.2019.116486. [DOI] [PubMed] [Google Scholar]
  • [15].Fox MD, Buckner RL, White MP, Greicius MD, Pascual-Leone A. Efficacy of transcranial magnetic stimulation targets for depression is related to intrinsic functional connectivity with the subgenual cingulate. Biol Psychiatry 2012;72:595–603. 10.1016/j.biopsych.2012.04.028. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [16].Matilainen N, Kataja J, Laakso I. Predicting the hotspot location and motor threshold prior to transcranial magnetic stimulation using electric field modelling. Phys Med Biol 2023;69:015012. 10.1088/1361-6560/ad0219. [DOI] [PubMed] [Google Scholar]
  • [17].Tang VM, Blumberger DM, Weissman CR, Dimitrova J, Throop A, McClintock SM, et al. A pilot study of magnetic seizure therapy for treatment-resistant obsessive–compulsive disorder. Depress Anxiety 2021;38:161–71. 10.1002/da.23097. [DOI] [PubMed] [Google Scholar]
  • [18].Smith SE, Kosik EL, van Engen Q, Kohn J, Hill AT, Zomorrodi R, et al. Magnetic seizure therapy and electroconvulsive therapy increase aperiodic activity. medRxiv 2023. 10.1101/2023.01.11.23284450. 2023.01.11.23284450. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [19].Cohen-Or D, Kaufman A. Fundamentals of surface voxelization. Graph Model Image Process 1995;57:453–61. 10.1006/gmip.1995.1039. [DOI] [Google Scholar]
  • [20].Virtanen P, Gommers R, Oliphant TE, Haberland M, Reddy T, Cournapeau D, et al. SciPy 1.0: fundamental algorithms for scientific computing in Python. Nat Methods 2020;17:261–72. 10.1038/s41592-019-0686-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [21].Cao Fang, Madsen Kristoffer Hougaard, Worbs Torge, Puonti Oula, Siebner Hartwig Roman, Schmitgen Arno, Kunz Patrik, et al. FEM-Based electric field calculations for neuronavigated transcranial magnetic stimulation. bioRxiv 10.1101/2024.12.13.628139. [DOI] [PubMed] [Google Scholar]
  • [22].Team TMD. Matplotlib: visualization with Python. 10.5281/zenodo.12652732; 2024. [DOI]
  • [23].Sullivan CB, Kaszynski AA. PyVista: 3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK). J Open Source Softw 2019;4:1450. 10.21105/joss.01450. [DOI] [Google Scholar]
  • [24].Van Essen DC, Ugurbil K, Auerbach E, Barch D, Behrens TEJ, Bucholz R, et al. The Human Connectome Project: a data acquisition perspective. Neuroimage 2012;62:2222–31. 10.1016/j.neuroimage.2012.02.018. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [25].Puonti O, Van Leemput K, Saturnino GB, Siebner HR, Madsen KH, Thielscher A. Accurate and robust whole-head segmentation from magnetic resonance images for individualized head modeling. Neuroimage 2020;219:117044. 10.1016/j.neuroimage.2020.117044. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [26].Dale AM, Fischl B, Sereno MI. Cortical surface-based analysis - I. Segmentation and surface reconstruction. Neuroimage 1999;9:179–94. 10.1006/nimg.1998.0395. [DOI] [PubMed] [Google Scholar]
  • [27].Deng ZD, Lisanby SH, Peterchev AV. Electric field depth-focality tradeoff in transcranial magnetic stimulation: simulation comparison of 50 coil designs. Brain Stimul 2013;6:1–13. 10.1016/j.brs.2012.02.005. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [28].Antonenko D, Grittner U, Saturnino G, Nierhaus T, Thielscher A, Floël A Inter-individual and age-dependent variability in simulated electric fields induced by conventional transcranial electrical stimulation. Neuroimage 2021;224:117413. 10.1016/j.neuroimage.2020.117413. [DOI] [PubMed] [Google Scholar]
  • [29].Gomez LJ, Dannhauer M, Peterchev AV. Fast computational optimization of TMS coil placement for individualized electric field targeting. Neuroimage 2021;228:117696. 10.1016/j.neuroimage.2020.117696. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [30].Wang D, Hasan NI, Dannhauer M, Yucel AC, Gomez LJ. Fast computational E-field dosimetry for transcranial magnetic stimulation using adaptive cross approximation and auxiliary dipole method (ACA-ADM). Neuroimage 2023;267:119850. 10.1016/j.neuroimage.2022.119850. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • [31].Tzirini M, Roth Y, Harmelech T, Zibman S, Pell GS, Kimiskidis V, et al. Electrical field measurements and simulations of the H7 and D-B80 coils: non-equivalence of the TMS coils for obsessive compulsive disorder. Brain Stimul Basic Transl Clin Res Neuromodulation 2021;14:1525–7. 10.1016/j.brs.2021.10.382. [DOI] [PubMed] [Google Scholar]
  • [32].Parazzini M, Fiocchi S, Chiaramello E, Roth Y, Zangen A, Ravazzani P. Electric field estimation of deep transcranial magnetic stimulation clinically used for the treatment of neuropsychiatric disorders in anatomical head models. Med Eng Phys 2017;43:30–8. 10.1016/j.medengphy.2017.02.003. [DOI] [PubMed] [Google Scholar]
  • [33].Tendler A, Barnea Ygael N, Roth Y, Zangen A. Deep transcranial magnetic stimulation (dTMS) – beyond depression. Expet Rev Med Dev 2016;13:987–1000. 10.1080/17434440.2016.1233812. [DOI] [PubMed] [Google Scholar]
  • [34].Fischl B, Sereno MI, Tootell RBH, Dale a M. High-resolution inter-subject averaging and a surface-based coordinate system. Hum Brain Mapp 1999;8:272–84. 10.1002/(SICI)1097-0193(1999)8. [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

1

RESOURCES