MIRP
MIRP: A Python package for standardised radiomics - Published in JOSS (2024)
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 2 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Scientific Fields
Repository
Medical Image Radiomics Processor
Basic Info
- Host: GitHub
- Owner: oncoray
- License: eupl-1.2
- Language: Python
- Default Branch: master
- Homepage: https://oncoray.github.io/mirp/
- Size: 458 MB
Statistics
- Stars: 70
- Watchers: 3
- Forks: 14
- Open Issues: 6
- Releases: 17
Topics
Metadata Files
README.md
Medical Image Radiomics Processor
MIRP is a python package for quantitative analysis of medical images. It focuses on processing images for integration with radiomics workflows. These workflows either use quantitative features computed using MIRP, or directly use MIRP to process images as input for neural networks and other deep learning models.
MIRP offers the following main functionality:
- Extract and collect metadata from medical images.
- Find and collect labels or names of regions of interest from image segmentations.
- Compute quantitative features from regions of interest in medical images.
- Process images for deep learning.
Tutorials
We currently offer the following tutorials:
Documentation
Documentation can be found here: https://oncoray.github.io/mirp/
Supported Python and OS
MIRP currently supports the following Python versions and operating systems:
| Python | Linux | Win | OSX | |--------|-----------|-----------|-----------| | 3.10 | Supported | Supported | Supported | | 3.11 | Supported | Supported | Supported | | 3.12 | Supported | Supported | Supported | | 3.13 | Supported | Supported | Supported |
Supported imaging and mask types
MIRP currently supports the following image and mask types:
| Data format | Data type | Supported modality | |-------------|-----------|-------------------------------------------------| | DICOM | image | CT, MR (incl. ADC, DCE), PT, RTDOSE, CR, DX, MG | | DICOM | mask | RTSTRUCT, SEG | | NIfTI | any | any | | NRRD | any | any | | numpy | any | any | | MIRP-native | any | any |
NIfTI, NRRD, and numpy files support any kind of (single-channel) image. MIRP cannot process RGB or 4D images.
MIRP-native images and masks can be produced by functions such as extract_images, and then used as input.
Installing MIRP
MIRP is available from PyPI and can be installed using pip, or other installer tools:
commandline
pip install mirp
Examples - Computing radiomics features
MIRP can be used to compute quantitative features from regions of interest in images in an IBSI-compliant manner using a standardized workflow This requires both images and masks. MIRP can process DICOM, NIfTI, NRRD and numpy images. Masks are DICOM radiotherapy structure sets (RTSTRUCT), DICOM segmentation (SEG) or volumetric data with integer labels (e.g. 1, 2, etc.).
Below is a minimal working example for extracting features from a single image file and its mask.
```python from mirp import extract_features
featuredata = extractfeatures(
image="path to image",
mask="path to mask",
basediscretisationmethod="fixedbinnumber",
basediscretisationnbins=32
)
``
Instead of providing the path to the image ("pathto_image"), a numpy image can be provided, and the same goes for
"path to mask"`. The disadvantage of doing so is that voxel spacing cannot be determined.
MIRP also supports processing images and masks for multiple samples (e.g., patients). The syntax is much the same,
but depending on the file type and directory structure, additional arguments need to be specified. For example,
assume that files are organised in subfolders for each sample, i.e. main_folder / sample_name / subfolder. The
minimal working example is then:
```python from mirp import extract_features
featuredata = extractfeatures(
image="path to main image directory",
mask="path to main mask directory",
imagesubfolder="image subdirectory structure relative to main image directory",
masksubfolder="mask subdirectory structure relative to main mask directory",
basediscretisationmethod="fixedbinnumber",
basediscretisationnbins=32
)
``
The above example will compute features sequentially. MIRP supports parallel processing using theraypackage.
Feature computation can be parallelized by specifying thenumcpusargument, e.g.num_cpus=2` for two CPU threads.
Examples - Image preprocessing for deep learning
Deep learning-based radiomics is an alternative to using predefined quantitative features. MIRP supports preprocessing of images and masks using the same standardized workflow that is used for computing features.
Below is a minimal working example for preprocessing deep learning images. Note that MIRP uses the numpy notation for indexing, i.e. indices are ordered [z, y, x].
```python from mirp import deeplearningpreprocessing
processedimages = deeplearningpreprocessing( image="path to image", mask="path to mask", cropsize=[50, 224, 224] ) ```
Examples - Summarising image metadata
MIRP can also summarise image metadata. This is particularly relevant for DICOM files that have considerable metadata. Other files, e.g. NIfTI, only have metadata related to position and spacing of the image.
Below is a minimal working example for extracting metadata from a single image file. ```python from mirp import extractimageparameters
imageparameters = extractimage_parameters( image="path to image" ) ```
MIRP also supports extracting metadata from multiple files. For example, assume that files are organised in
subfolders for each sample, i.e. main_folder / sample_name / subfolder. The minimal working example is then:
```python
from mirp import extractimageparameters
imageparameters = extractimageparameters( image="path to main image directory", imagesub_folder="image subdirectory structure relative to main image directory" ) ```
Examples - Finding labels
MIRP can identify which labels are present in masks. For a single mask file, labels can be retrieved as follows: ```python from mirp import extractmasklabels
masklabels = extractmask_labels( mask="path to mask" ) ```
MIRP supports extracting labels from multiple masks. For example, assume that files are organised in subfolders for
each sample, i.e. main_folder / sample_name / subfolder. The minimal working example is then:
python
from mirp import extract_mask_labels
mask_labels = extract_mask_labels(
mask="path to main mask directory",
mask_sub_folder="mask subdirectory structure relative to main mask directory"
)
Examples - Using MIRP native images and mask
MIRP supports exporting images and masks in its native, internal format. This is specified using the
image_export_format="native" argument, e.g. in extract_images(.., image_export_format="native") or
extract_features_and_images(..., image_export_format="native"). The resulting images and masks can be used again
as input, e.g. extract_features(image=native_images, masks=native_masks, ...), with native_images and
native_masks being the images and masks in the native format, respectively.
This allows for external processing of the contents of images and masks, such as performing gamma corrections. The
image and mask contents are retrieved using the get_voxel_grid method, and set using the set_voxel_grid method.
set_voxel_grid expects a numpy.ndarray of the same shape and type (float for images, bool for masks) as the
original.
```python from mirp import extractimages, extractfeatures
results = extractimages( image="path to image", mask="path to mask", imageexport_format="native" )
image = results[0][0][0] mask = results[0][1][0]
Obtain the numpy.ndarray.
voxelgrid = image.getvoxel_grid()
Divide intensities by 2.
image.setvoxelgrid(voxelgrid=voxelgrid / 2.0)
features = extractfeatures( image=image, mask=mask, basediscretisationmethod="fixedbinnumber", basediscretisationnbins=32 )[0] ```
Citation info
MIRP has been published in Journal of Open Source Software:
Zwanenburg A, Lck S. MIRP: A Python package for standardised radiomics. J Open Source Softw. 2024;9: 6413. doi:10.21105/joss.06413
Contributing
If you have ideas for improving MIRP, please read the short contribution guide.
Developers and contributors
MIRP is developed by: * Alex Zwanenburg
We would like thank the following contributors: * Stefan Leger * Sebastian Starke
Owner
- Name: OncoRay – National Center for Radiation Research in Oncology
- Login: oncoray
- Kind: organization
- Location: Dresden, Germany
- Website: https://www.oncoray.de/
- Repositories: 3
- Profile: https://github.com/oncoray
JOSS Publication
MIRP: A Python package for standardised radiomics
Authors
National Center for Tumor Diseases Dresden (NCT/UCC), Germany: German Cancer Research Center (DKFZ), Heidelberg, Germany; Faculty of Medicine and University Hospital Carl Gustav Carus, TUD Dresden University of Technology, Dresden, Germany; Helmholtz-Zentrum Dresden-Rossendorf (HZDR), Dresden, Germany, OncoRay – National Center for Radiation Research in Oncology, Faculty of Medicine and University Hospital Carl Gustav Carus, TUD Dresden University of Technology, Helmholtz-Zentrum Dresden-Rossendorf, Dresden, Germany
OncoRay – National Center for Radiation Research in Oncology, Faculty of Medicine and University Hospital Carl Gustav Carus, TUD Dresden University of Technology, Helmholtz-Zentrum Dresden-Rossendorf, Dresden, Germany, German Cancer Consortium (DKTK), Partner Site Dresden, and German Cancer Research Center (DKFZ), Heidelberg, Germany, Department of Radiotherapy and Radiation Oncology, Faculty of Medicine and University Hospital Carl Gustav Carus, TUD Dresden University of Technology, Dresden, Germany
Tags
radiomics medical imagingGitHub Events
Total
- Create event: 11
- Release event: 5
- Issues event: 21
- Watch event: 19
- Delete event: 4
- Issue comment event: 2
- Push event: 35
- Pull request event: 9
Last Year
- Create event: 11
- Release event: 5
- Issues event: 21
- Watch event: 19
- Delete event: 4
- Issue comment event: 2
- Push event: 35
- Pull request event: 9
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Alex Zwanenburg | a****g@n****e | 1,416 |
| Alex Zwanenburg | a****g@o****e | 40 |
| Sebastian | s****e@h****e | 8 |
| Matthew Jennings | m****s@o****u | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 79
- Total pull requests: 40
- Average time to close issues: 3 months
- Average time to close pull requests: 10 days
- Total issue authors: 13
- Total pull request authors: 3
- Average comments per issue: 1.86
- Average comments per pull request: 0.2
- Merged pull requests: 37
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 17
- Pull requests: 11
- Average time to close issues: 14 days
- Average time to close pull requests: about 2 hours
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.53
- Average comments per pull request: 0.0
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- alexzwanenburg (49)
- drcandacemakedamoore (9)
- Matthew-Jennings (4)
- surajpaib (4)
- kirbyju (2)
- peterneher (2)
- smaginmi (1)
- neerajaj96 (1)
- codingS3b (1)
- jo-mueller (1)
- KeithGeorgeCiantar (1)
- theanega (1)
- JZK00 (1)
Pull Request Authors
- alexzwanenburg (50)
- Matthew-Jennings (2)
- codingS3b (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 308 last-month
- Total dependent packages: 1
- Total dependent repositories: 0
- Total versions: 16
- Total maintainers: 1
pypi.org: mirp
A package for standardised processing of medical imaging and computation of quantitative features.
- Documentation: https://oncoray.github.io/mirp/
- License: eupl-1.2
-
Latest release: 2.4.1
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- itk >=5.3.0
- matplotlib >=3.7.0
- numpy >=1.25
- pandas >=2.0.0
- pydicom >=2.4.0
- pywavelets >=1.4.0
- ray >=2.7.0
- scikit-image >=0.20.0
- scipy >=1.11
- actions/checkout v4 composite
- actions/setup-python v5 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite