JoVE Logo

Sign In

In This Article

  • Summary
  • Abstract
  • Introduction
  • Protocol
  • Results
  • Discussion
  • Disclosures
  • Acknowledgements
  • Materials
  • References
  • Reprints and Permissions

Summary

This protocol presents PIPEMAT-RS, a standardized MATLAB-based preprocessing pipeline for resting-state EEG data. It ensures artifact removal, improves signal quality, and enhances data reproducibility across studies. The pipeline automates key preprocessing steps, including filtering, independent component analysis (ICA), and artifact classification, facilitating consistent and reliable EEG analysis for neurophysiological research.

Abstract

Electroencephalography (EEG) is a crucial tool in neuroscience research and clinical applications, but raw EEG data often contain noise and artifacts that compromise signal quality. To address this, we developed PIPEMAT-RS, a standardized MATLAB-based preprocessing pipeline for resting-state EEG data. PIPEMAT-RS follows a structured seven-step workflow: file format conversion, EEG montage configuration, downsampling, filtering, artifact rejection, independent component analysis (ICA), and ICLabel classification for automated artifact removal. This protocol enhances EEG data quality by minimizing human intervention while maintaining high accuracy in artifact rejection. It was validated using multiple datasets, demonstrating its robustness in improving signal integrity. PIPEMAT-RS provides a systematic approach that facilitates reproducibility and reliability in EEG studies, aligning with commonly adopted practices in the field and offering a clearly documented structure that can complement existing pipelines. By standardizing EEG preprocessing, PIPEMAT-RS facilitates neurophysiological research and clinical applications, allowing for more accurate interpretations of resting-state brain activity and its associations with neurological and psychiatric conditions.

Introduction

The electroencephalogram (EEG) is a critical tool in both neuroscience research and clinical practice, offering valuable insights into brain electrical activity. Resting-state EEG data, in particular, are extensively utilized to investigate various neurological and psychiatric conditions, such as stroke, fibromyalgia, and chronic neuropathic pain. Despite its widespread application, the analysis of EEG data necessitates rigorous preprocessing to eliminate artifacts and noise, ensuring the integrity and reliability of the results1,2,3. Over the years, EEG has been invaluable in providing non-invasive and high-temporal resolution measurements of brain activity, making it indispensable for studying the dynamic processes of the brain4,5. However, the raw EEG signals are often contaminated by a variety of noise sources that can obscure the neural signals of interest, thereby complicating the interpretation of the data6.

EEG signals are highly susceptible to contamination from sources such as muscle activity, eye movements, and electrical interference7. These artifacts can obscure neural signals, making preprocessing a critical step in EEG analysis. This process typically involves multiple stages-file format conversion, downsampling, filtering, artifact rejection, independent component analysis (ICA), and exclusion of noise-related components8,9. Each step contributes to improving signal quality and ensuring that the data accurately reflect neural activity10. The complexity of these processes necessitates the use of sophisticated algorithms and software tools to ensure that the preprocessing is both efficient and effective11.

One of the primary challenges in EEG data preprocessing is the variability in the data, which can differ significantly between subjects and recording sessions10,12. This variability arises due to differences in the physiological and anatomical characteristics of the subjects, as well as variations in the experimental conditions and equipment used. Additionally, the lack of standardized preprocessing protocols can lead to inconsistencies in data analysis and interpretation13,14. While several pipelines and preprocessing scripts are available, many of them are either tailored to specific datasets or lack comprehensive documentation, making them less accessible to the broader research community14. Platforms like GitHub host numerous EEG preprocessing scripts and plugins, facilitating the sharing and collaborative improvement of these tools15. However, the fragmented nature of these resources underscores the need for a robust, efficient, and standardized editable preprocessing pipeline that can be broadly applied across different datasets and research contexts16. Such a pipeline would not only enhance the reproducibility of EEG studies but also provide a foundation upon which the research community can build and adapt for specific needs17.

In addition to EEGLAB, which forms the basis of PIPEMAT-RS due to its extensive user base and integration with MATLAB, other EEG processing toolboxes are also widely used in the field. For instance, MNE-Python is an open-source Python-based platform that offers advanced functionalities for source localization, sensor-space analyses, and integration with machine learning workflows. FieldTrip, a MATLAB-based toolbox like EEGLAB, is known for its flexible scripting environment and comprehensive support for time-frequency and connectivity analyses. While these platforms provide powerful alternatives, they typically require steeper learning curves and more advanced programming skills. PIPEMAT-RS was designed to bridge accessibility and transparency, especially for researchers seeking an editable and modular solution for resting-state EEG preprocessing using EEGLAB. Nonetheless, the conceptual structure of PIPEMAT-RS can be adapted to other toolboxes as needed, fostering interoperability and customization across different software environments.

