Skip to content
nv-generate-mr-brain logo

NV-Generate-MR-Brain

nv-generate-mr-brain

Used for generating synthetic brain MRI volumes with NV-Generate-CTMR rflow-mr-brain. Not for production training data.

nvidia/skills1.8Kinstalls3.5Kstars

SKILL.md

Full skill instructions

NV-Generate-MR-Brain

Purpose

  • Used for generating synthetic T1, T2, FLAIR, SWI, or MRA brain MRI volumes with NV-Generate-CTMR rflow-mr-brain v1. Not for production training data.
  • 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, and validation.
  • Manifest I/​O: inputs are model_config_override; outputs are synthetic_mr_brain_volumes and result_json.

Instructions

  • Read skill_manifest.yaml before changing arguments, side effects, or validation gates.
  • Run scripts/​run_mr_brain.py through the documented command below; keep outputs under a caller-provided run directory.
  • If a host agent exposes run_script, use run_script("scripts/​run_mr_brain.py", args=[...]); otherwise run the Bash/​Python command shown below.
  • For a command-shape review, do not install packages, clone repositories, download weights, or start GPU inference. Emit only the exact wrapper command with the supplied config path plus explicit --output-dir, --modality, and --random-seed values.
  • For an executable run, emit a single bash code block and keep the python -m pip install -r "$NV_GENERATE_ROOT/​requirements.txt" step in that same command — the runtime may be a fresh environment without nibabel/​MONAI, so dropping the install fails with ModuleNotFoundError.
  • If --modality mri_mra is selected, state that upstream reports sparse MRA training coverage and that output quality is not guaranteed.
  • Do not add rm, mkdir, or any cleanup of --output-dir; the wrapper creates it. Use a fresh --output-dir instead of deleting one.
  • Check the emitted JSON and paired verifier guidance before treating the run as evidence.

Examples

Command-shape review only (no setup or execution):

python skills/​nv-generate-mr-brain/​scripts/​run_mr_brain.py \
  PATH_TO_MR_BRAIN_CONFIG.json \
  --output-dir runs/​nv_generate_mr_brain_demo \
  --modality mri_t1 \
  --random-seed 1234

For an executable run, use the setup-aware command under Usage.

Available Scripts

ScriptPurposeArguments
scripts/​run_mr_brain.pyPrimary entrypoint declared by skill_manifest.yaml.MODEL_CONFIG.json --output-dir OUT_DIR --modality mri_t1 [--random-seed N] [--yes]

Prerequisites

  • Runtime requirements: GPU/​CUDA when declared by the manifest; Python packages listed in runtime.side_effects.pip_packages.
  • Side effects: writes generated outputs under the caller's --output-dir, may cache model assets under ~/​.cache/​huggingface/, and may contact https://huggingface.co or https://github.com during 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.diff_model_infer. Do not modify code under $NV_GENERATE_ROOT or the repo-local fallback at .workbench_data/​upstreams/​NV-Generate-CTMR.
  • rflow-mr-brain generates image-only synthetic brain MRI volumes. It does not emit paired segmentation masks.
  • Output volumes are synthetic. They are not safe as training data for production medtech models without independent quality review.
  • Not for clinical deployment, clinical interpretation, autonomous diagnosis, regulatory submission.

Troubleshooting

ErrorCauseFix
Missing dependency or import errorRuntime package drift from skill_manifest.yaml.Install the packages declared in the manifest or use the documented setup command.
Empty or schema-invalid outputWrong input path, unsupported modality, or upstream failure.Re-run with a known fixture and inspect the wrapper JSON plus stderr.
Validation gate failureOutput 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 MR brain image-only generation workflow. The wrapper does not reimplement diffusion sampling or autoencoder decoding. It stages config overrides, runs the documented python -m scripts.diff_model_infer command for rflow-mr-brain, then summarizes the generated NIfTI volume.

Exact Runnable Surface

For user run commands, use this repo-root wrapper path exactly:

export NV_GENERATE_ROOT="${NV_GENERATE_ROOT:-$HOME/​.cache/​nvidia-skills/​upstreams/​NV-Generate-CTMR-da438fe}" && \
python -m pip install -r "$NV_GENERATE_ROOT/​requirements.txt" && \
python skills/​nv-generate-mr-brain/​scripts/​run_mr_brain.py PATH_TO_MR_BRAIN_CONFIG.json --output-dir OUT_DIR --modality mri_t1 --random-seed 1234

