Edit this page

NA-MIC Project Weeks

Back to Projects List

Real-time visualization for transcranial magnetic stimulation (TMS)

Key Investigators

Project Description

Transcranial magnetic stimulation is a nonivasive procedure used for treating depression with magnetic and electric fields to stimulate nerve cells. A TMS coil is slowly moved over the subject’s head suface to target certain areas in the brain. Our project aims to develop a deep-learning powered software for real-time E-Field prediction and a visualization of TMS within 3D Slicer.


Real-time visualization of an electric field (E-field) for transcranial magnetic stimulation (TMS) on the brain surface, visualization through an AR app (over browser).

Approach and Plan

Progress and Next Steps

  1. Some bug fixes of observers in the TMS Module
  2. Integration of deep learning model: Modified OpenIGTLink with pyigtl (https://github.com/lassoan/pyigtl) to send out transform message of the moving TMS coil (added nodes, enabled push on connect, modified python demon that accesses the outgoing data), in collaboration with the deep learning project Slicer TMS Deep-Learning
  3. Tested our new secure websocket connection to the browser (https://github.com/liampaulhus/slicerWebWSS-WIP) using a self-signed certificate for https.
  4. Next steps: a) Attach the coil to the skull/skin surface in Slicer and b) Modify the browser-based WebXR controller so that it can be synchronized with slicer


Current Visualization of the TMS Module in 3DSlicer with Coil and mapping of E-field on brain:

SlicerTMS Module with Efield mapped on brain

Coil moving and updating the electric field on the brain surface inside slicer:

Brain surface coil moving

Started WebSocket Tests: we can interact with the red, green and yellow slices with the new websocket connection:

So far, we tested some simple Javascript Face-Tracking via mobile Phone and redered the brain:

Facetracking in javascript for mobile phone

Background and References

This project is related to: ../SlicerTMS_E-field

Infos for running WebXR:

Phones need a Depth sensor to run AR/VR. A list of supported devices can be found here: https://developers.google.com/ar/devices

On an Android Phone via USB:

For iPhone:

For Slicer TMS Module (see previous project week PW 36):

<!– vtkProbeFilter: https://vtk.org/doc/nightly/html/classvtkProbeFilter.html Moving fiducials with CPYY: https://gist.github.com/pieper/f9da3e0a73c70981b48d0747132526d5

Measure rendering time in 3D Slicer:

  1. Getting renderer: https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#access-vtk-views-renderers-and-cameras
  2. Then applying renderer.GetLastRenderTimeInSeconds()