Grassroots DICOM runtime libraries
Project Links
Meta
Author: Thiago Franco de Moraes
Requires Python: >=3.7
Classifiers
Development Status
- 5 - Production/Stable
Environment
- Console
Intended Audience
- Developers
- Science/Research
License
- OSI Approved :: Apache Software License
Operating System
- MacOS
- Microsoft :: Windows
- POSIX
- Unix
Programming Language
- C
- Python
- Python :: 3
- Python :: 3 :: Only
- Python :: 3.7
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: Implementation :: CPython
Topic
- Scientific/Engineering
Python-GDCM
Unofficial GDCM packages for Python 3 on Linux, Windows and MacOS (both Intel and Apple Silicon).
Grassroots DiCoM is a C++ library for DICOM medical files that can be wrapped for Python using SWIG. It supports datasets encoded using native, JPEG, JPEG 2000, JPEG-LS, RLE and deflated transfer syntaxes. It also comes with Parts 3, 6 & 7 of the DICOM Standard as XML files.
Installation
Using pip
pip install -U python-gdcm
From source
Install dependencies
- Compiler for you platform (GCC, Clang, MSVC)
- CMake
- SWIG
- patchelf will also be needed on Linux
- Git to get the source code
Setup environment
If the cmake
or swig
executables aren't in $PATH
, either add them or create CMAKE_EXE
and SWIG_EXE
envars:
export CMAKE_EXE="path/to/cmake/executable"
export SWIG_EXE="path/to/swig/executable"
Clone source
git clone --recurse-submodules https://github.com/tfmoraes/python-gdcm
Build and install
# Note the trailing slash!
pip install python-gdcm/
Test installed package
python -c "import gdcm; print(gdcm.GDCM_VERSION)"
If you get a ModuleNotFoundError: No module named '_gdcm.gdcmswig'
error then make sure your current working directory doesn't contain a _gdcm
folder.
Usage
Reading a DICOM image file
import gdcm
reader = gdcm.ImageReader()
reader.SetFileName("dicom_image_file.dcm")
ret = reader.Read()
if not ret:
print("It was not possible to read your DICOM file")
Other Examples
See here https://github.com/malaterre/GDCM/tree/master/Examples/Python
Oct 06, 2025
3.2.2
Sep 11, 2025
3.2.1
Jul 11, 2025
3.0.26
May 26, 2025
3.0.25
May 07, 2024
3.0.24.1
Apr 09, 2024
3.0.23.1
Jan 10, 2024
3.0.23
May 08, 2023
3.0.22
Jan 31, 2023
3.0.21
Nov 18, 2022
3.0.20
Sep 26, 2022
3.0.19
Sep 08, 2022
3.0.17.1
Sep 01, 2022
3.0.16
Aug 12, 2022
3.0.15
Jun 24, 2022
3.0.14
Apr 04, 2022
3.0.12
Mar 25, 2022
3.0.11
Feb 11, 2022
3.0.10.2
Wheel compatibility matrix
Files in release
No dependencies