Do not invent generate.sh, infer.py, Medical AI Skills run, or python -m nv_generate_mr_brain commands. PATH_TO_MR_BRAIN_CONFIG.json must be the user's supplied request path.

Preconditions

If NV_GENERATE_ROOT already names a local checkout, the wrapper uses it and records its current commit in the result. Otherwise, create the recommended pinned default checkout once:

if [ -z "${NV_GENERATE_ROOT:-}" ]; then
  export NV_GENERATE_COMMIT=da438fec6484cdb6f421f8c7051d954ebefff730
  export NV_GENERATE_ROOT="$HOME/​.cache/​nvidia-skills/​upstreams/​NV-Generate-CTMR-da438fe"
  if [ ! -d "$NV_GENERATE_ROOT/​.git" ]; then
    git clone https://github.com/​NVIDIA-Medtech/​NV-Generate-CTMR.git "$NV_GENERATE_ROOT"
    git -C "$NV_GENERATE_ROOT" checkout --detach "$NV_GENERATE_COMMIT"
  fi
fi
pip install -r "$NV_GENERATE_ROOT/​requirements.txt"

The wrapper executes upstream code only when NV_GENERATE_ROOT is at the exact manifest commit and its tracked files are clean. Keep model weights untracked under models/, and use the wrapper override JSON instead of editing upstream configs. Child processes receive only an allowlist of runtime, CUDA, locale, and certificate variables; API keys, tokens, passwords, and unrelated parent environment values are not forwarded.

Download the reused autoencoder and MR-Brain v1 checkpoint from their exact manifest revisions:

python -m huggingface_hub.commands.huggingface_cli download \
  nvidia/​NV-Generate-CT models/​autoencoder_v1.pt \
  --revision 75ac080fb1083c403793563477724c038e7d430c \
  --local-dir "$NV_GENERATE_ROOT"
python -m huggingface_hub.commands.huggingface_cli download \
  nvidia/​NV-Generate-MR-Brain models/​diff_unet_3d_rflow-mr-brain_v1.pt \
  --revision ef9759bf221265b2704569cdeeac20bbf03b62ee \
  --local-dir "$NV_GENERATE_ROOT"

The wrapper verifies both downloaded files against their published Git LFS SHA-256 object IDs before launching inference.

Runtime needs an NVIDIA GPU with at least 16 GB VRAM. There is no CPU fallback in the upstream path.

The wrapper also searches .workbench_data/​upstreams/​NV-Generate-CTMR if NV_GENERATE_ROOT is unset or does not have the required upstream layout.

For agent-generated user run commands, use the command in Usage. Do not prepend clone or model-download setup steps when the repo-local upstream cache already exists. In a fresh Python environment, still include pip install -r "$NV_GENERATE_ROOT/​requirements.txt" before the wrapper unless the active environment has already proven those imports are available; cached weights do not imply cached Python packages. If setup requires cd "$NV_GENERATE_ROOT", return to the Medical AI Skills repo before invoking skills/​nv-generate-mr-brain/​scripts/​run_mr_brain.py.

Usage

export NV_GENERATE_ROOT="${NV_GENERATE_ROOT:-$HOME/​.cache/​nvidia-skills/​upstreams/​NV-Generate-CTMR-da438fe}" && \
python -m pip install -r "$NV_GENERATE_ROOT/​requirements.txt" && \
python skills/​nv-generate-mr-brain/​scripts/​run_mr_brain.py \
  PATH_TO_MR_BRAIN_CONFIG.json \
  --output-dir runs/​nv_generate_mr_brain_demo \
  --modality mri_t1 \
  --random-seed 1234

Replace PATH_TO_MR_BRAIN_CONFIG.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 request is at runs/​.../​default_mri_t1.json", that exact path is the first positional argument to scripts/​run_mr_brain.py.

Supported MR-brain modality names are mri, mri_t1, mri_t2, mri_flair, mri_mra, mri_swi, mri_t1_skull_stripped, mri_t2_skull_stripped, mri_flair_skull_stripped, mri_mra_skull_stripped, and mri_swi_skull_stripped. These map to the upstream configs/​modality_mapping.json IDs documented in the README. For FOV and setup details, see references/​fov-and-downloads.md.

