• PDF [1 MB]PDF [1 MB]
• Top

# TMS (K) coil design instrument (Kodein Box): A toolbox for creating user-defined coils from conductor path data

Open AccessPublished:March 07, 2023

## 1. Introduction

In addition to experiments, modeling and simulation has become a common procedure to study and optimize technology and complex procedures for a better understanding or controlling variability. In brain stimulation and particularly transcranial magnetic stimulation (TMS), several freely available tools, such as Roast and SimNIBS provide continuously improving alternatives to expensive and complicated expert tools known in other domains of engineering and physics or in-house code packages from various research laboratories [

G. B. Saturnino, O. Puonti, J. D. Nielsen, D. Antonenko, K. H. Madsen, and A. Thielscher, "SimNIBS 2.1: a comprehensive pipeline for individualized electric field modelling for transcranial brain stimulation," in Brain and Human Body Modeling: Computational Human Modeling at.EMBC 2018, S. Makarov, M. Horner, and G. Noetscher, Eds., ed Cham: Springer International Publishing, 2019, pp. 3–25.Pubmed Partial Author articletitle stitle stitle Page.

,
• Htet A.T.
• Saturnino G.B.
• Burnham E.H.
• Noetscher G.M.
• Nummenmaa A.
• Makarov S.N.
Comparative performance of the finite element method and the boundary element fast multipole method for problems mimicking transcranial magnetic stimulation (TMS).
,
• Huang Y.
• Datta A.
• Bikson M.
• Parra L.
ROAST: a fully-automated, open-source, Realistic vOlumetric-Approach-based Simulator for TES.
]. There is a limited set of coils available, which do only include a small subset of commercially available coils, let alone new, experimental ones. The generation of user-defined coil files needs expert knowledge and either own toolboxes or expensive additional software packages so that standard users have few options.
Most flexibly, NIfTI (Neuroimaging Informatics Technology Initiative) files describe coils through the spatial distribution of the magnetic vector potential of the coil. Their generation from coil specifications or design files is not obvious. While most laboratories working on technologies may even have entire toolboxes for field and neurosimulation including codes for coil generation, the majority of users that would like to use simulation models in their daily routines are left alone. A tool that gives users and also manufacturers—which should have a strong interest in their coils being available in typical tools—an easy way to generate coil files may solve this issue.

### 1.1 MATLAB application

To cover the drawbacks, we used code from our internal field simulation toolbox and developed a user-friendly application with graphical user interface (MATLAB App Designer, The MathWorks, Natick (MA), USA) [
• Peterchev A.V.
• Deng Z.D.
• Goetz S.M.
Advances in transcranial magnetic stimulation technology.
,
• Goetz S.M.
• Kammermann J.
• Helling F.
• Weyh T.
• Li Z.
Force recruitment of neuromuscular magnetic stimulation predicted through high-resolution anatomical 3D models.
,
• Goetz S.
• Gattinger N.
• Weyh T.
• Szecsi J.
• Straube A.
Accurate approach for the calculation of induced fields in biologic tissues.
]. The tool can load one path or several parallel paths representing the electrical conductor inside the coil as a list of sample points from a user-generated file (MATLAB.mat, Microsoft Excel, or comma-separated value files with the points of the conductor as a list), display the coil conductor geometry in space, and calculate the magnetic vector potential. It can further display the vector potential as a vector field or a streamline plot and generate a NIfTI file suitable for SimNIBS. In addition to the obvious functionality of creating the coil file, the application calculates a number of useful specs about the coil, such as the necessary wire length to implement that winding, the inductance, which determines if a coil can be connected to a specific stimulator, and quality information about the sample points, such as the average sampling resolution and the longest distance of two sampling points in the loaded file.

### 1.2 Calculation of the magnetic vector potential and coil properties such as inductance

The TMS Kodein Box in default calculates the magnetic vector potential within the region of [–200 mm, +200 mm] in both x and y direction, [–85 mm, +115 mm] in z direction. The spacing between points is 2.5 mm, resulting in a grid size of 161 × 161 × 81 points.
Higher resolutions than 2.5 mm are highly encouraged by the authors for the future but may need updates in simulation packages.
The tool evaluates the magnetic vector potential for each of these points $p$ using the Biot–Savart solution of the extended potential version of Ampère's law, which integrates the coil current along its path, i.e., discretely sums up the contribution of the magnetic vector potential contribution of every pathway element $s$ of the coil’ Jordan path C to the cumulative vector potential at point $p→$ per
$Equation 1.$
(1)

The self-inductance can be calculated very similarly through the self-projection of the coil potential onto itself, representing induction according to Faraday's law, which is sometimes attributed to v. Neumann. This step requires an estimate of the conductor cross section or current distribution, resulting in the equation
$Equation 2.$
(2)

where l is the length of the wire and Y is the constant describing the current distribution in the wire. Y is for example 0 for current only flowing on the surface of the conductor (total skin effect) and 1/2 for an equal current distribution over the cross section of the conductor.

### 1.3 Requirements for the underlying coil data