Several automated EEG preprocessing pipelines have been developed in recent years, such as RELAX18, Automagic19, APP20, and PREP7. These pipelines incorporate advanced algorithms for artifact removal and data cleaning, often employing ICA-based strategies with limited transparency or customization for non-expert users. For instance, RELAX introduces a multi-step ICA cleaning method that improves artifact rejection but relies on complex configurations that may not be easily modifiable21. In contrast, PIPEMAT-RS is designed to provide a flexible, transparent, and educationally accessible alternative, enabling researchers to understand and manually adjust each preprocessing step. This transparency allows PIPEMAT-RS to be used as both a research and teaching tool while maintaining rigor and reproducibility. Moreover, PIPEMAT-RS emphasizes documentation, modular execution, and adaptability across datasets-features that are often underreported or absent in other pipelines.

Economically, the development and implementation of a standardized editable preprocessing pipeline for EEG data can have significant impacts. The global EEG devices market was valued at approximately USD 1.2 billion in 2020 and is expected to grow at a compound annual growth rate (CAGR) of 7.5% from 2021 to 202822. Efficient preprocessing pipelines, particularly those that are editable and modular, can reduce the time and cost associated with data analysis-an important consideration in large-scale clinical trials and public health research. By minimizing human error and automating repetitive tasks, such pipelines can improve the accuracy of EEG data analysis and lead to more reliable research outcomes13. This, in turn, can accelerate the development of new diagnostic tools and therapeutic interventions, potentially reducing healthcare costs and improving patient outcomes1.

This paper aims to present and validate a standardized editable Preprocessing Integrated Pipeline for Resting-State EEG using MATLAB (PIPEMAT-RS). Designed to be both robust and efficient, this editable pipeline is versatile and can be widely applied to various datasets and research scenarios. The seven comprehensive steps include file format conversion, downsampling, filtering, artifact rejection, independent component analysis (ICA), and noise related components exclusion, all integrated into a cohesive workflow23,24. The development of PIPEMAT-RS was guided by the need to address common challenges in EEG preprocessing and to provide a tool that researchers can use to streamline their data analysis processes25. By integrating with commonly adopted practices in the field and leveraging the capabilities of MATLAB, PIPEMAT-RS aims to offer a reliable, editable, and user-friendly framework to support EEG data preprocessing26.

To validate the effectiveness of PIPEMAT-RS, we have applied it in several studies. In one study, PIPEMAT-RS was utilized to investigate EEG biomarkers in stroke patients, identifying significant correlations between maladaptive motor function and depressive profiles27. Another study applied PIPEMAT-RS to analyze neural signatures of brain compensation in stroke patients using EEG and TMS, revealing critical insights into the brain's adaptive mechanisms post-stroke28. Further validation comes from a study that explored the neural adaptations and compensations in fibromyalgia patients29. Additionally, another study demonstrated how delta and theta bands in resting-state EEG serve as compensatory mechanisms in chronic neuropathic pain30.

These studies collectively highlight PIPEMAT-RS's utility in processing and analyzing EEG data, establishing its efficacy across various conditions and applications. By providing a standardized approach, this pipeline not only enhances the reproducibility of EEG studies but also facilitates the broader adoption of consistent preprocessing methods in the research community. Through this paper, we aim to contribute a valuable resource to the field, promoting more accurate and reliable EEG data analysis16,17. In doing so, we hope to support the advancement of research in neurophysiology and the development of novel therapeutic approaches for neurological and psychiatric conditions.

The foundational preprocessing steps used in PIPEMAT-RS are rooted in robust, widely validated methods that have become essential in EEG research for ensuring data quality and reproducibility2,8,14. Although these methodologies are well-established, they remain crucial due to their effectiveness in addressing common EEG artifacts and noise, which continues to support reliable analyses across studies. However, few studies have recently provided a fully documented, standardized pipeline tailored for resting-state EEG. By integrating these proven techniques with recent advances, such as ICLabel for automated artifact classification, PIPEMAT-RS delivers a contemporary, structured approach that enhances replicability and accessibility for researchers, fulfilling an ongoing need for rigorously documented preprocessing workflows in the field.

While PIPEMAT-RS pipeline follows established preprocessing steps commonly employed in EEG studies, its documentation in the form of a scientific paper fills an important gap in the literature. Many EEG studies rely on similar preprocessing methods but often lack a comprehensive, step-by-step description that allows for full reproducibility and ease of adoption by other researchers. By detailing each component of PIPEMAT-RS and presenting a standardized sequence for resting-state EEG analysis, this work aims to enhance transparency, minimize user variability, and provide a replicable framework applicable across studies. Rather than introducing novel methods, this contribution is intended to serve as an instructional and practical guide that helps standardize preprocessing practices and improve accessibility for a wide range of EEG researchers, particularly those working with resting-state data.

