Skip to main content

Extract image data into a 3D numpy array from a set of DICOM files.

Project description

https://travis-ci.org/innolitics/dicom-numpy.svg?branch=master

DICOM Numpy

Overview

This python module provides utilities for extracting image data contained in DICOM files into Numpy ndarrays.

Dependencies

  • Python 2.7 or Python 3.3+

  • Numpy

  • PyDicom

Installation

pip install dicom_numpy

Basic Usage

import dicom
import dicom_numpy

def extract_voxel_data(list_of_dicom_files):
    datasets = [dicom.read_file(f) for f in list_of_dicom_files]
    try:
        voxel_ndarray = dicom_numpy.combine_slices(datasets)
    except dicom_numpy.DicomImportException as e:
        # Either the DICOM files are not from the same series, there are missing
        # internal slices (we can't detect missing end slices), or the data
        # is inconsistent in some way (e.g. the size of each slice is
        # inconsistent).
        raise
    return voxel_ndarray

Project details


Download files

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

Source Distribution

dicom_numpy-0.1.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

dicom_numpy-0.1.1-py2.py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page