Skip to content

GDCM Packaging tweaked for dicom-fixer

License

Notifications You must be signed in to change notification settings

flywheel-io/python-gdcm

 
 

Repository files navigation

Python version PyPI version Downloads

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

About

GDCM Packaging tweaked for dicom-fixer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.4%
  • Shell 9.6%