К основному содержанию
скилл CX Codex

nv-generate-mr — скилл для Claude Code: что делает и как установить

Генерирует синтетические 3D-томограммы тела (MRI) через модель NV-Generate-CTMR rflow-mr. Пригодится для синтеза медицинских объёмов T1 без разметки.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add NVIDIA/skills --skill nv-generate-mr -a claude-code
Открыть на GitHub

Что делает nv-generate-mr

Скилл оборачивает инференс репозитория NVIDIA-Medtech/NV-Generate-CTMR и запускает точку входа scripts/run_mr.py. Он подготавливает переопределения конфигурации, вызывает скрипт scripts.diff_model_infer для чекпоинта rflow-mr и сохраняет готовый NIfTI-объём вместе с итоговым отчётом в JSON.

Для запуска обязательно требуется видеокарта NVIDIA минимум с 16 ГБ VRAM, так как процессорный режим в исходном коде не предусмотрен. Среда также требует предварительной установки зависимостей из requirements.txt upstream-репозитория и загрузки весов модели командой загрузчика.

Инструмент создаёт только сами изображения томографии (модальность mri_t1) и не выдаёт маски сегментации органов. Модель не подходит для синтеза МРТ головного мозга или клинической диагностики, а оригинальные веса распространяются под некоммерческой лицензией NVIDIA Non-Commercial.

Какие задачи решает

  • сгенерировать синтетический 3D-объём МРТ тела по входному конфигу
  • получить томограмму в модальности mri_t1 в формате NIfTI
  • запустить диффузионную модель rflow-mr через фиксированный скрипт
  • сохранить сгенерированный медицинский объём и JSON-манифест в целевую папку

Примеры запросов агенту

  • Сгенерируй синтетическое МРТ тела через nv-generate-mr по конфигу runs/config.json в папку runs/out с модальностью mri_t1
  • Запусти scripts/run_mr.py для model_config.json со случайным сидом 0 и запиши результат в runs/nv_generate_mr_demo

Как установить nv-generate-mr

1Через Skills CLI (Vercel)

npx skills add NVIDIA/skills --skill nv-generate-mr -a claude-code

2Вручную: положить файлы

~/.claude/skills/nv-generate-mr/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/nv-generate-mr/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о nv-generate-mr

Как установить nv-generate-mr в Claude Code?

Выполните команду npx skills add NVIDIA/skills --skill nv-generate-mr -a claude-code в терминале.

Что делает скилл nv-generate-mr?

Он запускает диффузионный пайплайн NV-Generate-CTMR rflow-mr для генерации 3D-снимков МРТ тела и сохраняет полученные NIfTI-файлы с метаданными.

Можно ли запустить генерацию без видеокарты?

Нет, для работы необходима карта NVIDIA минимум с 16 ГБ VRAM, потому что запуск на CPU архитектурой модели не поддерживается.

Исходный текст

SKILL.md · Apache-2.0
---
name: nv-generate-mr
description: Used for generating synthetic body MRI volumes with NV-Generate-CTMR rflow-mr. Not for paired masks or production training data.
license: Apache-2.0
allowed-tools: Bash
metadata:
  author: NVIDIA MedTech Team
  tags:
    - MedTech
    - MRI
    - generation
---

# NV-Generate-MR

## Purpose
- Used for generating synthetic body MRI volumes with NV-Generate-CTMR rflow-mr. Not for paired masks or 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_volumes` and `result_json`.

## Instructions
- Read `skill_manifest.yaml` before changing arguments, side effects, or validation gates.
- Run `scripts/run_mr.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.py", args=[...])`; otherwise run the Bash/Python command shown below.
- 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`.
- 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.

## Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
| `scripts/run_mr.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 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 generates image-only synthetic MRI volumes. It does not emit paired segmentation masks.
- The upstream README recommends `rflow-mr-brain` instead for brain MRI synthesis; use `skills/nv-generate-mr-brain` for that path.
- NV-Generate-MR weights are listed by upstream as NVIDIA Non-Commercial. Do not use outputs as production training data without legal and 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`](https://github.com/NVIDIA-Medtech/NV-Generate-CTMR/tree/61c4ec709b84cad468852243c48e250bec732074)
MR 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`, then
summarizes the generated NIfTI volume.


## Exact Runnable Surface

For user run commands in a fresh benchmark environment, use this setup plus
repo-root wrapper command exactly:

```bash
export NV_GENERATE_ROOT="${NV_GENERATE_ROOT:-$HOME/.cache/nvidia-skills/upstreams/NV-Generate-CTMR-61c4ec7}" && \
python -m pip install -r "$NV_GENERATE_ROOT/requirements.txt" && \
python skills/nv-generate-mr/scripts/run_mr.py PATH_TO_MR_CONFIG.json --output-dir OUT_DIR --modality mri_t1 --random-seed 0
```

