npx skills add nvidia/skills --skill nv-generate-ct-rflow
promptingcompany/nv-skills
nv-generate-ct-rflow
Used for generating synthetic CT volumes and masks with NV-Generate-CTMR rflow-ct. Not for production training data without review.
Installation
npx skills add promptingcompany/nv-skills --skill nv-generate-ct-rflow
Similar popular skills
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Used for generating synthetic CT volumes and masks with NV-Generate-CTMR rflow-ct. Not for prod…
1.7K installsRead data from a Google Sheet and create a formatted Google Docs report.
27.5K installsGenerate a Playwright test based on a scenario using Playwright MCP
18K installsMigration and code evolution instructions generator for GitHub Copilot. Analyzes differences be…
9K installsTransform this Python script into a polished, beginner-friendly project by refactoring the code…
8.9K installsStructured Autonomy Implementation Generator Prompt
8.8K installsAlso in this package
Other skills from promptingcompany/nv-skills · top by installs.
npx skills add promptingcompany/nv-skills
More details
Agent compatibility
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Also listed on
Alternate registries and mirrors of this skill.
Repository health
main
Skill metadata
Parsed from SKILL.md frontmatter.
BashMore metadata
- author
- NVIDIA MedTech Team
- tags
- ["MedTech","CT","generation"]
Package contents
Files included with this skill beyond the listing page.
-
skill md
SKILL.md11,769 B -
docs
SUMMARY.md159 B
History
- First seen on skills.sh
- First recorded snapshot · 40 installs
SKILL.md
NV-Generate-CT (rflow-ct)
Purpose
- Used for generating synthetic CT volumes and masks with NV-Generate-CTMR rflow-ct. Not for production training data without review.
- Use the wrapper exactly as documented; do not replace the upstream entrypoint with a handwritten implementation.
- Do not write custom inference code for normal runs. The wrapper owns config staging, output paths, label mapping evidence, and validation.
- Manifest I/O: inputs are
configinferoverride; outputs aresyntheticctvolumesandresult_json.
Instructions
- Read
skill_manifest.yamlbefore changing arguments, side effects, or validation gates. - Run
scripts/runrflowct.pythrough the documented command below; keep outputs under a caller-provided run directory. - If a host agent exposes
runscript, userunscript("scripts/runrflowct.py", args=[...]); otherwise run the Bash/Python command shown below. - Emit a single bash code block, and keep the
python -m pip install -r "$NVGENERATEROOT/requirements.txt"step in that same command — the runtime may be a fresh environment withoutnibabel/MONAI, so dropping the install fails withModuleNotFoundError. - Do not add
rm,mkdir, or any cleanup of--output-dir; the wrapper creates it. Use a fresh--output-dirinstead of deleting one. - Check the emitted JSON and paired verifier guidance before treating the run as evidence.
Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
scripts/_anatomy.py |
Internal helper used by the primary entrypoint. | Imported only; do not call directly. |
scripts/summarycard.py |
Internal helper used by the primary entrypoint. | Imported only; do not call directly. |
scripts/list_anatomies.py |
Helper command for catalog or anatomy lookup. | [--region REGION] [--filter TEXT] [--controllable] |
scripts/runrflowct.py |
Primary entrypoint declared by skill_manifest.yaml. | CONFIGINFER.json --output-dir OUTDIR [--random-seed N] [--version rflow-ct] [--yes] |
scripts/runctmask.py |
Advanced diagnostic helper for standalone raw MAISI mask generation. | REQUEST.json --output-dir OUT_DIR [--random-seed N] [--preflight-only] [--yes] |
scripts/runctfrom_mask.py |
Advanced helper for CT image generation from a MAISI label mask. | REQUEST.json --output-dir OUT_DIR [--random-seed N] [--yes] |
scripts/runctimage.py |
Advanced helper for CT image-only generation without paired labels. | MODELCONFIG.json --output-dir OUTDIR [--version rflow-ct] [--random-seed N] [--yes] |
Prerequisites
- Required environment variables:
NVGENERATEROOT. - Runtime requirements: GPU/CUDA when declared by the manifest; Python packages listed in
runtime.sideeffects.pippackages. - Side effects: writes generated outputs under the caller's
--output-dir, may cache model assets under~/.cache/huggingface/, and may contacthttps://huggingface.coorhttps://github.comduring setup. - Run commands from the repository root unless an existing section below says otherwise.
Limitations
- This is a thin wrapper. Inference, sampling, and decoding are delegated entirely to NVIDIA-Medtech/NV-Generate-CTMR's
scripts.inference. Do not modify code under $NVGENERATEROOT. - rflow-ct requires CUDA and ≈ 16 GB VRAM minimum for the default 256³ outputsize. Larger outputsize (e.g. 512×512×768) needs an A100/H100.
- Output volumes are synthetic. They are not safe to use as training data for production medtech models without an independent quality review.
- Not for clinical deployment, clinical interpretation, autonomous diagnosis, regulatory submission.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
| 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-Medtech/NV-Generate-CTMR rectified-flow synthesis pipeline. The wrapper does not reimplement diffusion, sampling, or autoencoder decoding — it shells out to the upstream scripts.inference entry point exactly as the project's README documents and inspects the produced image/mask pairs.
Preconditions
- Clone the upstream repo and point
NVGENERATEROOTat it (one-time):
``bash test -d "$HOME/nv-generate-ctmr/.git" || \ git clone https://github.com/NVIDIA-Medtech/NV-Generate-CTMR.git $HOME/nv-generate-ctmr export NVGENERATEROOT=$HOME/nv-generate-ctmr pip install -r "$NVGENERATEROOT/requirements.txt" ``
- Download the
rflow-ctweights and the mask-candidate datasets
into the clone (one-time, ≈ 5.5 GB):
``bash cd "$NVGENERATEROOT" python -m scripts.downloadmodeldata --version rflow-ct --root_dir "./" ``
The mask candidates (datasets/allmasksflexiblesizeandspacing4000) condition the diffusion sampler; omitting them via --model_only will make the inference script fail with a missing-file error at startup. The anatomy-size condition file is also part of the full CT download and is needed for controllable mask generation.
- NVIDIA GPU with ≥ 16 GB VRAM and CUDA. There is no CPU fallback.
For agent-generated user run commands, prefer the short wrapper command in Usage. Do not prepend clone or model-download setup steps when NVGENERATEROOT or the repo-local upstream cache is already present. In a fresh Python environment, still include pip install -r "$NVGENERATEROOT/requirements.txt" before the wrapper unless the active environment has already proven those imports are available; cached weights do not imply cached Python packages. Run the wrapper from the medical-AI-skills repo root. If setup requires cd "$NVGENERATEROOT", return to the Medical AI Skills repo before invoking skills/nv-generate-ct-rflow/scripts/runrflowct.py.
Usage
export NV_GENERATE_ROOT="${NV_GENERATE_ROOT:-$HOME/nv-generate-ctmr}" && \
python -m pip install -r "$NV_GENERATE_ROOT/requirements.txt" && \
python skills/nv-generate-ct-rflow/scripts/run_rflow_ct.py \
PATH_TO_CONFIG_INFER.json \
--output-dir runs/nv_generate_ct_rflow_demo \
--random-seed 0 \
--version rflow-ct
Replace PATHTOCONFIGINFER.json with the user's actual request/config path. Do not copy the fixture path from this document unless the user explicitly asked to run that fixture. If the user says "the case request is at runs/.../chestlungtumorcontrollable.json", that exact path is the first positional argument to scripts/runrflowct.py.
The fixture argument is a configinfer.json override file: it can replace numoutputsamples, bodyregion, anatomylist, controllableanatomysize, outputsize, and spacing. Pass default to use the upstream config verbatim. The wrapper stages the override into the upstream tree before running.
Fixture catalog
fixtures/ ships curated configs for common paired synthesis use cases: chest lung lobes, chest with controllable lung tumor, abdomen solid organs, abdomen with controllable hepatic tumor, head + cervical spine, pelvis. See [fixtures/README.md](fixtures/README.md) for the full table.
Helper commands
# Browse the 132-class label_dict grouped by body region.
python skills/nv-generate-ct-rflow/scripts/list_anatomies.py --region chest
python skills/nv-generate-ct-rflow/scripts/list_anatomies.py --controllable
python skills/nv-generate-ct-rflow/scripts/list_anatomies.py --filter tumor
# Validate a fixture and preview cost without launching inference.
NV_GENERATE_ROOT=$HOME/nv-generate-ctmr \
python skills/nv-generate-ct-rflow/scripts/run_rflow_ct.py \
skills/nv-generate-ct-rflow/fixtures/abdomen_liver_spleen.json \
--output-dir runs/preview --preflight-only
Advanced helpers stay inside this skill for debugging and less-common CT generation modes. Use them only when the user explicitly asks for that mode:
# Raw MAISI mask diagnostic, useful for checking lung tumor -> label 23.
python skills/nv-generate-ct-rflow/scripts/run_ct_mask.py \
skills/nv-generate-ct-rflow/fixtures/ct_mask_lung_tumor.json \
--output-dir runs/ct_mask_debug --preflight-only
# CT image from an existing MAISI label mask with body label 200.
python skills/nv-generate-ct-rflow/scripts/run_ct_from_mask.py \
skills/nv-generate-ct-rflow/fixtures/ct_from_mask_request_example.json \
--output-dir runs/ct_from_mask_demo
# CT image-only generation without paired labels.
python skills/nv-generate-ct-rflow/scripts/run_ct_image.py \
skills/nv-generate-ct-rflow/fixtures/ct_image_only_default.json \
--output-dir runs/ct_image_only_demo --version rflow-ct
The wrapper runs preflight on every invocation (regardless of --preflight-only): config-schema bounds, anatomy names matched against the upstream labeldict, bodyregion in the supported set, controllableanatomysize constraints, upstream CT output-size/spacing contracts, body-region-aware x/y FOV minimums, dataset presence under $NVGENERATEROOT/datasets/, CUDA available, and an estimated peak VRAM / wall-time. Runs estimated to exceed 5 min wall-time or 30 GB VRAM peak require --yes to proceed.
Each invocation runs python -m scripts.inference -t configs/confignetworkrflow.json -i configs/configinfer.json -e configs/environmentrflow-ct.json --random-seed <s> --version rflow-ct. Output evidence records the upstream git commit, model checkpoint hashes, the rendered config, per-sample image/mask geometry, mask label set, image HU range summary, and per-class voxel volumes.
When controllableanatomysize is non-empty, upstream ignores the broader anatomylist for the saved paired label map and filters labels to the controllable anatomy names. The saved paired label values are local 1..N ordinals, not raw MAISI label IDs. Read output.outputlabelmapping in resultjson to map saved output labels back to source labels; for example, output label 1 can represent MAISI label 23 (lung tumor). For curated lung-tumor examples, prefer a controllable size around 0.5 or larger; smaller requests such as 0.2 can produce absent or extremely small label-23 components for some seeds.
For FOV and setup details, see references/fov-and-downloads.md. For advanced helper label-space details, see references/ct-mask-label-space.md and references/ct-from-mask-format.md.
Visual sample card
Alongside the NIfTI pairs, the wrapper writes summary.html to the output directory: a per-sample mid-slice triptych (axial / coronal / sagittal) with label overlay, plus a table of the rendered config and verifier-facing aggregates. Lets you eyeball the result without firing up 3D Slicer. Pass --no-summary-card to skip.
Anatomy plausibility (label-set sanity, voxel HU range as CT, image/mask geometry match, declared output labels present, lung-lobe HU floor) is checked by verifiers/ctsynthesisquality_v1.
Not for clinical interpretation, training data for production deployment, or any non-synthetic-research use.