mirp 2.3.1__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.
Files changed (134) hide show
  1. {mirp-2.3.1 → mirp-2.3.2}/NEWS.md +18 -0
  2. {mirp-2.3.1 → mirp-2.3.2}/PKG-INFO +3 -2
  3. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/dzm_matrix.py +1 -1
  4. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/szm_matrix.py +1 -1
  5. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/mr_image.py +3 -3
  6. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/feature_parameters.py +6 -6
  7. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/image_processing_parameters.py +7 -3
  8. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/transformation_parameters.py +77 -9
  9. {mirp-2.3.1 → mirp-2.3.2}/mirp.egg-info/PKG-INFO +3 -2
  10. {mirp-2.3.1 → mirp-2.3.2}/pyproject.toml +1 -1
  11. {mirp-2.3.1 → mirp-2.3.2}/CONTRIBUTING.md +0 -0
  12. {mirp-2.3.1 → mirp-2.3.2}/LICENSE.txt +0 -0
  13. {mirp-2.3.1 → mirp-2.3.2}/MANIFEST.in +0 -0
  14. {mirp-2.3.1 → mirp-2.3.2}/README.md +0 -0
  15. {mirp-2.3.1 → mirp-2.3.2}/mirp/__init__.py +0 -0
  16. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/__init__.py +0 -0
  17. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file.py +0 -0
  18. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_cr.py +0 -0
  19. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_ct.py +0 -0
  20. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_dx.py +0 -0
  21. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_mg.py +0 -0
  22. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_mr.py +0 -0
  23. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_mr_adc.py +0 -0
  24. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_mr_dce.py +0 -0
  25. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_pet.py +0 -0
  26. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_rtdose.py +0 -0
  27. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_rtstruct.py +0 -0
  28. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_seg.py +0 -0
  29. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_file_stack.py +0 -0
  30. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_multi_frame.py +0 -0
  31. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/dicom_planar_image.py +0 -0
  32. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/directory.py +0 -0
  33. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/generic_file.py +0 -0
  34. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/generic_file_stack.py +0 -0
  35. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/itk_file.py +0 -0
  36. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/itk_file_stack.py +0 -0
  37. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/mask_contour.py +0 -0
  38. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/numpy_file.py +0 -0
  39. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/numpy_file_stack.py +0 -0
  40. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/read_data.py +0 -0
  41. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/suv.py +0 -0
  42. {mirp-2.3.1 → mirp-2.3.2}/mirp/_data_import/utilities.py +0 -0
  43. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/__init__.py +0 -0
  44. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/base_feature.py +0 -0
  45. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/cm_features.py +0 -0
  46. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/cm_matrix.py +0 -0
  47. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/dzm_features.py +0 -0
  48. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/feature_generator.py +0 -0
  49. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/histogram.py +0 -0
  50. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/ih_features.py +0 -0
  51. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/ivh_features.py +0 -0
  52. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/local_intensity_features.py +0 -0
  53. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/morph_3d_data.py +0 -0
  54. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/morph_3d_features.py +0 -0
  55. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/ngldm_features.py +0 -0
  56. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/ngldm_matrix.py +0 -0
  57. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/ngtdm_features.py +0 -0
  58. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/ngtdm_matrix.py +0 -0
  59. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/rlm_features.py +0 -0
  60. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/rlm_matrix.py +0 -0
  61. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/stat_features.py +0 -0
  62. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/szm_features.py +0 -0
  63. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/texture_features.py +0 -0
  64. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/texture_matrix.py +0 -0
  65. {mirp-2.3.1 → mirp-2.3.2}/mirp/_features/utilities.py +0 -0
  66. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/__init__.py +0 -0
  67. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/alter_mask.py +0 -0
  68. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/anti_aliasing.py +0 -0
  69. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/cropping.py +0 -0
  70. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/discretise_image.py +0 -0
  71. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/randomise_mask.py +0 -0
  72. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/split_mask.py +0 -0
  73. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/tissue_mask.py +0 -0
  74. {mirp-2.3.1 → mirp-2.3.2}/mirp/_image_processing/utilities.py +0 -0
  75. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/__init__.py +0 -0
  76. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/exponential_transform.py +0 -0
  77. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/gabor.py +0 -0
  78. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/gaussian.py +0 -0
  79. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/generic.py +0 -0
  80. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/laplacian_of_gaussian.py +0 -0
  81. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/laws.py +0 -0
  82. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/log_transform.py +0 -0
  83. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/mean.py +0 -0
  84. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/nonseparable_wavelet.py +0 -0
  85. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/separable_wavelet.py +0 -0
  86. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/square_root_transform.py +0 -0
  87. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/square_transform.py +0 -0
  88. {mirp-2.3.1 → mirp-2.3.2}/mirp/_imagefilters/utilities.py +0 -0
  89. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/__init__.py +0 -0
  90. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/base_image.py +0 -0
  91. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/ct_image.py +0 -0
  92. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/digital_xray_image.py +0 -0
  93. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/generic_image.py +0 -0
  94. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/mask_image.py +0 -0
  95. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/mr_adc_image.py +0 -0
  96. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/mr_dce_image.py +0 -0
  97. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/pet_image.py +0 -0
  98. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/rtdose_image.py +0 -0
  99. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/transformed_image.py +0 -0
  100. {mirp-2.3.1 → mirp-2.3.2}/mirp/_images/utilities.py +0 -0
  101. {mirp-2.3.1 → mirp-2.3.2}/mirp/_masks/__init__.py +0 -0
  102. {mirp-2.3.1 → mirp-2.3.2}/mirp/_masks/base_mask.py +0 -0
  103. {mirp-2.3.1 → mirp-2.3.2}/mirp/_workflows/__init__.py +0 -0
  104. {mirp-2.3.1 → mirp-2.3.2}/mirp/_workflows/baseWorkflow.py +0 -0
  105. {mirp-2.3.1 → mirp-2.3.2}/mirp/_workflows/standardWorkflow.py +0 -0
  106. {mirp-2.3.1 → mirp-2.3.2}/mirp/config_data.xml +0 -0
  107. {mirp-2.3.1 → mirp-2.3.2}/mirp/config_settings.xml +0 -0
  108. {mirp-2.3.1 → mirp-2.3.2}/mirp/data_import/__init__.py +0 -0
  109. {mirp-2.3.1 → mirp-2.3.2}/mirp/data_import/import_image.py +0 -0
  110. {mirp-2.3.1 → mirp-2.3.2}/mirp/data_import/import_image_and_mask.py +0 -0
  111. {mirp-2.3.1 → mirp-2.3.2}/mirp/data_import/import_mask.py +0 -0
  112. {mirp-2.3.1 → mirp-2.3.2}/mirp/deep_learning_preprocessing.py +0 -0
  113. {mirp-2.3.1 → mirp-2.3.2}/mirp/deprecated.py +0 -0
  114. {mirp-2.3.1 → mirp-2.3.2}/mirp/extract_features_and_images.py +0 -0
  115. {mirp-2.3.1 → mirp-2.3.2}/mirp/extract_image_parameters.py +0 -0
  116. {mirp-2.3.1 → mirp-2.3.2}/mirp/extract_mask_labels.py +0 -0
  117. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/__init__.py +0 -0
  118. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/general_parameters.py +0 -0
  119. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/generic.py +0 -0
  120. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/import_config_parameters.py +0 -0
  121. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/import_data_parameters.py +0 -0
  122. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/interpolation_parameters.py +0 -0
  123. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/perturbation_parameters.py +0 -0
  124. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/resegmentation_parameters.py +0 -0
  125. {mirp-2.3.1 → mirp-2.3.2}/mirp/settings/utilities.py +0 -0
  126. {mirp-2.3.1 → mirp-2.3.2}/mirp/utilities/__init__.py +0 -0
  127. {mirp-2.3.1 → mirp-2.3.2}/mirp/utilities/config_utilities.py +0 -0
  128. {mirp-2.3.1 → mirp-2.3.2}/mirp/utilities/parallel.py +0 -0
  129. {mirp-2.3.1 → mirp-2.3.2}/mirp/utilities/utilities.py +0 -0
  130. {mirp-2.3.1 → mirp-2.3.2}/mirp.egg-info/SOURCES.txt +0 -0
  131. {mirp-2.3.1 → mirp-2.3.2}/mirp.egg-info/dependency_links.txt +0 -0
  132. {mirp-2.3.1 → mirp-2.3.2}/mirp.egg-info/requires.txt +0 -0
  133. {mirp-2.3.1 → mirp-2.3.2}/mirp.egg-info/top_level.txt +0 -0
  134. {mirp-2.3.1 → mirp-2.3.2}/setup.cfg +0 -0
