Skip to content

DICOM sorting and managing functionality written in python

License

Notifications You must be signed in to change notification settings

BAIRLab/DICOManager

Repository files navigation

Contributors Forks Stargazers Issues BSD-3-Clause License 3.8


DICOManager

A DICOM Sorting and Processing Toolkit written in Python
Explore the docs »
View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

DICOManager is designed around building a DICOM file tree, from which multi-threaded reconstruction, processing and saving can be conducted. For systems with limited memory, file trees contain pointers to disk allowing reconstruction to be run on as little as 8 GiB memory. For systems with limited write access, all operations can be conducted in memory.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This package requires python version 3.8 or greater.

Installation

  1. Clone the repo
    git clone https://github.com/BAIRLab/DICOManager.git
  2. Install PIP packages
    python -m pip install -r requirements.txt

Usage

DICOManager is designed around building DICOM trees and conducting multithreaded operations on the trees. The basic tree design has the following heirachy:

  1. Cohort
  2. PatientID
  3. FrameOfReferenceUID
  4. StudyInstanceUID
  5. SeriesInstanceUID
  6. Modality (contains individual dicom and reconstructed files)

The file tree can then be saved, reconstructed into volumes, filtered, sorted or manipulated.

Building a tree

from DICOManager import groupings
from glob import glob

files = glob('/path/to/unsorted/files/**/*.dcm', recursive=True)
project = groupings.Cohort(files=files, name='Example')
print(project)

Saving DICOM tree

project.save_tree('/path/to/save/tree')

Reconstructing DICOMs
To reduce memory usage, the default behavior for reconstruction is to write the volumes to disk and only store the paths to the volumes in memory.

project.recon(path='/path/to/save/pointers')

For more examples, please refer to the jupyter notebook or the example script example.py.

Roadmap

See the open issues for a list of proposed features (and known issues).

The remaining tasks are in the process of being completed:

  • Support for data generators for pytorch / tensorflow
  • Reading saved directory trees without re-sorting
  • Checking loaded tree for validity
  • Updating deconstruction for new data structures
  • Support for saving as NIFTI format or x-array
  • Improving documentation and creation of wiki
  • Formatting for pip install

Contributing

Any contributions are greatly appreciated. Please submit a pull request as follows:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the BSD-3-Clause License. See LICENSE for more information.

Contact

Evan Porter - evan.porter(at)beaumont.org

Acknowledgements