DICaugment

DICaugment: A Python Package for 3D Medical Imaging Augmentation - Published in JOSS (2024)

https://github.com/didsr/dicaugment

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Mathematics Computer Science - 37% confidence
Last synced: 6 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: DIDSR
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 160 MB
Statistics
  • Stars: 5
  • Watchers: 3
  • Forks: 1
  • Open Issues: 0
  • Releases: 8
Created almost 3 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Changelog Contributing License

README.md

DICaugment

Build Status PyPI version PyPI - Python Version codecov DOI

DICaugment (/daɪkɔːɡˈment/) is a Python package based on the popular image augmentation library Albumentations [1], but with specific enhancements for working with 3D images, such as CT scans. This package provides a collection of powerful and efficient augmentation techniques that can be seamlessly integrated into your machine learning pipeline.

Below are some examples of some common or unique augmentations that are possible with the DICaugment library applied on an example obtained from the NLST dataset [2]:

Features

DICaugment offers the following key features:

  • 3D-specific augmentation techniques: The package includes a variety of augmentation methods specifically designed for volumetric 3D images, such as CT scans. These techniques can be used to augment data and improve model generalization. The package was designed to incorporate the metadata availble in DICOM headers, allowing users to create transformations that are consistent with an image's acquisition parameters.

  • Seamless integration: The package is built as an extension of the Albumentations library, making it easy to incorporate 3D augmentation into your existing image processing pipelines. It maintains a similar API and workflow, ensuring a smooth transition for users already familiar with Albumentations.

  • Flexibility: DICaugment is designed to be flexible, allowing users to create custom augmentation pipelines tailored to their specific needs. The modular architecture of the package makes it easy create long and complex augmentation pipelines suitable for their needs.

Key Differences between DICaugment and Albumentations

  • Dimensionality is a key difference as Albumentations and most other augmentation libraries do not support volumetric images while DICaugment is specifically tailored for these types of images

  • The backbone of Albumentations mainly relies on operations in the openCV framework while DICaugment relies on SciPy. As DICaugment is specifically designed to operate on multidimensional data SciPY is used throughout the library. In the future, certain operations that are acheivable through openCV will be implemented.

Authors

Jacob McIntosh

Qian Cao

Berkman Sahiner

Nicholas Petrick

Mehdi Farhangi

Installation

DICaugment requires Python 3.8 or higher. To install the latest version using pip:

pip install dicaugment

Usage

To use DICaugment, you need to import the necessary modules and define an augmentation pipeline. Here's a simple example demonstrating how to apply a 3D augmentation pipeline to a CT scan:

```python import dicaugment as dca

Define the augmentation pipeline

transform = dca.Compose([ dca.Rotate(p=0.5, limit=20, interpolation=1), dca.RandomCrop(p=0.5, height=64, width=64, depth=64) ])

Apply the augmentation pipeline to a CT scan

augmented_scan = transform(image=scan)["image"] ```

In the example above, we import the dicaugment module and create an instance of dca.Compose to define our augmentation pipeline. We then specify the desired augmentation techniques, such as rotation (dca.Rotate) and random cropping (dca.RandomCrop), along with their respective parameters. Finally, we apply the transformation to a CT scan using the transform function.

Please refer to the DICaugment documentation for more detailed usage instructions and a comprehensive list of available augmentation techniques.

List of augmentations

Pixel-level transforms

Pixel-level transforms will change just an input image and will leave any additional targets such as masks, bounding boxes, and keypoints unchanged. The list of pixel-level transforms:

Spatial-level transforms

Spatial-level transforms will simultaneously change both an input image as well as additional targets such as masks, bounding boxes, and keypoints. The following table shows which additional targets are supported by each transform.

| Transform | Image | Masks | BBoxes | Keypoints | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---: | :---: | :----: | :-------: | | BBoxSafeRandomCrop | ✓ | ✓ | ✓ | | | CenterCrop | ✓ | ✓ | ✓ | ✓ | | CoarseDropout | ✓ | ✓ | | ✓ | | Crop | ✓ | ✓ | ✓ | ✓ | | CropAndPad | ✓ | ✓ | ✓ | ✓ | | Flip | ✓ | ✓ | ✓ | ✓ | | GridDropout | ✓ | ✓ | | | | HorizontalFlip | ✓ | ✓ | ✓ | ✓ | | LongestMaxSize | ✓ | ✓ | ✓ | ✓ | | NoOp | ✓ | ✓ | ✓ | ✓ | | PadIfNeeded | ✓ | ✓ | ✓ | ✓ | | PixelDropout | ✓ | ✓ | ✓ | ✓ | | RandomCrop | ✓ | ✓ | ✓ | ✓ | | RandomCropFromBorders | ✓ | ✓ | ✓ | ✓ | | RandomCropNearBBox | ✓ | ✓ | ✓ | ✓ | | RandomRotate90 | ✓ | ✓ | ✓ | ✓ | | RandomScale | ✓ | ✓ | ✓ | ✓ | | RandomSizedBBoxSafeCrop | ✓ | ✓ | ✓ | | | RandomSizedCrop | ✓ | ✓ | ✓ | ✓ | | Resize | ✓ | ✓ | ✓ | ✓ | | Rotate | ✓ | ✓ | ✓ | ✓ | | ShiftScaleRotate | ✓ | ✓ | ✓ | ✓ | | SliceFlip | ✓ | ✓ | ✓ | ✓ | | SmallestMaxSize | ✓ | ✓ | ✓ | ✓ | | Transpose | ✓ | ✓ | ✓ | ✓ | | VerticalFlip | ✓ | ✓ | ✓ | ✓ |

