pydicom

Read, write, and manipulate DICOM files with pixel data extraction.

557|98|Updated Nov 7, 2025
One-click install
npx skills add https://github.com/jimmc414/Kosmos --skill pydicom-jimmc414
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pydicom
Source: https://github.com/jimmc414/Kosmos/tree/main/kosmos-claude-scientific-skills/scientific-skills/pydicom
Command: npx skills add https://github.com/jimmc414/Kosmos --skill pydicom-jimmc414

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 simplifies the complex task of working with DICOM (Digital Imaging and Communications in Medicine) files, enabling efficient handling of medical imaging data.

Core Features & Use Cases

  • Read & Write DICOM: Load, modify, and save DICOM files.
  • Pixel Data Handling: Extract, process, and visualize image data from medical scans.
  • Metadata Management: Access, modify, and anonymize DICOM tags and attributes.
  • Use Case: A researcher needs to extract all CT scan images from a patient's study, anonymize them by removing patient identifiers, and convert them into PNG format for a presentation.

Quick Start

Use the pydicom skill to read the DICOM file 'patient_scan.dcm' and print the patient's name.

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 DICOM file using Python?

You can extract DICOM pixel data by reading the file and processing the image array for CT, MRI, or X-ray scans. The extracted pixel data can then be visualized using matplotlib or converted into standard image formats like PNG.

What is the best way to anonymize patient identifiers in medical imaging files?

Anonymizing medical imaging files requires accessing and modifying specific DICOM tags and attributes to remove patient identifiers. This ensures the extracted imaging data can be safely shared for research or presentations.

Does pydicom support handling compressed DICOM data?

Yes, handling compressed DICOM data is fully supported through specific dependencies like pylibjpeg and python-gdcm. These libraries enable the decompression and processing of complex medical imaging files.

Can I convert a CT scan DICOM file to a standard image format like PNG?

Yes, you can convert a CT scan by extracting the DICOM pixel data and saving it as a standard image format. This workflow relies on image processing libraries like Pillow to generate the final output image.

How do I access and modify metadata tags in a DICOM file?

You can access and modify DICOM metadata tags by loading the file and iterating through its attributes. This allows you to read, update, or remove specific tags before saving the modified medical imaging data.

What Python libraries do I need to visualize MRI images from DICOM files?

To visualize MRI images from DICOM files, you need numpy for array manipulation and matplotlib for rendering the pixel data. These libraries work together to process and display the extracted medical imaging data.