Skip to content

29. TMS E field modeling

Fa-Hsuan Lin edited this page Jan 5, 2024 · 20 revisions

We use the Matlab toolbox provided by Drs. Sergey N Makarov and Aapo Nummenmaa to calculate the induced electric field in TMS.

1. Prepare an anatomical model.

1.1 Geometries preparation

[This script file] prepares the geometries needed for BEM models. The surfaces include:

  • outer skin (outer_skin.surf)
  • outer skull (outer_skull.surf)
  • inner skull (inner_skull.surf)
  • left hemisphere pial surface (surf/lh.orig)
  • right hemisphere pial surface (surf/rh.orig)

The first three files were created at the bem folder of the subject's FreeSurfer recon. See EEG/SEEG modeling pages for details creating these files.

The last two files were created at the surf folder of the subjects' FreeSurfer recon. automatically.

[This script file] shows the head/brain geometries.

1.2 Tissue parameter setup

The file about tissue conductivity must be provided with matched definition. For example, the tissue_index.txt file was for subject 's002', who had a few mat files defining the head/brain geometries. These mat files were created from the procedure above. Associated with these boundaries, conductivity must be specified. We define a few boundaries 'Freespace', 'Skin', 'Skull', 'GM_LH', and 'GM_RH' here.

>Skin : s002_skin.mat : 0.4650 : FreeSpace
>Skull : s002_skull.mat : 0.010 : Skin
>GM_LH : s002_gm_lh.mat : 0.2750 : Skull
>GM_RH : s002_gm_rh.mat : 0.2750 : Skull

2. Run the following scripts sequentially

2.1 Load model

This script loads the model.

2.2 Setup TMS coil

This script sets up the TMS coil.

Remember to check the following line to define the tissue to be rendered. This string is defined in the tissue_index.txt file (see above).

tissue_to_plot = 'GM_RH';

2.3 Charge engine

This script charges the computation engine.

2.4 Calculate fields

NOTE Sometimes the maximum value of the electric field can be extremely high and spatially sparse. To improve the visualization, some thresholding, as shown belown, is helpful.

bemf2_graphics_surf_field(P, t, etc_threshold(temp,0.999), Indicator, objectnumber);

The total electric field is shown here.

2.5 Define planes

This script defines the planes to be drawn.

2.6 Draw fields over planes

3. References

1 Van Hoornweder, S. et al. Neuroimage 281, 120379 (2023)

2 Lynch, C. J. et al. Neuron 110, 3263–3277.e4 (2022)

3 Daneshzand, M. et al. Neuroimage 237, 118097 (2021)

4 Koponen, L. M. et al. Sci. Rep. 10, 17397 (2020)

Clone this wiki locally