Metadata-Version: 2.5
Name: biomedparse-mlx
Version: 0.1.2
Summary: Native MLX inference for BioMedParse v2 on Apple Silicon
Author: Joseph Sandoval, Alfredo Sandoval Jr.
License-Expression: Apache-2.0 AND MIT AND BSD-3-Clause
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Classifier: Operating System :: MacOS :: MacOS X
Requires-Python: <3.15,>=3.13
Requires-Dist: medmlx-core==0.2.4
Requires-Dist: nibabel<6,>=5.3
Requires-Dist: numpy<3,>=2
Requires-Dist: pillow<14,>=13
Requires-Dist: pydicom<4,>=3
Requires-Dist: scikit-image<1,>=0.25
Requires-Dist: tokenizers<0.23,>=0.22
Provides-Extra: assets
Requires-Dist: huggingface-hub<2,>=1; extra == 'assets'
Provides-Extra: conversion
Requires-Dist: safetensors<1,>=0.6; extra == 'conversion'
Requires-Dist: torch<3,>=2.6; extra == 'conversion'
Provides-Extra: dev
Requires-Dist: hypothesis<7,>=6.140; extra == 'dev'
Requires-Dist: pyright==1.1.414; extra == 'dev'
Requires-Dist: pytest<10,>=8.4; extra == 'dev'
Requires-Dist: ruff<1,>=0.13; extra == 'dev'
Provides-Extra: oracle
Requires-Dist: fvcore>=0.1.5; extra == 'oracle'
Requires-Dist: hydra-core<2,>=1.3; extra == 'oracle'
Requires-Dist: safetensors<1,>=0.6; extra == 'oracle'
Requires-Dist: simpleitk<3,>=2.4; extra == 'oracle'
Requires-Dist: timm<2,>=1; extra == 'oracle'
Requires-Dist: torch<3,>=2.6; extra == 'oracle'
Requires-Dist: transformers<6,>=5; extra == 'oracle'
Description-Content-Type: text/markdown

# biomedparse-mlx

Segment 3D medical images from text prompts with Microsoft BioMedParse v2 and native MLX.

[Docs](https://github.com/MedMLX/biomedparse-mlx/blob/main/docs/usage.md) · [MedMLX](https://github.com/MedMLX)

![Text-prompted liver, spleen and kidney segmentation with a 3D mask view.](https://raw.githubusercontent.com/MedMLX/biomedparse-mlx/main/docs/example-abdomen.png)

*Four text prompts: liver, spleen, left kidney and right kidney on abdominal CT.*

| Input | Output |
| :--- | :--- |
| Medical image + text prompts | Labeled segmentation |

**Apple Silicon · Metal · Python 3.13 / 3.14** · [uv](https://docs.astral.sh/uv/)

## Quick start

```bash
uv venv --python 3.13
source .venv/bin/activate
uv pip install "biomedparse-mlx[conversion,assets]"
```

Download `biomedparse_v2.ckpt` from the gated [BiomedParse](https://huggingface.co/microsoft/BiomedParse) repo to `weights/source/`, and `tokenizer.json` from [CLIP](https://huggingface.co/openai/clip-vit-base-patch32) to `weights/`. Convert once, then segment:

```bash
biomedparse-mlx convert \
  --source weights/source/biomedparse_v2.ckpt \
  --output weights/biomedparse-v2.npz

biomedparse-mlx segment \
  --image scan.npy --weights weights/biomedparse-v2.npz \
  --tokenizer weights/tokenizer.json \
  --prompt 'Visualization of the liver in abdominal CT imaging' \
  --label 6 --output-dir outputs/liver
```

Prepared arrays must use the 0–255 intensity range. Raw NIfTI and DICOM require explicit modality and CT-site windowing; see Docs.

## License

[Apache-2.0](https://github.com/MedMLX/biomedparse-mlx/blob/main/LICENSE). See [third-party notices](https://github.com/MedMLX/biomedparse-mlx/blob/main/THIRD_PARTY_NOTICES.md). Model weights retain their publisher terms. BioMedParse weights are CC-BY-NC-SA-4.0.

For research and education. Outputs require human review.
