dicom-series-preflight
NVIDIA/skills
扫描 DICOM 系列文件夹,提取头信息元数据,并在不解码像素数据的情况下生成预检结果。
...展开全部DICOM 系列预检
用途
- 用于在转换或导入前对单个 DICOM 系列文件夹进行仅头部的预检。不适用于去识别化或临床审核。
- 请严格按照文档说明使用该封装类;请勿用自定义实现替换上游入口点。
- 清单输入/输出:输入为
dicom_dir;输出为preflight_json。
使用说明
- 在更改参数、副作用或验证条件之前,请先阅读
skill_manifest.yaml文件。 - 通过下文所述的命令运行
scripts/preflight_series.py;请将输出文件保存在调用方提供的运行目录下。 - 如果主机代理提供了
run_script接口,请使用run_script("scripts/preflight_series.py", args=[...]); 否则,请运行下文所示的 Bash/Python 命令。 - 在将运行结果作为证据处理之前,请检查生成的 JSON 以及相应的验证器指南。
可用脚本
| 脚本 | 用途 | 参数 |
|---|---|---|
scripts/preflight_series.py |
由 skill_manifest.yaml 声明的主入口点。 | PATH_TO_DICOM_DIR |
先决条件
- 运行时要求:
runtime.side_effects.pip_packages中列出的 Python 包。 - 除非下文现有章节另有说明,否则请从仓库根目录运行命令。
限制
- 仅处理头文件;不解码像素数据,也不检测嵌入的 PHI。
- 规范方向门假设采用基于 LPS 的 CT 轴代码 L、P、S。
- 会针对压缩传输语法和多帧实例发出警告,但不会进行解码。
- 单目录扫描;不会对同一树中的多个研究进行整合。
- 不适用于临床部署、法规要求的去识别化、自主诊断,以及在未经过审核的转换器情况下进行生产环境数据导入。
故障排除
| 错误 | 原因 | 解决方法 |
|---|---|---|
| 缺少依赖项或导入错误 | 运行时包与skill_manifest.yaml 中的声明不一致。 |
安装清单中声明的包,或使用文档中所述的 setup 命令。 |
| 输出为空或模式无效 | 输入路径错误、模态不受支持或上游处理失败。 | 请使用已知测试用例重新运行,并检查包装器 JSON 以及标准错误输出。 |
| 验证门失败 | 输出违反了声明的工程不变量。 | 保留失败的证据包,并根据验证门消息修复输入或封装代码。 |
扫描 DICOM目录(每个文件夹包含一个序列),不进行像素解码。
输出包含清单、方向轴码、PHI 标志、发现结果以及
preflight.verdict(结果为通过、警告或失败)的 JSON 文件。
python scripts/preflight_series.py PATH_TO_DICOM_DIR
与verifiers/dicom_preflight_quality_v1配合使用,以生成可信的预检包:
make run-trusted SKILL=dicom_series_preflight \
FIXTURE=skills/dicom-series-preflight/fixtures/clean_no_phi \
OUT=runs/dicom_preflight_demo
旗舰工作流:
make run-workflow \
WORKFLOW=examples/workflows/dicom_preflight_gate.yaml \
WORKFLOW_INPUT=skills/dicom-series-preflight/fixtures/clean_no_phi \
WORKFLOW_OUT=runs/dicom_preflight_gate
不适用于去识别化、私有标签审核或临床审批。
---
name: dicom-series-preflight
description: Scans a DICOM series folder to extract header metadata and produce a preflight verdict without decoding pixel data.
license: Apache-2.0
---
# DICOM Series Preflight
## Purpose
- Used for header-only preflight of one DICOM series folder before conversion or inference. Not for de-identification or clinical clearance.
- Use the wrapper exactly as documented; do not replace the upstream entrypoint with a handwritten implementation.
- Manifest I/O: inputs are `dicom_dir`; outputs are `preflight_json`.
## Instructions
- Read `skill_manifest.yaml` before changing arguments, side effects, or validation gates.
- Run `scripts/preflight_series.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/preflight_series.py", args=[...])`; otherwise run the Bash/Python command shown below.
- Check the emitted JSON and paired verifier guidance before treating the run as evidence.
## Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
| `scripts/preflight_series.py` | Primary entrypoint declared by skill_manifest.yaml. | `PATH_TO_DICOM_DIR` |
## Prerequisites
- Runtime requirements: Python packages listed in `runtime.side_effects.pip_packages`.
- Run commands from the repository root unless an existing section below says otherwise.
## Limitations
- Header-only; does not decode pixel data or detect burnt-in PHI.
- Canonical orientation gate assumes LPS-derived CT axcodes L,P,S.
- Compressed transfer syntax and multi-frame instances are warned, not decoded.
- Single-directory scan; does not reconcile multiple studies in one tree.
- Not for clinical deployment, regulatory de-identification, autonomous diagnosis, production ingestion without a vetted converter.
## 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. |
Scans a DICOM **directory** (one series per folder) without decoding pixels.
Emits JSON with inventory, orientation axcodes, PHI flags, findings, and a
`preflight.verdict` of `pass`, `warn`, or `fail`.
```bash
python scripts/preflight_series.py PATH_TO_DICOM_DIR
```
Pair with `verifiers/dicom_preflight_quality_v1` for a trusted preflight pack:
```bash
make run-trusted SKILL=dicom_series_preflight \
FIXTURE=skills/dicom-series-preflight/fixtures/clean_no_phi \
OUT=runs/dicom_preflight_demo
```
Flagship workflow:
```bash
make run-workflow \
WORKFLOW=examples/workflows/dicom_preflight_gate.yaml \
WORKFLOW_INPUT=skills/dicom-series-preflight/fixtures/clean_no_phi \
WORKFLOW_OUT=runs/dicom_preflight_gate
```
Not for de-identification, private-tag review, or clinical clearance.





首页
