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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
brainchop-0.2.5.tar.gz
(41.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
brainchop-0.2.5-py3-none-any.whl
(38.7 kB
view details)
File details
Details for the file brainchop-0.2.5.tar.gz.
File metadata
- Download URL: brainchop-0.2.5.tar.gz
- Upload date:
- Size: 41.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e62259f96947323968e26ee093a7ed1da3f81b36d135303af7997908a96cdbd9
|
|
| MD5 |
297d9ecabc73774a02fbcc6c9c1786de
|
|
| BLAKE2b-256 |
48dfeba84c62ce0491a9ba8275e38ccebfac86b1d8c08179230d7da5610e9e17
|
File details
Details for the file brainchop-0.2.5-py3-none-any.whl.
File metadata
- Download URL: brainchop-0.2.5-py3-none-any.whl
- Upload date:
- Size: 38.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
564c8775f0758c34449f2702384112c1f9af9f91156fc462e53303f70180ae0b
|
|
| MD5 |
26ea16a95d02a2e814b944e8d21f5d0f
|
|
| BLAKE2b-256 |
0eb73af6cf406ba2a50a441b63e9a9a61618d288c5f889a23141bdb78d17e1cd
|