Skip to main content

BrainChop

BrainChop Core

Fast, zero-dependency 3D brain segmentation and skull stripping for desktops, HPC clusters, Python pipelines, and web browsers.

CI PyPI npm brainchop.org License: MIT

Powered by four embedded 3D MeshNet models with no PyTorch, TensorFlow, tinygrad, CUDA Toolkit, or Python ML stack required at runtime.

Embedded Models & Model Cards

All four models are compiled directly into self-contained binaries (no separate weight downloads or cache directories):

CLI / API name Paper name Executable Params Classes Intended Input Purpose & Notes
mindgrab (--skull-strip) MindGrab brainchop-mindgrab 145K 2 T1, T2, FLAIR, DWI, EPI, MRA, PDw, qT1, CT, PET Modality-agnostic skull stripping & brain masking (--mask, --border, --crop)
mindmap (default) MindMap-24 brainchop-mindmap 188K 18 3D T1w MRI Primary cortical & subcortical segmentation; optional experimental GM/WM/CSF tissue fractions (--pve)
mindsnap MindSnap-104 brainchop-mindsnap 190K 104 3D T1w MRI Desikan-Killiany cortical + subcortical + 5-part corpus callosum parcellation
mindmap-fast MindMap-16 brainchop-mindmap-fast 84K 18 3D T1w MRI Fast lightweight 18-class preview (16chan18cls alias); not recommended for hippocampal atrophy morphometry

Training & label provenance: mindmap, mindsnap, and mindmap-fast are trained on synthetic and T1w brain volumes supervised with FreeSurfer-convention anatomical parcellation labels; mindgrab is trained on multi-contrast synthetic and multi-modal neuroimaging volumes (Fani et al., 2026). The companion manuscript also evaluates a 50-class variant (MindSnap-50), omitted from this default runtime bundle to keep package footprints small.

Validation Summary & Known Limitations

Metrics below are from the locked evaluation ledger (v3.8 spec / v4.0 release weights; exact checkpoint checksums in Weight Provenance):

Benchmark mindmap mindsnap mindmap-fast SynthSeg 2.0 FastSurferVINN 2.4.2
6 Manual-Label Cohorts Mean Dice (Mindboggle, IBSR18, LPBA40, HiSUB25, MALC-35, Hammers) 0.792 0.790 0.790 0.801 0.803
Mindboggle-101 Shared-11 Manual Dice 0.829 0.826 0.822 0.827 0.843
Mindboggle-101 Cortical DKT-62 Dice (FS-initialized GT) — 0.720 — 0.714 (--parc) 0.824
EADC-ADNI HarP (N=135) Hippocampal Asymmetry Pearson r 0.794 0.684 0.009 0.792 0.811
OASIS-TRT-20 Scan–Rescan Repeatability (Shared-11 AVD ↓) 2.21% 2.26% 2.66% — 3.38%
Ultra-Low-Field 64 mT MRI (ds006557, N=23, 2.34 mm vs paired 3T FastSurfer ref) 0.636 0.649 0.627 0.621 0.397
Severe Acquisition Noise (10% head-masked noise, Mindboggle N=20, Shared-11 Dice) 0.819 0.808 0.813 0.784 0.796
Same-Laptop Apple M1 (16 GB) Runtime & Peak Memory (WebGPU vs CPU / MPS) 3.8 s (1.6 GiB) 3.9 s (1.6 GiB) 2.3 s (1.3 GiB) 656 s (16.7 GiB, swaps) 311 s (8.4 GiB)