@@ -1,3 +1,21 @@
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
+
1
19
  # Version 2.3.1
2
20
 
3
21
  ## Fixes
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: mirp
3
- Version: 2.3.1
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
 
@@ -65,7 +65,7 @@ class MatrixDZM(Matrix):
65
65
  # Label all connected voxels with the same label.
66
66
  labelled_image = skimage.measure.label(
67
67
  label_image=image,
68
- background=0.0,
68
+ background=0,
69
69
  connectivity=connectivity
70
70
  )
71
71
 
@@ -61,7 +61,7 @@ class MatrixSZM(Matrix):
61
61
  # Label all connected voxels with the same label.
62
62
  labelled_image = skimage.measure.label(
63
63
  label_image=image,
64
- background=0.0,
64
+ background=0,
65
65
  connectivity=connectivity
66
66
  )
67
67
 
@@ -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 = [100 for ii in range(n_fitting_levels)]
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 = False``) or "3d_volume_merge" (``by_slice = True``).
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 = False``) or "3d_volume_merge" (``by_slice = True``).
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 = False``) or "3d" (``by_slice = True``).
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 = False``) or "3d" (``by_slice = True``).
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 = False``) or "3d" (``by_slice = True``).
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 = False``) or "3d" (``by_slice = True``).
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
- bias_field_correction_n_fitting_levels: int, optional, default: 1
25
- The number of fitting levels for the N4 bias field correction algorithm.
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 = 1,
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",
@@ -847,6 +847,14 @@ class ImageTransformationSettingsClass:
847
847
  if allow_none:
