Skip to content

mne-tools/mne-icalabel

mne-icalabel

Ruff Code style: black Imports: isort Codecov tests doc PyPI version PyPI Download count Conda Version Conda Downloads Conda Platforms JOSS

This repository is a conversion of the popular Matlab-based ICLabel classifier for Python. In addition, mne-icalabel provides extensions and improvements in the form of other models.

Why?

EEG and MEG recordings include artifacts, such as heartbeat, eyeblink, muscle, and movement activity. Independent component analysis (ICA) is a common method to remove artifacts, but typically relies on manual annotations labelling which independent components (IC) reflect noise and which reflect brain activity.

This package aims at automating this process, using the popular MNE-Python API for EEG, MEG and iEEG data.

Basic Usage

MNE-ICALabel estimates the labels of ICA components given a MNE-Python Raw or Epochs object and an ICA instance using the ICA decomposition available in MNE-Python.

from mne_icalabel import label_components

# assuming you have a Raw and ICA instance previously fitted
label_components(raw, ica, method='iclabel')

The only current available method is 'iclabel'.

Documentation

Stable version documentation. Dev version documentation.

Installation

The current stable release of mne-icalabel can be installed with pip, for example, by running:

pip install mne-icalabel

For further details about installation, see the install page.

To get the latest (development) version, using git, open a terminal and type:

git clone git://github.com/mne-tools/mne-icalabel.git
cd mne-icalabel
pip install -e .

The development version can also be installed directly using pip:

pip install https://api.github.com/repos/mne-tools/mne-icalabel/zipball/main

Alternatively, you can also download a zip file of the latest development version.

Contributing

If you are interested in contributing, please read the contributing guidelines.

Getting Help

MNE Forum

For any usage questions, please post to the MNE Forum. Be sure to add the mne-icalabel tag to your question.

Citing

If you use the ICLabel model, please consider citing our paper:

Li et al., (2022). MNE-ICALabel: Automatically annotating ICA components with ICLabel in Python. Journal of Open Source Software, 7(76), 4484, https://doi.org/10.21105/joss.04484

with the corresponding BibTex:

@article{Li2022,
    doi       = {10.21105/joss.04484},
    url       = {https://doi.org/10.21105/joss.04484},
    year      = {2022},
    publisher = {The Open Journal},
    volume    = {7},
    number    = {76},
    pages     = {4484},
    author    = {Adam Li and Jacob Feitelberg and Anand Prakash Saini and Richard Höchenberger and Mathieu Scheltienne},
    title     = {MNE-ICALabel: Automatically annotating ICA components with ICLabel in Python},
    journal   = {Journal of Open Source Software}
}

Future versions of the software are aimed at improved models and may have different papers associated with it.