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 輸出至標準輸出 (stdout)。
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
```
所有檔案
12 個檔案安裝 dicom-metadata-extract
請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。
下載 ZIP複製儲存庫並將技能檔案複製到您的專案中。
git clone https://github.com/NVIDIA/skills/tree/main/skills/dicom-metadata-extract # Copy SKILL.md to your .claude/skills/ directory
複製





首頁