The preprocessing of EEG data is a critical step that significantly influences the quality and reliability of subsequent analyses. The Preprocessing Integrated Pipeline for Resting-State EEG using MATLAB (PIPEMAT-RS) was developed to address common challenges in EEG data preprocessing by providing a comprehensive, standardized approach applicable to various datasets. This structured, editable pipeline consists of seven key steps: i) File Format Conversion; ii) EEG Montage; iii) Downsampling and Filtering; iv) Artifact Rejection and Rereferencing; v) Independent Component Analysis (ICA); vi) ICLabel Classification; vii) Data Normalization. Each step is meticulously designed to enhance signal quality and facilitate the extraction of meaningful information from raw EEG data.

A critical feature of PIPEMAT-RS is that each preprocessing step concludes with saving the dataset under a distinct filename. This structure ensures that, for each processed file, a derivative version corresponding to each specific step is generated. This systematic approach allows users to access data at any point within the seven-step preprocessing pipeline. The saved files include identifiers that clearly indicate the stage of preprocessing, making it easier to track and manage data throughout the workflow.

PIPEMAT-RS begins with file format conversion, where raw EEG data files are transformed into a MATLAB-compatible format. This conversion is essential for the seamless handling of data in MATLAB's robust computational environment. Following this, the EEG montage step assigns precise spatial locations to each electrode on the scalp based on standardized electrode placement systems. This spatial information is crucial for the accurate interpretation of EEG data in neurophysiological studies.

Next, the pipeline applies downsampling and filtering to reduce the data's sampling rate and eliminate noise while retaining the frequency components relevant to neurophysiological research. Downsampling decreases the computational load and storage requirements without compromising data quality. Filtering removes specific frequency components known to be associated with artifacts, thereby preserving the essential neural signals.

Subsequently, artifact rejection and rereferencing are performed. This step identifies and removes segments of data contaminated by noise sources such as eye blinks, muscle activity, and electrode movement. Automatic artifact rejection algorithms are utilized to minimize manual intervention, reducing the potential for human error and increasing preprocessing efficiency. Rereferencing the data to the average of all electrodes helps to mitigate the influence of any single electrode and provides a stable reference for the EEG signals.

The Independent Component Analysis (ICA) step further refines the data by separating mixed signals into their independent sources. This decomposition facilitates the identification and removal of artifacts such as eye blinks, muscle artifacts, and line noise. ICA is a powerful technique that ensures the remaining data accurately reflects underlying neural activity.

Finally, ICLabel classification is applied to automatically identify and remove components classified as artifacts. ICLabel assigns probabilistic labels to independent components, categorizing them as brain activity, muscle activity, eye blinks, heartbeats, line noise, or channel noise. Components with a high probability of representing brain activity are retained, while those identified as artifacts are removed. This automated approach significantly reduces manual effort and ensures consistent and objective classification across datasets.

Each of these preprocessing steps is essential for improving the quality of EEG data. By standardizing the preprocessing workflow, PIPEMAT-RS minimizes variability introduced by different preprocessing methods, facilitating the comparison of results across studies. The pipeline's implementation in MATLAB, a widely-used platform in the neuroscience community, ensures accessibility and ease of integration into existing research workflows.

The development of PIPEMAT-RS was guided by commonly adopted practices in EEG data analysis, incorporating methods and techniques validated in previous research. Each step was carefully designed and rigorously tested to ensure its effectiveness in enhancing data quality (Figure 1). This comprehensive approach not only improves the reliability of EEG data but also supports the identification of neurophysiological markers critical for understanding various neurological and psychiatric conditions.

Protocol

PIPEMAT-RS was developed as part of our ongoing research project, approved by the Ethics Committee of the Clinics Hospital, University of São Paulo Medical School (CAAE: 86832518.7.0000.0068). This project aims to enhance the quality and reliability of resting-state EEG data for various neurological and psychiatric studies. The data used in this study are derived from a cohort study, the protocol of which was previously published by Simis et al. (2021)31. The main study is still in progress, with data collection ongoing for the remaining clinical groups. The script for the pipeline is provided in Supplementary File 1.

1. File format conversion

  1. Prepare the data directory.
    1. Open MATLAB and navigate to the directory containing raw EEG data files.
    2. Define the path using pathname = 'C:\\Path\\To\\RawData\\'; and list subjects with name_subj_raw = {'subject1', 'subject2', ...};.
    3. If the dataset is already in .mat format, skip this step and proceed to EEG Montage.
  2. Convert files.
    1. Load each raw data file using the appropriate MATLAB function for the file type. For example, use load for .mat files or file-specific EEGLAB functions such as pop_biosig (for .edf, .bdf) or pop_fileio (for various proprietary formats).
      NOTE: Users should adapt this step based on the format of their raw EEG files and refer to EEGLAB's documentation for additional file support.
    2. Save each file in .mat format, ensuring data integrity and retaining all relevant metadata.

