pydicom

Read, modify, and validate DICOM medical image pixel data and metadata in Python.

33.0k|3.2k|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill pydicom-k-dense-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pydicom
Source: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/pydicom
Command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill pydicom-k-dense-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pydicom, Pillow, numpy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Pydicom enables Python-based reading, modification, and analysis of DICOM medical imaging data, removing the need for proprietary viewers to access imaging metadata and pixel arrays.

Core Features & Use Cases

  • Read DICOM files with dcmread and access metadata (PatientName, StudyDate, etc.).
  • Work with pixel data via ds.pixel_array for visualization, processing, and conversion to common image formats.
  • Anonymize PHI and modify or create DICOM fields for research datasets and privacy-compliant data sharing.
  • Convert DICOM images to standard formats (PNG/JPEG) and generate metadata reports for pipelines or audits.

Quick Start

Install pydicom with pip install pydicom, then load a DICOM file with dcmread('path.dcm') to inspect metadata and pixel data.

Frequently Asked Questions about pydicom

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

FAQPage Schema
How do I read DICOM medical imaging files and extract metadata in Python?

Read DICOM files in Python using dcmread to access metadata elements like PatientName and StudyDate, and use pixel_array to extract image data for clinical research and radiology workflows.

What is the best way to anonymize DICOM files for privacy-compliant research datasets?

Anonymize DICOM files by modifying or removing Protected Health Information (PHI) fields, enabling privacy-compliant data sharing for clinical research datasets without relying on proprietary viewers.

Can I convert DICOM images to standard formats like PNG or JPEG using Python?

Convert DICOM images to standard formats like PNG or JPEG using Python by accessing pixel arrays with numpy and processing them with Pillow for pipeline integration or audits.

Do I need to install numpy and Pillow to process DICOM pixel data?

Yes, numpy and Pillow are optional dependencies required to process pixel arrays and convert DICOM images to standard formats, while pydicom handles reading metadata and file structures.

How does Python handle DICOM pixel arrays for medical image visualization?

Python handles DICOM pixel arrays by loading them through pixel_array, returning a numpy array that enables direct visualization, processing, and format conversion for medical imaging pipelines.