Skills

Extracting Dicom Metadata

Reads DICOM file headers and DICOM-SR (Structured Report) content to pull study/series...

Install

npx skills add maziyarpanahi/openmed --skill extracting-dicom-metadata -g -a claude-code -y
Repository
maziyarpanahi/openmed5.8k
Category
Engineering
Updated
4d ago
License
Apache-2.0
Context cost
Mediumabout 1,612 tokens
Runs scripts
No, instructions only

What it does

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.

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:

TagNameVRNotes
(0010,0010)PatientNamePNdirect identifier
(0010,0020)PatientIDLOMRN
(0010,0030)PatientBirthDateDADOB
(0010,1040)PatientAddressLOaddress
(0008,0090)ReferringPhysicianNamePNprovider
(0008,0020/0030)StudyDate / StudyTimeDA/TMdates
(0008,0050)AccessionNumberSHorder id
(0008,103E)SeriesDescriptionLOfree text, may leak PHI
(0020,4000)ImageCommentsLTfree text, may leak PHI
(0040,A730)ContentSequenceSQDICOM-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")
Read the whole SKILL.md on GitHub

More in Engineering