Skip to content

MemoSLAP utility functions for planning of personalized f-TES montages

License

Notifications You must be signed in to change notification settings

simnibs/memoslap_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SimNIBS Memoslap utils

A. Thielscher, 23/05/2025

The uility functions are used in MemoSLAP (https://www.memoslap.de) project 9 to plan personalized transcranial electric stimulation montages. They need a working SimNIBS installation (http://www.simnibs.org). You need to provide m2m-folders with the personal head models, created by SimNIBS charm.

What the utils do:

  1. Create a coarse cerebellum central gm surface and add it to the m2m-folder content (only for charm results)
  2. Map project-specific mask to the central gm surfaces. The mask can be either in fsaverage surface space (most projects) or in MNI volume space (e.g. project 6)
  3. Get the position of center electrode
  4. Set up and run the FEM simulations (sets also the surround electrode positions)
  5. Map E-field quantities (magn, normal, tangent) onto the middle GM surfaces, and results of lh and rh to fsaverage (optional)
  6. Get field medians and focalities
  7. Export electrode positions for use with neuronavigation (only simnibs4)
  8. Save some key results

Notes:

  • example.py in the examples folder shows how to use it
  • the mask files are in simnibs_memoslap_utils/masks
  • project_settings.py in simnibs_memoslap_utils contains all project-relevant settings
  • electrode properties are specified in simu_settings.py
  • the utils support iteration over different radii (see also exemple.py), but not phis
  • focality values will be different for add_cerebellum=True versus add_cerebellum=False, as for the former case the area of the cerebellum surface will be included in the calculations
  • when running with simnibs3, set add_cerebellum=False
  • it should run with simnibs3, but is not tested yet (good luck!)
  • meshio and pyvista need to be added to the simnibs environment
  • Update 13/10/2025: Per default, SimNIBS4 head meshes in their m2m-folders will be replaced by versions in which internal air surfaces are relabled to 1099. Call run with fix_internal_air=False to prevent this.
  • Update 19/01/2026: updated code to run with SimNIBS v4.6; minor bug fix related to ROIs defined as MNI volume masks

About

MemoSLAP utility functions for planning of personalized f-TES montages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages