pydicom
A pure Python package for reading and writing DICOM data
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 pydicomuv
uv add pydicompoetry
poetry add pydicomInstalling 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
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
dicom2niftiConverts DICOM medical imaging files to NIfTI…
permissive · top 15,000 on PyPI
fabioFabIO reads and writes 2D X-ray detector images…
permissive · top 15,000 on PyPI
highdicomHighdicom provides a high-level Python API for…
permissive · top 15,000 on PyPI
pylibjpegDecodes and encodes JPEG, JPEG-LS, JPEG 2000,…
permissive · top 15,000 on PyPI
python-gdcmPython wrapper for GDCM (Grassroots DICOM), a…
permissive · top 15,000 on PyPI
pylibjpeg-libjpegDecodes JPEG and JPEG-LS images to NumPy…
copyleft · top 15,000 on PyPI
pylibjpeg-openjpegDecodes and encodes JPEG 2000 images to and…
permissive · top 15,000 on PyPI
dicomweb-clientA Python client library for interacting with…
permissive · top 15,000 on PyPI
pynrrdReads and writes NRRD (Nearly Raw Raster Data)…
permissive · top 15,000 on PyPI
pyheifReads HEIF/HEIC image files and exposes their…
permissive · top 15,000 on PyPI