jryoungw / lightdicom_python

Light DICOM package
15 stars 1 forks source link
dicom python python3

LightDICOM

LightDICOM is a fast as light, light as feather Python3 package for managing DICOM files.
The only 3rd party dependency is numpy, thus fast and light.

Basic Usage

from LightClass import LightDCMClass

lc = LightDCMClass()
lc.path = path_to_dicom
d = lc.get_data('0010,0010') # Read tag (0010, 0010), which is "Patient's Name"
npy = lc.read_pixel() # Read pixel values

Or

from LightClass import LightDCMClass

lc = LightDCMClass(path=path_to_dicom)
d = lc.get_data('0010,0010') # Read tag (0010, 0010), which is "Patient's Name"
npy = lc.read_pixel() # Read pixel values

How to read all headers and their values?

lc = LightDCMClass()
lc.path = path_to_dicom 
# Equivalent code : lc = LightDCMClass(path=path_to_dicom)
all_headers = lc.read_all(with_pixel=True)

In .read_all method, there are two arguments:

Dependencies

- Python 3.x
- Numpy

Installation

If numpy is not installed, first install it by pip, conda or other method of your choice.

This is a prototype version, so do remember that bugs or unexpected behaviors may exist.
Whenever bugs are found, please contact via the aforementioned methods. PRs are welcome!