pydicom

Read and transform DICOM files by extracting pixel data and metadata.

Updated May 24, 2026
One-click install
npx skills add https://github.com/Estrella-231/Mathematical_modeling_tongmeng --skill pydicom-estrella-231
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pydicom
Source: https://github.com/Estrella-231/Mathematical_modeling_tongmeng/tree/main/.agents/skills/pydicom
Command: npx skills add https://github.com/Estrella-231/Mathematical_modeling_tongmeng --skill pydicom-estrella-231

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pydicom, pillow, numpy, matplotlib, pylibjpeg, pylibjpeg-libjpeg, pylibjpeg-openjpeg, python-gdcm, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Pydicom removes the friction of working with DICOM medical imaging files by enabling reliable access to pixel data and metadata, conversion to common image formats, and safer data sharing through anonymization.

Core Features & Use Cases

  • DICOM Metadata & Tag Handling: Read and inspect patient/study/series/image metadata via pydicom datasets and tags.
  • Pixel Data Extraction & Visualization: Load pixel arrays (including multi-frame volumes), apply VOI LUT windowing for correct display, and handle grayscale/RGB images.
  • Conversion, Anonymization & Utility Scripts: Convert DICOM to PNG/JPEG/TIFF; anonymize common PHI fields; extract metadata to text/JSON for downstream pipelines.

Quick Start

Use the pydicom skill to convert the attached DICOM file 'input.dcm' into an image and write it to 'output.png'.

Frequently Asked Questions about pydicom

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a DICOM file to PNG or JPEG?

To convert a DICOM file to PNG or JPEG, the Skill extracts the pixel data and applies VOI LUT windowing for correct grayscale or RGB display, then writes the output to standard image formats like PNG, JPEG, or TIFF.

What is the best way to anonymize DICOM metadata for clinical datasets?

Anonymizing DICOM metadata involves safely processing datasets to clear or modify common Protected Health Information (PHI) fields while maintaining correct UID and tag handling for compliant data sharing.

How do I extract pixel arrays from multi-frame DICOM volumes?

Extracting pixel arrays from multi-frame DICOM volumes requires loading the dataset and decoding compressed pixel data via appropriate transfer-syntax aware handlers like pylibjpeg or python-gdcm to access the underlying numpy arrays.

Does pylibjpeg work with pydicom for compressed DICOM pixel data decompression?

Yes, pylibjpeg works with pydicom for compressed pixel data decompression by acting as a transfer-syntax aware handler, specifically utilizing pylibjpeg-libjpeg and pylibjpeg-openjpeg to decode JPEG encoded medical imaging files.

Why does my DICOM image display incorrectly after conversion?

DICOM images may display incorrectly if VOI LUT windowing is not applied during pixel data extraction, which adjusts the grayscale values for accurate visualization of medical imaging datasets.

Can I export DICOM metadata to JSON for downstream pipelines?

Yes, you can export DICOM metadata to JSON by reading patient, study, series, and image tags from the dataset and extracting them into text or JSON formats for downstream clinical imaging pipelines.