Metadata-Version: 2.5
Name: segresnet-mlx
Version: 0.2.2
Summary: Native MLX SegResNet with NumPy sliding-window logit inference
Project-URL: Homepage, https://github.com/MedMLX/segresnet-mlx
Project-URL: Documentation, https://github.com/MedMLX/segresnet-mlx/blob/main/docs/technical.md
Project-URL: Repository, https://github.com/MedMLX/segresnet-mlx
Project-URL: Issues, https://github.com/MedMLX/segresnet-mlx/issues
Author: Joseph Sandoval, Alfredo Sandoval Jr.
License-Expression: Apache-2.0
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.0
Provides-Extra: conversion
Requires-Dist: torch<3,>=2.6; extra == 'conversion'
Provides-Extra: dev
Requires-Dist: hypothesis<7,>=6; extra == 'dev'
Requires-Dist: monai==1.6.1; extra == 'dev'
Requires-Dist: pyright==1.1.414; extra == 'dev'
Requires-Dist: pytest<10,>=8.4; extra == 'dev'
Requires-Dist: pytorch-ignite<0.6,>=0.4.11; extra == 'dev'
Requires-Dist: ruff<1,>=0.13; extra == 'dev'
Requires-Dist: torch<3,>=2.6; extra == 'dev'
Description-Content-Type: text/markdown

# segresnet-mlx

Segment brain tumors, renal structures and whole-body CT anatomy with MONAI SegResNet models in native MLX.

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

![SegResNet brain tumor segmentation in axial, coronal and sagittal views](https://raw.githubusercontent.com/MedMLX/segresnet-mlx/main/docs/example.png)

*BraTS bundle output on a Medical Segmentation Decathlon brain MRI: tumor core
(red), edema (green) and enhancing tumor (yellow).*

| Input | Output |
| :--- | :--- |
| MRI sequences or CT volumes | Segmentation on the input grid |

**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 segresnet-mlx huggingface-hub
```

Download the converted [BraTS](https://huggingface.co/MedMLX/segresnet-brats-mlx) weights, then run:

```python
from huggingface_hub import hf_hub_download
from segresnet_mlx.medmlx import run

bundle = "brats_mri_segmentation"
weights = hf_hub_download("MedMLX/segresnet-brats-mlx", "segresnet-brats.safetensors")

result = run(
    bundle=bundle,
    t1c_path="t1c.nii.gz",
    t1_path="t1.nii.gz",
    t2_path="t2.nii.gz",
    flair_path="flair.nii.gz",
    weights_path=weights,
    output_dir="out",
)
print(result["outputs"]["mask"])
```

Keep input volumes on the same voxel grid. Converted weights are also available for
[renal CECT](https://huggingface.co/MedMLX/segresnet-renal-cect-mlx). Docs cover
checkpoint conversion and whole-body CT.

## License

[Apache-2.0](https://github.com/MedMLX/segresnet-mlx/blob/main/LICENSE). See [third-party notices](https://github.com/MedMLX/segresnet-mlx/blob/main/THIRD_PARTY_NOTICES.md). Model weights retain their publisher terms.

For research and education. Outputs require human review.