(Bold indicates the best value in each row. On the 16 GB Apple M1 laptop, SynthSeg 2.0's 16.7 GiB peak footprint exceeds physical RAM and triggers macOS swap.)

Known limitations:

  • Thick-slice clinical scans (5 mm): SynthSeg 2.0 (0.791) and FastSurferVINN (0.789) outperform isotropic-trained BrainChop (0.734–0.739) on heavily anisotropic 5 mm acquisitions.
  • Sub-voxel grid shifts & large head tilts: Inference runs directly on a single conformed 1 mm 256³ grid without affine registration or test-time augmentation, so sub-voxel padding/grid shifts or large head tilts can reduce boundary overlap compared to scan–rescan repeatability.
  • mindmap-fast hippocampal atrophy: mindmap-fast does not include the atrophy-repaired training regime (HarP asymmetry r = 0.009); use mindmap or mindsnap for hippocampal morphometry or dementia cohorts.
  • Experimental --pve tissue fractions: Continuous GM/WM/CSF/Brain probability maps (mindmap --pve / segmentTissues) are experimental and have not yet been quantitatively benchmarked against CAT12 or FSL FAST.

Weight Provenance (SHA-256)

Every binary and npm asset in this repository is built directly from the verified files below:

Model Paper Checkpoint Shipped model.bin (SHA-256) Shipped model.safetensors FP16 (SHA-256) Locked .pth (SHA-256)
mindgrab MindGrab (NeuroImage 2026) c9a01490fe2d13acc1515fd019b69db176ebe6f40c9b84aeb77f25acbc2ee0f3 21bf4c811a4790fa2498a49f2aa9042f9108964111b54a006fde1194b0e0e7b9 —
mindmap MindMap-24 58006d1951212bf33695a8f4409823e872902a6e060b21e87d3fd65c1eb7c4e5 b86e11e7884061b81c2ac6d253c90933a3651e0accb7657b9c90f98afcee76ef f6b60026daccabc689ff56bbadd5c1141a5645529f75eb998fe58426ac7f1b48
mindsnap MindSnap-104 995cdb522ba941b41ba7ab61d0484e8700f6c3d6084398ce28c6ce75d1ca2a1a e485cac1ffc5bfc55a9cbca848d4fdae4a99a9f06cdec7e5d55e7801b9e44540 6b713d9d995bcce0ad5dd6c129f022aeb0241812f5acf64610f4a43ea6544bbc
mindmap-fast MindMap-16 22d73f439fbf4e4195adbd68f813f3c433b2d3f336d48a097ce7fb83bc5785b6 aa0ea2e4a4f1fdffadf0bcb957f8aa5c13efd3dc4e7f85a39df2ae8690a6748f 5b8aade1940ae11ddd472a5a212da2a5b7d16f3ceec4f6884bcfe99f7f1bdfe5

Quick Install

Python / PyPI (Zero ML Dependencies)

pip install brainchop

# Or run immediately with uv (no virtualenv required)
uvx brainchop input.nii.gz -o labels.nii.gz

Prebuilt wheels (win_amd64, macosx_14_0_arm64, manylinux_2_28_x86_64) install in ~2 seconds with zero runtime dependencies (no PyTorch, no tinygrad, no CUDA Toolkit, no compiler needed). GPU backends (Metal, CUDA, HIP) run at full native speed in prebuilt wheels; for peak CPU-only throughput on newer hosts (e.g., Apple SME or x86-64 AVX-512 VNNI), build locally via pip install --no-binary brainchop brainchop or make -C src so the compiler targets your host CPU ISA rather than a portable baseline. On macOS 13.2–13.x Apple Silicon, pip falls back to a local source build (or install via Homebrew / the signed .pkg below), because PEP 425 wheel tags require minor version 0 on macOS 11+ (macosx_14_0_arm64). Source installs automatically detect your CPU/GPU (Apple Metal, NVIDIA CUDA Driver API, AMD ROCm HIP) and compile locally. See docs/pypi.md for details.

Homebrew (macOS & Linux)

brew install neuroneural/tap/brainchop

Browser / JavaScript (npm)

npm install @brainchop/core

Pure-JS WebGPU engine with automatic low-memory staging, plus WebGL2 and multi-threaded WebAssembly CPU fallbacks. See js/README.md for browser API usage.

Standalone Native Binaries (Zero Python)

Download signed macOS Apple Silicon .pkg installers (macOS 13.2+) or self-contained Linux / Windows archives from GitHub Releases. Each archive includes the brainchop dispatcher plus all four standalone executables.

Build from Source

make -C src -j4

Requires only a C11 compiler (clang or gcc) and system zlib. Builds all four model executables and the zero-dependency brainchop dispatcher.

Usage

Command Line

# Default 18-class cortical & subcortical segmentation (mindmap)
brainchop input.nii.gz -o labels.nii.gz

# 104-class Desikan-Killiany parcellation (mindsnap)
brainchop input.nii.gz -m mindsnap -o parcels.nii.gz

# Fast lightweight 18-class segmentation (mindmap-fast)
brainchop input.nii.gz -m mindmap-fast -o labels_fast.nii.gz

# Experimental continuous GM / WM / CSF / Brain partial-volume maps
brainchop input.nii.gz -m mindmap --pve -o tissues.nii.gz

# Skull stripping + binary brain mask (mindgrab)
brainchop input.nii.gz --skull-strip --mask brain_mask.nii.gz -o stripped.nii.gz

# Keep label output in conformed 256^3 1 mm space instead of input space
brainchop input.nii.gz -m mindmap --save-conform -o labels_conformed.nii.gz

# List embedded models or inspect GPU adapters
brainchop --list
brainchop-mindmap -a -1

Unified output space: Every interface — the Python brainchop CLI, import brainchop, standalone native executables (brainchop-mindmap, etc.), and @brainchop/core — writes outputs in the original input voxel grid by default. Pass --save-conform (save_conform=True in Python, saveConform: true in JS) to keep conformed 256³ outputs. (--inverse-conform is still accepted as a no-op compatibility flag.) mindgrab always writes in input space.

Python API

The import brainchop scripting interface requires zero external packages (numpy is optional; when installed, vol.data returns a numpy.ndarray):

import brainchop as bc

print(bc.list_models())

vol = bc.load("input.nii.gz")
labels = bc.segment(vol, "mindmap")          # default: native input space
bc.save(labels, "labels.nii.gz")

# Optional conformed 256^3 output
labels_conf = bc.segment("input.nii.gz", "mindsnap", save_conform=True)

# Experimental GM/WM/CSF/Brain partial-volume tissue fractions
tissues = bc.segment("input.nii.gz", "mindmap", pve=True)
bc.save(tissues["gm"], "gm.nii.gz")

Browser / JavaScript (WebGPU + WebGL2 + WASM CPU)

Install @brainchop/core via npm (npm install @brainchop/core) — see js/README.md.

Compute Backends, Precision & Provenance

brainchop automatically picks the fastest validated backend on your machine and falls back cleanly to multi-threaded CPU:

Backend Hardware Auto-Selected Notes
CUDA NVIDIA GPUs (sm60–sm90+, Driver API >= 12.8) Yes Embedded offline fatbins — no CUDA Toolkit or nvcc required
HIP AMD Radeon (gfx1151 / ROCm) Yes Embedded HSACO artifacts — no hipcc required
Metal Apple Silicon (macOS 13.2+ native / 14+ wheel) Yes 8-bit Turbo (~0.8–1.2 s for mindmap/mindsnap on M-series) & exact fp16
CPU Apple SME / NEON, x86-64 AVX-512 VNNI / AVX-VNNI / AVX2+FMA Yes 8-bit Turbo & bit-exact fp32 across compilers/architectures
OpenCL Explicit opt-in (--backend opencl) No Available via -backend opencl when explicitly requested

Cross-platform determinism, NIfTI headers & provenance:

  • Both the default 8-bit activation path (turbo) and GPU FP16 paths can differ at a small fraction of boundary voxels across GPU/CPU architectures (typical whole-brain voxel agreement >99.9%). For longitudinal or multi-site studies, pin a single backend across the cohort — or pass -cpu 0 --no-turbo for bit-exact FP32 CPU reproducibility across machines.
  • Every output NIfTI-1 file stamps provenance into its 80-byte descrip header field in the form:
    brainchop <version> <model>/<sha256[:8]> <backend>[ <mode>]
    
    where <sha256[:8]> is the first 8 lowercase hex characters of the shipped model.bin SHA-256 digest (matching Weight Provenance above), so outputs uniquely identify both the exact weights and execution backend even when checkpoints are updated between version bumps (e.g., brainchop 1.1.1 mindmap/58006d19 metal turbo, brainchop 1.1.1 mindsnap/995cdb52 cpu exact, brainchop 1.1.1 mindmap/58006d19 metal pve, brainchop 1.1.1 mindmap/58006d19 webgpu).
  • Output intent_code follows NIfTI-1 conventions: categorical label volumes (mindmap, mindsnap, mindmap-fast) and mindgrab --mask set NIFTI_INTENT_LABEL (1002); continuous partial-volume maps (--pve) and raw --export-classes maps set NIFTI_INTENT_NONE (0); mindgrab skull-stripped intensity outputs preserve the input volume's intent and datatype.

Documentation

Citation

If you use BrainChop Core in published research, please cite the relevant papers below (see also CITATION.cff):

  1. MindGrab (mindgrab skull stripping): Armina Fani, Mike Doan, Isabelle Le, Alex Fedorov, Malte Hoffmann, Chris Rorden, and Sergey Plis. MindGrab: A spectrally-motivated architecture for accessible deep learning in neuroimaging. NeuroImage, 338:122074, 2026. DOI: 10.1016/j.neuroimage.2026.122074 · ScienceDirect · PubMed (PMID: 42331200)

  2. BrainChop Edge Ecosystem (primary BrainChop reference): Sergey M. Plis, Mohamed Masoud, Farfalla Hu, Taylor Hanayik, Satrajit S. Ghosh, Chris Drake, Roger Newman-Norlund, and Christopher Rorden. Brainchop: Providing an edge ecosystem for deployment of neuroimaging artificial intelligence models. Aperture Neuro, 4, 2024. DOI: 10.52294/001c.123059 · Aperture Neuro

  3. Original BrainChop Software Paper: Mohamed Masoud, Farfalla Hu, and Sergey Plis. Brainchop: In-browser MRI volumetric segmentation and rendering. Journal of Open Source Software, 8(83):5098, 2023. DOI: 10.21105/joss.05098

(Citations for the MindMap and MindSnap segmentation models will be added here upon publication.)

@article{fani2026mindgrab,
  title   = {MindGrab: A spectrally-motivated architecture for accessible deep learning in neuroimaging},
  author  = {Fani, Armina and Doan, Mike and Le, Isabelle and Fedorov, Alex and Hoffmann, Malte and Rorden, Chris and Plis, Sergey},
  journal = {NeuroImage},
  volume  = {338},
  pages   = {122074},
  year    = {2026},
  doi     = {10.1016/j.neuroimage.2026.122074}
}

@article{plis2024brainchop,
  title   = {Brainchop: Providing an edge ecosystem for deployment of neuroimaging artificial intelligence models},
  author  = {Plis, Sergey M. and Masoud, Mohamed and Hu, Farfalla and Hanayik, Taylor and Ghosh, Satrajit S. and Drake, Chris and Newman-Norlund, Roger and Rorden, Christopher},
  journal = {Aperture Neuro},
  volume  = {4},
  year    = {2024},
  doi     = {10.52294/001c.123059}
}

@article{masoud2023brainchop,
  title   = {Brainchop: In-browser MRI volumetric segmentation and rendering},
  author  = {Masoud, Mohamed and Hu, Farfalla and Plis, Sergey},
  journal = {Journal of Open Source Software},
  volume  = {8},
  number  = {83},
  pages   = {5098},
  year    = {2023},
  doi     = {10.21105/joss.05098}
}

Metadata

Release files for brainchop 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brainchop 1.1.1
File Size Uploaded Provenance Actions
brainchop-1.1.1.tar.gz 11.7 MB With provenance Details for brainchop-1.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for brainchop 1.1.1
File Interpreter ABI Platform Actions
brainchop-1.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for brainchop-1.1.1-py3-none-win_amd64.whl
brainchop-1.1.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for brainchop-1.1.1-py3-none-manylinux_2_28_x86_64.whl
brainchop-1.1.1-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details for brainchop-1.1.1-py3-none-macosx_14_0_arm64.whl

Total release size: 71.1 MB

Release files / brainchop-1.1.1.tar.gz

Download URL brainchop-1.1.1.tar.gz
Size 11.7 MB
Tags Source
SHA-256 checksum
How to use checksums
fb3114d7f9973455cef6f25744a4be39f039ce5be04e53b5458596abe11d016a
BLAKE2b-256 checksum
How to use checksums
007f0cfdefcf44affd05aff28150d6a89dbd17676dc7e5d0db6c1d8d8e96f9f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / brainchop-1.1.1-py3-none-win_amd64.whl

Download URL brainchop-1.1.1-py3-none-win_amd64.whl
Size 22.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d1792a5de77d8e229d0649706f0e7cbdec45c8b5d93181610b7523c376bfa492
BLAKE2b-256 checksum
How to use checksums
56a80e91a382632f98b707ff051028e710b286610c91b6a091cde6aa64928a62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / brainchop-1.1.1-py3-none-manylinux_2_28_x86_64.whl

Download URL brainchop-1.1.1-py3-none-manylinux_2_28_x86_64.whl
Size 22.4 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
05c3652a5cc2297b16bb4147c25f8749db4ee73f437debc96132248e6bcd6bd1
BLAKE2b-256 checksum
How to use checksums
7da3127bf41094df1bd2428706b50383128fa48f22cf62e93a3d6266a9cd84eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / brainchop-1.1.1-py3-none-macosx_14_0_arm64.whl

Download URL brainchop-1.1.1-py3-none-macosx_14_0_arm64.whl
Size 14.3 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
52eb9f2ca2d002396056187668f7d483b851ff7009615ce343aae58acfca288c
BLAKE2b-256 checksum
How to use checksums
c07de11a887d65a27a0c95e6413541f7f9c21bb3149bf75c6b07faeddae8842b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for brainchop 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for brainchop-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

4 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page