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",
    revision="afb51518689f71e6abb367ee6301b2cd0225c66a",
))
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.3.0

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.3.0
File Size Uploaded Provenance Actions
mlx_segment_ct-0.3.0.tar.gz 67.6 kB Without provenance Details for mlx_segment_ct-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 151.1 kB

Release files / mlx_segment_ct-0.3.0.tar.gz

Download URL mlx_segment_ct-0.3.0.tar.gz
Size 67.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a18cf5d2115e7970ad1d26401424d63eb7e0790305bb0b0744719668d145329b
BLAKE2b-256 checksum
How to use checksums
b1ad332d01f6e4b98666f61a28efd420276d221fbea16dec01eec8b88cae108b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL mlx_segment_ct-0.3.0-py3-none-any.whl
Size 83.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fdabdc5927a5cff4f7b6e428b3f865e0373b1954b44256849ed82c95abbee94
BLAKE2b-256 checksum
How to use checksums
9449c1f90bd384a0ef12a18a72e5e189b6bf64a8fa4bb5520cca4a25e5b2b92b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mlx-segment-ct 0.3.0

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