2. EEG montage

  1. Load EEG data.
    1. Open MATLAB and navigate to the directory with the .mat files.
    2. Use the pop_loadset function from the EEGLAB toolbox to load each subject's EEG dataset (e.g., EEG = pop_loadset('filename.set');).
  2. Apply electrode locations.
    1. Ensure the appropriate electrode location file (e.g., EEGSystem_128.loc) corresponding to the EEG cap configuration is available.
    2. Use the pop_chanedit function to apply electrode locations. For example:
      EEG = pop_chanedit(EEG, 'load', {'EEGSystem_128.loc', 'filetype', 'loc'});
    3. Visually confirm that the electrode positions were loaded correctly by reviewing the channel layout using EEGLAB's GUI.
  3. Save the dataset.
    1. Save the updated EEG dataset using the pop_saveset function (e.g., pop_saveset(EEG, 'filename', 'subject1_loc.set')).

3. Downsampling and filtering

  1. Downsample the EEG Data.
    1. Reduce the sampling rate of the EEG data to 250 Hz using the pop_resample function (optional).
      NOTE: The pop_resample function automatically applies an appropriate low-pass anti-aliasing filter before downsampling. This step ensures that high-frequency components are attenuated prior to resampling, preventing aliasing artifacts and preserving the quality of the EEG signal.
  2. Apply band-pass filtering.
    1. Apply a band-pass filter from 1 Hz to 50 Hz to channels 1-64 using the pop_basicfilter function with a Butterworth design and filter order of 2.
    2. Use zero-phase forward and reverse filtering to prevent phase distortion.
  3. Apply notch filtering (Optional).
    1. Apply a notch filter at 50 or 60 Hz to channels 1-64 using pop_basicfilter with the 'PMnotch' design and filter order of 180.
      NOTE: This step is optional and should be used when analyzing oscillatory activity above 30 Hz (e.g., gamma band). In such cases, researchers may increase the upper limit of the band-pass filter (e.g., up to 80 or 100 Hz), making the notch filter crucial for eliminating powerline interference. The command is provided in the pipeline for convenience and can be easily adjusted depending on the local electrical frequency (e.g., 50 Hz or 60 Hz).

4. Artifact rejection and rereferencing

  1. Perform automatic artifact rejection.
    1. Use the clean_rawdata function with parameters (5, [-1], 0.7, -1, 8, 0.85) to automatically detect and remove flatline channels, noisy segments, and low-frequency drifts. These parameters correspond respectively to:
      FlatlineCriterion (5): removes channels flat for more than 5 s.
      ChannelCriterion ([-1]): disables channel correlation-based rejection.
      LineNoiseCriterion (0.7): removes channels with excessive line noise above this threshold.
      Highpass (−1): disables additional high-pass filtering during cleaning.
      BurstCriterion (8): removes data bursts that exceed 8 standard deviations.
      WindowCriterion (0.85): requires 85% of data in a window to be clean to retain it.
      NOTE: Users may adjust these values depending on dataset characteristics. For instance, reducing the BurstCriterion will result in more aggressive artifact rejection, while lowering the WindowCriterion will increase the tolerance for noisy data windows.
  2. Perform manual artifact inspection (optional).
    1. If necessary, visually inspect the EEG data using eegplot from EEGLAB to identify residual artifacts not detected by automatic methods.
    2. Manually mark and remove remaining artifacts to ensure high data quality.
      NOTE: This step is optional and primarily recommended when dealing with datasets that present non-standard noise patterns or when greater precision is needed beyond automated procedures.
  3. Rereference the data.
    1. Use the pop_reref function to rereference EEG signals to the average of all electrodes, ensuring that the original reference electrode is retained in the dataset.
      NOTE: In this pipeline, average re-referencing is performed using the available channels without reconstructing the original reference electrode. However, users aiming for enhanced rank consistency and cross-subject comparability may consider temporarily reinserting the original reference electrode (e.g., Cz) as a zero-valued time series before re-referencing. This allows the reference to contribute to the average calculation. Afterward, the added channel can be removed to avoid rank deficiency before performing ICA. This process is exemplified in the RELAX_average_rereference.m function of the RELAX pipeline, which also includes interpolation of all channels prior to referencing. While PIPEMAT-RS maintains a simplified version for clarity and accessibility, users are encouraged to adapt this step as needed depending on the goals of their analysis.

5. Independent component analysis (ICA)

  1. Load preprocessed EEG data.
    1. Load the file with the suffix _loc_filt_cleanraw_reref.set using the pop_loadset function.
  2. Perform ICA.
    1. Run ICA using the pop_runica function with the runica algorithm to decompose the data into independent components.The 'runica' algorithm, based on the Infomax approach, maximizes the statistical independence of the components and is widely used in EEG preprocessing.
      NOTE: For users seeking faster ICA computation, alternative algorithms such as picard may be used by specifying icatype, picard in the function call. These alternatives offer comparable performance and may reduce computation time.
  3. Save the ICA dataset.
    1. Save the dataset with the suffix _loc_filt_cleanraw_reref_ICA using pop_saveset to indicate that ICA has been performed.

