Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính5.8k · #14700

extracting-dicom-metadata

Skill này làm gì

Skill này đọc tệp hình ảnh y tế DICOM, lấy văn bản báo cáo và liệt kê các trường trong phần đầu có chứa chi tiết bệnh nhân. Dành cho các nhóm chuẩn bị dữ liệu hình ảnh để phân tích văn bản lâm sàng hoặc chia sẻ an toàn.

Khi nào nên dùng

  • ✓Khi bạn nhập tệp DICOM và cần phân tích văn bản báo cáo chẩn đoán hình ảnh.
  • ✓Khi bạn cần liệt kê các thẻ phần đầu chứa thông tin bệnh nhân trước khi chia sẻ hình ảnh.
  • ✓Khi một báo cáo có cấu trúc DICOM chứa báo cáo đã được đọc cần khử nhận dạng.

Liên kết skill

https://github.com/maziyarpanahi/openmed/blob/master/skills/extracting-dicom-metadata/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/maziyarpanahi/openmed/blob/master/skills/extracting-dicom-metadata/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy đọc các tệp DICOM CT này, lấy văn bản báo cáo và liệt kê các trường phần đầu có chứa thông tin bệnh nhân.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đọc phần đầu tệp và nội dung báo cáo có cấu trúc, trích xuất phần văn bản tường thuật, gắn cờ các thẻ có định danh, rồi chuyển văn bản báo cáo sang bước khử nhận dạng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Extracting DICOM Metadata & Report Text for OpenMed

DICOM (Digital Imaging and Communications in Medicine) files carry far more than pixels: a header of tagged attributes (patient, study, series, equipment) and, for DICOM-SR (Structured Reports), a content tree holding the actual radiology/cardiology report text. Two jobs sit here: pull the report narrative for NLP, and flag the PHI in the header so it gets scrubbed. This skill does both, then hands narrative to OpenMed. Header tags are read with pydicom (external, MIT-licensed); de-identification of the extracted text is OpenMed's.

When to use

  • You ingest DICOM from PACS/VNA or a research archive and want the SR report text mined with clinical NLP.
  • You must enumerate PHI-bearing header tags before sharing/exporting images.
  • You have DICOM-SR objects (e.g. radiology measurements + impression) whose content tree contains the dictated report.

DICOM headers in one minute

Every attribute has a tag (gggg,eeee) (group, element), a VR (value representation, e.g. PN person name, DA date, UI UID), and a value. PHI clusters in well-known tags:

Tag Name VR Notes
(0010,0010) PatientName PN direct identifier
(0010,0020) PatientID LO MRN
(0010,0030) PatientBirthDate DA DOB
(0010,1040) PatientAddress LO address
(0008,0090) ReferringPhysicianName PN provider
(0008,0020/0030) StudyDate / StudyTime DA/TM dates
(0008,0050) AccessionNumber SH order id
(0008,103E) SeriesDescription LO free text — may leak PHI
(0020,4000) ImageComments LT free text — may leak PHI
(0040,A730) ContentSequence SQ DICOM-SR report tree

Quick start

Read the header, pull SR report text, flag PHI tags, hand off to OpenMed:

import pydicom
import openmed

ds = pydicom.dcmread("study.dcm")

# 1) Enumerate PHI-bearing header tags (report, do not log values).
PHI_TAGS = [
    (0x0010, 0x0010), (0x0010, 0x0020), (0x0010, 0x0030), (0x0010, 0x1040),
    (0x0008, 0x0090), (0x0008, 0x0050), (0x0008, 0x0020), (0x0008, 0x0030),
]
present_phi = [hex_pair for hex_pair in PHI_TAGS if hex_pair in ds]

# 2) Extract report text from a DICOM-SR content tree (recursively).
def sr_text(dataset):
    chunks = []
    for item in dataset.get("ContentSequence", []):
        vt = item.get("ValueType")
        if vt == "TEXT" and "TextValue" in item:
            chunks.append(item.TextValue)
        if "ContentSequence" in item:          # nested CONTAINER
            chunks.append(sr_text(item))
    return "\n".join(c for c in chunks if c)

report = sr_text(ds)
# Some modalities stash narrative in free-text header tags too:
for tag in ("ImageComments", "SeriesDescription", "StudyDescription"):
    if tag in ds and isinstance(ds.get(tag), str):
        report += "\n" + ds.get(tag)

# 3) De-identify the narrative, then run NER.
if report.strip():
    deid = openmed.deidentify(report, method="replace", policy="hipaa_safe_harbor")
    result = openmed.analyze_text(deid.text, output_format="dict")

pydicom reads tags by keyword (ds.PatientName) or by (group, element). DICOM-SR text lives in the recursive ContentSequence content tree.

Workflow

  1. Read the dataset with pydicom.dcmread (use stop_before_pixels=True for header-only/metadata work — faster, avoids loading pixels).
  2. Walk the SR content tree. ContentSequence nests CONTAINER, TEXT, CODE, NUM, PNAME nodes; concatenate TEXT.TextValue (and relevant CODE/NUM measurements) in document order to reconstruct the report.
  3. Inventory PHI tags. Flag the standard identifier tags and free-text tags (ImageComments, *Description) that frequently leak PHI. Report tag presence — never echo the values into logs.
  4. De-identify → analyze the report narrative with OpenMed.
  5. Scrub the header before any image export using a DICOM de-identification profile (PS3.15 Annex E / Basic Application Level Confidentiality). OpenMed de-identifies the narrative; header scrubbing is a separate DICOM step.

Hand-off to / from OpenMed

  • To OpenMed: SR report text (and free-text header tags) → openmed.deidentify → openmed.analyze_text.
  • Header de-id is out of scope for OpenMed — OpenMed handles the text narrative; use a DICOM-native de-identifier (pydicom + PS3.15 profile, or a PACS de-id node) to scrub `(
Câu hỏi thường gặp

Nó có phân tích điểm ảnh của hình ảnh không?

Không. Nó đọc phần đầu và văn bản báo cáo có cấu trúc, không đọc chính hình ảnh.

Nó hỗ trợ những loại hình ảnh nào?

Nó bao quát các phương thức phổ biến như CT, MR, CR và siêu âm, cùng báo cáo có cấu trúc chẩn đoán hình ảnh.

Nó có khử nhận dạng chính văn bản báo cáo không?

Văn bản báo cáo đã trích xuất được chuyển sang bước khử nhận dạng, là một bước riêng.

Chi tiết

Mô tả gốc của tác giả

Reads DICOM file headers and DICOM-SR (Structured Report) content to pull study/series metadata and embedded report text, and flags PHI carried in header tags. Use before OpenMed processing when ingesting imaging data (CT/MR/CR/US, radiology SR) and you need the report narrative de-identified and analyzed, plus a list of header tags that must be scrubbed. Hand SR/report text to openmed.deidentify and openmed.analyze_text; use pydicom to read tags. Trigger keywords: DICOM, pydicom, DICOM-SR, structured report, PatientName, study metadata, PACS, radiology report, PS3.

repo: maziyarpanahi/openmed

Độ phổ biến

Sao GitHub
5.8k
Vị trí xếp hạng
#14700
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự