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

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

Model CLI / Python name Executable Channels / Classes Purpose
MindGrab mindgrab (--skull-strip) brainchop-mindgrab 15ch / 2-class Modality-agnostic skull stripping & brain masking (--mask, --border, --crop)
MindMap Fast mindmap-fast (default) brainchop-mindmap-fast 16ch / 18-class (v3.5) Fast 18-class cortical & subcortical segmentation (16chan18cls alias)
MindMap-18 mindmap brainchop-mindmap 24ch / 18-class (v4.0 Gold) High-accuracy 18-class segmentation + CAT-lite GM/WM/CSF tissue fractions (--pve)
MindSnap-104 mindsnap brainchop-mindsnap 24ch / 104-class (v4.0 Gold) Full 104-class Desikan-Killiany cortical & subcortical parcellation

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_arm64, linux_x86_64) install in ~2 seconds with zero runtime dependencies (no PyTorch, no tinygrad, no CUDA Toolkit, no compiler needed). 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 V4 engine (with automatic low-memory staging for mobile & integrated GPUs), 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 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 fast segmentation (MindMap Fast v3.5)
brainchop input.nii.gz -o labels.nii.gz

# High-accuracy 18-class segmentation (MindMap-18 v4.0 Gold)
brainchop input.nii.gz -m mindmap -o labels.nii.gz

# Continuous GM / WM / CSF / Brain partial-volume maps (CAT-lite)
brainchop input.nii.gz -m mindmap --pve -o tissues.nii.gz

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

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

# Reslice label output back to original input voxel grid
brainchop input.nii.gz -m mindmap --inverse-conform -o labels_native.nii.gz

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

Output space: The Python brainchop wrapper preserves historical brainchop-cli behavior (label outputs in conformed 256³ space by default; pass --inverse-conform for native input space). Standalone native executables (brainchop-mindmap, etc.) default to input space (pass --save-conform for conformed 256³ space). 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")          # or pass a path / list of paths directly
bc.save(labels, "labels.nii.gz")

# Native input-space output
labels_native = bc.segment("input.nii.gz", "mindsnap", inverse_conform=True)

# CAT-lite GM/WM/CSF/Brain 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 for the browser ES module package supporting client-side 3D segmentation on pure-JS WebGPU V4 (including automatic low-memory staging for mobile & integrated GPUs), WebGL2, and multi-threaded WebAssembly CPU.

Compute Backends & Performance

brainchop automatically picks the fastest validated backend on your machine and falls back cleanly to multi-threaded CPU (--no-turbo switches from the default fast 8-bit activation path to exact fp32/fp16 math):

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+) Yes 8-bit Turbo (~0.8–1.2 s for 24ch models 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

Documentation

Citation

If you use BrainChop in academic work, please cite the BrainChop project (see CITATION.cff):

@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.0.0

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.0.0
File Size Uploaded Provenance Actions
brainchop-1.0.0.tar.gz 6.2 MB With provenance Details for brainchop-1.0.0.tar.gz

Built distributions (wheels)

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

Total release size: 39.5 MB

Release files / brainchop-1.0.0.tar.gz

Download URL brainchop-1.0.0.tar.gz
Size 6.2 MB
Tags Source
SHA-256 checksum
How to use checksums
2aeb531ad147835969a225f92864241794df640dbb89fc6dd0c419fc78005f4c
BLAKE2b-256 checksum
How to use checksums
db66175ba9120dfe9ad358225287b0516046b6b130953e312fc7fb11f8cb9bde
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 22, 2026.

Transparency log

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

Download URL brainchop-1.0.0-py3-none-win_amd64.whl
Size 12.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
3faedcbf51510bd6715f163e365b4c6095d786a56110d79063272fb798955eb2
BLAKE2b-256 checksum
How to use checksums
77d8f51a47189b89e0ff8471015ac6fc377b6e65521618aafa3234588fdf8e79
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 22, 2026.

Transparency log

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

Download URL brainchop-1.0.0-py3-none-manylinux_2_28_x86_64.whl
Size 12.1 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
18b8694747bf313a79ca7d4a5aa5472ce2b1ba5fd874f211495c3671d6e29889
BLAKE2b-256 checksum
How to use checksums
90d0111df1a124f6bbb929c1be2a74538431ea51d7f3606ab2ae6c46870a47f4
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 22, 2026.

Transparency log

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

Download URL brainchop-1.0.0-py3-none-macosx_14_0_arm64.whl
Size 8.8 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
120c1e1a4ccc962447754bc36dfcab9c713d09778014975158b48e48b760fd47
BLAKE2b-256 checksum
How to use checksums
fffb021cc0cd00d376f1bbf2254e1583d701489ec72faaa780a66d232e3ba03d
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 22, 2026.

Transparency log

Security for brainchop 1.0.0

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.0.0.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 22, 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.0.0 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