The pinned v1 config ships axial T1w defaults of dim=[256,256,128], spacing=[0.94,0.94,1.36], 30 inference steps, and cfg_guidance_scale=2. Keep the staged config value unless a model-specific validation justifies an override; older examples may describe the v0 256^3/​1 mm geometry or guidance scale 10. MRA is supported by v1, but the upstream training-data report contains few MRA scans, so output quality is not guaranteed.

The fixture argument is a small JSON override for configs/​config_maisi_diff_model_rflow-mr-brain.json. Pass default to use the upstream defaults plus the CLI modality and random seed. Common override keys are dim, spacing, num_inference_steps, cfg_guidance_scale, and modality.

Each run records the staged config, model inventory, upstream command, output geometry, spacing, affine, intensity range, and non-constant / finite-data checks. Output volumes are synthetic and are not safe as production training data without independent review.

Not for clinical interpretation, production deployment, autonomous diagnosis, or regulatory submission.

More skills from nvidia

cudaq-guide logo
nvidia/skills

cudaq-guide

CUDA-Q onboarding guide for installation, test programs, GPU simulation, QPU hardware, and quantum applications.

3.5K 2.5K
View
data-designer logo
nvidia/skills

data-designer

Use when the user wants to create a dataset, generate synthetic data, or build a data generation pipeline.

3.5K 2.4K
View
deepstream-dev logo
nvidia/skills

deepstream-dev

NVIDIA DeepStream SDK development with Python pyservicemaker API. Use when building video analytics pipelines, GStreamer-based video processing, TensorRT inference integration, object detection/tracking, or Kafka/message broker integration.

3.5K 2.4K
View
rag-eval logo
nvidia/skills

rag-eval

Filesystem RAG benchmarks: corpus/, train.json, evaluate_rag.py (RAGAS quality). Not for prod monitoring, latency/throughput benchmarking (use rag-perf), or evals outside this repo layout.

3.5K 2.3K
View
nemo-retriever logo
nvidia/skills

nemo-retriever

Use when the user wants to search, query, extract, transcribe, describe, quote, filter, or aggregate across documents — PDFs, scanned forms / images (`.jpg` `.png` `.tiff`), Office (`.docx` `.pptx`), text (`.html` `.txt`), audio (`.mp3` `.wav` `.m4a`), or video (`.mp4` `.mov`). Prefer this over native Read / Grep for multi-file or non-PDF corpora. Not for: editing files, web browsing, single-file plain-text lookups, fine-tuning.

3.5K 2.3K
View

Coordinate the end-to-end CAD/source-asset to SimReady workflow. Use for broad requests such as CAD to SimReady, source asset to simulation-ready USD, or prop packaging that require conversion, material/physics assignment, SimReady conformance, validation, and optional package creation; deploy or verify Content Agents services first when property assignment is enabled; route single-stage work through nested references.

3.5K 2.3K
View

Use this skill to bring any vision model from HuggingFace or NVIDIA NGC into an NVIDIA DeepStream pipeline with end-to-end automation: ONNX download, SafeTensors export, TRT engine build, custom nvinfer bbox parser, multi-stream benchmark, and PDF report. Object detection models only.

3.5K 2.3K
View

Top-level workflow skill for USD performance diagnosis and optimization. Handles slow loading, high memory, low FPS, and broad scene-optimization requests; delegates auth/runtime setup to Phase 0 owners.

3.5K 2.3K
View

Vehicle routing (VRP, TSP, PDP) with cuOpt — Python API only. Use when the user is building or solving routing in Python.

3.5K 2.2K
View

Use only to generate or update a governance skill card for a specified existing agent skill directory. Do not use for explaining, listing, comparing, or discussing skill capabilities.

3.5K 2.2K
View

Use as the top-level router for Omniverse Realtime Viewer USD app requests and focused viewer reference documents.

3.5K 2.2K
View
rag-perf logo
nvidia/skills

rag-perf

Performance benchmarking for a deployed NVIDIA RAG Blueprint server: profiling pass + aiperf load test driven by a single YAML config. Not for accuracy / RAGAS scoring (use rag-eval) or for deploying / repairing services (use rag-blueprint).

3.5K 2.1K
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View