A DICOM Sorting and Processing Toolkit written in Python
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
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.
To get a local copy up and running follow these simple steps.
This package requires python version 3.8 or greater.
- Clone the repo
git clone https://github.com/BAIRLab/DICOManager.git
- Install PIP packages
python -m pip install -r requirements.txt
DICOManager is designed around building DICOM trees and conducting multithreaded operations on the trees. The basic tree design has the following heirachy:
- Cohort
- PatientID
- FrameOfReferenceUID
- StudyInstanceUID
- SeriesInstanceUID
- 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.
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
Any contributions are greatly appreciated. Please submit a pull request as follows:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the BSD-3-Clause License. See LICENSE
for more information.
Evan Porter - evan.porter(at)beaumont.org