6. ICLabel classification

  1. Load the ICA dataset.
    1. Import the dataset with ICA components using the pop_loadset function.
  2. Apply ICLabel classification.
    1. Run the pop_iclabel function with the default model to classify independent components into brain and artifact categories.
    2. Identify components with a probability greater than 0.7 of representing brain activity.
  3. Remove artifact components.
    1. Use the pop_subcomp function to remove all components with ICLabel brain probability below 0.7.
    2. Retain only components with a brain activity probability above 0.7. The threshold of 0.7 balances the need to preserve genuine neural signals while ensuring the effective removal of artifacts.
  4. Save the cleaned dataset.
    1. Save the cleaned dataset with the suffix _loc_filt_cleanraw_reref_ICA_Cleaned using pop_saveset to indicate the removal of artifact components.

7. Data normalization

  1. Load cleaned EEG data.
    1. Import the dataset with artifact-free ICA components using the pop_loadset function.
  2. Apply Z-Score normalization.
    1. Normalize each EEG channel using Z-score transformation by computing (x - mean(x)) / std(x) for each channel individually.
      NOTE: Z-score normalization is optional and should be applied based on the analytical goals of the study. While it reduces inter-subject variability and standardizes data for group-level comparisons, it may also attenuate topographical distinctions and eliminate meaningful amplitude differences across channels. Researchers interested in preserving raw signal magnitude or spatial distribution are advised to skip this step.
  3. Save the final dataset.
    1. Save the fully preprocessed and normalized dataset with the suffix _loc_filt_cleanraw_reref_ICA_Normalized using pop_saveset to indicate the completion of preprocessing.

Results

The validation of the EEG preprocessing pipeline is essential to ensure the reliability and effectiveness of the methods employed for extracting meaningful neurophysiological data. This process involves empirical evidence from published studies, statistical assessments, and comparisons with established benchmarks in the field.

The robustness and utility of PIPEMAT-RS have been demonstrated through its successful application in several published studies spanning a range of neurological and psychiatric conditions. For example, in the investigation of EEG biomarkers in stroke patients, significant correlations were found between maladaptive motor function, depressive profiles, and specific EEG markers, validating the effectiveness of the preprocessing steps in enhancing signal quality and facilitating meaningful data analysis32. Similarly, the analysis of neural signatures of brain compensation in stroke patients revealed critical insights into the brain's adaptive mechanisms post-stroke, demonstrating PIPEMAT-RS's capability to handle complex datasets and produce reliable results28. Further validation is evident in studies exploring neural adaptations and compensations in fibromyalgia patients, which identified distinct neural signatures associated with pain and compensation mechanisms, supporting the preprocessing methods in diverse clinical contexts29. Additionally, the investigation of compensatory mechanisms in chronic neuropathic pain highlighted the relevance of delta and theta bands in chronic pain states, further demonstrating PIPEMAT-RS's effectiveness in various neurophysiological conditions30.

Statistical validation of PIPEMAT-RS includes both quantitative and qualitative assessments to ensure the robustness of the preprocessing methods. Quantitative measures such as the signal-to-noise ratio (SNR), kurtosis, and skewness were used to objectively assess data quality. The SNR was calculated as the ratio between the power of the signal in the 1-50 Hz frequency range and the power outside this range (e.g., <1 Hz and >50 Hz), which typically contains non-neural noise. Increases in this ratio after preprocessing indicate enhanced preservation of neural information relative to noise. Similarly, kurtosis and skewness were assessed to evaluate the distribution characteristics of the EEG signal. Elevated kurtosis often reflects the presence of sharp transients or muscle artifacts, while high skewness may result from asymmetric signal distributions caused by noise or recording issues. Reductions in these values following preprocessing suggest improved signal regularity and reduced contamination by non-neural sources, supporting the overall enhancement of data quality. Preprocessing led to notable improvements in SNR, indicating that PIPEMAT-RS effectively reduces noise and enhances the neural signal. For example, in datasets with initially low SNR values (~5 dB), the preprocessing steps increased the SNR to approximately 7.5 dB, reflecting a clearer neural signal. Similarly, reductions in kurtosis (e.g., from 5.2 to 2.3) and skewness (e.g., from 1.5 to 0.8) further confirmed the attenuation of non-neural artifacts². Qualitative assessments involved visual inspection of the preprocessed data to ensure that artifacts were adequately removed and that the data accurately reflected underlying neural activity (Figure 2). This step allowed researchers to manually verify the effectiveness of the automatic preprocessing steps, ensuring no significant artifacts remained.