848
848
  valid_pooling_method += ["none"]
849
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.
850
858
  if x not in valid_pooling_method:
851
859
  raise ValueError(
852
860
  f"The {var_name} parameter expects one of the following values: "
@@ -856,7 +864,15 @@ class ImageTransformationSettingsClass:
856
864
 
857
865
  @staticmethod
858
866
  def check_sigma(x, var_name):
859
- # Check sigma is a list.
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.
860
876
  if not isinstance(x, list):
861
877
  x = [x]
862
878
 
@@ -876,6 +892,12 @@ class ImageTransformationSettingsClass:
876
892
  @staticmethod
877
893
  def check_truncation(x, var_name):
878
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
+
879
901
  # Check that the truncation values are floating points.
880
902
  if not isinstance(x, float):
881
903
  raise TypeError(
@@ -894,6 +916,13 @@ class ImageTransformationSettingsClass:
894
916
 
895
917
  valid_response = ["modulus", "abs", "magnitude", "angle", "phase", "argument", "real", "imaginary"]
896
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
+
897
926
  # Check that response is correct.
898
927
  if x not in valid_response:
899
928
  raise ValueError(
@@ -907,12 +936,22 @@ class ImageTransformationSettingsClass:
907
936
  # Import pywavelets.
908
937
  import pywt
909
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.
910
950
  if not isinstance(x, list):
911
951
  x = [x]
912
952
 
913
- available_kernels = pywt.wavelist(kind="discrete")
953
+ # Check validity.
914
954
  valid_kernel = [kernel.lower() in available_kernels for kernel in x]
915
-
916
955
  if not all(valid_kernel):
917
956
  raise ValueError(
918
957
  f"The {var_name} parameter requires wavelet families that match those defined in the "
@@ -924,12 +963,22 @@ class ImageTransformationSettingsClass:
924
963
 
925
964
  @staticmethod
926
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.
927
977
  if not isinstance(x, list):
928
978
  x = [x]
929
979
 
930
- available_kernels = ["simoncelli", "shannon"]
980
+ # Check validity.
931
981
  valid_kernel = [kernel.lower() in available_kernels for kernel in x]
932
-
933
982
  if not all(valid_kernel):
934
983
  raise ValueError(
935
984
  f"The {var_name} parameter expects one or more of the following values: "
@@ -941,14 +990,25 @@ class ImageTransformationSettingsClass:
941
990
 
942
991
  @staticmethod
943
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.
944
1002
  if not isinstance(x, list):
945
1003
  x = [x]
946
1004
 
1005
+ # Check that all values in x are integers.
947
1006
  if not all(isinstance(xx, int) for xx in x):
948
1007
  raise TypeError(
949
1008
  f"The {var_name} parameter should be one or more integer "
950
1009
  f"values of at least 1. Found: one or more values that was not an integer.")
951
1010
 
1011
+ # Check that all values in x are greater or equal to 1.
952
1012
  if not all(xx >= 1 for xx in x):
953
1013
  raise ValueError(
954
1014
  f"The {var_name} parameter should be one or more integer "
@@ -959,6 +1019,7 @@ class ImageTransformationSettingsClass:
959
1019
  def check_separable_wavelet_sets(self, x: None | str | list[str], var_name: str):
960
1020
  from itertools import product
961
1021
 
1022
+ # Set default value.
962
1023
  if x is None:
963
1024
  if self.by_slice:
964
1025
  x = "hh"
@@ -993,7 +1054,7 @@ class ImageTransformationSettingsClass:
993
1054
  # Return lowercase values.
994
1055
  return [xx.lower() for xx in x]
995
1056
 
996
- 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):
997
1058
  from itertools import product
998
1059
 
999
1060
  # Set implemented kernels.
@@ -1006,19 +1067,26 @@ class ImageTransformationSettingsClass:
1006
1067
  else:
1007
1068
  possible_combinations = ["".join(combination) for combination in product(kernels, repeat=3)]
1008
1069
 
1009
- # Create list.
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.
1010
1078
  if not isinstance(x, list):
1011
1079
  x = [x]
1012
1080
 
1013
1081
  # Check which kernels are valid.
1014
1082
  valid_kernel = [kernel.lower() in possible_combinations for kernel in x]
1015
-
1016
1083
  if not all(valid_kernel):
1017
1084
  raise ValueError(
1018
1085
  f"The {var_name} parameter requires combinations of Laws kernels. The follow kernels are "
1019
1086
  f"implemented: {', '.join(kernels)}. Two kernels should be specified for 2D, "
1020
1087
  f"and three for 3D. Found the following illegal combinations: "
1021
- 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
+ )
1022
1090
 
1023
1091
  # Return lowercase values.
1024
1092
  return [xx.lower() for xx in x]
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: mirp
3
- Version: 2.3.1
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
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mirp"
7
- version = "2.3.1"
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