Metadata-Version: 2.5
Name: flexray-mlx
Version: 0.2.1
Summary: Native MLX implementation of FleXray
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.3
Requires-Dist: mlx<1,>=0.32.4
Requires-Dist: numpy<3,>=2.0
Requires-Dist: pillow<14,>=13
Requires-Dist: pydicom<4,>=3
Requires-Dist: pyyaml<7,>=6
Requires-Dist: safetensors<1,>=0.6
Provides-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'
Description-Content-Type: text/markdown

# flexray-mlx

Segment anatomical structures in radiographs with FleXray and native MLX.

[Docs](docs/technical.md) · [MedMLX](https://github.com/MedMLX)

![One chest radiograph → separate lung, heart and individual rib masks.](https://raw.githubusercontent.com/MedMLX/flexray-mlx/main/docs/showcase.png)

*One chest radiograph → separate lung, heart and individual rib masks.*

| Input | Output |
| :--- | :--- |
| Raster image or single-frame DICOM | Structure masks and probabilities |

**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
repo="https://github.com/MedMLX/flexray-mlx"
uv pip install \
  "flexray-mlx @ git+$repo" \
  huggingface-hub
```

Download the released weights and run:

```python
from huggingface_hub import snapshot_download
from flexray_mlx.medmlx import run

weights = snapshot_download("VictorButoi/flexray", local_dir="flexray", ignore_patterns=["*.onnx"])

result = run(image_path="chest.png", weights_path=weights, output_dir="out")
print(result["outputs"]["mask"])
```

Use `label_name` to select a structure and `ensemble=True` to average all five members.

## License

[Apache-2.0](LICENSE). See [third-party notices](THIRD_PARTY_NOTICES.md). Model weights retain their publisher terms. FleXray weights are noncommercial (CC-BY-NC-4.0).

For research and education. Outputs require human review.
