dicom-metadata-extract
NVIDIA/skills
从 DICOM 文件中提取选定的元数据,并标记标准标签中是否包含受保护健康信息(PHI)。本工具不适用于匿名化处理或临床用途。
...展开全部DICOM 元数据提取
用途
- 用于从单个 DICOM 文件中提取选定的元数据,并标记标准标签中是否包含受保护健康信息(PHI)。本工具不适用于匿名化处理或临床用途。
- 请严格按照文档说明使用该封装类;请勿用自定义实现替换上游入口点。
- 清单 I/O:输入为
dicom_path;输出为metadata_json.
使用说明
- 请先阅读
skill_manifest.yaml。 - 请
scripts/extract_metadata.py执行下文所述的命令;将输出保存在调用方提供的运行目录下。 - 如果主机代理暴露了
run_script,请使用run_script("scripts/extract_metadata.py", args=[...]);否则运行下文所示的 Bash/Python 命令。 - 检查生成的 JSON 并运行
medagent.verifiers.dicom_metadata_quality_v1对证据包进行处理,之后才将该运行结果视为已审核的证据。
可用脚本
| 脚本 | 用途 | 参数 |
|---|---|---|
scripts/extract_metadata.py |
由 skill_manifest.yaml 声明的主入口点。 | PATH_TO_DICOM [--output OUT.json] |
先决条件
- 运行时要求:
runtime.side_effects.pip_packages. - 除非下文现有章节另有说明,否则请从仓库根目录运行命令。
限制
- 仅支持受 PS3.15 启发的小型标准标签子集;并非完整的“基本应用程序保密性配置文件”实现。
- 未检查私有标签
- 未检测到烧屏像素 PHI
- 多帧处理功能有限
- 不适用于临床部署、法规要求的去识别化、自主诊断以及面向患者的使用。
故障排除
| 错误 | 原因 | 解决方法 |
|---|---|---|
| 缺少依赖项或导入错误 | 运行时包与 skill_manifest.yaml. |
安装清单中声明的包,或使用文档中记载的设置命令。 |
| 输出为空或模式无效 | 输入路径错误、模态不支持或上游处理失败。 | 请使用已知测试用例重新运行,并检查包装器 JSON 以及标准错误输出。 |
| 验证门失败 | 输出违反了声明的工程不变量。 | 保留失败的证据包,并利用验证闸门报错信息修复输入数据或封装器代码。 |
使用 pydicom 读取一个 DICOM 文件,并将 JSON 输出到标准输出。
python scripts/extract_metadata.py PATH_TO_DICOM
python scripts/extract_metadata.py PATH_TO_DICOM --output result.json
输出包括 transfer_syntax, modality按研究/序列/图像
分组的元数据, phi_present,以及 phi_tags_found.
请将此用作 Medical AI Skills 技能的最简端到端示例。请勿将其 用于匿名化、私有标签审查、像素级 PHI 检测或临床 解读。
对于二次证据审查,请生成一个可信运行:
python -m eval_engine.run_trusted skills/dicom-metadata-extract \
--fixture skills/dicom-metadata-extract/fixtures/sample_ct.dcm \
--out runs/dicom_metadata_trusted
---
name: dicom-metadata-extract
description: Extracts selected metadata from a DICOM file and flags standard-tag PHI presence. Not for anonymization or clinical use.
license: Apache-2.0
---
# DICOM Metadata Extract
## Purpose
- Used for extracting selected metadata from one DICOM file and flagging standard-tag PHI presence. Not for anonymization or clinical use.
- Use the wrapper exactly as documented; do not replace the upstream entrypoint with a handwritten implementation.
- Manifest I/O: inputs are `dicom_path`; outputs are `metadata_json`.
## Instructions
- Read `skill_manifest.yaml` before changing arguments, side effects, or validation gates.
- Run `scripts/extract_metadata.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/extract_metadata.py", args=[...])`; otherwise run the Bash/Python command shown below.
- Check the emitted JSON and run `medagent.verifiers.dicom_metadata_quality_v1` on evidence packs before treating the run as reviewed evidence.
## Available Scripts
| Script | Purpose | Arguments |
|---|---|---|
| `scripts/extract_metadata.py` | Primary entrypoint declared by skill_manifest.yaml. | `PATH_TO_DICOM [--output OUT.json]` |
## 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
- Small PS3.15-inspired standard-tag subset only; not a complete Basic Application Confidentiality Profile implementation.
- Private tags not checked
- Burnt-in pixel PHI not detected
- Multi-frame handling minimal
- Not for clinical deployment, regulatory de-identification, autonomous diagnosis, patient-facing use.
## 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. |
Reads one DICOM file with pydicom and emits JSON on stdout.
```bash
python scripts/extract_metadata.py PATH_TO_DICOM
python scripts/extract_metadata.py PATH_TO_DICOM --output result.json
```
Output includes `transfer_syntax`, `modality`, grouped study/series/image
metadata, `phi_present`, and `phi_tags_found`.
Use this as the smallest end-to-end example of a Medical AI Skills skill. Do not use
it for anonymization, private-tag review, pixel PHI detection, or clinical
interpretation.
For second-pass evidence review, generate a trusted run:
```bash
python -m eval_engine.run_trusted skills/dicom-metadata-extract \
--fixture skills/dicom-metadata-extract/fixtures/sample_ct.dcm \
--out runs/dicom_metadata_trusted
```





首页
