skillfed

pydicom

A pure Python package for reading and writing DICOM data

pydicom v3.0.2 5.5M downloads/30d#2,083 on PyPI2,193
Permissive license Active released

What it is and what it does

Pydicom is a pure Python framework for reading, modifying, and writing DICOM files—the standard format for medical imaging data. It provides a pythonic interface to DICOM datasets, allowing you to access and edit individual elements like patient IDs, study descriptions, and pixel data. Since it has no required dependencies beyond Python itself, it runs anywhere Python runs, making it portable across platforms and environments.

Pixel data handling is flexible: you can always read and write compressed or uncompressed pixel data as raw bytes, and if you install NumPy, you can convert pixel data to arrays for numerical processing. The package is intentionally general-purpose and does not attempt to handle specifics of individual DICOM SOP classes or networking; other libraries in the pydicom organization (like pynetdicom for DICOM networking or deid for anonymization) build on top of pydicom for specialized tasks.

Use it for:

  • Extract and modify patient identifiers or study metadata in DICOM files for data management workflows
  • Convert DICOM pixel data to NumPy arrays for image analysis, visualization, or machine learning pipelines
  • Batch process medical imaging datasets to standardize tags, anonymize records, or validate DICOM compliance
  • Read DICOM headers to extract acquisition parameters, modality, or imaging geometry for research
  • Write new DICOM files programmatically from raw image data or modified datasets

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pydicom reads, modifies, and writes DICOM medical imaging files in pure Python, with optional NumPy support for pixel data as arrays.

Yes. Pydicom is the standard Python library for DICOM file I/O, actively maintained, permissively licensed, and has zero required dependencies. Install it if you work with medical imaging data, DICOM files, or healthcare IT systems. The only caveat is that advanced pixel data decompression (JPEG, JPEG 2000) requires optional libraries, but basic read/write and NumPy integration work out of the box.

Install

pydicom on PyPI

pip

pip install pydicom

uv

uv add pydicom

poetry

poetry add pydicom

Installing pydicom

Before you install

Low friction: pure Python package with no required runtime dependencies and a wheel distribution. Active maintenance with recent commits and a stable release history since 2014.

License in practice

Permissive license (MIT) means you can use, modify, and distribute pydicom freely in commercial and private projects with minimal restrictions.

Quickstart

pip install pydicom

from pydicom import dcmread
ds = dcmread('/path/to/file.dcm')
ds.PatientID = '12345678'
ds.save_as('/path/to/file_updated.dcm')

NumPy is optional but recommended if you need to work with pixel data as arrays; decompressing JPEG, JPEG-LS, or JPEG 2000 compressed pixel data requires additional libraries.

Verify before relying

  • Performance characteristics when handling large DICOM files or batch processing workflows
  • Completeness of support for all DICOM SOP classes and transfer syntaxes
  • Specific version requirements for optional compression libraries (pyjpegls, pylibjpeg, gdcm)

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 148 days since the last release
Last repo commit
First released
Downloads 5,521,040/month — #2,083 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pydicom-3.0.2-py3-none-any.whl

Keywords: dicom, python, medical, imaging

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Healthcare IndustryIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Scientific/Engineering :: Medical Science Apps.Topic :: Scientific/Engineering :: PhysicsTopic :: Software Development :: Libraries

Tags

read write dicom filesmedical imaging pythondicom dataset manipulationhealthcare data processingct mri scan filesdicom pixel datamedical image format
medical-imagingdicom-formathealthcare-data

More Libraries packages