The inclusion of advanced techniques such as Independent Component Analysis (ICA) and ICLabel for artifact removal has been particularly validated in the literature. Studies have shown that ICA, when combined with automated classification algorithms like ICLabel, achieves classification accuracies that closely match expert-labeled components. ICLabel demonstrates an average classification accuracy of approximately 91%, reflecting strong agreement with human expert classifications and offering a standardized, scalable solution for large EEG datasets while minimizing inter-rater variability32.

Another aspect of validation is the comparison with established benchmarks in the field. The methods and results of our pipeline were aligned with standard practices and guidelines in EEG preprocessing, as recommended by leading researchers and institutions14. While PIPEMAT-RS does not claim superiority over existing pipelines, its modular structure, transparency, and ease of use aim to meet or complement the quality standards commonly accepted in the field (Table 1).

figure-results-5021
Figure 1: PIPEMAT-RS pipeline code structure. Overview of the MATLAB code implementing each step of the PIPEMAT-RS preprocessing pipeline. Please click here to view a larger version of this figure.

figure-results-5523
Figure 2: EEG signal quality before and after preprocessing. Comparison of (A) raw data, (B) manually cleaned data, and (C) data processed with PIPEMAT-RS, illustrating artifact reduction and improved signal clarity. Please click here to view a larger version of this figure.

Table 1: Comparison between manual and automated EEG preprocessing using PIPEMAT-RS. Please click here to download this Table.

Supplementary File 1: Complete Preprocessing Integrated Pipeline for Resting-State EEG using MATLAB (PIPEMAT-RS) script. This script encompasses all the steps detailed in the Protocol section, from file format conversion to data quality assurance. Please click here to download this File.

Discussion

The PIPEMAT-RS pipeline was developed to provide a standardized, efficient method for preprocessing resting-state EEG data. Critical steps in this protocol include artifact rejection and Independent Component Analysis (ICA), both of which significantly enhance the signal-to-noise ratio and ensure the extraction of meaningful neural signals. The combination of automatic artifact rejection using the clean_rawdata function and manual inspection via eegplot ensures comprehensive artifact management, balancing efficiency and accuracy. The application of ICLabel for automated classification of independent components further refines the data, reducing manual workload while maintaining high classification accuracy (91%) consistent with human expert labeling32.

Modifications to the protocol may be necessary depending on the characteristics of the dataset. For example, while the pipeline is designed for resting-state EEG data, researchers can adapt filter settings and artifact rejection thresholds for task-based EEG recordings or datasets with different sampling rates. Troubleshooting steps include adjusting the flatline criterion and channel correlation thresholds in clean_rawdata if excessive channel removal occurs or if residual noise persists after automatic cleaning. Additionally, while ICA typically performs well with datasets of 32 or more electrodes, datasets with fewer electrodes may require manual fine-tuning or alternative artifact correction methods to achieve optimal results2.

Despite its strengths, PIPEMAT-RS has limitations. The effectiveness of ICA and ICLabel may vary based on the number of channels and the quality of the raw data. High levels of noise or poor electrode contact can reduce the accuracy of component separation and classification. Moreover, the pipeline is optimized for single-site studies and may require additional harmonization steps, such as ComBat, to minimize site-specific variability in multi-center research33. While PIPEMAT-RS enhances data quality through standardized preprocessing, the potential for user-induced variability remains if default settings are altered without careful validation.

Although ICA combined with ICLabel classification offers an efficient and automated solution for artifact rejection, it is important to acknowledge its limitations. The separation of neural and non-neural components is not perfect, and rejecting components classified as artifacts may still result in the unintended removal of neural signals, especially when sources are mixed22. While PIPEMAT-RS applies a conservative threshold (retaining components with a brain probability > 0.7) to reduce this risk, it does not eliminate it. This threshold follows standard practices to balance signal preservation and artifact removal, but future enhancements to the pipeline may incorporate more refined strategies -- such as dipole fitting, wavelet-enhanced ICA, or targeted ICA cleaning -- to further improve the specificity and accuracy of artifact rejection.

Compared to existing methods, PIPEMAT-RS offers a streamlined, standardized sequence of preprocessing steps that reduces variability between studies. Unlike flexible platforms like BEAPP, which allow users to customize preprocessing sequences, PIPEMAT-RS enforces a fixed structure, ensuring consistency across datasets34. This approach minimizes manual intervention, reduces human error, and ensures reproducibility, particularly in large-scale studies. Additionally, the integration of advanced tools like ICLabel and the focus on resting-state EEG data distinguish PIPEMAT-RS from other pipelines that may not prioritize artifact rejection and independent component analysis to the same extent.

