
NV-Segment-CT
OfficialFreeRun CT segmentation using NVIDIA's VISTA3D tool.
Free · Opens the source repo
What NV-Segment-CT does
NV-Segment-CT is a specialized tool designed for processing CT NIfTI volumes using NVIDIA's VISTA3D framework. This skill enables users to run segmentation tasks on medical imaging data, specifically tailored for extracting label maps from CT scans. It is important to note that this tool is not intended for clinical interpretation or autonomous diagnosis. Instead, it serves as a robust solution for researchers and developers working in the field of medical imaging who need to automate segmentation tasks without delving into the complexities of the underlying model implementations.
The skill operates by utilizing a Python wrapper around the VISTA3D inference engine. Users are required to provide a CT volume as input, and the skill will output a label map along with a JSON file containing results. To ensure proper functionality, users must adhere to the documented usage instructions, which include setting up a Python 3.10 virtual environment and executing the provided scripts with the correct arguments. This structured approach helps maintain the integrity of the environment and prevents conflicts with other Python packages.
For those looking to implement this skill, it is essential to have an NVIDIA GPU with CUDA support, as the performance on a CPU may be significantly slower. The skill also includes built-in validation to ensure that the outputs are semantically valid, which is crucial for maintaining the quality of the segmentation results. However, users should be aware that the skill is a thin wrapper and delegates most processing tasks to the upstream NVIDIA model, meaning that modifications to the underlying code are not permitted.
In summary, NV-Segment-CT is an effective tool for automating CT segmentation using NVIDIA's technology, making it a valuable asset for developers and researchers in the medical imaging domain who require reliable and efficient processing capabilities.
When to use it
Use this skill when you need to segment CT images for research or development purposes, particularly in automated workflows.
When not to use it
Avoid using this skill for clinical applications or when clinical interpretation of results is required, as it is not designed for such use cases.
What you can build with it
Automating Medical Research Workflows
Researchers can integrate NV-Segment-CT into their pipelines to automate the segmentation of CT images, saving time and reducing manual errors.
Testing New Segmentation Algorithms
Developers can use this skill to quickly test and validate new segmentation algorithms on standardized CT datasets.
Educational Purposes in Medical Imaging
Educators can demonstrate the capabilities of automated CT segmentation in academic settings, providing hands-on experience with real-world tools.
How to install NV-Segment-CT
View source1. Install with the skills CLI
npx skills add nvidia/skills/nv-segment-ct --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by nvidiaNV-Segment-CT
Purpose
- Used for running NV-Segment-CT VISTA3D on CT NIfTI volumes and recording label-map evidence. Not for clinical interpretation.
- Use the wrapper exactly as documented; do not replace the upstream entrypoint with a handwritten implementation.
- Manifest I/O: inputs are
ct_volume; outputs arelabel_mapandresult_json.
Instructions
- Read
skill_manifest.yamlbefore changing arguments, side effects, or validation gates. - Run
scripts/run_vista3d.pythrough the documented command below; keep outputs under a caller-provided run directory. - If a host agent exposes
run_script, userun_script("scripts/run_vista3d.py", args=[...]); otherwise run the Bash/Python command shown below. - Create the documented Python 3.10 virtual environment and invoke its binaries directly; do not install model dependencies into the caller's active environment.
- Check the emitted JSON and paired verifier guidance before treating the run as evidence.
Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
scripts/run_vista3d.py | Primary entrypoint declared by skill_manifest.yaml. | PATH_TO_CT.nii.gz [--output-dir OUT_DIR] [--label-prompts IDS] |
Prerequisites
- Runtime requirements: Python 3.10 with
venvsupport and GPU/CUDA when declared by the manifest. Model packages come from the pinned upstream requirements file; only wrapper-specific packages are added locally. - Side effects: creates an isolated environment under
~/.cache/nvidia-skills/venvs/nv-segment-ct-f9f5f51/, writes the downloaded bundle underskills/nv-segment-ct/bundle/, may cache model assets under~/.cache/huggingface/, and may contacthttps://huggingface.coandhttps://raw.githubusercontent.comduring first setup; the optional spleen fixture fetcher downloads MSD09 fromhttps://msd-for-monai.s3-us-west-2.amazonaws.com. - Run commands from the repository root unless an existing section below says otherwise.
Limitations
- This is a thin wrapper. Inference, preprocessing, and postprocessing are delegated entirely to the official
hugging_face_pipeline.HuggingFacePipelineHelperin bundle/. Do not modify code under bundle/. transformers==4.46.3is the wrapper compatibility overlay tested with the upstream requirements' Torch 2.0.1; newer Transformers releases can disable that older Torch backend.- The pinned upstream requirements include Torch 2.0.1. Use only the pinned NVIDIA model assets; do not load untrusted checkpoints in this legacy reproduction environment.
- Device auto-detected (cuda if available, else cpu);
--deviceflag overrides. - Output may be schema-valid but semantically empty (e.g. label prompts that do not match the input anatomy). Sanity gates assert at least one foreground voxel per requested anatomy.
- Not for clinical deployment, clinical interpretation, autonomous diagnosis, regulatory submission.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
ensurepip is not available while creating the environment | The host Python installation omitted its OS venv package. | Install the matching Python 3.10 venv support package or create the same isolated environment with virtualenv -p python3.10. |
| Missing dependency or import error | Runtime package drift from skill_manifest.yaml. | Install the packages declared in the manifest or use the documented setup command. |
| Empty or schema-invalid output | Wrong input path, unsupported modality, or upstream failure. | Re-run with a known fixture and inspect the wrapper JSON plus stderr. |
| Validation gate failure | Output violated a declared engineering invariant. | Keep the failed evidence pack and use the gate message to repair inputs or wrapper code. |
Wraps the upstream nvidia/NV-Segment-CT helper. The wrapper does not
reimplement VISTA3D inference.
Exact Runnable Surface
For CT segmentation user runs, use this repo-root wrapper path exactly:
"$NV_SEGMENT_CT_VENV/bin/python" skills/nv-segment-ct/scripts/run_vista3d.py PATH_TO_CT.nii.gz --label-prompts "1,3,5,14" --output-dir OUT_DIR
Do not invent infer.py, Medical AI Skills run, python -m nv_segment_ct, or anatomy-name-only flags. For spleen, liver, right kidney, and left kidney, the required VISTA3D label IDs are exactly 1,3,5,14.
Preconditions
The skill assumes a Python 3.10 interpreter with venv support. Its documented
command creates a dedicated environment and installs the model dependencies
from NV-Segment-CT/requirements.txt at the immutable NVIDIA-Medtech commit
f9f5f51b589e5dc9c23c453cf5138398e4084056. The Hugging Face bundle itself
does not ship a requirements.txt.
Two one-time downloads (the documented command does the first one; the fixture fetch is a separate step you run when bootstrapping):
# Spleen example fixture from Decathlon MSD09 (~1.5 GB tar, ~11 MB
# fixture extracted into skills/nv-segment-ct/fixtures/spleen_03.nii.gz):
python skills/nv-segment-ct/fixtures/fetch_spleen_fixture.py
Both downloads (the bundle below, and the fixture) are gitignored
(Medical AI Skills policy: no medical data or model weights in git). The fetch
script is idempotent and caches the tar under
.workbench_data/datasets/ so re-runs are no-ops.
Runtime needs an NVIDIA GPU with CUDA. CPU fallback is supported but slow.
Usage
From the skills repository root, run the complete bootstrap. Invoke the virtual environment's binaries directly so the caller's active environment is not modified:
export NV_SEGMENT_CT_VENV="${NV_SEGMENT_CT_VENV:-$HOME/.cache/nvidia-skills/venvs/nv-segment-ct-f9f5f51}"
export NV_SEGMENT_CT_REQUIREMENTS="${NV_SEGMENT_CT_REQUIREMENTS:-https://raw.githubusercontent.com/NVIDIA-Medtech/NV-Segment-CTMR/f9f5f51b589e5dc9c23c453cf5138398e4084056/NV-Segment-CT/requirements.txt}"
if [ ! -x "$NV_SEGMENT_CT_VENV/bin/python" ]; then
python3.10 -m venv "$NV_SEGMENT_CT_VENV"
fi
"$NV_SEGMENT_CT_VENV/bin/python" -m pip install \
-r "$NV_SEGMENT_CT_REQUIREMENTS" \
"transformers==4.46.3" \
"typer>=0.9"
"$NV_SEGMENT_CT_VENV/bin/hf" download nvidia/NV-Segment-CT \
--revision afb51518689f71e6abb367ee6301b2cd0225c66a \
--local-dir skills/nv-segment-ct/bundle/
"$NV_SEGMENT_CT_VENV/bin/python" skills/nv-segment-ct/scripts/run_vista3d.py PATH_TO_CT.nii.gz \
--label-prompts "1,3,5,14" \
--output-dir vista3d_outputs
When the user names anatomies, translate them to VISTA3D class IDs before running. For the common abdominal CT request:
| Anatomy | VISTA3D class ID |
|---|---|
| liver | 1 |
| spleen | 3 |
| right kidney | 5 |
| left kidney | 14 |
For "segment the spleen, liver, right kidney, and left kidney", the correct
--label-prompts value is exactly "1,3,5,14". Do not substitute kidney
IDs from another label dictionary; the wrapper validates the requested label
set and will mark the run invalid if the emitted mask contains labels outside
the requested set.
The install and download steps are load-bearing. The pinned upstream file owns
the model environment, while Transformers and Typer support this thin wrapper.
hf download pulls the ~832 MB model bundle into
skills/nv-segment-ct/bundle/; subsequent calls reuse the caches.
label-prompts are VISTA3D class IDs. The evidence output records input
geometry, output mask path, observed label IDs, unexpected labels,
per-class voxel counts, per-class physical volumes computed from the output
mask header spacing, runtime, model identity, and fixed code-derived artifact
checks such as mask shape, affine match, label set, foreground count, and
class-volume bounds.
Pass --ground-truth PATH to record a reference label-map path under
input.ground_truth_path. The skill does not compute Dice; that is the
paired verifier's job.
Anatomy plausibility (per-class volume bounds, fragmentation, bilateral
symmetry, liver larger than spleen) and optional per-class Dice/IoU against
the recorded ground truth are checked by
verifiers/ct_segmentation_quality_v1.
Not for clinical interpretation, production deployment, or non-CT modalities.
Frequently asked questions about NV-Segment-CT
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
