Toolkit for pre-processing of intracranial EEG data, and an interactive pipeline for pre-processing method evaluation.
Toolkit available in Matlab and Python, compatible with iEEG.org
pip install
pip install git+https://github.com/penn-cnt/CNT_research_tools.git#subdirectory=python
Alternatively, download or clone the toolbox into a local folder via git, switch to folder, and pip install locally:
git clone [email protected]:haoershi/CNT_research_tools.git
cd CNT_research_tools/python
pip install .
Set Conda Environment
An environment could be set through conda to reduce the likelihood of dependency conflicts and making it easier to set up.
Dependencies:
Create a conda environment and activate:
conda env create -n ieegpy -f ieegpy.yml
conda activate ieegpy
If the above command doesn't work, you can manually create an enviornment and install the necessary libraries:
conda create -n ieegpy python=3.9
conda activate ieegpy
pip install -r requirements.txt
Testing
Run pytest to ensure no running issues. (Getting data may not be tested currently) (Need update for the new system)
Dependencies:
- MATLAB >= R2021b
- Signal Processing Toolbox
- Statistics and Machine Learning Toolbox Toolboxes could be installed via Adds-Ons > Get Adds-Ons.
- IEEG MATLAB Toolbox (Can be downloaded at https://main.ieeg.org/?q=node/29, or we've provided with our toolkit)
Add folder matlab in MATLAB working directory.
addpath(genpath('path/CNT_research_tools/matlab'));
Testing
Run unit tests to ensure no running issues: (Getting data may not be tested currently, need update to the current system)
runtests('matlab/test','IncludeSubfolders',true);
During usage of toolkit, folders users and data would be created under the python/CNTtools or matlab folder to store user login information and data files, respectively.
The toolkit currently depends on ieeg.org.
To access data, please register first on https://www.ieeg.org.
A usr_ieeglogin.bin password file and a usr_config.json file are required in the user folder before data downloading can run correctly.
Files could be automatically generated throught running login configuration and input of username and password.
session = iEEGPreprocess()
session.login_config()
# input of user information
The toolbox includes the following functions:
- Download data from ieeg.org
- Standardize channel labels and identify band channels
- Signal filtering
- Data re-referencing
- Common Average Re-referencing (CAR)
- Bipolar Re-referencing (BR)
- Laplacian Re-referencing (LR)
- Pre-whitening
- Feature extraction
- Connectivity calculation
- Plotting and connectivity heatmap
![](https://private-user-images.githubusercontent.com/116624350/279292428-2e28a994-71ef-4b31-b368-df081b367aa4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjU3OTMsIm5iZiI6MTczOTI2NTQ5MywicGF0aCI6Ii8xMTY2MjQzNTAvMjc5MjkyNDI4LTJlMjhhOTk0LTcxZWYtNGIzMS1iMzY4LWRmMDgxYjM2N2FhNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwOTE4MTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01N2FkNWQ3NjNlZWIxYTVkMWY2MjUzZGQzZGY4YWJhYjIzYzI4NTNkOTM2MDE5YTYzMDc1OGU0ZWFkYjU2OTE0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.b2k9Ljy50-XExzCmBLSbKTp5cJQinVPI7sRpeG6vzFc)
This toolkit provides a recommended usage pipeline in the form of interactive notebooks in both MATLAB and Python.
For illustration, this toolkit is also used for an systematic evaluation of pre-processing methods, as shown in the demo folder.