Skip to main content

Grassroots DICOM runtime libraries

Project description

Python version PyPI version


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.


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

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.


Reading a DICOM image file

import gdcm
reader = gdcm.ImageReader()
ret = reader.Read()
if not ret:
    print("It was not possible to read your DICOM file")

Other Examples

See here

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-gdcm-3.0.19.tar.gz (3.6 MB view hashes)

Uploaded source

Built Distributions

python_gdcm-3.0.19-cp311-cp311-win_amd64.whl (27.2 MB view hashes)

Uploaded cp311

python_gdcm-3.0.19-cp311-cp311-win32.whl (23.3 MB view hashes)

Uploaded cp311

python_gdcm-3.0.19-cp310-cp310-win_amd64.whl (27.2 MB view hashes)

Uploaded cp310

python_gdcm-3.0.19-cp310-cp310-win32.whl (23.3 MB view hashes)

Uploaded cp310

python_gdcm-3.0.19-cp39-cp39-win_amd64.whl (27.2 MB view hashes)

Uploaded cp39

python_gdcm-3.0.19-cp39-cp39-win32.whl (23.3 MB view hashes)

Uploaded cp39

python_gdcm-3.0.19-cp38-cp38-win_amd64.whl (27.2 MB view hashes)

Uploaded cp38

python_gdcm-3.0.19-cp38-cp38-win32.whl (23.3 MB view hashes)

Uploaded cp38

python_gdcm-3.0.19-cp37-cp37m-win_amd64.whl (27.1 MB view hashes)

Uploaded cp37

python_gdcm-3.0.19-cp37-cp37m-win32.whl (23.3 MB view hashes)

Uploaded cp37

python_gdcm-3.0.19-cp36-cp36m-win_amd64.whl (27.1 MB view hashes)

Uploaded cp36

python_gdcm-3.0.19-cp36-cp36m-win32.whl (23.3 MB view hashes)

Uploaded cp36

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page