Real-time control software for EEG- and EMG-guided TMS

Poster No:

123 

Submission Type:

Abstract Submission 

Authors:

Olli-Pekka Kahilakoski1, Kyösti Alkio1, Kim Valén1, Matilda Makkonen1, Tuomas Mutanen1, Risto Ilmoniemi1, Timo Roine1

Institutions:

1Aalto University School of Science, Espoo, Finland

First Author:

Olli-Pekka Kahilakoski  
Aalto University School of Science
Espoo, Finland

Co-Author(s):

Kyösti Alkio  
Aalto University School of Science
Espoo, Finland
Kim Valén  
Aalto University School of Science
Espoo, Finland
Matilda Makkonen  
Aalto University School of Science
Espoo, Finland
Tuomas Mutanen  
Aalto University School of Science
Espoo, Finland
Risto Ilmoniemi  
Aalto University School of Science
Espoo, Finland
Timo Roine  
Aalto University School of Science
Espoo, Finland

Introduction:

Transcranial magnetic stimulation (TMS) is routinely used in functional mapping of the human brain and in treatment of several neurological and psychiatric disorders (Tremblay et al. 2019). TMS can be combined with electroencephalography (EEG) and electromyography (EMG) to measure brain and muscle responses, respectively (Ilmoniemi & Kicić 2010), and to allow adjusting the stimulation online in a closed loop.

However, guiding the stimulation based on EEG or EMG has traditionally been performed manually (Casarotto et al. 2022), has taken place in non-real-time scenarios, or has relied on specialized hardware (Zrenner et al. 2018). Moreover, there has been a lack of general frameworks that would allow arbitrary stimulation algorithms to be implemented using high-level programming languages.

Methods:

We introduce real-time control software for EEG- and EMG-guided TMS, integrating (i) customizable Python-based preprocessing and stimulation algorithms, (ii) a user-friendly graphical user interface for selecting algorithms and monitoring the system state, and (iii) presentation of sensory stimuli for the subject, synchronized with the EEG and the stimulation pulses.

The software runs on a desktop computer with real-time-enabled Ubuntu Linux. The core of the software is written in C++ to achieve the determinism and high performance needed for real-time applications. The communication architecture of the software is Robot Operating System (ROS2), chosen for its flexible communication patterns and suitability for real-time computing.

The customizability of the software allows it to support a variety of existing and novel stimulation protocols, such as timing the stimulation pulses at specific phases of an ongoing EEG rhythm or at a high-excitability connectivity state.

Results:

-

Conclusions:

Our software enables controlling closed-loop EEG–TMS experiments in real time on a desktop computer.

Employing Python for algorithm implementation has the advantage of a large userbase and strong support in the research community. In addition, its relative ease of use allows for rapid prototyping and facilitates developing novel stimulation and data analysis protocols.

Using ROS as the communication architecture has several benefits: (i) it enables a modular design, distributing the state across the services, and (ii) it includes support for recording and playing back experiments.

By following many of the best practices in software development, such as continuous integration, version control, and regular code reviews, we aim to ensure the maintainability and extensibility of the software.

Future work includes supporting several EEG devices and integrating application programming interfaces (APIs) of various TMS devices with the software, as well as establishing a library of predefined preprocessing and stimulation algorithms.

Brain Stimulation:

TMS 1

Modeling and Analysis Methods:

Methods Development

Novel Imaging Acquisition Methods:

EEG 2

Keywords:

Data analysis
Electroencephaolography (EEG)
Experimental Design
Open-Source Software
Workflows
Other - Electromyography (EMG)

1|2Indicates the priority used for review

Provide references using author date format

Casarotto, S., et al. (2022), 'The rt-TEP tool: real-time visualization of TMS-Evoked Potentials to maximize cortical activation and minimize artifacts', Journal of Neuroscience Methods, vol. 370, 109486. ISSN 0165-0270. https://doi.org/10.1016/j.jneumeth.2022.109486.

Ilmoniemi, R.J. and Kicić, D. (2010), 'Methodology for combined TMS and EEG', Brain Topography, vol. 22, no. 4, pp. 233–248. DOI: 10.1007/s10548-009-0123-4.

Tremblay, S., et al. (2019), 'Clinical utility and prospective of TMS–EEG', Clinical Neurophysiology, vol. 130, no. 5, pp. 802–844. DOI: 10.1016/j.clinph.2019.01.001

Zrenner, C., et al. (2018), 'Real-time EEG-defined excitability states determine efficacy of TMS-induced plasticity in human motor cortex', Brain Stimulation, vol. 11, no. 2, pp. 374–389. DOI: 10.1016/j.brs.2017.11.016.