This is a workflow that automatically preprocess, analyzes and visualizes resting state EEG data in Matlab using EEGLab and FieldTrip toolboxes. It has been tested on the LEMON dataset and the Chronic Pain EEG dataset.
The input data needs to be raw EEG data in BIDS format, please check that you comply with the standard with the BIDS validator. The output data are the preprocessed EEG data, the below mentioned EEG features, and a visualization of the results in form of a PDF report for each recording.
- Downsampling (optional)
- Line noise removal
- High pass filtering and bad channel removal
- Re-referencing to the average reference
- Independent Component Analysis automatic detection and removal of artifactual independent components
- Interpolation of rejected bad channels
- Detection and rejection of bad time segments
- Segmentation into epochs
- Power spectrum (sensor space)
- Alpha Peak Frequency (sensor space)
- Power topographies (source space)
- Functional connectivy (source space): phase-based (dwPLI) and amplitude-based (oAEC)
- Brain network characteristics (source space): two local graph theory measures (degree, clustering coefficient) and three global measures (global clustering coefficient, global efficiency, smallworldness).
Brain features in the source space are computed separately for four frequency bands of interest (theta, alpha, beta and gamma).
- Matlab with Signal Processing and Statistical and Machine Learning Toolboxes (Developed and tested on R2020b; also tested in R2022a)
- EEGLab (Developed and tested with v2022.0) The following EEGlab plugins need to be installed:
- bids-matlb-tool v6.1
- bva-io if your data is in BVA format v1.7
- clean_rawdata v2.7
- cleanline v2.0
- dipfilt v4.3
- firfilt v2.4
- ICLabel v1.3
- Fieldtrip (tested with fieldtrip-20220104)
- Brain connectivity toolbox (Developed and tested with version 2019_03_03)
- Download the pipeline code here
- Download Matlab and the above listed Matlab toolboxes
- Download EEGLab
- Download the aforementioned EEGlab plugins via the EEGLab GUI or in the provided URL. If you choose the second option, add them to the eeglab/plugins folder. Note that in eeglab/plugins there must not be a same-named subfolder for any plugin (e.g. eeglab/plugins/clean_rawdata-master/clean_rawdata is NOT correct; it should be eeglab/plugins/clean_rawdata).
- Change EEGLab preferences in EEGLab GUI. Make sure that the box 'Keep at most one dataset in memmory' is selected.
- Download FieldTrip
- Download the BCT toolbox
- Update the path of the toolboxes in
define_params.m
- Read the
define_params.m
file and change the settings according to your needs. The minimum parameters that need to be specified are:- Your study name in
params.study
- The path to your BIDS raw data in
params.raw_data_path
- Your study name in
- Run
main_pipeline.m
- By default the output of the pipeline will be found in a subfolder of your raw data folder called 'derivatives_vYYYY_MM_DD'
Cristina Gil Ávila, cristina.gil@tum.de
For bugs or problems contact cristina.gil@tum.de or open an issue here
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.