Cere-MEG-Bellum (CMB)
CMB is a Python package for fitting a high-resolution cerebellar atlas to standard MRI (ARCUS) and MEG/EEG source space computation including the cerebellum.
Currently under active development: API may change without notice. Please report any issues or feature requests on the GitHub issue tracker.
For more information about the method, please see:
Samuelsson, J. G., J. D.Schmahmann, M. I.Sereno, B.Rosen, and M. S.Hämäläinen. 2026. “A Digital Anatomical Atlas of the Human Cerebellum at Subfolial Resolution.” Human Brain Mapping 47, no. 4: e70497. https://doi.org/10.1002/hbm.70497.
Features
- Automatic segmentation of cerebellar lobules using a trained nnU-Net model
- Diffeomorphic registration (ANTs SyNCC) of a high-resolution cerebellar template to subject anatomy
- Construction of cerebellar cortical source spaces compatible with MNE-Python
- Visualization of cerebellar data in normal, inflated, and flatmap views
Documentation
The full documentation, including the API reference, is available at ceremegbellum.readthedocs.io.
Requirements
- Python >= 3.10
- nnU-Net (v1) (installed automatically as a dependency)
- FreeSurfer (not required to run the package, but
recon-alloutputs are required)
Installation
-
Create a new virtual environment for Cere-MEG-Bellum and activate it. You can do this, for example, with uv (recommended!), venv or conda.
uvandcondaare good options because they can also manage the Python version without depending on system Python.# uv uv venv cmb-env --python 3.12 --seed source cmb-env/bin/activate # conda conda create -n cmb-env python=3.12 pip conda activate cmb-env # venv python -m venv cmb-env source cmb-env/bin/activate
-
Install the correct PyTorch version for your hardware. Look up the exact installation command on the PyTorch website. Here is an example command for NVIDIA GPUs with CUDA 12.6 support.
# NOTE: PyTorch website may use pip3. # Inside virtual environment pip and pip3 are the same. pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126 # Or use uv for faster installation! uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126
-
Install Cere-MEG-Bellum and rest of the dependencies from PyPI.
pip install "cmb[viz]" # Or use uv for faster installation! uv pip install "cmb[viz]"
This installs the core package plus PyVista for 3D visualization. If you don't need 3D views (normal/inflated) and only want flatmaps, you can use
pip install cmbinstead.To use the non-blocking Qt window (
backend="pyvistaqt"inplot_normal/plot_inflated), installpip install "cmb[viz-qt]", which adds pyvistaqt and the PySide6 Qt binding. If you prefer another Qt binding (e.g. PyQt6), installpip install "cmb[viz]" pyvistaqt pyqt6instead.
Quick start
See examples/example_script.py for a complete end-to-end example using the MNE sample dataset.
For developers
Installation for development
Follow steps 1 and 2 from regular installation, then install the package from source with all optional dependencies and developer tools:
git clone https://github.com/johnsam7/ceremegbellum.git
cd ceremegbellum
pip install -e ".[dev,viz-qt]"
# or
uv pip install -e ".[dev,viz-qt]"
-e flag stands for editable mode (changes to source code will be reflected immediately).
Running tests
# Runs all the tests, including those that need data.
pytest tests/
# Runs only the tests that don't need data (and are faster).
pytest tests/ -m "not requires_data"
Building the documentation
The documentation is built with Sphinx and hosted on
Read the Docs. The front page is generated from this README,
and the API reference from the NumPy-style docstrings. The documentation dependencies are included in
the dev extra.
cd docs
make html # on Windows use 'make.bat html'
Then view the built html documentation by opening file docs/build/html/index.html in a web browser.
Type checking, linting, and formatting
# Type checking
pyright
# Linting
ruff check .
# Fixing linting errors
ruff check --fix .
# Checking formatting
ruff format --check .
# Fixing formatting
ruff format .
License
CMB is licensed under the MIT License.
Copyright (c) 2021-2026, authors of CMB. All rights reserved.
Metadata
Release files for cmb 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cmb-0.1.1.tar.gz | 39.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmb-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.5 kB
Release files / cmb-0.1.1.tar.gz
| Download URL | cmb-0.1.1.tar.gz |
|---|---|
| Size | 39.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c39eda4b10488884c98a76d92a4f45fce6327a463a2081a788c2faa194e766d
|
|
BLAKE2b-256 checksum How to use checksums |
b38cef43dd7fad977d65ecaf6c67640546593e327dd5d27faeca58c4a77cd11a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cmb-0.1.1-py3-none-any.whl
| Download URL | cmb-0.1.1-py3-none-any.whl |
|---|---|
| Size | 38.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f849e3dc052aa760a1f2a76c63dbe9a3dffd0404dbb621b6bcf3fea436bcd286
|
|
BLAKE2b-256 checksum How to use checksums |
1554b46c42a7c433565715e2e84e93b384cff77cbdb61f7717b01f3d6c4547a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|