pydicom

Anonymize PHI in DICOM files while preserving pixel data and metadata.

15|2|Updated Dec 17, 2025
One-click install
npx skills add https://github.com/rubensliv/k-dense-ai --skill pydicom-rubensliv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pydicom
Source: https://github.com/rubensliv/k-dense-ai/tree/main/scientific-skills/pydicom
Command: npx skills add https://github.com/rubensliv/k-dense-ai --skill pydicom-rubensliv

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

PHI-rich DICOM datasets often need safe sharing and preprocessing. This skill anonymizes patient identifiers while preserving pixel data and essential metadata for research, clinical workflows, and data analysis.

Core Features & Use Cases

  • Read, write, modify, and anonymize DICOM files, including metadata and tags.
  • Extract and convert pixel data to common image formats (PNG/JPEG) and generate previews.
  • Handle multi-frame and series data, including basic visualization and metadata extraction.
  • Support for transfer syntaxes and basic compression/decompression workflows via pydicom.

Quick Start

Start by running the skill on input.dcm to anonymize PHI and generate an anonymized output and a pixel data preview image.

Frequently Asked Questions about pydicom

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

FAQPage Schema
How do I anonymize DICOM files while preserving pixel data for research?

Anonymize DICOM files by stripping PHI identifiers from metadata tags while explicitly retaining the raw pixel data arrays, ensuring datasets remain intact for clinical imaging research and safe sharing.

Can I convert DICOM pixel data to PNG or JPEG using Python?

Yes, you can convert DICOM pixel data to common image formats like PNG or JPEG by utilizing Python imaging libraries to extract arrays and generate preview images.

Does pydicom support reading and modifying multi-frame DICOM series metadata?

Yes, pydicom supports reading, writing, and modifying multi-frame DICOM series, enabling basic visualization and metadata extraction across complex clinical imaging datasets.

What is the best way to handle DICOM transfer syntaxes and compression in Python?

Handle DICOM transfer syntaxes and basic compression or decompression workflows in Python by utilizing dedicated libraries that parse file headers and manage pixel data encoding.

Do I need numpy and Pillow to process DICOM pixel arrays?

You need numpy and Pillow as optional dependencies to support pixel data processing and image export, while the core DICOM reading and anonymization relies on pydicom.