mirp 2.3.0__tar.gz → 2.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mirp-2.3.0 → mirp-2.3.2}/NEWS.md +31 -0
- {mirp-2.3.0 → mirp-2.3.2}/PKG-INFO +5 -4
- {mirp-2.3.0 → mirp-2.3.2}/README.md +2 -2
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_pet.py +9 -24
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/dzm_matrix.py +1 -1
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/local_intensity_features.py +23 -14
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/szm_matrix.py +1 -1
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/mr_image.py +3 -3
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/feature_parameters.py +6 -6
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/image_processing_parameters.py +7 -3
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/transformation_parameters.py +85 -10
- {mirp-2.3.0 → mirp-2.3.2}/mirp.egg-info/PKG-INFO +5 -4
- {mirp-2.3.0 → mirp-2.3.2}/pyproject.toml +1 -1
- {mirp-2.3.0 → mirp-2.3.2}/CONTRIBUTING.md +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/LICENSE.txt +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/MANIFEST.in +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_cr.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_ct.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_dx.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_mg.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_mr.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_mr_adc.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_mr_dce.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_rtdose.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_rtstruct.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_seg.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_file_stack.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_multi_frame.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/dicom_planar_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/directory.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/generic_file.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/generic_file_stack.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/itk_file.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/itk_file_stack.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/mask_contour.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/numpy_file.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/numpy_file_stack.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/read_data.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/suv.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_data_import/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/base_feature.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/cm_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/cm_matrix.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/dzm_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/feature_generator.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/histogram.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/ih_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/ivh_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/morph_3d_data.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/morph_3d_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/ngldm_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/ngldm_matrix.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/ngtdm_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/ngtdm_matrix.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/rlm_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/rlm_matrix.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/stat_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/szm_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/texture_features.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/texture_matrix.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_features/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/alter_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/anti_aliasing.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/cropping.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/discretise_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/randomise_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/split_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/tissue_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_image_processing/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/exponential_transform.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/gabor.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/gaussian.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/generic.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/laplacian_of_gaussian.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/laws.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/log_transform.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/mean.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/nonseparable_wavelet.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/separable_wavelet.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/square_root_transform.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/square_transform.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_imagefilters/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/base_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/ct_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/digital_xray_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/generic_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/mask_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/mr_adc_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/mr_dce_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/pet_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/rtdose_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/transformed_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_images/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_masks/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_masks/base_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_workflows/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_workflows/baseWorkflow.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/_workflows/standardWorkflow.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/config_data.xml +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/config_settings.xml +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/data_import/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/data_import/import_image.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/data_import/import_image_and_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/data_import/import_mask.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/deep_learning_preprocessing.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/deprecated.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/extract_features_and_images.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/extract_image_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/extract_mask_labels.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/general_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/generic.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/import_config_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/import_data_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/interpolation_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/perturbation_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/resegmentation_parameters.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/settings/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/utilities/__init__.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/utilities/config_utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/utilities/parallel.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp/utilities/utilities.py +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp.egg-info/SOURCES.txt +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp.egg-info/dependency_links.txt +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp.egg-info/requires.txt +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/mirp.egg-info/top_level.txt +0 -0
- {mirp-2.3.0 → mirp-2.3.2}/setup.cfg +0 -0
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
# Version 2.3.2
|
|
2
|
+
|
|
3
|
+
## Minor changes
|
|
4
|
+
|
|
5
|
+
- Improved checks on absent (missing) image transformation parameters where the user is expected to specify one or
|
|
6
|
+
more values. This now provides clear errors.
|
|
7
|
+
- The default value of `bias_field_correction_n_fitting_levels` was changed from `1` to `3`, as
|
|
8
|
+
`bias_field_correction_n_fitting_levels=1` yielded only very minor improvements to image quality,
|
|
9
|
+
i.e. did not noticeably reduce bias fields in MR.
|
|
10
|
+
|
|
11
|
+
## Fixes
|
|
12
|
+
|
|
13
|
+
- Background label is now specified as an integer for scikit-image's `measure.label` function.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
- Several fixes to the documentation were made.
|
|
18
|
+
|
|
19
|
+
# Version 2.3.1
|
|
20
|
+
|
|
21
|
+
## Fixes
|
|
22
|
+
|
|
23
|
+
- SUV values with decay correction `START` are now computed correctly. The previous code, based on the QIBA
|
|
24
|
+
vendor-neutral code, computed the SUV values as if decay correction `NONE` was used.
|
|
25
|
+
- The error message for invalid feature families for filtered images (response maps) now correctly mentions
|
|
26
|
+
`response_map_feature_families`.
|
|
27
|
+
- Setting `response_map_feature_families = "all` now correctly excludes morphological features.
|
|
28
|
+
- Trying to compute local intensity features from imaging with high resolution and low image dimensions no
|
|
29
|
+
longer causes a hard crash due to memory errors produced by `scipy.ndimage.convolve`. Instead, these errors are
|
|
30
|
+
handled gracefully -- local intensity features are not computed, however.
|
|
31
|
+
|
|
1
32
|
# Version 2.3.0
|
|
2
33
|
|
|
3
34
|
## Major changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mirp
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: A package for standardised processing of medical imaging and computation of quantitative features.
|
|
5
5
|
Author-email: Alex Zwanenburg <alexander.zwanenburg@nct-dresden.de>
|
|
6
6
|
License: European Union Public Licence
|
|
@@ -308,6 +308,7 @@ Provides-Extra: docs
|
|
|
308
308
|
Requires-Dist: sphinx>=5.0.0; extra == "docs"
|
|
309
309
|
Requires-Dist: sphinx_rtd_theme>=2.0.0; extra == "docs"
|
|
310
310
|
Requires-Dist: nbsphinx; extra == "docs"
|
|
311
|
+
Dynamic: license-file
|
|
311
312
|
|
|
312
313
|
<img src="https://raw.githubusercontent.com/oncoray/mirp/master/icon/mirp.svg" align="right" width="120"/>
|
|
313
314
|
|
|
@@ -510,8 +511,8 @@ For advanced users and developers, the following changes are relevant:
|
|
|
510
511
|
- MIRP now uses the `ray` package for parallel processing.
|
|
511
512
|
|
|
512
513
|
# Citation info
|
|
513
|
-
|
|
514
|
-
```Zwanenburg A,
|
|
514
|
+
MIRP has been published in *Journal of Open Source Software*:
|
|
515
|
+
```Zwanenburg A, Löck S. MIRP: A Python package for standardised radiomics. J Open Source Softw. 2024;9: 6413. doi:10.21105/joss.06413```
|
|
515
516
|
|
|
516
517
|
# Contributing
|
|
517
518
|
If you have ideas for improving MIRP, please read the short [contribution guide](./CONTRIBUTING.md).
|
|
@@ -199,8 +199,8 @@ For advanced users and developers, the following changes are relevant:
|
|
|
199
199
|
- MIRP now uses the `ray` package for parallel processing.
|
|
200
200
|
|
|
201
201
|
# Citation info
|
|
202
|
-
|
|
203
|
-
```Zwanenburg A,
|
|
202
|
+
MIRP has been published in *Journal of Open Source Software*:
|
|
203
|
+
```Zwanenburg A, Löck S. MIRP: A Python package for standardised radiomics. J Open Source Softw. 2024;9: 6413. doi:10.21105/joss.06413```
|
|
204
204
|
|
|
205
205
|
# Contributing
|
|
206
206
|
If you have ideas for improving MIRP, please read the short [contribution guide](./CONTRIBUTING.md).
|
|
@@ -478,6 +478,8 @@ class ImageDicomFilePT(ImageDicomFile):
|
|
|
478
478
|
time_to_acquisition_start.seconds +
|
|
479
479
|
time_to_acquisition_start.microseconds / 1000000.0
|
|
480
480
|
)
|
|
481
|
+
|
|
482
|
+
# Correct for decay during frame in addition to decay between administration and acquisition start.
|
|
481
483
|
decay_factor = (
|
|
482
484
|
frame_duration * _lambda * np.exp(_lambda * time_to_acquisition_start) /
|
|
483
485
|
(1.0 - np.exp(-_lambda * frame_duration))
|
|
@@ -488,32 +490,15 @@ class ImageDicomFilePT(ImageDicomFile):
|
|
|
488
490
|
# Additionally correct for decay between administration and acquisition start. Based on QIBA SUV
|
|
489
491
|
# vendorneutral pseudocode.
|
|
490
492
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
)
|
|
497
|
-
if frame_reference_time is None:
|
|
498
|
-
raise ValueError(f"Frame reference time (0x0054, 0x1300) was missing. [{self.describe_self()}]")
|
|
499
|
-
frame_reference_time /= 1000.0
|
|
500
|
-
|
|
501
|
-
# Time at which the average count rate is found, relative to acquisition start time.
|
|
502
|
-
time_count_average = 1.0 / _lambda * np.log(
|
|
503
|
-
_lambda * frame_duration / (1.0 - np.exp(-_lambda * frame_duration))
|
|
493
|
+
time_to_acquisition_start = acquisition_start_time - tracer_administration_time
|
|
494
|
+
time_to_acquisition_start = (
|
|
495
|
+
time_to_acquisition_start.days * 86400.0 +
|
|
496
|
+
time_to_acquisition_start.seconds +
|
|
497
|
+
time_to_acquisition_start.microseconds / 1000000.0
|
|
504
498
|
)
|
|
505
499
|
|
|
506
|
-
#
|
|
507
|
-
|
|
508
|
-
seconds=time_count_average - frame_reference_time
|
|
509
|
-
)
|
|
510
|
-
time_to_reference_start = reference_start_time - tracer_administration_time
|
|
511
|
-
time_to_reference_start = (
|
|
512
|
-
time_to_reference_start.days * 86400.0 +
|
|
513
|
-
time_to_reference_start.seconds +
|
|
514
|
-
time_to_reference_start.microseconds / 1000000.0
|
|
515
|
-
)
|
|
516
|
-
decay_factor = np.exp(_lambda * time_to_reference_start)
|
|
500
|
+
# Correct for decay between administration and acquisition start.
|
|
501
|
+
decay_factor = np.exp(_lambda * time_to_acquisition_start)
|
|
517
502
|
|
|
518
503
|
else:
|
|
519
504
|
raise ValueError(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import warnings
|
|
1
2
|
from functools import lru_cache
|
|
2
3
|
from typing import Generator
|
|
3
4
|
|
|
@@ -92,21 +93,29 @@ class DataLocalIntensity(object):
|
|
|
92
93
|
)
|
|
93
94
|
conv_filter[df_base.z.astype(int), df_base.y.astype(int), df_base.x.astype(int)] = df_base.weight
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
try:
|
|
97
|
+
# Filter image using mean filter
|
|
98
|
+
if image.get_default_lowest_intensity() is not None:
|
|
99
|
+
# Use 0.0 constant for PET data
|
|
100
|
+
img_avg = ndi.convolve(
|
|
101
|
+
image.get_voxel_grid(),
|
|
102
|
+
weights=conv_filter,
|
|
103
|
+
mode="constant",
|
|
104
|
+
cval=image.get_default_lowest_intensity()
|
|
105
|
+
)
|
|
106
|
+
else:
|
|
107
|
+
img_avg = ndi.convolve(
|
|
108
|
+
image.get_voxel_grid(),
|
|
109
|
+
weights=conv_filter,
|
|
110
|
+
mode="nearest"
|
|
111
|
+
)
|
|
112
|
+
except MemoryError as err:
|
|
113
|
+
warnings.warn(
|
|
114
|
+
f"Unable to compute local intensity features due to Memory error. The image size and "
|
|
115
|
+
f"resolution may be too small to fit a 1cm³ spherical filter for computing local intensity features.",
|
|
116
|
+
UserWarning
|
|
109
117
|
)
|
|
118
|
+
return
|
|
110
119
|
|
|
111
120
|
# Construct data frame for comparison
|
|
112
121
|
self.data = pd.DataFrame({
|
|
@@ -26,7 +26,7 @@ class MRImage(GenericImage):
|
|
|
26
26
|
mask = np.ones(self.image_dimension, dtype=np.uint8)
|
|
27
27
|
|
|
28
28
|
if n_max_iterations is None:
|
|
29
|
-
n_max_iterations = [
|
|
29
|
+
n_max_iterations = [50 for ii in range(n_fitting_levels)]
|
|
30
30
|
|
|
31
31
|
# Create ITK input masks
|
|
32
32
|
input_image = itk.GetImageFromArray(self.get_voxel_grid())
|
|
@@ -39,9 +39,9 @@ class MRImage(GenericImage):
|
|
|
39
39
|
threader.SetGlobalDefaultNumberOfThreads(1)
|
|
40
40
|
|
|
41
41
|
# Start N4 bias correction
|
|
42
|
-
corrector = itk.N4BiasFieldCorrectionImageFilter.New(input_image, input_mask)
|
|
43
|
-
corrector.SetNumberOfFittingLevels(n_fitting_levels)
|
|
42
|
+
corrector = itk.N4BiasFieldCorrectionImageFilter[type(input_image), type(input_mask), type(input_image)].New(input_image, input_mask)
|
|
44
43
|
corrector.SetMaximumNumberOfIterations(n_max_iterations)
|
|
44
|
+
corrector.SetNumberOfFittingLevels(n_fitting_levels)
|
|
45
45
|
corrector.SetConvergenceThreshold(convergence_threshold)
|
|
46
46
|
corrector.Update()
|
|
47
47
|
output_image = corrector.GetOutput()
|
|
@@ -118,7 +118,7 @@ class FeatureExtractionSettingsClass:
|
|
|
118
118
|
[IBSI:IAZD].
|
|
119
119
|
|
|
120
120
|
A list of values may be provided to extract features for multiple spatial methods. Default: "2d_slice_merge"
|
|
121
|
-
(``by_slice =
|
|
121
|
+
(``by_slice = True``) or "3d_volume_merge" (``by_slice = False``).
|
|
122
122
|
|
|
123
123
|
glrlm_spatial_method: {"2d_average", "2d_slice_merge", "2.5d_direction_merge", "2.5d_volume_merge", "3d_average", "3d_volume_merge"}, optional
|
|
124
124
|
Determines how run length matrices are formed and aggregated. One of the following:
|
|
@@ -133,7 +133,7 @@ class FeatureExtractionSettingsClass:
|
|
|
133
133
|
[IBSI:IAZD].
|
|
134
134
|
|
|
135
135
|
A list of values may be provided to extract features for multiple spatial methods. Default:
|
|
136
|
-
"2d_slice_merge" (``by_slice =
|
|
136
|
+
"2d_slice_merge" (``by_slice = True``) or "3d_volume_merge" (``by_slice = False``).
|
|
137
137
|
|
|
138
138
|
glszm_spatial_method: {"2d", "2.5d", "3d"}, optional
|
|
139
139
|
Determines how the size zone matrices are formed and aggregated. One of the following:
|
|
@@ -143,7 +143,7 @@ class FeatureExtractionSettingsClass:
|
|
|
143
143
|
* "3d": features are computed from a single 3D matrix [IBSI:KOBO].
|
|
144
144
|
|
|
145
145
|
A list of values may be provided to extract features for multiple spatial methods. Default: "2d"
|
|
146
|
-
(``by_slice =
|
|
146
|
+
(``by_slice = True``) or "3d" (``by_slice = False``).
|
|
147
147
|
|
|
148
148
|
gldzm_spatial_method: {"2d", "2.5d", "3d"}, optional
|
|
149
149
|
Determines how the distance zone matrices are formed and aggregated. One of the following:
|
|
@@ -153,7 +153,7 @@ class FeatureExtractionSettingsClass:
|
|
|
153
153
|
* "3d": features are computed from a single 3D matrix [IBSI:KOBO].
|
|
154
154
|
|
|
155
155
|
A list of values may be provided to extract features for multiple spatial methods. Default: "2d"
|
|
156
|
-
(``by_slice =
|
|
156
|
+
(``by_slice = True``) or "3d" (``by_slice = False``).
|
|
157
157
|
|
|
158
158
|
ngtdm_spatial_method: {"2d", "2.5d", "3d"}, optional
|
|
159
159
|
Determines how the neighbourhood grey tone difference matrices are formed and aggregated. One of the
|
|
@@ -164,7 +164,7 @@ class FeatureExtractionSettingsClass:
|
|
|
164
164
|
* "3d": features are computed from a single 3D matrix [IBSI:KOBO].
|
|
165
165
|
|
|
166
166
|
A list of values may be provided to extract features for multiple spatial methods. Default: "2d"
|
|
167
|
-
(``by_slice =
|
|
167
|
+
(``by_slice = True``) or "3d" (``by_slice = False``).
|
|
168
168
|
|
|
169
169
|
ngldm_distance: float or list of float, optional, default: 1.0
|
|
170
170
|
Distance (in voxels) for NGLDM for determining the neighbourhood. Chebyshev, or checkerboard, distance is
|
|
@@ -183,7 +183,7 @@ class FeatureExtractionSettingsClass:
|
|
|
183
183
|
* "3d": features are computed from a single 3D matrix [IBSI:KOBO].
|
|
184
184
|
|
|
185
185
|
A list of values may be provided to extract features for multiple spatial methods. Default: "2d"
|
|
186
|
-
(``by_slice =
|
|
186
|
+
(``by_slice = True``) or "3d" (``by_slice = False``).
|
|
187
187
|
|
|
188
188
|
**kwargs: dict, optional
|
|
189
189
|
Unused keyword arguments.
|
|
@@ -21,8 +21,12 @@ class ImagePostProcessingClass:
|
|
|
21
21
|
.. note::
|
|
22
22
|
Bias-field correction can only be applied to MR imaging.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
.. note::
|
|
25
|
+
Bias-field correction using the N4 algorithm is computationally expensive, and it may be preferable to
|
|
26
|
+
perform this correction prior to feeding MR data to MIRP.
|
|
27
|
+
|
|
28
|
+
bias_field_correction_n_fitting_levels: int, optional, default: 3
|
|
29
|
+
The number of fitting levels for the N4 bias field correction algorithm. The default in ITK (1) prevents
|
|
26
30
|
|
|
27
31
|
bias_field_correction_n_max_iterations: int or list of int, optional, default: 50
|
|
28
32
|
The number of fitting iterations for the N4 bias field algorithm. A single integer, or a list of integers
|
|
@@ -118,7 +122,7 @@ class ImagePostProcessingClass:
|
|
|
118
122
|
def __init__(
|
|
119
123
|
self,
|
|
120
124
|
bias_field_correction: bool = False,
|
|
121
|
-
bias_field_correction_n_fitting_levels: int =
|
|
125
|
+
bias_field_correction_n_fitting_levels: int = 3,
|
|
122
126
|
bias_field_correction_n_max_iterations: int | list[int] | None = None,
|
|
123
127
|
bias_field_convergence_threshold: float = 0.001,
|
|
124
128
|
pet_suv_conversion: str = "body_weight",
|
|
@@ -434,7 +434,7 @@ class ImageTransformationSettingsClass:
|
|
|
434
434
|
|
|
435
435
|
if not all(valid_families):
|
|
436
436
|
raise ValueError(
|
|
437
|
-
f"One or more families in the
|
|
437
|
+
f"One or more families in the response_map_feature_families parameter were not recognised: "
|
|
438
438
|
f"{', '.join([response_map_feature_families[ii] for ii, is_valid in enumerate(valid_families) if not is_valid])}"
|
|
439
439
|
)
|
|
440
440
|
|
|
@@ -460,6 +460,13 @@ class ImageTransformationSettingsClass:
|
|
|
460
460
|
# Set feature settings.
|
|
461
461
|
self.feature_settings: FeatureExtractionSettingsClass = response_map_feature_settings
|
|
462
462
|
|
|
463
|
+
# If "all" appears in feature_settings.families: exclude morphological features.
|
|
464
|
+
if "all" in self.feature_settings.families:
|
|
465
|
+
self.feature_settings.families = [
|
|
466
|
+
"local_intensity", "statistics", "intensity_histogram", "intensity_volume_histogram", "glcm", "glrlm",
|
|
467
|
+
"glszm", "gldzm", "ngtdm", "ngldm"
|
|
468
|
+
]
|
|
469
|
+
|
|
463
470
|
# Check boundary condition.
|
|
464
471
|
self.boundary_condition = boundary_condition
|
|
465
472
|
self.boundary_condition: str = self.check_boundary_condition(
|
|
@@ -840,6 +847,14 @@ class ImageTransformationSettingsClass:
|
|
|
840
847
|
if allow_none:
|
|
841
848
|
valid_pooling_method += ["none"]
|
|
842
849
|
|
|
850
|
+
# Check if x is provided.
|
|
851
|
+
if x is None:
|
|
852
|
+
raise ValueError(
|
|
853
|
+
f"No value for the {var_name} parameter could be found. One of the following values is expected: "
|
|
854
|
+
f"{', '.join(valid_pooling_method)}"
|
|
855
|
+
)
|
|
856
|
+
|
|
857
|
+
# Check if x is a valid pooling method.
|
|
843
858
|
if x not in valid_pooling_method:
|
|
844
859
|
raise ValueError(
|
|
845
860
|
f"The {var_name} parameter expects one of the following values: "
|
|
@@ -849,7 +864,15 @@ class ImageTransformationSettingsClass:
|
|
|
849
864
|
|
|
850
865
|
@staticmethod
|
|
851
866
|
def check_sigma(x, var_name):
|
|
852
|
-
|
|
867
|
+
|
|
868
|
+
# Check if x is provided.
|
|
869
|
+
if x is None:
|
|
870
|
+
raise ValueError(
|
|
871
|
+
f"No value for the {var_name} parameter could be found. One or more numerical values > 0.0 "
|
|
872
|
+
f"are expected."
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
# Ensure that sigma is a list.
|
|
853
876
|
if not isinstance(x, list):
|
|
854
877
|
x = [x]
|
|
855
878
|
|
|
@@ -869,6 +892,12 @@ class ImageTransformationSettingsClass:
|
|
|
869
892
|
@staticmethod
|
|
870
893
|
def check_truncation(x, var_name):
|
|
871
894
|
|
|
895
|
+
# Check if x is provided.
|
|
896
|
+
if x is None:
|
|
897
|
+
raise ValueError(
|
|
898
|
+
f"No value for the {var_name} parameter could be found. A numerical value > 0.0 is expected."
|
|
899
|
+
)
|
|
900
|
+
|
|
872
901
|
# Check that the truncation values are floating points.
|
|
873
902
|
if not isinstance(x, float):
|
|
874
903
|
raise TypeError(
|
|
@@ -887,6 +916,13 @@ class ImageTransformationSettingsClass:
|
|
|
887
916
|
|
|
888
917
|
valid_response = ["modulus", "abs", "magnitude", "angle", "phase", "argument", "real", "imaginary"]
|
|
889
918
|
|
|
919
|
+
# Check if x is provided.
|
|
920
|
+
if x is None:
|
|
921
|
+
raise ValueError(
|
|
922
|
+
f"No value for the {var_name} parameter could be found. One of the following values is expected: "
|
|
923
|
+
f"{', '.join(valid_response)}."
|
|
924
|
+
)
|
|
925
|
+
|
|
890
926
|
# Check that response is correct.
|
|
891
927
|
if x not in valid_response:
|
|
892
928
|
raise ValueError(
|
|
@@ -900,12 +936,22 @@ class ImageTransformationSettingsClass:
|
|
|
900
936
|
# Import pywavelets.
|
|
901
937
|
import pywt
|
|
902
938
|
|
|
939
|
+
# All available kernels from pywavelets.
|
|
940
|
+
available_kernels = pywt.wavelist(kind="discrete")
|
|
941
|
+
|
|
942
|
+
# Check if x is provided.
|
|
943
|
+
if x is None:
|
|
944
|
+
raise ValueError(
|
|
945
|
+
f"No value for the {var_name} parameter could be found. One or more of the following values is "
|
|
946
|
+
f"expected: {', '.join(available_kernels)}."
|
|
947
|
+
)
|
|
948
|
+
|
|
949
|
+
# Ensure that x is a list.
|
|
903
950
|
if not isinstance(x, list):
|
|
904
951
|
x = [x]
|
|
905
952
|
|
|
906
|
-
|
|
953
|
+
# Check validity.
|
|
907
954
|
valid_kernel = [kernel.lower() in available_kernels for kernel in x]
|
|
908
|
-
|
|
909
955
|
if not all(valid_kernel):
|
|
910
956
|
raise ValueError(
|
|
911
957
|
f"The {var_name} parameter requires wavelet families that match those defined in the "
|
|
@@ -917,12 +963,22 @@ class ImageTransformationSettingsClass:
|
|
|
917
963
|
|
|
918
964
|
@staticmethod
|
|
919
965
|
def check_nonseparable_wavelet_families(x, var_name):
|
|
966
|
+
|
|
967
|
+
available_kernels = ["simoncelli", "shannon"]
|
|
968
|
+
|
|
969
|
+
# Check if x is provided.
|
|
970
|
+
if x is None:
|
|
971
|
+
raise ValueError(
|
|
972
|
+
f"No value for the {var_name} parameter could be found. One or more of the following values is "
|
|
973
|
+
f"expected: {', '.join(available_kernels)}."
|
|
974
|
+
)
|
|
975
|
+
|
|
976
|
+
# Ensure that x is a list.
|
|
920
977
|
if not isinstance(x, list):
|
|
921
978
|
x = [x]
|
|
922
979
|
|
|
923
|
-
|
|
980
|
+
# Check validity.
|
|
924
981
|
valid_kernel = [kernel.lower() in available_kernels for kernel in x]
|
|
925
|
-
|
|
926
982
|
if not all(valid_kernel):
|
|
927
983
|
raise ValueError(
|
|
928
984
|
f"The {var_name} parameter expects one or more of the following values: "
|
|
@@ -934,14 +990,25 @@ class ImageTransformationSettingsClass:
|
|
|
934
990
|
|
|
935
991
|
@staticmethod
|
|
936
992
|
def check_decomposition_level(x, var_name):
|
|
993
|
+
|
|
994
|
+
# Check if x is provided.
|
|
995
|
+
if x is None:
|
|
996
|
+
raise ValueError(
|
|
997
|
+
f"No value for the {var_name} parameter could be found. One or more integer values equal to or greater "
|
|
998
|
+
f"than 1 are expected."
|
|
999
|
+
)
|
|
1000
|
+
|
|
1001
|
+
# Ensure that x is a list.
|
|
937
1002
|
if not isinstance(x, list):
|
|
938
1003
|
x = [x]
|
|
939
1004
|
|
|
1005
|
+
# Check that all values in x are integers.
|
|
940
1006
|
if not all(isinstance(xx, int) for xx in x):
|
|
941
1007
|
raise TypeError(
|
|
942
1008
|
f"The {var_name} parameter should be one or more integer "
|
|
943
1009
|
f"values of at least 1. Found: one or more values that was not an integer.")
|
|
944
1010
|
|
|
1011
|
+
# Check that all values in x are greater or equal to 1.
|
|
945
1012
|
if not all(xx >= 1 for xx in x):
|
|
946
1013
|
raise ValueError(
|
|
947
1014
|
f"The {var_name} parameter should be one or more integer "
|
|
@@ -952,6 +1019,7 @@ class ImageTransformationSettingsClass:
|
|
|
952
1019
|
def check_separable_wavelet_sets(self, x: None | str | list[str], var_name: str):
|
|
953
1020
|
from itertools import product
|
|
954
1021
|
|
|
1022
|
+
# Set default value.
|
|
955
1023
|
if x is None:
|
|
956
1024
|
if self.by_slice:
|
|
957
1025
|
x = "hh"
|
|
@@ -986,7 +1054,7 @@ class ImageTransformationSettingsClass:
|
|
|
986
1054
|
# Return lowercase values.
|
|
987
1055
|
return [xx.lower() for xx in x]
|
|
988
1056
|
|
|
989
|
-
def check_laws_kernels(self, x: str | list[str], var_name: str):
|
|
1057
|
+
def check_laws_kernels(self, x: None | str | list[str], var_name: str):
|
|
990
1058
|
from itertools import product
|
|
991
1059
|
|
|
992
1060
|
# Set implemented kernels.
|
|
@@ -999,19 +1067,26 @@ class ImageTransformationSettingsClass:
|
|
|
999
1067
|
else:
|
|
1000
1068
|
possible_combinations = ["".join(combination) for combination in product(kernels, repeat=3)]
|
|
1001
1069
|
|
|
1002
|
-
#
|
|
1070
|
+
# Check if x is provided.
|
|
1071
|
+
if x is None:
|
|
1072
|
+
raise ValueError(
|
|
1073
|
+
f"No value for the {var_name} parameter could be found. One or more of the following values is "
|
|
1074
|
+
f"expected: {', '.join(possible_combinations)}."
|
|
1075
|
+
)
|
|
1076
|
+
|
|
1077
|
+
# Ensure that x is a list.
|
|
1003
1078
|
if not isinstance(x, list):
|
|
1004
1079
|
x = [x]
|
|
1005
1080
|
|
|
1006
1081
|
# Check which kernels are valid.
|
|
1007
1082
|
valid_kernel = [kernel.lower() in possible_combinations for kernel in x]
|
|
1008
|
-
|
|
1009
1083
|
if not all(valid_kernel):
|
|
1010
1084
|
raise ValueError(
|
|
1011
1085
|
f"The {var_name} parameter requires combinations of Laws kernels. The follow kernels are "
|
|
1012
1086
|
f"implemented: {', '.join(kernels)}. Two kernels should be specified for 2D, "
|
|
1013
1087
|
f"and three for 3D. Found the following illegal combinations: "
|
|
1014
|
-
f"{', '.join([kernel for ii, kernel in enumerate(x) if not valid_kernel[ii]])}"
|
|
1088
|
+
f"{', '.join([kernel for ii, kernel in enumerate(x) if not valid_kernel[ii]])}"
|
|
1089
|
+
)
|
|
1015
1090
|
|
|
1016
1091
|
# Return lowercase values.
|
|
1017
1092
|
return [xx.lower() for xx in x]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mirp
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: A package for standardised processing of medical imaging and computation of quantitative features.
|
|
5
5
|
Author-email: Alex Zwanenburg <alexander.zwanenburg@nct-dresden.de>
|
|
6
6
|
License: European Union Public Licence
|
|
@@ -308,6 +308,7 @@ Provides-Extra: docs
|
|
|
308
308
|
Requires-Dist: sphinx>=5.0.0; extra == "docs"
|
|
309
309
|
Requires-Dist: sphinx_rtd_theme>=2.0.0; extra == "docs"
|
|
310
310
|
Requires-Dist: nbsphinx; extra == "docs"
|
|
311
|
+
Dynamic: license-file
|
|
311
312
|
|
|
312
313
|
<img src="https://raw.githubusercontent.com/oncoray/mirp/master/icon/mirp.svg" align="right" width="120"/>
|
|
313
314
|
|
|
@@ -510,8 +511,8 @@ For advanced users and developers, the following changes are relevant:
|
|
|
510
511
|
- MIRP now uses the `ray` package for parallel processing.
|
|
511
512
|
|
|
512
513
|
# Citation info
|
|
513
|
-
|
|
514
|
-
```Zwanenburg A,
|
|
514
|
+
MIRP has been published in *Journal of Open Source Software*:
|
|
515
|
+
```Zwanenburg A, Löck S. MIRP: A Python package for standardised radiomics. J Open Source Softw. 2024;9: 6413. doi:10.21105/joss.06413```
|
|
515
516
|
|
|
516
517
|
# Contributing
|
|
517
518
|
If you have ideas for improving MIRP, please read the short [contribution guide](./CONTRIBUTING.md).
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mirp"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.2"
|
|
8
8
|
description = "A package for standardised processing of medical imaging and computation of quantitative features."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Alex Zwanenburg", email = "alexander.zwanenburg@nct-dresden.de"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|