$$\rightleftharpoonup{xx}$$
$$\longleftharp{xx}$$,
$$\longrightharp{xx}$$,
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.