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 aresynthetic_mr_brain_volumesandresult_json.
Instructions
- Read
skill_manifest.yamlbefore changing arguments, side effects, or validation gates. - Run
scripts/run_mr_brain.pythrough the documented command below; keep outputs under a caller-provided run directory. - If a host agent exposes
run_script, userun_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_mrais 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-dirinstead 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
Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
| scripts/run_mr_brain.py | Primary 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 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.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
| 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