The tangential plane of the coil is defined by the x and y axes, whilst the z axis forms the normal. The zero position on the x and y axes are set to be the point of contact between the coil (with its casing) and the head. The z component, on the other hand, must be elevated (z direction) by 115 mm for SimNIBS so that the coil lies above the field-perfused volume to be calculated. Having coil elements reaching into the field-perfused volume is not problematic, as long as the contact point between the coil and the head is located at the 115 mm mark in z direction. Accordingly, a user who wants to draw a (planar) coil should use the xy plane for the coil and let the winding reside at (0, 0, 115 mm + <wire radius > + <thickness of bottom casing>). In case the coil is already designed with its origin in (0, 0, 0), the z-offset can also effortlessly be applied in the tool.
If the coil consists of multiple strands, for example the representation of the commercial MagVenture Round coil with Litz wire in Fig. 1(e) or to represent conductor bands, the data must be formatted as follows: the first strand has its x-, y-, and z-components in the first three rows, the second strand has its x-, y- and z-components in the fourth, fifth, and sixth row, and so on. This continues for the number of strands of the coil data.

## 2. Results

Fig. 1 shows an example based on the MagVenture MC-B70 coil. The coil path data displayed in Fig. 1(a) are loaded into the tool in Fig. 1(b), which provides a clean and easy-to-understand graphical interface, where the user can initiate the calculation of the inductance or the magnetic vector potential and save the magnetic vector potential as a NIfTI file. During the process, both the coil and its associated magnetic vector potential are displayed to allow checking whether the coil data was loaded correctly and if the calculated magnetic vector potential matches the expectations.
Fig. 1(c) shows the magnetic vector potential for a representative coil placement on the C3 position in the international 10–20 coordinate system on the Ernie reference head model. Fig. 1(d) visualizes the electric field in the brain, calculated with SimNIBS v3.2 with the aforementioned coil placement. Both figures reflect the coils wire geometry as expected.

## 3. Conclusion

We presented a tool to close a gap in freely available TMS field simulation tools, such as the widely used SimNIBS environment, namely a simple generation of coil files out of wire paths. The tool comes with a number of coil models, shown in Fig. 1(e), many of which are not available yet. The tool should enable users and companies to easily generate coil files for their own coils and novel developments. The software is provided with code to the community with the invitation to contribute to its further development. Manufacturers and users can easily generate the coil path from design data or extract and digitize them from x-ray images with widely available tools, such as various MATLAB-based or online plot digitizers. As researchers in the field of TMS, especially on coil design, we routinely use this plugin ourselves to generate specialized NIfTIs to validate our designs and accelerate prototyping.

## Availability

The application is available in the MATLAB Add-Ons Manager under the name Kodein Box and on GitHub: https://github.com/maxxkoehler/TMS-Koil-Design-Instrument-Box-Kodein-Box

## Declaration of competing interest

SMG and MK are inventors of medical technology unrelated to the Kodein Box. The authors declare no relevant conflicts of interest. Ethics approval was not necessary because the scope of this work did not include research on human subjects, human tissue, or animals.

## Acknowledgments

The authors thank KSB Foundation, which funded part of this work.

## References

1. G. B. Saturnino, O. Puonti, J. D. Nielsen, D. Antonenko, K. H. Madsen, and A. Thielscher, "SimNIBS 2.1: a comprehensive pipeline for individualized electric field modelling for transcranial brain stimulation," in Brain and Human Body Modeling: Computational Human Modeling at.EMBC 2018, S. Makarov, M. Horner, and G. Noetscher, Eds., ed Cham: Springer International Publishing, 2019, pp. 3–25.Pubmed Partial Author articletitle stitle stitle Page.

• Htet A.T.
• Saturnino G.B.
• Burnham E.H.
• Noetscher G.M.
• Nummenmaa A.
• Makarov S.N.
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; 16024001
• Huang Y.
• Datta A.
• Bikson M.
• Parra L.
ROAST: a fully-automated, open-source, Realistic vOlumetric-Approach-based Simulator for TES.
Brain Stimul: Basic Trans. Clinic Res. Neuromod. 2019; 12: 391
• Peterchev A.V.
• Deng Z.D.
• Goetz S.M.
Advances in transcranial magnetic stimulation technology.
in: Brain stimulation. John Wiley & Sons, 2015: 165-189
• Goetz S.M.
• Kammermann J.
• Helling F.
• Weyh T.
• Li Z.
Force recruitment of neuromuscular magnetic stimulation predicted through high-resolution anatomical 3D models.
bioRxiv. 2021; https://doi.org/10.1101/2021.12.25.474143
• Goetz S.
• Gattinger N.
• Weyh T.
• Szecsi J.
• Straube A.
Accurate approach for the calculation of induced fields in biologic tissues.
in: Proc. 3rd int. Conf. TMS tDCS. 2008 (Goettingen)
• Goetz S.M.
• Weyh T.
• Afinowi I.A.A.
• Herzog H.G.
Coil design for neuromuscular magnetic stimulation based on a detailed 3-D thigh model.
IEEE Trans Magn. 2014; 50: 1-10
• Kammer T.
• Thielscher U.A.
Physikalische und physiologische Grundlagen der transkraniellen Magnetstimulation.
Nervenheilkunde. 2003; 22: 168-176
• Goetz S.M.
• Herzog H.G.
• Gattinger N.
• Gleich B.
Comparison of coil designs for peripheral magnetic muscle stimulation.
J Neural Eng. 2011; 8056007
• Tendler A.
• Roth Y.
• Barnea-Ygael N.
• Zangen A.
How to use the H1 deep transcranial magnetic stimulation coil for conditions other than depression.
JoVE, 2017e55100
• Levkovitz Y.
• Isserles M.