Registry / data / python-gdcm

python-gdcm

JSON →
library3.2.6pypypiunverified

python-gdcm provides unofficial Python 3 bindings for the Grassroots DiCoM (GDCM) C++ library. GDCM is a cross-platform library designed for handling DICOM medical files, supporting various transfer syntaxes including native, JPEG, JPEG 2000, JPEG-LS, RLE, and deflated. The library also includes XML representations of parts 3, 6, and 7 of the DICOM Standard. As of version 3.2.2, it is actively maintained with irregular but consistent updates.

pip install -U python-gdcm
INSTALL
IMPORT
SIG · PYTHON-GDCM
P
python-gdcm
datapythonv3.2.6
Install
1.9s avg
Import
72ms
Disk
58MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.2.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 1.98s
py 3.11
✕ build_error
✓ 1.9s
py 3.12
✕ build_error
✓ 1.9s
py 3.13
✕ build_error
✓ 2s
py 3.9
✕ build_error
✕ build_error
58MB installed
● package 58MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gdcm
import gdcm
import _gdcm.gdcmswig
The `_gdcm.gdcmswig` module is an internal SWIG-generated module and should not be imported directly. The `gdcm` module is the public entry point.

This quickstart demonstrates how to read a DICOM image file using `gdcm.ImageReader`. It initializes a reader, sets the file name, attempts to read the file, and prints a success or error message.

import gdcm # Assuming 'dicom_image_file.dcm' exists in the current directory # Or provide a full path: reader.SetFileName('/path/to/your/dicom_image_file.dcm') reader = gdcm.ImageReader() reader.SetFileName("dicom_image_file.dcm") if reader.Read(): image = reader.GetImage() print(f"DICOM image successfully read. Dimensions: {image.GetDimension(0)}x{image.GetDimension(1)}") # Further processing, e.g., accessing pixel data: # pixel_array = image.GetBuffer() else: print(f"Error: It was not possible to read 'dicom_image_file.dcm'.")
Debug
Known issues
gotchaWhen using `import gdcm`, ensure that your current working directory does not contain a folder named `_gdcm`. If such a folder exists, it can lead to a `ModuleNotFoundError: No module named '_gdcm.gdcmswig'` or other unexpected import errors due to Python's module resolution order conflicting with the internal structure of the `python-gdcm` package.
fix
Rename or remove any local `_gdcm` directory if you encounter import issues.
affects: All versions
breakingPrevious versions of GDCM for Python (before the `python-gdcm` PyPI package became the primary distribution) often had complex installation procedures, especially on Windows, and could be sensitive to the Python version. The `python-gdcm` package on PyPI aims to provide pre-built wheels for common platforms, significantly simplifying installation. However, older manual installations might lead to `ImportError: DLL load failed` due to missing C++ runtime libraries or incorrect Python bindings.
fix
Always prefer `pip install python-gdcm` to leverage pre-built wheels. Ensure your Python environment meets the `>=3.7` requirement. For issues related to third-party libraries like `pydicom` using `gdcm` as a backend, verify `pydicom`'s compatibility with your `python-gdcm` version.
affects: < 3.0.0 (unofficial distributions)
gotchaAlthough `python-gdcm` wraps the C++ GDCM library, direct breaking changes within the Python API between `python-gdcm` versions 3.0.x and 3.2.x are not widely documented. Most compatibility concerns arise from interactions with other Python DICOM libraries like `pydicom`, which might have their own breaking changes or specific GDCM version requirements. For example, `pydicom` v3.0.0 introduced breaking changes and may interact differently with GDCM.
fix
When upgrading `python-gdcm` alongside other DICOM libraries, consult the release notes for all involved packages for potential interaction issues. Test thoroughly after upgrades.
affects: All versions (in conjunction with other libraries)
Upgrade
Version history
3.2.6latest on PyPI · released May 11, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
python-gdcm — pip install python-gdcm · libregistry