The significance of PIPEMAT-RS lies in its ability to produce high-quality, reliable EEG data suitable for diverse applications in neuroscience and clinical research. The pipeline has been successfully applied to studies investigating neural markers of stroke recovery, chronic pain, and fibromyalgia, demonstrating its versatility and robustness27,28,29,30. By improving data quality and reducing preprocessing time, PIPEMAT-RS facilitates large-scale studies, contributes to the identification of neurophysiological biomarkers, and supports advancements in personalized medicine. Its standardized approach ensures that results are comparable across studies, enhancing the reproducibility and reliability of EEG research in both clinical and academic settings.

In conclusion, PIPEMAT-RS provides a robust, standardized solution for preprocessing resting-state EEG data, addressing common challenges related to artifact rejection, signal clarity, and data consistency. By integrating automated techniques such as ICA and ICLabel with manual verification steps, the pipeline ensures high-quality, reproducible data suitable for a wide range of neurological and psychiatric research applications. Its fixed sequence of preprocessing steps minimizes user-induced variability, facilitating consistent results across studies. While the pipeline demonstrates strong performance in various clinical contexts, including stroke and chronic pain research, future work should focus on validating its applicability across diverse experimental paradigms and multi-site studies. Overall, PIPEMAT-RS offers a structured and well-documented alternative for EEG preprocessing, designed to enhance data quality, reproducibility, and accessibility across studies.

Disclosures

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgements

Specifically, LMM was supported by a postdoctoral research grant #21/05897-5, São Paulo Research Foundation (FAPESP). AC was supported by a scientific initiation grant #21/12790-2, São Paulo Research Foundation (FAPESP). SPB was supported by a postdoctoral research grant #20/08512-4, São Paulo Research Foundation (FAPESP). FF and LRB are supported by research grant #17/12943-8, São Paulo Research Foundation (FAPESP). Individually, FF received support from NHI 2020 R01 AT, Project #1R01AT009491-01A1.

Materials

NameCompanyCatalog NumberComments
MATLAB MathWorksR2020a or newerRequired for executing the PIPEMAT-RS script.
EEG Recording SystemBrain Productshttps://www.brainproducts.com/EEG acquisition system used for data collection. Other brands  include BioSemi / ANT Neuro (or equivalent) 
EEGLAB ToolboxSwartz Center for Computational NeuroscienceN/AOpen-source MATLAB toolbox for EEG analysis.
Electrodes (Ag/AgCl)Brain Products https://www.brainproducts.com/solutions/r-net/Used in EEG data acquisition. Other brands  include BioSemi / ANT Neuro (or equivalent) 
ICLabel PluginSwartz Center for Computational NeuroscienceN/AAutomated artifact classification tool for EEG.
PIPEMAT-RS ScriptN/AN/ACustom MATLAB script for standardized EEG preprocessing.
Signal AmplifierBrain Products https://www.brainproducts.com/solutions/#amplifiersAmplifies EEG signals for processing. Other brands  include BioSemi / ANT Neuro (or equivalent) 
Standard 64-Channel EEG CapBrain Products https://www.brainproducts.com/solutions/#electrodes-capsElectrode cap for EEG recording. Other brands  include BioSemi / ANT Neuro (or equivalent) 

