pydicom

Read, extract pixels from, inspect metadata of, convert, and anonymize DICOM medical images using pydicom.

783|65|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/LeonChaoX/qinyan-academic-skills --skill pydicom-leonchaox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pydicom
Source: https://github.com/LeonChaoX/qinyan-academic-skills/tree/main/skills/07-%E4%B8%B4%E5%BA%8A%E5%8C%BB%E5%AD%A6%E4%B8%8E%E7%B2%BE%E5%87%86%E5%8C%BB%E7%96%97/pydicom
Command: npx skills add https://github.com/LeonChaoX/qinyan-academic-skills --skill pydicom-leonchaox

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?

This skill removes friction in medical-imaging workflows by helping you reliably read DICOM files, extract pixel data and metadata, convert them for downstream use, and anonymize sensitive information for research or sharing.

Core Features & Use Cases

  • DICOM metadata handling: Parse and inspect DICOM tags (including file meta such as Transfer Syntax) and read study/series/image attributes.
  • Pixel data extraction & visualization prep: Load pixel arrays (single-frame and multi-frame), apply VOI LUT/windowing when available, and handle common color interpretations.
  • Privacy-preserving anonymization: Remove or replace PHI fields (e.g., patient name/ID/birthdate) while keeping the image data intact.
  • Format conversion: Convert DICOM images to standard formats (PNG/JPEG/TIFF) using extracted pixel data.
  • Use Case: You receive a multi-slice CT series as DICOM; use this skill to extract metadata for documentation, convert slices to PNGs for a paper figure, and anonymize patient identifiers before dataset sharing.

Quick Start

Ask the AI to anonymize and convert your DICOM into image files, then save the outputs: "Anonymize input.dcm to anonymized.dcm and convert input.dcm 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 extract pixel data from a multi-frame DICOM file in Python?

To extract pixel data from a multi-frame DICOM file in Python, you can programmatically load pixel arrays and apply VOI LUT windowing. This workflow supports multi-frame data and prepares the extracted pixel arrays for downstream visualization or analysis pipelines.

What is the best way to anonymize patient identifiers in DICOM metadata?

The best way to anonymize patient identifiers in DICOM metadata is to programmatically remove or replace PHI fields like patient name, ID, and birthdate. This sanitizes the DICOM tags while keeping the image and pixel data completely intact for research sharing.

Can I convert a DICOM image to PNG or JPEG using Python?

Yes, you can convert a DICOM image to PNG or JPEG using Python. By extracting the pixel data from the DICOM file and applying any available VOI windowing, the workflow converts the medical imaging slices into standard image formats for use in papers or datasets.

How do I parse and inspect DICOM metadata tags like Transfer Syntax?

To parse and inspect DICOM metadata tags like Transfer Syntax, you use programmatic dataset operations to read the file meta information. This allows you to inspect study, series, and image attributes while ensuring transfer syntax awareness for compatibility.

Does Python pydicom support loading CT series with multi-slice pixel arrays?

Yes, Python pydicom supports loading CT series with multi-slice pixel arrays. The workflow provides deterministic operations for reading both single-frame and multi-frame imaging data, handling complex color interpretations and multi-frame support for radiology data preparation.

Do I need additional libraries to handle compressed DICOM pixel data in Python?

Yes, handling compressed DICOM pixel data in Python requires additional libraries like pylibjpeg and python-gdcm. These dependencies provide the necessary decoding support for various transfer syntaxes, enabling successful pixel data extraction and visualization preparation.