Do not invent `generate.sh`, `infer.py`, `Medical AI Skills run`, or `python -m nv_generate_mr` commands. `PATH_TO_MR_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:

```bash
if [ -z "${NV_GENERATE_ROOT:-}" ]; then
  export NV_GENERATE_COMMIT=61c4ec709b84cad468852243c48e250bec732074
  export NV_GENERATE_ROOT="$HOME/.cache/nvidia-skills/upstreams/NV-Generate-CTMR-61c4ec7"
  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"
```

Download the MR weights:

```bash
cd "$NV_GENERATE_ROOT"
python -m scripts.download_model_data --version rflow-mr --root_dir ./ --model_only
```

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/scripts/run_mr.py`.

## Usage

```bash
export NV_GENERATE_ROOT="${NV_GENERATE_ROOT:-$HOME/.cache/nvidia-skills/upstreams/NV-Generate-CTMR-61c4ec7}" && \
python -m pip install -r "$NV_GENERATE_ROOT/requirements.txt" && \
python skills/nv-generate-mr/scripts/run_mr.py \
  PATH_TO_MR_CONFIG.json \
  --output-dir runs/nv_generate_mr_demo \
  --modality mri_t1 \
  --random-seed 0
```

Replace `PATH_TO_MR_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.py`.

Supported rflow-mr modality names are `mri`, `mri_t1`, `mri_t2`, and
`mri_flair`, matching the upstream MR image-generation guide. The upstream
README recommends `rflow-mr-brain` instead when synthesizing brain images;
use `skills/nv-generate-mr-brain` for that path.
For FOV and setup details, see `references/fov-and-downloads.md`.

The fixture argument is a small JSON override for
`configs/config_maisi_diff_model_rflow-mr.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.

© NVIDIA MedTech Team · Apache-2.0 · NVIDIA/skills

Похожие скиллы

Всё по теме «ИИ и ML» →
generate-synthetic-data ai-evals-course Скилл собирает разнообразные тестовые запросы для оценки LLM-пайплайна, когда реальных данных мало. CX Codex +1 984установок ml-training-recipes dailycafi Скилл содержит практические шаблоны обучения моделей на PyTorch: от настройки циклов и оптимизаторов Muon и AdamW до смешанной точности и устранения OOM. CX Codex +1 912установок see-through-anime-layer-decomposition reason-machines Разбирает одну аниме-иллюстрацию на смысловые слои и собирает из них PSD с картами глубины — для 2.5D-анимации. CX Codex +1 759установок regulatory-affairs-head Alireza Rezvani Скилл для регуляторных задач в MedTech: готовит пакеты FDA 510(k), De Novo и PMA, документацию CE под EU MDR 2017/745. 790установок agentforce-generate forcedotcom Скилл для создания, аудита и отладки агентов Salesforce в формате Agent Script. Помогает писать файлы .agent, настраивать бандлы и развёртывать метаданные через sf CLI. CX Codex +1 5 900установок venice-image-generate nexu-io Скилл открывает агенту доступ к эндпоинтам генерации картинок и стилям через API Venice AI. Пригодится для подготовки иллюстраций прямо из чата. CX Codex +1 2 700установок

Из того же набора178

nv-segment-ct-finetune Дообучает NV-Segment-CT VISTA3D на КТ-датасетах в NIfTI, включая fixed-channel softmax и трекинг в MLflow. Нужен, когда классы известны заранее. CX Codex +1 1 800установок nv-reason-cxr Скилл запускает смоук-тесты модели NV-Reason-CXR-3B для анализа рентгенограмм грудной клетки. Пригодится инженерам для валидации пайплайнов и проверки форматов JSON. CX Codex +1 1 800установок nv-generate-ct-rflow Скилл запускает генерацию синтетических КТ-объёмов и масок через rflow-ct. Результаты требуют независимой проверки перед использованием в обучении медицинских моделей. CX Codex +1 1 800установок nv-segment-ctmr Запускает NV-Segment-CTMR на NIfTI-объёмах КТ или МРТ и сохраняет карту меток вместе с JSON-отчётом. Для клинической трактовки не годится. CX Codex +1 1 800установок nv-segment-ct Запускает VISTA3D на КТ-объёмах в NIfTI и сохраняет карту меток с JSON-отчётом. Для исследовательских прогонов, не для клиники. CX Codex +1 1 800установок nv-generate-mr-brain-finetune Дообучает диффузионную модель NV-Generate-CTMR MR-Brain v1 на ваших NIfTI-снимках T1, T2, FLAIR, SWI или MRA. Сначала прогоняет проверку без GPU. CX Codex +1 1 800установок nv-generate-mr-brain Скилл запускает генерацию синтетических 3D-томограмм мозга (T1, T2, FLAIR, SWI, MRA) через модель NV-Generate-CTMR. Пригодится для подготовки тестовых объёмов NIfTI без реальных снимков. CX Codex +1 1 800установок tao-finetune-huggingface-model Запускает дообучение моделей HuggingFace на локальных видеокартах NVIDIA внутри контейнера NGC PyTorch, если для них нет отдельного скилла TAO. CX Codex +1 1 700установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой