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
repo="https://github.com/MedMLX/mlx-segment-ct"
uv pip install \
  "mlx-segment-ct[conversion] @ git+$repo" \
  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.1

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.1
File Size Uploaded Provenance Actions
mlx_segment_ct-0.2.1.tar.gz 65.8 kB Without provenance Details for mlx_segment_ct-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 147.6 kB

Release files / mlx_segment_ct-0.2.1.tar.gz

Download URL mlx_segment_ct-0.2.1.tar.gz
Size 65.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dae24ffffb224784bd5c06b357e7e91455165ed2983669c08edbcae15081be8f
BLAKE2b-256 checksum
How to use checksums
25fd584022d6ba3b5ab18f8ded3e99f2ba62c0ec8c0cdf948fe7a10c31e96cc5
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.1-py3-none-any.whl

Download URL mlx_segment_ct-0.2.1-py3-none-any.whl
Size 81.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b69baf6347ad1c0e1a49a585566e8a6f511e28f8c8b14d626d8ed1685355c76d
BLAKE2b-256 checksum
How to use checksums
a620a186a2b5996f081ebc2834ba2844bfc45b0fbef77a7e6518e67e7e7fddbb
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.1

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