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)
| File | Size | Uploaded | |
|---|---|---|---|
| brainchop-0.2.5.tar.gz | 41.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|