Skip to main content

BrainChop

BrainChop is a lightweight tool for brain segmentation that runs on pretty much everything.


(NEW) No install single command use

Using uv, brainchop can be ran without needing an enviroment

uvx brainchop --help

## Installation

```bash
pip install brainchop

For development (includes docs, testing):

pip install -e ".[all]"

CLI Usage

# Segment a brain MRI
brainchop input.nii.gz -o output.nii.gz

# List available models
brainchop --list

# Use a specific model
brainchop input.nii.gz -m subcortical -o output.nii.gz

# Skull stripping
brainchop input.nii.gz --skull-strip -o brain.nii.gz

# With BEAM optimization
brainchop input.nii.gz -m tissue_fast --beam 2 -o output.nii.gz

Python API

import brainchop as bc

# List available models
print(bc.list_models())

# Load, segment, save
vol = bc.load("input.nii.gz")
result = bc.segment(vol, "subcortical")
bc.save(result, "output.nii.gz")

# With BEAM optimization
bc.optimize("tissue_fast", beam=2)
result = bc.segment(vol, "tissue_fast")

# Export to WebGPU
bc.export("tissue_fast", "/tmp/export")

Documentation

Serve docs locally:

mkdocs serve -w brainchop/

Docker

git clone git@github.com:neuroneural/brainchop-cli.git
cd brainchop-cli
docker build -t brainchop .

Then to run:

docker run --rm -it --device=nvidia.com/gpu=all -v [[output directory]]:/app brainchop [[input nifti file]] -o [[output nifti file]]

Requirements

  • Python 3.10+
  • tinygrad
  • numpy
  • requests

to use the WEBGPU export backend, also install dawn

brew tap wpmed92/dawn
brew install dawn

License

MIT License

Metadata

Release files for brainchop 0.2.5

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 0.2.5
File Size Uploaded
brainchop-0.2.5.tar.gz 41.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brainchop 0.2.5
File Interpreter ABI Platform
brainchop-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 80.1 kB

Release files / brainchop-0.2.5.tar.gz

Download URL brainchop-0.2.5.tar.gz
Size 41.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e62259f96947323968e26ee093a7ed1da3f81b36d135303af7997908a96cdbd9
BLAKE2b-256 checksum
How to use checksums
48dfeba84c62ce0491a9ba8275e38ccebfac86b1d8c08179230d7da5610e9e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / brainchop-0.2.5-py3-none-any.whl

Download URL brainchop-0.2.5-py3-none-any.whl
Size 38.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
564c8775f0758c34449f2702384112c1f9af9f91156fc462e53303f70180ae0b
BLAKE2b-256 checksum
How to use checksums
0eb73af6cf406ba2a50a441b63e9a9a61618d288c5f889a23141bdb78d17e1cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1.23

2 release files

0.1.21

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

3 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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