References

  1. Niedermeyer, E., da Silva, F. L. Electroencephalography: basic principles, clinical applications, and related fields. , Lippincott Williams and Wilkins. Philadelphia, PA. (2004).
  2. Delorme, A., Makeig, S. EEGLAB: an open-source toolbox for analysis of single-trial EEG dynamics including independent component analysis. J Neurosci Methods. 134 (1), 9-21 (2004).
  3. Cohen, M. X. Analyzing neural time series data: theory and practice. , MIT Press. (2014).
  4. Buzsáki, G., Anastassiou, C. A., Koch, C. The origin of extracellular fields and currents-EEG, ECoG, LFP and spikes. Nat Rev Neurosci. 13 (6), 407-420 (2012).
  5. Nunez, P. L., Srinivasan, R. Electric fields of the brain: the neurophysics of EEG. , Oxford University Press. (2006).
  6. Gratton, G. Brain reflections: a circuit-based framework for understanding information processing and cognitive control. Psychophysiology. 55 (3), e13038(2018).
  7. Bigdely-Shamlo, N., et al. The PREP pipeline: standardized preprocessing for large-scale EEG analysis. Front Neuroinform. 9, 16(2015).
  8. Pernet, C. R., Chauveau, N., Gaspar, C., Rousselet, G. A. LIMO EEG: a toolbox for hierarchical linear modeling of electroencephalographic data. Comput Intell Neurosci. 2011, 831409(2011).
  9. Onton, J., Makeig, S. Independent component analysis for EEG artifacts. Neuroimage. 15 (3), 789-801 (2006).
  10. Delorme, A., Miyakoshi, M., Jung, T. P., Makeig, S. Grand average ERP-image plotting and statistics: a method for comparing variability in event-related single-trial EEG activities across subjects and conditions. J Neurosci Methods. 210 (2), 132-145 (2012).
  11. Debener, S., Thorne, J., Schneider, T. R., Viola, F. C. Using ICA for the analysis of multi-channel EEG data. Simultaneous EEG and FMRI. , Springer. New York, NY. (2010).
  12. Luck, S. J. An introduction to the event-related potential technique. , MIT Press. (2014).
  13. Cohen, M. X. Where does EEG come from and what does it mean. Trends Neurosci. 40 (4), 208-218 (2017).
  14. Keil, A., et al. Committee report: publication guidelines and recommendations for studies using electroencephalography and magnetoencephalography. Psychophysiology. 51 (1), 1-21 (2014).
  15. Gramfort, A., et al. MEG and EEG data analysis with MNE-Python. Front Neurosci. 7, 7(2013).
  16. Pernet, C., et al. Issues and recommendations from the OHBM COBIDAS MEEG committee for reproducible EEG and MEG research. Nat Neurosci. 23 (12), 1473-1483 (2020).
  17. Oostenveld, R., et al. FieldTrip: open-source software for advanced analysis of MEG, EEG, and invasive electrophysiological data. Comput Intell Neurosci. 2011, 156869(2011).
  18. Bailey, N. W., et al. Introducing RELAX: an automated preprocessing pipeline for cleaning EEG data-Part 1: algorithm and application to oscillations. Clin Neurophysiol. 149, 178-201 (2023).
  19. Pedroni, A., Bahreini, A., Langer, N. Automagic: standardized preprocessing of big EEG data. Neuroimage. 200, 460-473 (2019).
  20. da Cruz, J. R., et al. An automatic preprocessing pipeline for EEG analysis (APP) based on robust statistics. Clin Neurophysiol. 129 (7), 1427-1437 (2018).
  21. Bailey, N. W., et al. EEG is better when cleaning effectively targets artifacts. bioRxiv. , 2024-2106 (2024).
  22. Global EEG devices market report. , Grand View Research. Available at: https://www.grandviewresearch.com (2021).
  23. Makoto's preprocessing pipeline. , Available at: https://sccn.ucsd.edu/wiki/Makoto's_preprocessing_pipeline (2015).
  24. Winkler, I., et al. On the influence of high-pass filtering on ICA-based artifact reduction in EEG-ERP. Annu Int Conf IEEE Eng Med Biol Soc. 2015, 4101-4105 (2015).
  25. Gramfort, A., et al. Time-frequency mixed-norm estimates: sparse M/EEG imaging with non-stationary source activations. Neuroimage. 70, 410-422 (2013).
  26. Delorme, A., Sejnowski, T., Makeig, S. Enhanced detection of artifacts in EEG data using higher-order statistics and independent component analysis. Neuroimage. 34 (4), 1443-1449 (2007).
  27. Marques, L. M., et al. Resting-state EEG as biomarker of maladaptive motor function and depressive profile in stroke patients. Clin EEG Neurosci. 55 (4), 496-507 (2024).
  28. Lacerda, G. J., et al. A neural signature for brain compensation in stroke with EEG and TMS: insights from the DEFINE cohort study. Neurophysiol Clin. 54 (5), 102985(2024).
  29. Camargo, L., et al. Adaptive and compensatory neural signatures in fibromyalgia: an analysis of resting-state and stimulus-evoked EEG oscillations. Biomedicines. 12 (7), 1428(2024).
  30. Barbosa, S. P., et al. Resting-state electroencephalography delta and theta bands as compensatory oscillations in chronic neuropathic pain: a secondary data analysis. Brain Netw Modul. 3 (2), 52-60 (2024).
  31. Simis, M., et al. Deficit of inhibition as a marker of neuroplasticity (DEFINE study) in rehabilitation: a longitudinal cohort study protocol. Front Neurol. 12, 695406(2021).
  32. Pion-Tonachini, L., Kreutz-Delgado, K., Makeig, S. ICLabel: an automated electroencephalographic independent component classifier, dataset, and website. Neuroimage. 198, 181-197 (2019).
  33. Jaramillo-Jimenez, A., et al. Reproducible python workflow for multi-site resting-state EEG analysis. Alzheimer's Dement. 19, e076353(2023).
  34. Levin, A. R., et al. BEAPP: the batch electroencephalography automated processing platform. Front Neurosci. 12, 513(2018).

Reprints and Permissions

Request permission to reuse the text or figures of this JoVE article

Request Permission

Explore More Articles

NeuroscienceEEGpreprocessing pipelineMATLABresting state EEGartifact rejectionindependent component analysisPIPEMAT RS

This article has been published

Video Coming Soon

JoVE Logo

Privacy

Terms of Use

Policies

Research

Education

ABOUT JoVE

Copyright © 2025 MyJoVE Corporation. All rights reserved