The BrainBeats toolbox is an open-source EEGLAB plugin designed to jointly analyze EEG and cardiovascular (ECG/PPG) signals. It includes heartbeat-evoked potentials (HEP) assessment, feature-based analysis, and heart artifact extraction from EEG signals. The protocol will aid in studying brain-heart interplay through two lenses (HEP and features), enhancing reproducibility and accessibility.
The interplay between the brain and the cardiovascular systems is garnering increased attention for its potential to advance our understanding of human physiology and improve health outcomes. However, the multimodal analysis of these signals is challenging due to the lack of guidelines, standardized signal processing and statistical tools, graphical user interfaces (GUIs), and automation for processing large datasets or increasing reproducibility. A further void exists in standardized EEG and heart-rate variability (HRV) feature extraction methods, undermining clinical diagnostics or the robustness of machine learning (ML) models. In response to these limitations, we introduce the BrainBeats toolbox. Implemented as an open-source EEGLAB plugin, BrainBeats integrates three main protocols: 1) Heartbeat-evoked potentials (HEP) and oscillations (HEO) for assessing time-locked brain-heart interplay at the millisecond accuracy; 2) EEG and HRV feature extraction for examining associations/differences between various brain and heart metrics or for building robust feature-based ML models; 3) Automated extraction of heart artifacts from EEG signals to remove any potential cardiovascular contamination while conducting EEG analysis. We provide a step-by-step tutorial for applying these three methods to an open-source dataset containing simultaneous 64-channel EEG, ECG, and PPG signals. Users can easily fine-tune parameters to tailor their unique research needs using the graphical user interface (GUI) or the command line. BrainBeats should make brain-heart interplay research more accessible and reproducible.
For a long time, the reductionist approach has dominated scientific inquiry in human physiology and cognition. This approach involved dissecting complex bodily and mental processes into smaller, more manageable components, allowing researchers to focus on individual systems in isolation. This strategy arose due to the challenges in studying the intricate and interconnected nature of the human body and mind1. Reductionism has been instrumental in understanding individual subsystems in isolation, such as elucidating the role of ion channels and action potentials for neural2 or cardiac3 communication. However, a significant gap remains in our understanding of how these isolated systems interact on a larger spatial and temporal scale. The multimodal (integrative or ecological) framework considers the human body a complex multidimensional system, where the mind is seen not as a product of the brain but as an activity of the living being, an activity that integrates the brain within the everyday functions of the human body4. The multimodal and reductionist approaches are not exclusive, just like we cannot study one neuron without the whole brain or the whole brain without understanding individual neuron properties. Together, they pave the way for a more comprehensive, synergetic understanding of human health, pathology, cognition, psychology, and consciousness. The present method aims to ease the multimodal investigation of the interplay between the brain and the heart by providing joint analysis of electroencephalography (EEG) and cardiovascular signals, namely electrocardiography (ECG) and photoplethysmography (PPG). This toolbox, implemented as an EEGLAB plugin in MATLAB, addresses existing methodological limitations and is made open source to facilitate accessibility and reproducibility in the scientific area. It implements the latest guidelines and recommendations into its design and default parameters to encourage users to follow known best practices. The proposed toolbox should be a valuable resource for researchers and clinicians interested in 1) studying heartbeat-evoked potentials , 2) extracting features from EEG and ECG/PPG signals, or 3) removing heart artifacts from EEG signals.
Heart-brain research
The relationship between the heart and the brain has been historically studied via neuroimaging methods such as functional magnetic resonance imaging (fMRI) and positron emission tomography (PET). Using these tools, researchers highlighted some brain regions associated with cardiovascular control (e.g., manipulation of heart rate and blood pressure5), showed the influence of heart rate on the BOLD signal6, or identified potential brain-body pathways contributing to coronary heart disease (i.e., stress-evoked blood pressure7). While these studies have significantly advanced our understanding of the complex interplay between the central nervous system (CNS) and cardiovascular function, these neuroimaging techniques are expensive, have limited availability, and are confined to controlled laboratory settings, which restricts their practicality for real-world and large-scale applications.
In contrast, EEG and ECG/PPG are more affordable and portable tools that offer the potential for studying brain-heart interactions in more diverse settings and populations or over longer periods, providing new opportunities. ECG measures the electrical signals generated by each heartbeat when the heart contracts and relaxes via electrodes placed on the skin (usually on the chest or arms)8. PPG measures blood volume changes in the microvascular tissues (i.e., blood flow and pulse rate) using a light source (e.g., LED) and a photodetector (commonly placed on a fingertip, wrist, or forehead), relying on how blood absorbs more light than the surrounding tissue9. Both methods provide valuable information about cardiovascular function but serve different purposes and offer distinct data types. Like ECG, EEG records the electrical fields generated by the synchronized activity of thousands of cortical neurons that propagate through the extracellular matrix, tissues, skull, and scalp until they reach the electrodes placed on the scalp's surface10. As such, the use of EEG and ECG/PPG holds great promise for advancing our understanding of the physiological, cognitive, and emotional processes underlying brain-heart interactions and their implications for human health and well-being. Therefore, capturing heart-brain interplay from EEG, ECG/PPG signals with the BrainBeats toolbox may be particularly useful for the following scientific areas: clinical diagnostic and forecasting, big data machine learning (ML), real-world self-monitoring11, and mobile brain/body imaging (MoBI)12,13.
Two approaches for jointly analyzing EEG and ECG signals
There are two main approaches to studying interactions between EEG and cardiovascular signals:
The heartbeat-evoked potentials (HEP) in the time domain: event-related potentials (ERP), and the heartbeat-evoked oscillations (HEO) in the time-frequency domain: event-related spectral perturbations (ERSP) and inter-trial coherence (ITC). This approach examines how the brain processes each heartbeat. With millisecond (ms) accuracy, this method requires that both time series are perfectly synchronized and the heartbeats to be marked in the EEG signals. This approach has gained interest in recent years14,15,16,17,18,19.
Feature-based approach: this approach extracts EEG and heart-rate variability (HRV) features from continuous signals and examines associations between them. This has been done independently for EEG (often termed quantitative EEG or qEEG20), ECG21,22,23, and PPG24,25,26. This approach presents promising applications by capturing both state- and trait-related variables. Note that, for both EEG and cardiovascular signals, the longer the recording, the more dominant the trait variable27,28,29. Thus, the applications depend on the recording parameters. Feature-based analyses are gaining growing interest, providing new quantitative metrics for forecasting the development of mental and neurological disorders, treatment-response, or relapse30,31,32,33,34,35. This approach is especially compelling with large and real-world datasets (e.g., clinic, remote monitoring), which can be more easily obtained thanks to the recent innovations in wearable neurotechnology11. A less explored application is the identification of associations between specific brain and heart features, highlighting potential underlying central nervous system dynamics. Heart rate variability (HRV) can be calculated from both ECG and PPG signals. It provides information about the autonomous nervous system (ANS) by measuring the variations in time intervals between heartbeats (i.e., the normal-to-normal intervals)27. Increased sympathetic (SNS) activity (e.g., during stress or exercise) typically reduces HRV, while parasympathetic (PNS) activity (e.g., during relaxation) increases it. A slower breathing rate generally increases HRV due to enhanced PNS activity, especially for short recordings (<10 min)27. Higher HRV scores generally suggest a more resilient and adaptable ANS, while a lower HRV can indicate stress, fatigue, or underlying health issues. Long HRV recordings (i.e., at least 24 h) provide a predictive prognosis for various health conditions, including cardiovascular diseases, stress, anxiety, and some neurological conditions27. Measures like blood pressure, heart rate, or cholesterol levels give information about the cardiovascular system's status. In contrast, HRV adds a dynamic aspect, showing how the heart responds to and recovers from stress.
BrainBeats' advantages over existing methods
While tools exist, as reviewed below, to process cardiovascular and EEG signals independently from each other, they cannot be jointly analyzed. Furthermore, most available means to process cardiovascular signals involve costly licensing, do not allow automated processing (especially beneficial for large datasets), have proprietary algorithms that prevent transparency and reproducibility, or require advanced programming skills by not providing a graphical user interface (GUI)36. To our knowledge, four open-source MATLAB toolboxes support HEP/HEO analysis with a GUI: the ecg-kit toolbox37, the BeMoBIL pipeline38, the HEPLAB EEGLAB plugin39, and the CARE-rCortex toolbox40. While HEPLAB, BeMoBIL, and ecg-kit facilitate HEP analysis by detecting heartbeats and marking them in the EEG signals, they do not provide statistical analysis or are limited to the time domain (i.e., HEP). The CARE-rCortex plugin addressed these issues by supporting ECG and respiratory signals, time-frequency domain analysis, statistics, and advanced baseline normalization and correction methods adapted to HEP/HEO analysis. However, it uses the Bonferroni method for statistical correction of the type 1 error (i.e., false positives), which is too conservative and not physiologically sound for EEG applications, leading to an increase in type II errors (i.e., false negatives)41. Furthermore, the toolbox does not offer command-line access for automation. Finally, recent studies recommend against baseline correction methods42,43,44, as they reduce the signal-to-noise ratio (SNR) and are statistically unnecessary and undesirable.
To address these limitations, we introduce the BrainBeats toolbox, currently implemented as an open-source EEGLAB plugin in the MATLAB environment. It incorporates the following advantages over previous methods:
1) An easy-to-use GUI and command-line capabilities (for programmers aiming to perform automated processing). 2) Validated algorithms, parameters, and guidelines for processing cardiovascular signals, such as detecting R peaks, interpolating RR artifacts, and computing HRV metrics (e.g., implanting guidelines for windowing, resampling, normalization, etc.27,45,46). This is important because Vest et al. demonstrated how modest differences in these processing steps can lead to divergent results, contributing to the lack of reproducibility and clinical applicability of HRV metrics46. 3) Validated algorithms, default parameters, and guidelines for processing EEG signals, including filtering and windowing44,47, re-referencing48,49, removal of abnormal channels and artifacts50,51,52, optimized ICA decomposition and classification of independent components53,54,55,56. The users can fine-tune all preprocessing parameters or even preprocess their EEG data with their preferred method before using the toolbox to match their needs (e.g., with EEGLAB clean_rawdata plugin50,52, the BeMoBIL pipeline38, the PREP pipeline57, etc.). 4) Heartbeat-evoked potentials (HEP, i.e., time domain) and oscillations (HEO; event-related spectral perturbations with wavelet or FFT methods, and inter-trial coherence are available through the standard EEGLAB software) from ECG signals. Parametric and nonparametric statistics with corrections for type 1 errors are available via EEGLAB's standard software. Nonparametric statistics include permutation statistics and spatiotemporal corrections for multiple comparisons (e.g., spatiotemporal clustering or threshold-free cluster enhancement)58,59. Users can use the LIMO-EEG plugin to implement hierarchical linear modeling, which accounts well for within and between-subjects variance and implements an assumption-free mass-univariate approach with robust control for type I and II errors60,61. The HEP/HEO data statistical analyses can be performed in the channel and independent component domains. 5) HEP/HEO and HRV analysis from PPG signals (for the first time for HEP/HEO). 6) Supports the joint extraction of EEG and HRV features for the first time. 7) The toolbox provides various data visualizations to inspect signals at various necessary processing steps and outputs at the subject level.
Method | Detect R-peaks from ECG | Detect R-waves from PPG | HEP/HEO | EEG & HRV features | Remove heart artifacts from EEG | GUI | Command line |
ecg-kit | X | X | X | X | |||
BeMoBIL | X | X | X | ||||
HEPLAB | X | X | X | X | |||
CARE-rCortex | X | X | X | X | |||
BrainBeats | X | X | X | X | X | X | X |
TABLE 1: Novelties brought by BrainBeats relative to pre-existing, similar methods.
Information to help readers decide whether the method is appropriate for them
This toolbox is appropriate for any researcher or clinician with EEG and ECG/PPG data. The plugin does not yet support importing EEG and ECG/PPG signals from separate files (although this feature will be available soon). The toolbox is appropriate for anyone aiming to perform HEP/HEO analysis, extract EEG and/or HRV features with standardized methods, or simply remove heart artifacts from EEG signals. See Figure 1 for a block diagram summarizing BrainBeats' overall flow and methods.
FIGURE 1. Block diagram summarizing BrainBeats' overall architecture and flow. The operations that are common across the three methods are brown. Operations specific to heartbeat-evoked potentials (HEP) and oscillations (HEO) are green. Operations specific to the extraction of EEG and HRV features are blue. Operations specific to removing heart artifacts from the EEG signals are red. Please click here to view a larger version of this figure.
Informed consent was obtained from each participant, and the Ural Federal University ethics committee approved the experimental protocol.
1. BrainBeats requirements
2. Heartbeat-evoked potentials (HEP) and oscillations (HEO)
3. Extracting EEG and HRV features
4. Extract heart artifacts from EEG signals.
First, the BrainBeats plugin was used to preprocess EEG and ECG data, identify and remove artifacts, and analyze heartbeat-evoked potentials (HEP) and oscillations (HEO). BrainBeats successfully detected the RR intervals from the ECG signal and some RR artifacts (Figure 2). BrainBeats also reported in the command window that 11/305 (3.61%) of the heartbeats were flagged as artifacts and interpolated. The average signal quality index (SQI) of the RR intervals (before interpolation) has a value of 1, which is the highest value. A low signal quality corresponds to 20% or more of the RR series being flagged as an artifact or with an SQI<0.9. The TP9 EEG channel was removed and interpolated (Figure 3), several epochs containing artifacts (Figure 6), and two eye components were flagged for removal (Figure 7). The output includes grand average HEP (Figure 8) and HEO (Figure 9). We observed significant heartbeat-evoked oscillations (HEO) in the alpha band (8-15 Hz) from 150 to 400 ms post-heartbeat at a frontocentral scalp site (Figure 9, top), consistent with previous findings17,67). On the other hand, the inter-trial coherence (ITC) analysis suggested no significant phase-locking or resetting of the EEG phase with respect to the heartbeats (Figure 9, bottom).
Second, the BrainBeats plugin was used to do the same thing but with PPG. BrainBeats successfully detected the RR intervals from the ECG signal and some RR artifacts (Figure 10). BrainBeats reported in the command window that 15/309 (4.85%) of the heartbeats were flagged as artifacts and interpolated. The average signal quality index (SQI) of the RR intervals (before interpolation) has a value of 0.87. Signal quality is below 0.9 on average but still considered good because less than 20% of the RR series was flagged as an artifact or had an SQI<0.9. The outputs showed the grand average HEP (Figure 11) based on the R waves detected from the PPG signal. We observed significant effects at a frontocentral scalp site in almost the whole-time window following the R-wave (150-400 ms) and almost the whole frequency range (Figure 12 top). No ITC effect was observed (Figure 12 bottom). This is the first time HEP/HEO analysis has been performed from PPG signals, and future research is required to interpret these results.
Third, BrainBeats was used to extract EEG features and HRV features from the ECG signal. The process includes preprocessing the ECG and EEG signals, detecting, and removing artifacts, and computing HRV and EEG features in various domains. We observed a peak in the HRV power spectral density (PSD) distribution at ~0.19 Hz within the high-frequency (HF) band (Figure 14 top). For EEG, we observed a peak in the PSD distribution at ~10.5 Hz within the alpha band Figure 14 bottom). The scalp topographies (Figure 15) indicate that the average power in the main frequency bands (and the highest peak alpha frequency values) are primarily localized in the posterior scalp areas. Furthermore, higher fuzzy entropy values (reflecting higher complexity in terms of regularity) are mostly localized in the frontal right and posterior scalp regions. In contrast, fractal dimension values (reflecting greater complexity in terms of fractal characteristics) do not show much variance across scalp regions. Finally, the alpha asymmetry plot (bottom right corner) shows greater left-than-right alpha power in the central parietal region and greater right-than-left alpha power in the posterior region. These differences in inter-hemispheric alpha power are generally interpreted in terms of local inhibition in the corresponding areas (i.e., more alpha power reflects greater cortical inhibition).
Fourth, BrainBeats was used to do the same, except that HRV features were extracted from the PPG signal. This time, we observe a peak at ~0.04 Hz within the LF frequency band and a split peak around ~0.19 Hz (Figure 16 top). Note that this distribution is slightly different than that obtained from the NN interval calculated from the ECG signal (Figure 14 top). This could be the result of lower signal quality in the PPG signal. EEG features are the same as in Figure 14.
Lastly, we used BrainBeats to extract heart artifacts from the EEG signals. A heart component was classified with 94.1% confidence using the boost mode (Figure 17 Left) and extracted from the EEG signals (Figure 17 Right).
FIGURE 2. RR intervals, artifacts, and NN intervals obtained from ECG signal. Top: preprocessed ECG signal (blue) with the R-peaks detected by BrainBeats (orange dots, i.e. RR intervals). Middle: Normal-to-Normal (NN) intervals (in blue) after interpolation of the RR artifacts (in red). Bottom: Same as top plot but zoomed in (30-s window) to inspect the R-peaks more closely with a scrolling feature by pressing the left/right arrows. Please click here to view a larger version of this figure.
FIGURE 3. Rejection of bad EEG channels. Visualization of the abnormal EEG channel (TP9) automatically detected and removed from the dataset. Note: the large artifact is dealt with in a further step. EEG data were bandpass filtered (1-40 Hz) and re-referenced to infinity. Please click here to view a larger version of this figure.
FIGURE 4. Visualization of the 64-channel EEG data after preprocessing and marking the R-peaks in the signal. The ECG signal is included in the plot at the bottom for visual confirmation. Please click here to view a larger version of this figure.
Figure 5. Histogram of the interbeat intervals (IBI). The red line shows the fitted normal distribution and the red dashed line shows the 5% percentile, used as the upper cutoff value at which the EEG data are segmented (i.e., 650 ms after the R-peak here). Please click here to view a larger version of this figure.
Figure 6. Removal of artifactual epochs. Visualization of the EEG outlier epochs (i.e., containing artifacts) that were detected and removed prior to performing independent component analysis (ICA). Please click here to view a larger version of this figure.
Figure 7. Classification of the independent components to remove non-brain artifacts. After performing blind source separation to obtain the independent components of our EEG data, the ICLabel plugin is used to classify them and automatically flag the non-brain components for extraction. Please click here to view a larger version of this figure.
Figure 8. Grand average heartbeat-evoked potentials (HEP) obtained with ECG. Top: Average across epochs for each EEG channel (superimposed), with scalp topographies showing amplitude distribution in the period of interest (200-500 ms post R-peak). Bottom: HEP evolution over time (each "trial" corresponds to a heartbeat). Please click here to view a larger version of this figure.
Figure 9. Heartbeat-evoked oscillations (HEO) obtained from ECG. Top: HEO at channel Fz (frontocentral region) after permutation statistics (1000-iterations) and corrected for false discovery rate (FDR) at the 95% confidence level (p<0.05). Bottom: Inter-trial coherence (ITC) after FDR correction. Please click here to view a larger version of this figure.
FIGURE 10. RR intervals, artifacts, and NN intervals obtained from PPG signal. Top: preprocessed PPG signal (blue) with the pulse waves detected by BrainBeats (orange dots, i.e. RR intervals). Middle: Normal-to-Normal (NN) intervals (in blue) after interpolation of the RR artifacts (in red). Bottom: Same as top plot but zoomed in (30-s window) to inspect the pulse waves more closely with a scrolling feature by pressing the left/right arrows. Please click here to view a larger version of this figure.
Figure 11. Grand average heartbeat-evoked potentials (HEP) obtained with PPG. Top: All electrodes are superimposed in the time domain, with scalp topographies showing amplitude distribution in the period of interest (200-500 ms after heartbeat). Bottom: HEP evolution over time (each "trial" corresponds to a pulse wave). Please click here to view a larger version of this figure.
Figure 12. Heartbeat-evoked oscillations (HEO) obtained from PPG. Top: HEO for EEG channel Fz (frontocentral region) after permutation statistics (1000-iterations) and corrected for false discovery rate (FDR) at the 95% confidence level (p<0.05). Bottom: Inter-trial coherence (ITC) after FDR correction. Please click here to view a larger version of this figure.
Figure 13. A large EEG artifact was detected and removed by the artifact subspace reconstruction (ASR) algorithm. Users can scroll through the whole file to inspect the segments removed by the algorithm. Please click here to view a larger version of this figure.
Figure 14. Power spectral density (PSD) extracted from NN intervals (ECG) and EEG signals. Top: Heart-rate variability (HRV) power in the low-frequency (LF; 0.04-0.15 Hz; in yellow) and high-frequency (HF; 0.15-0.40 Hz; in blue) bands, estimated using the normalized Lomb-Scargle periodogram from ECG signal. Bottom: PSD normalized to decibels (dB) calculated from the preprocessed EEG data, averaged across all channels for visualization. Please click here to view a larger version of this figure.
Figure 15. The main EEG features extracted by BrainBeats are illustrated by scalp topographies. The main EEG features include average spectral power in the delta (1-3 Hz), theta (3-7 Hz), alpha (8-13 Hz), beta (13-30 Hz), and gamma (30-40 Hz) frequency bands, the individual alpha frequency (IAF), fuzzy entropy, fractal dimension, and alpha asymmetry, in order. Notes: Greater fuzzy entropy values reflect higher complexity in terms of regularity, whereas the fractal dimension reflects greater complexity in terms of fractal characteristics. Alpha asymmetry was calculated on 16 symmetric pairs of electrodes. Positive values reflect greater left-than-right alpha power, typically associated with greater left-than-right inhibition of local cortical regions. Please click here to view a larger version of this figure.
Figure 16. Power spectral density (PSD) extracted from NN intervals (PPG) and EEG signals. Top: Heart-rate variability (HRV) power in the low-frequency (LF; 0.04-0.15 Hz; in yellow) and high-frequency (HF; 0.15-0.40 Hz; in blue) bands, estimated using the normalized Lomb-Scargle periodogram from PPG signal. Please click here to view a larger version of this figure.
Figure 17. Visualization of the heart component detected and removed by BrainBeats. Left: Scalp topography and the classification's confidence level. Right: EEG time series (in blue) after extracting the heart component (in red). Please click here to view a larger version of this figure.
Critical steps in the protocol
Critical steps are described in steps 1.1-1.4. Warnings and error messages are implemented at various places in the toolbox to help users understand why they may encounter issues (e.g., electrode locations not loaded in the EEG data, file length being too short for calculating a reliable measure of ultra-low frequency HRV, signal quality being too low for any reliable analysis, etc.). Each function is documented for advanced users, and the parameters can be easily fine-tuned (recommended parameters and typical ranges are documented in this manuscript and in the code). Users can access help regarding how to use certain functions or what normal ranges of parameters are, using the help command followed by the function's name (e.g., type help brainbeats_process in the command window).
Limitations of the method
Users must possess a dataset with EEG and cardiovascular (ECG or PPG) within the same file or know how to merge them independently. Data importation is currently not automated via BrainBeats because specific plugins need to be installed to account for the various data formats (e.g., .csv,. edf,. bdf,. vhdr, etc.). A future version will allow users to automatically load BIDS datasets with any number of files directly into BrainBeats, combine the EEG and cardiovascular signals available, and deal with potential time synchronicity issues (e.g., different sampling rates, align timestamps, etc.).
Entropy features are particularly promising for capturing complex, bidirectional interactions between cardiovascular, subcortical, and cortical systems that may be hidden in nonlinear feedback loop dynamics27,73,74. However, they are computationally heavy and can take a long time to compute from EEG signals, especially with high sampling rates. While some solutions are implemented (parallel computing, down sampling/decimation), future work will further reduce these computational costs.
While group-level statistics are available for HEP/HEO, they are not currently available for the features mode but will be available soon. Meanwhile, users may still use this method to extract features easily and reliably, perform statistics with any standard statistical software, or build feature-based ML models with their method of choice.
ECG directly assesses cardiac electrophysiology by capturing the heart's electric fields. In contrast, PPG measures blood volume changes in microvascular beds, reflecting cardiac activity more indirectly through blood flow dynamics. Identifying the R-peak in ECG is straightforward due to its clear manifestation in the QRS complex, corresponding to the ventricular depolarization preceding the heart's contraction. In contrast, the most prominent peak for the PPG signal is the systolic peak (or pulse wave peak), corresponding to the point of maximum blood volume in the arteries. It occurs slightly after the R-peak in the ECG. This delay is due to the time it takes for the pressure wave to travel from the heart to the peripheral site where the PPG signal is measured. Thus, the valley in the PPG waveform (marked as R-wave in BrainBeats), occurring between two systolic peaks, corresponds to the point of minimum blood volume and does not align with the R-peak in the ECG. Instead, it is closer to the T-wave in the ECG, which represents ventricular repolarization9. This difference in signal characteristics results in timing disparities between ECG and PPG signals, which influence the temporal aspects of observed HEPs. Clinically, this divergence necessitates careful consideration in selecting the appropriate modality for HEP analysis, with ECG preferred for direct cardiac electrophysiological studies and PPG offering benefits in ease of use and patient comfort for long-term monitoring. While ECG and PPG can facilitate HEP analysis, their differing signal natures and physiological implications suggest that their inferences are not directly interchangeable. The choice between ECG and PPG for HEP analysis should be tailored to the specific objectives and needs of the study or clinical application. While this can be a limitation, it is also a strength because it means that ECG and PPG can provide two different types of information about the cardiovascular system, which can be complementary and provide new insights when combined. Furthermore, the temporal difference between R-peaks (from ECG) and R-waves (from PPG) could be corrected if stable over time by using a dataset containing simultaneous ECG-PPG signals, as used for this tutorial.
PPG signals are smoother and lack distinct features relative to ECG, making them vulnerable to artifacts75. While the algorithm used in this study was previously validated and performed well on the dataset used for this study, it might not perform as well on other types of PPG signals, especially those collected with wearable technologies.
For HEP/HEO analysis, epochs are defined using thresholds based on the distribution of the individuals' interbeat intervals (IBI; ~600-1000 ms). This leads to different epoch lengths across subjects and errors for group analysis. Furthermore, the short epoch length resulting from IBIs, relative to conventional EEG studies (stimuli are typically spaced in several seconds to allow the brain to return to baseline), leads to potential undesired edge effects or prevents users from examining slow frequencies. Time-frequency decomposition typically requires epochs to extend up to 3 cycles in the lowest frequency of interest beyond the window of interest. For HEO, the window of interest is 200-500 ms. Thus, one would require, for example, an additional 600 ms before and after the window (i.e., -400 to 900 ms) for examining frequencies as low as 5 Hz. If one wanted to examine frequencies as low as 1 Hz, an additional 3 s are needed before and after the window of interest. This is necessary for obtaining correct time and frequency resolution while avoiding edge effects.
Significance of the method with respect to existing methods
Overall, BrainBeats provides state-of-the-art signal processing techniques for both EEG and cardiovascular signals, with fine-tuning capabilities via command line and graphical user interface (GUI).
The three methods can be performed using both a user-friendly graphical interface (GUI) and a command line (experts, allowing automation). Method 1 can be examined in the time (HEP), frequency (HEO), or time-frequency (HEO) domains, as well as at the channel or independent component levels. To our knowledge, HEP/HEO has never been performed using PPG signals and is now readily available.
Method 2 does not currently have a pre-existing alternative. Furthermore, users can also use BrainBeats to simply preprocess and extract EEG or HRV features individually with other datasets that do not contain both signals. For example, a user can preprocess ECG/PPG signals and extract HRV features to analyze HRV values only (and vice versa if a user wants to extract EEG features from an EEG dataset). This can be particularly useful for feature-based ML applications.
Method 3 allows quick and automated removal of heart artifacts from the EEG signals. While this is already possible in EEGLAB with the ICLabel plugin, it requires users to perform a series of steps and choice of parameters (e.g., highpass filtering the signals, running ICA, running ICLabel, tuning parameters, subtracting the heart components from the EEG signals, and removing the ECG channels) that can easily lead to errors (e.g., ghost ICs55). Furthermore, we introduce a boost method that increases the performance of this method using the cardiovascular signal (generally not included in these operations).
Additionally, the toolbox implements computing performance improvements to accelerate the estimation of EEG features (mainly multiscale entropy measures), including GPU and parallel computing. Note that these options are only as beneficial as the users' hardware (i.e., graphic card and number of processors and threads).
Future directions
The toolbox will continue to be modified and improved by the authors in the long term to implement field experts' latest guidelines and recommendations and fix any errors that may arise.
Additional features and methods will be added to assess interactions between EEG and cardiovascular signals. For example, qEEG features such as theta/beta ratio (or similar spectral ratios that capture relevant clinical or cognitive information) can easily be added to the toolbox. New methods will include, for example, EEG-ECG direct and partial coherence, the time-resolved directional brain/heart interplay measurement76, or classification of HEP or feature data using machine learning (e.g., decision trees, random forest, naïve Bayes, SVM, KNN, long short-term memory networks, etc.)17.
For the best performance at detecting R-waves from noisy PPG signals collected with wearable technologies, future BrainBeats versions may provide alternative algorithms for these applications. Other promising algorithms include signal derivatives-based algorithms77, adaptive linear neuron artificial neural networks (used for ECG78), or ensemble empirical mode decomposition79.
For HEO analysis, to address the short epoch issue for time-frequency estimation (see limitations above), we plan to implement in future versions the reflection method, which mirrors the signal from the window of interest (i.e., backward version of the signal) before and after the window of interest to expand it. This provides smooth transitions and removes the undesired edge effects. The mirrored sections are then removed.
The authors have nothing to disclose.
The Institute of Noetic Sciences supported this research. We thank the developers of the original open-source algorithms that were adapted to develop some of BrainBeats' algorithms.
EEGLAB | Swartz Center for Computational Neuroscience (SCCN) | Free/Open-source | |
MATLAB | The Mathworks, Inc. | Requires a license | |
Windows PC | Lenovo, Inc. |