Skip to main content

mlx-segment-ct

Segment CT anatomy automatically or with anatomy names and clicks, using NVIDIA VISTA-3D in native MLX.

Docs · MedMLX

Automatic CT segmentation with selected organs and pelvic bones in 3D.

Automatic CT segmentation with selected organs and pelvic bones in 3D.

Input Output
3D CT · NIfTI Anatomical labels on the input grid

Apple Silicon · Metal · Python 3.13 / 3.14 · uv

Quick start

uv venv --python 3.13
source .venv/bin/activate
uv pip install "mlx-segment-ct[conversion]" huggingface-hub

Download and convert the checkpoint once, then run:

from pathlib import Path

from huggingface_hub import hf_hub_download
from medmlx_core.runtime import import_mlx
from mlx_segment_ct import mlx_correction_weights, mlx_weights

mx = import_mlx()
checkpoint = Path(hf_hub_download("nvidia/NV-Segment-CT", "vista3d_pretrained_model/model.pt"))
out = Path("weights")
out.mkdir(exist_ok=True)
mx.save_safetensors(
    str(out / "automatic.safetensors"), mlx_weights.convert_weights(checkpoint, mx=mx)
)
mx.save_safetensors(
    str(out / "correction.safetensors"),
    {k: mx.array(v) for k, v in mlx_correction_weights.convert_weights(checkpoint).items()},
)
from mlx_segment_ct.medmlx import run

common = dict(image_path="ct.nii.gz", weights_path="weights")

run(**common, output_dir="all")  # all 117 classes
run(**common, output_dir="organs", prompt="liver, spleen")
run(
    **common,
    output_dir="points",  # clicks: (x, y, z) voxels
    points=[[40, 50, 30], [44, 51, 30]],
    point_labels=[1, 0],
)

Docs cover click prompts, interactive correction and the NV-Segment-CTMR checkpoint for CT and MRI.

License

Apache-2.0. See third-party notices. Model weights retain their publisher terms.

For research and education. Outputs require human review.

Metadata

Release files for mlx-segment-ct 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlx-segment-ct 0.2.2
File Size Uploaded Provenance Actions
mlx_segment_ct-0.2.2.tar.gz 66.3 kB Without provenance Details for mlx_segment_ct-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mlx-segment-ct 0.2.2
File Interpreter ABI Platform Actions
mlx_segment_ct-0.2.2-py3-none-any.whl Python 3 none any Details for mlx_segment_ct-0.2.2-py3-none-any.whl

Total release size: 148.6 kB

Release files / mlx_segment_ct-0.2.2.tar.gz

Download URL mlx_segment_ct-0.2.2.tar.gz
Size 66.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4494231409613abbdd260621e26350808e58efa961a5d7ccf54e8194b4d0a462
BLAKE2b-256 checksum
How to use checksums
248903bfcf1c94033cd1453ca13278ee513e781afa35dc8fbede8fbc9ee7a800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / mlx_segment_ct-0.2.2-py3-none-any.whl

Download URL mlx_segment_ct-0.2.2-py3-none-any.whl
Size 82.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0285bc33a8087f140cdfa3c78fa2b9367867db5f956271410f38d3eecd492b6
BLAKE2b-256 checksum
How to use checksums
226723b0bb71e4519badca01451ecbbf1b745fc2dc38834335a8e0dbbc357020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for mlx-segment-ct 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page