Metadata-Version: 2.5
Name: medsam2-mlx
Version: 0.2.4
Summary: Native MLX implementation of MedSAM2
Project-URL: Homepage, https://huggingface.co/MedMLX/medsam2-ct-lesion-mlx
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.5
Requires-Dist: mlx<0.33,>=0.32.4
Requires-Dist: nibabel<6,>=5.3
Requires-Dist: numpy<3,>=2.0
Requires-Dist: pillow<14,>=13
Requires-Dist: scipy<2,>=1.13
Provides-Extra: dev
Requires-Dist: hypothesis<7,>=6.156; 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'
Requires-Dist: simpleitk<3,>=2.5.6; extra == 'dev'
Requires-Dist: torch<3,>=2.6; extra == 'dev'
Provides-Extra: reference
Requires-Dist: hydra-core<1.4,>=1.3.8; extra == 'reference'
Requires-Dist: iopath<0.2,>=0.1.10; extra == 'reference'
Requires-Dist: opencv-python-headless==5.0.0.93; extra == 'reference'
Requires-Dist: pillow<14,>=13; extra == 'reference'
Requires-Dist: simpleitk<3,>=2.5; extra == 'reference'
Requires-Dist: torch<3,>=2.6; extra == 'reference'
Requires-Dist: tqdm<5,>=4.66; extra == 'reference'
Description-Content-Type: text/markdown

# medsam2-mlx

Segment lesions or organs from a box, point or mask prompt, then track them through a volume with MedSAM2.

[Model weights](https://huggingface.co/MedMLX/medsam2-ct-lesion-mlx)

| Input | Output |
| :--- | :--- |
| Scan + slice-level prompt | Tracked masks on the input grid |

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

## Quick start

```bash
uv pip install "medsam2-mlx>=0.2.4" huggingface-hub
```

```python
from medsam2_mlx.medmlx import run

result = run(
    image_path="ct.nii.gz", output_dir="out",
    box_xyxy=[120, 140, 180, 200], frame_idx=40, propagation="both",
)
print(result["outputs"])
```

Omitting `weights_path` downloads `MedMLX/medsam2-ct-lesion-mlx` once and reuses its local cache.
An explicit model folder contains `MedSAM2_CTLesion.safetensors`; standalone
checkpoint-file paths are still accepted. For NIfTI, `frame_idx` uses the third voxel
axis. Box and point coordinates use the first two stored voxel axes.

Downloaded commits are returned in `details.weights_revision`; explicit local
weights report `null` unless the folder carries a MedMLX download revision.
The published [weight repository](https://huggingface.co/MedMLX/medsam2-mlx)
also contains the other four MedSAM2 checkpoints.

## License

Apache-2.0; license and third-party notices are included in the distribution. Model weights retain their publisher terms; see the [model card](https://huggingface.co/MedMLX/medsam2-mlx).

For research and education. Outputs require human review.