CT Scan Specific Transforms

These transforms utilize metadata from a DICOM header file to apply a pixel-level or spatial-level transformation

The NPSNoise transormation applies a random change in the magnitude of the noise present in the image consistent with the kernel type [3] provided in the DICOM header

```python import dicaugment as dca

scan = dca.readdcmimage( path='path/to/dcm/folder/', return_header=False # Set as True to recieve scan and dicom header )

dicom = { "PixelSpacing" : (0.48, 0.48), "RescaleIntercept" : -1024.0, "RescaleSlope" : 1.0, "ConvolutionKernel" : 'b30f', "XRayTubeCurrent" : 240 }

aug = dca.Compose([dca.NPSNoise()]) result = aug(image=scan, dicom=dicom) ```

Contributing

Contributions to DICaugment are welcome! If you have any bug reports, feature requests, or would like to contribute code, please check out our CONTRIBUTING guidelines.

License

DICaugment is distributed under the MIT license. See LICENSE for more information.

Acknowledgments

We would like to express our gratitude to the developers of Albumentations [1] for their excellent work on the original library, which served as the foundation for DICaugment. We also thank the open-source community for their contributions and feedback.

Author Contributions

Jacob McIntosh authored the package, developed the pipeline and its functions, wrote the documentation, and drafted the article. Qian Cao assisted in noise insertion augmentation and contributed to the drafting of the article. Berkman Sahiner and Nicholas Petrick assisted in designing the validation study, noise simulation, and contributed to the drafting of the article. Mehdi Farhangi supervised the project, implemented the noise insertion augmentation, conducted the validation study, and contributed to the article drafting.

References

[1] Buslaev, A., Iglovikov, V. I., Khvedchenya, E., Parinov, A., Druzhinin, M., & Kalinin, A. A. (2020). Albumentations: fast and flexible image augmentations. Information, 11(2), 125.

[2] National Lung Screening Trial Research Team. (2013). Data from the National Lung Screening Trial (NLST) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.HMQ8-J677

[3] Solomon, Justin B., Olav Christianson, and Ehsan Samei. "Quantitative comparison of noise texture across CT scanners from different manufacturers." Medical physics 39.10 (2012): 6048-6055.

Owner

  • Name: DIDSR (Aldo Badano, Director)
  • Login: DIDSR
  • Kind: organization
  • Location: United States of America

FDA, CDRH, OSEL, Division of Imaging, Diagnostics, and Software Reliability

JOSS Publication

DICaugment: A Python Package for 3D Medical Imaging Augmentation
Published
March 03, 2024
Volume 9, Issue 95, Page 6120
Authors
J. McIntosh ORCID
Division of Imaging, Diagnostics, and Software Reliability, CDRH, U.S. Food and Drug Administration, Silver Spring, MD 20993, USA
Qian Cao
Division of Imaging, Diagnostics, and Software Reliability, CDRH, U.S. Food and Drug Administration, Silver Spring, MD 20993, USA
Berkman Sahiner
Division of Imaging, Diagnostics, and Software Reliability, CDRH, U.S. Food and Drug Administration, Silver Spring, MD 20993, USA
Nicholas Petrick
Division of Imaging, Diagnostics, and Software Reliability, CDRH, U.S. Food and Drug Administration, Silver Spring, MD 20993, USA
M. Mehdi Farhangi
Division of Imaging, Diagnostics, and Software Reliability, CDRH, U.S. Food and Drug Administration, Silver Spring, MD 20993, USA
Editor
Øystein Sørensen ORCID
Tags
Augmentation Deep Learning Medical

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 95
  • Total Committers: 3
  • Avg Commits per committer: 31.667
  • Development Distribution Score (DDS): 0.116
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
jjmcintosh j****h@g****m 84
Mac 6****h 10
Øystein Sørensen o****n@h****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 12
  • Average time to close issues: 12 days
  • Average time to close pull requests: 3 days
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.08
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • kuadrat (1)
Pull Request Authors
  • jjmcintosh (21)
  • osorensen (2)
Top Labels
Issue Labels
Pull Request Labels
documentation (10) bug (6) enhancement (3)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 23 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 8
  • Total maintainers: 2
pypi.org: dicaugment

3D medical image augmentation library

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 23 Last month
Rankings
Dependent packages count: 7.5%
Forks count: 30.2%
Average: 36.6%
Stargazers count: 39.1%
Dependent repos count: 69.7%
Maintainers (2)
Last synced: 6 months ago

Dependencies

docs/requirements.txt pypi
  • numpy *
  • opencv-python *
  • pydicom *
  • pytest *
  • scipy *
  • tensorflow *
  • torch *
  • torchvision *
setup.py pypi
.github/workflows/auto_test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
requirements.txt pypi
  • PyYAML *
  • numpy >=1.11.1
  • pydicom *
  • qudida >=0.0.4
  • scikit-image >=0.16.1
  • scipy >=1.1.0
  • setuptools *
.github/workflows/publish.yml actions