
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:
| 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")
