mirp 2.4.0__tar.gz → 2.4.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.4.0 → mirp-2.4.2}/NEWS.md +35 -1
- {mirp-2.4.0 → mirp-2.4.2}/PKG-INFO +28 -1
- {mirp-2.4.0 → mirp-2.4.2}/README.md +27 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file.py +1 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_rtdose.py +37 -0
- mirp-2.4.2/mirp/_data_import/dicom_file_volume_stack.py +63 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/directory.py +1 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/generic_file.py +6 -3
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/generic_file_stack.py +8 -2
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/itk_file.py +1 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/numpy_file.py +4 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/utilities.py +9 -9
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/discretise_image.py +27 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/exponential_transform.py +41 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/gabor.py +119 -2
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/gaussian.py +81 -3
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/generic.py +13 -0
- mirp-2.4.2/mirp/_imagefilters/laplacian.py +226 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/laplacian_of_gaussian.py +136 -6
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/laws.py +105 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/local_binary_patterns.py +84 -2
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/log_transform.py +41 -1
- mirp-2.4.2/mirp/_imagefilters/mean.py +148 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/nonseparable_wavelet.py +79 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/separable_wavelet.py +114 -1
- mirp-2.4.2/mirp/_imagefilters/square_root_transform.py +85 -0
- mirp-2.4.2/mirp/_imagefilters/square_transform.py +84 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/base_image.py +5 -2
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/ct_image.py +2 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/generic_image.py +6 -2
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/mr_adc_image.py +2 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/mr_dce_image.py +2 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/pet_image.py +2 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/rtdose_image.py +2 -0
- mirp-2.4.2/mirp/_images/transformed_image.py +13 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_masks/base_mask.py +1 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_workflows/standardWorkflow.py +10 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/config_settings.xml +7 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/transformation_parameters.py +88 -17
- {mirp-2.4.0 → mirp-2.4.2}/mirp.egg-info/PKG-INFO +28 -1
- {mirp-2.4.0 → mirp-2.4.2}/mirp.egg-info/SOURCES.txt +2 -0
- {mirp-2.4.0 → mirp-2.4.2}/pyproject.toml +1 -1
- mirp-2.4.0/mirp/_imagefilters/mean.py +0 -78
- mirp-2.4.0/mirp/_imagefilters/square_root_transform.py +0 -44
- mirp-2.4.0/mirp/_imagefilters/square_transform.py +0 -44
- mirp-2.4.0/mirp/_images/transformed_image.py +0 -824
- {mirp-2.4.0 → mirp-2.4.2}/CONTRIBUTING.md +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/LICENSE.txt +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/MANIFEST.in +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_cr.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_ct.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_dx.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_mg.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_mr.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_mr_adc.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_mr_dce.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_pet.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_rtstruct.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_seg.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_file_stack.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_multi_frame.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/dicom_planar_image.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/itk_file_stack.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/mask_contour.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/numpy_file_stack.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/read_data.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_data_import/suv.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/base_feature.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/cm_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/cm_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/dzm_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/dzm_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/feature_generator.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/histogram.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/ih_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/ivh_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/local_intensity_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/morph_3d_data.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/morph_3d_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/ngldm_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/ngldm_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/ngtdm_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/ngtdm_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/rlm_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/rlm_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/stat_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/szm_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/szm_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/texture_features.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/texture_matrix.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_features/utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/alter_mask.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/anti_aliasing.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/cropping.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/randomise_mask.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/split_mask.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/tissue_mask.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_image_processing/utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_imagefilters/utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/digital_xray_image.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/mask_image.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/mr_image.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_images/utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_masks/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_workflows/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/_workflows/baseWorkflow.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/config_data.xml +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/data_import/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/data_import/import_image.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/data_import/import_image_and_mask.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/data_import/import_mask.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/deep_learning_preprocessing.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/deprecated.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/extract_features_and_images.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/extract_image_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/extract_mask_labels.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/feature_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/general_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/generic.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/image_processing_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/import_config_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/import_data_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/interpolation_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/perturbation_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/resegmentation_parameters.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/settings/utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/utilities/__init__.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/utilities/config_utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/utilities/parallel.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/utilities/parallel_joblib.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/utilities/parallel_ray.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp/utilities/utilities.py +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp.egg-info/dependency_links.txt +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp.egg-info/requires.txt +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/mirp.egg-info/top_level.txt +0 -0
- {mirp-2.4.0 → mirp-2.4.2}/setup.cfg +0 -0
|
@@ -1,6 +1,40 @@
|
|
|
1
|
+
# Version 2.4.2
|
|
2
|
+
|
|
3
|
+
## Minor changes
|
|
4
|
+
|
|
5
|
+
- Added a normalised version of the Laplacian-of-Gaussian filter (`normalised_laplacian_of_gaussian` or `norm_log`)
|
|
6
|
+
for compatibility with software packages that use (non-IBSI-compliant) implementations that normalise the filter.
|
|
7
|
+
|
|
8
|
+
- Added support for dose summation of RTDOSE maps for different beams.
|
|
9
|
+
|
|
10
|
+
- Added support for 2D and 3D discrete Laplace filters.
|
|
11
|
+
|
|
12
|
+
- Applying 3D filters in a slice-by-slice analysis will now raise an error.
|
|
13
|
+
|
|
14
|
+
- Applying filters to images with anisotropic voxel spacing now raises a warning for filters where the
|
|
15
|
+
spatial frequency response depends on the number of voxels, such as filters with kernels with fixed weights.
|
|
16
|
+
|
|
17
|
+
- Applying fixed bin size discretisation now raises a warning if all intensities in the masked region are
|
|
18
|
+
assigned to the same bin.
|
|
19
|
+
|
|
20
|
+
- Applying fixed bin size discretisation to images that do not have intensities with calibrated units now raises a
|
|
21
|
+
warning.
|
|
22
|
+
|
|
23
|
+
## Fixes
|
|
24
|
+
|
|
25
|
+
- Saving image objects to NIfTI now correctly sets orientation. Previously, oblique orientations were not set correctly.
|
|
26
|
+
- Metadata for masks is now exported correctly for segmentation masks that derive from NIfTI, NRRD or Numpy files when
|
|
27
|
+
`export_format = "dict"`.
|
|
28
|
+
|
|
29
|
+
# Version 2.4.1
|
|
30
|
+
|
|
31
|
+
## Minor changes
|
|
32
|
+
|
|
33
|
+
- Added `kurtosis` method for local binary pattern filter.
|
|
34
|
+
|
|
1
35
|
# Version 2.4.0
|
|
2
36
|
|
|
3
|
-
|
|
37
|
+
## Major changes
|
|
4
38
|
|
|
5
39
|
- It is now possible to use and process (in-memory) images and masks in a native `mirp` format. It was already
|
|
6
40
|
possible to export imaging and masks, e.g. using `extract_images(..., image_export_format="native")` or
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mirp
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.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-Expression: EUPL-1.2
|
|
@@ -250,6 +250,33 @@ features = extract_features(
|
|
|
250
250
|
)[0]
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
+
# Compatibility
|
|
254
|
+
|
|
255
|
+
MIRP is compliant with the Image Biomarker Standardisation Initiative's reference standards for image processing and
|
|
256
|
+
feature computation and for image filters. Compliance is checked automatically as part
|
|
257
|
+
of the software tests.
|
|
258
|
+
|
|
259
|
+
The reference standards do not cover all possible image pre-processing steps, features or image filters. There are three
|
|
260
|
+
pre-processing steps in MIRP that are used by default and that currently lack reference standards, and thus may be
|
|
261
|
+
implemented differently in other software packages, or be absent entirely. These are:
|
|
262
|
+
|
|
263
|
+
1. **Anti-aliasing**: Downsampling, i.e. resampling from a high-resolution scan to a lower-resolution image leads
|
|
264
|
+
to aliasing artifacts because the interpolation algorithms will primary use local information from the voxels directly
|
|
265
|
+
adjacent to each interpolation point. To counteract this, MIRP by default uses a Gaussian
|
|
266
|
+
anti-aliasing filter prior to resampling. This filters smooths local information, prevent anti-aliasing artifacts. To
|
|
267
|
+
turn anti-aliasing off set `anti_aliasing = False`.
|
|
268
|
+
|
|
269
|
+
2. **Use of tissue masks for intensity normalisation**: Intensity normalisation is a pre-processing step commonly
|
|
270
|
+
used for harmonising clinical MRI sequences. These methods use information from intensities in a scan. Generally,
|
|
271
|
+
information from voxels outside the studied patient (air voxels) are not relevant. By default, MIRP tries to exclude
|
|
272
|
+
such voxels by generating a tissue mask based on the intensity distribution, and use only information from voxels
|
|
273
|
+
related containing patient tissue for normalisation. To turn tissue masks off, set `tissue_mask_type = "none"`.
|
|
274
|
+
|
|
275
|
+
3. **Conversion of PET values to SUV**: If PET scans are provided in the DICOM format, by default MIRP will use
|
|
276
|
+
information contained in the DICOM headers to compute body-weight corrected standardised uptake values. To use raw PET
|
|
277
|
+
information, set `pet_suv_conversion = "none"`. Other types of standardised uptake value can be computed using other
|
|
278
|
+
options.
|
|
279
|
+
|
|
253
280
|
# Citation info
|
|
254
281
|
MIRP has been published in *Journal of Open Source Software*:
|
|
255
282
|
```Zwanenburg A, Löck S. MIRP: A Python package for standardised radiomics. J Open Source Softw. 2024;9: 6413. doi:10.21105/joss.06413```
|
|
@@ -209,6 +209,33 @@ features = extract_features(
|
|
|
209
209
|
)[0]
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
+
# Compatibility
|
|
213
|
+
|
|
214
|
+
MIRP is compliant with the Image Biomarker Standardisation Initiative's reference standards for image processing and
|
|
215
|
+
feature computation and for image filters. Compliance is checked automatically as part
|
|
216
|
+
of the software tests.
|
|
217
|
+
|
|
218
|
+
The reference standards do not cover all possible image pre-processing steps, features or image filters. There are three
|
|
219
|
+
pre-processing steps in MIRP that are used by default and that currently lack reference standards, and thus may be
|
|
220
|
+
implemented differently in other software packages, or be absent entirely. These are:
|
|
221
|
+
|
|
222
|
+
1. **Anti-aliasing**: Downsampling, i.e. resampling from a high-resolution scan to a lower-resolution image leads
|
|
223
|
+
to aliasing artifacts because the interpolation algorithms will primary use local information from the voxels directly
|
|
224
|
+
adjacent to each interpolation point. To counteract this, MIRP by default uses a Gaussian
|
|
225
|
+
anti-aliasing filter prior to resampling. This filters smooths local information, prevent anti-aliasing artifacts. To
|
|
226
|
+
turn anti-aliasing off set `anti_aliasing = False`.
|
|
227
|
+
|
|
228
|
+
2. **Use of tissue masks for intensity normalisation**: Intensity normalisation is a pre-processing step commonly
|
|
229
|
+
used for harmonising clinical MRI sequences. These methods use information from intensities in a scan. Generally,
|
|
230
|
+
information from voxels outside the studied patient (air voxels) are not relevant. By default, MIRP tries to exclude
|
|
231
|
+
such voxels by generating a tissue mask based on the intensity distribution, and use only information from voxels
|
|
232
|
+
related containing patient tissue for normalisation. To turn tissue masks off, set `tissue_mask_type = "none"`.
|
|
233
|
+
|
|
234
|
+
3. **Conversion of PET values to SUV**: If PET scans are provided in the DICOM format, by default MIRP will use
|
|
235
|
+
information contained in the DICOM headers to compute body-weight corrected standardised uptake values. To use raw PET
|
|
236
|
+
information, set `pet_suv_conversion = "none"`. Other types of standardised uptake value can be computed using other
|
|
237
|
+
options.
|
|
238
|
+
|
|
212
239
|
# Citation info
|
|
213
240
|
MIRP has been published in *Journal of Open Source Software*:
|
|
214
241
|
```Zwanenburg A, Löck S. MIRP: A Python package for standardised radiomics. J Open Source Softw. 2024;9: 6413. doi:10.21105/joss.06413```
|
|
@@ -664,6 +664,7 @@ class ImageDicomFile(ImageFile):
|
|
|
664
664
|
(0x0028, 0x0010), # pixel rows
|
|
665
665
|
(0x0028, 0x0011), # pixel columns
|
|
666
666
|
(0x0028, 0x0030), # pixel spacing
|
|
667
|
+
(0x3004, 0x000A), # dose summation type
|
|
667
668
|
(0x3004, 0x000C), # grid frame offset vector
|
|
668
669
|
(0x5200, 0x9229), # shared functional groups sequence
|
|
669
670
|
(0x5200, 0x9230) # per-frame functional groups sequence
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
import os
|
|
3
|
+
import hashlib
|
|
3
4
|
|
|
4
5
|
import numpy as np
|
|
5
6
|
|
|
@@ -13,8 +14,44 @@ class ImageDicomFileRTDose(ImageDicomFile):
|
|
|
13
14
|
super().__init__(**kwargs)
|
|
14
15
|
|
|
15
16
|
def is_stackable(self, stack_images: str):
|
|
17
|
+
if stack_images == "false":
|
|
18
|
+
return False
|
|
19
|
+
|
|
20
|
+
# If Dose Summation Type (0x3004, 0x000A) is BEAM, the items are stackable.
|
|
21
|
+
dose_summation_type: str = get_pydicom_meta_tag(
|
|
22
|
+
dcm_seq=self.image_metadata,
|
|
23
|
+
tag=(0x3004, 0x000A),
|
|
24
|
+
tag_type="str"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Stack dose maps for different beams.
|
|
28
|
+
if dose_summation_type == "BEAM":
|
|
29
|
+
return True
|
|
30
|
+
|
|
16
31
|
return False
|
|
17
32
|
|
|
33
|
+
def get_identifiers(self, as_hash=False) -> dict[str, Any] | bytes:
|
|
34
|
+
"""
|
|
35
|
+
General identifiers for images. Compared to other
|
|
36
|
+
:return: a dictionary with identifiers.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
identifier_data: dict[str, Any] = super().get_identifiers(as_hash=False)
|
|
40
|
+
identifier_data.update(
|
|
41
|
+
dict({
|
|
42
|
+
"dose_summation_type" : [get_pydicom_meta_tag(
|
|
43
|
+
dcm_seq=self.image_metadata,
|
|
44
|
+
tag=(0x3004, 0x000A),
|
|
45
|
+
tag_type="str"
|
|
46
|
+
)]
|
|
47
|
+
})
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
if as_hash:
|
|
51
|
+
return hashlib.sha256(str(identifier_data).encode(), usedforsecurity=False).digest()
|
|
52
|
+
else:
|
|
53
|
+
return identifier_data
|
|
54
|
+
|
|
18
55
|
def create(self):
|
|
19
56
|
return self
|
|
20
57
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
from mirp._data_import.dicom_file import ImageDicomFile
|
|
4
|
+
from mirp._data_import.dicom_file_stack import ImageDicomFileStack
|
|
5
|
+
|
|
6
|
+
class ImageDicomFileVolumeStack(ImageDicomFileStack):
|
|
7
|
+
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
image_file_objects: list[ImageDicomFile],
|
|
11
|
+
**kwargs
|
|
12
|
+
):
|
|
13
|
+
super().__init__(image_file_objects, **kwargs)
|
|
14
|
+
|
|
15
|
+
def complete(self, remove_metadata=False, force=False):
|
|
16
|
+
"""
|
|
17
|
+
Fills out missing attributes in an image stack. Image parameters in DICOM stacks, by design,
|
|
18
|
+
are fully determined by the origin of all slices in the stack. This method then sorts the image file objects
|
|
19
|
+
by origin, and uses their relative positions to determine slice spacing and the orientation vector.
|
|
20
|
+
:param remove_metadata: Whether metadata (DICOM headers) should be removed after completing information.
|
|
21
|
+
:param force: Whether attributes are forced to update or not.
|
|
22
|
+
:return: nothing, attributes are updated in place.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
# Load metadata of every slice.
|
|
26
|
+
self.load_metadata(limited=True)
|
|
27
|
+
|
|
28
|
+
# Complete metadata of underlying files.
|
|
29
|
+
for image_file_object in self.image_file_objects:
|
|
30
|
+
image_file_object.complete(remove_metadata = False)
|
|
31
|
+
|
|
32
|
+
self._complete_modality()
|
|
33
|
+
self._complete_sample_name()
|
|
34
|
+
|
|
35
|
+
# For image-related aspects, use the first file as a template.
|
|
36
|
+
if self.image_orientation is None:
|
|
37
|
+
self.image_orientation = self.image_file_objects[0].image_orientation
|
|
38
|
+
if self.image_origin is None:
|
|
39
|
+
self.image_origin = self.image_file_objects[0].image_origin
|
|
40
|
+
if self.image_spacing is None:
|
|
41
|
+
self.image_spacing = self.image_file_objects[0].image_spacing
|
|
42
|
+
if self.image_dimension is None:
|
|
43
|
+
self.image_dimension = self.image_file_objects[0].image_dimension
|
|
44
|
+
|
|
45
|
+
# Check if the complete data passes verification.
|
|
46
|
+
self.check(raise_error=True, remove_metadata=False)
|
|
47
|
+
|
|
48
|
+
if remove_metadata:
|
|
49
|
+
self.remove_metadata()
|
|
50
|
+
|
|
51
|
+
def stack_slices(self):
|
|
52
|
+
if self.image_data is not None:
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
image = np.zeros(self.image_dimension, dtype=np.float32)
|
|
56
|
+
for image_file in self.image_file_objects:
|
|
57
|
+
if image_file.image_data is None:
|
|
58
|
+
raise ValueError(
|
|
59
|
+
"DEV: the image_data attribute of underlying image files are not set. Please call load_data first."
|
|
60
|
+
)
|
|
61
|
+
image += image_file.image_data.astype(np.float32)
|
|
62
|
+
|
|
63
|
+
self.image_data = image
|
|
@@ -265,7 +265,7 @@ class ImageDirectory:
|
|
|
265
265
|
continue
|
|
266
266
|
|
|
267
267
|
sample_name = [
|
|
268
|
-
isolate_sample_name(x=file_name, pattern=self.image_name,
|
|
268
|
+
isolate_sample_name(x=file_name, pattern=self.image_name, file_extension=allowed_file_extensions)
|
|
269
269
|
for file_name in path_info_element[2]
|
|
270
270
|
]
|
|
271
271
|
|
|
@@ -95,7 +95,7 @@ class ImageFile(BaseImage):
|
|
|
95
95
|
f"implementation for subclasses."
|
|
96
96
|
)
|
|
97
97
|
|
|
98
|
-
def copy(self):
|
|
98
|
+
def copy(self, drop_image=False):
|
|
99
99
|
return copy.deepcopy(self)
|
|
100
100
|
|
|
101
101
|
def on_file_system(self):
|
|
@@ -453,6 +453,8 @@ class ImageFile(BaseImage):
|
|
|
453
453
|
else:
|
|
454
454
|
return False
|
|
455
455
|
|
|
456
|
+
return True
|
|
457
|
+
|
|
456
458
|
def _check_sample_name(self, raise_error: bool) -> bool:
|
|
457
459
|
# Check that image file contains a sample name, if multiple sample names are present. To assess the filename,
|
|
458
460
|
# we first strip the extension. Optionally we split the filename on the image name pattern, reducing the
|
|
@@ -732,7 +734,7 @@ class ImageFile(BaseImage):
|
|
|
732
734
|
f"implementation for subclasses."
|
|
733
735
|
)
|
|
734
736
|
|
|
735
|
-
def remove_metadata(self):
|
|
737
|
+
def remove_metadata(self, force=False):
|
|
736
738
|
self.image_metadata = None
|
|
737
739
|
|
|
738
740
|
def load_data(self, **kwargs):
|
|
@@ -1240,7 +1242,8 @@ class MaskFile(ImageFile):
|
|
|
1240
1242
|
image_spacing=self.image_spacing,
|
|
1241
1243
|
image_origin=self.image_origin,
|
|
1242
1244
|
image_orientation=self.image_orientation,
|
|
1243
|
-
image_dimensions=self.image_dimension
|
|
1245
|
+
image_dimensions=self.image_dimension,
|
|
1246
|
+
metadata=self.object_metadata
|
|
1244
1247
|
)
|
|
1245
1248
|
]
|
|
1246
1249
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import copy
|
|
2
1
|
import itertools
|
|
3
2
|
import warnings
|
|
4
3
|
|
|
@@ -67,10 +66,17 @@ class ImageFileStack(ImageFile):
|
|
|
67
66
|
def create(self):
|
|
68
67
|
# Import locally to avoid potential circular references.
|
|
69
68
|
from mirp._data_import.dicom_file_stack import ImageDicomFileStack
|
|
69
|
+
from mirp._data_import.dicom_file_volume_stack import ImageDicomFileVolumeStack
|
|
70
70
|
from mirp._data_import.itk_file_stack import ImageITKFileStack
|
|
71
71
|
from mirp._data_import.numpy_file_stack import ImageNumpyFileStack
|
|
72
|
+
from mirp._data_import.dicom_file_rtdose import ImageDicomFileRTDose
|
|
72
73
|
|
|
73
|
-
if all(isinstance(image_file_object,
|
|
74
|
+
if all(isinstance(image_file_object, ImageDicomFileRTDose) for image_file_object in self.image_file_objects):
|
|
75
|
+
file_stack_class = ImageDicomFileVolumeStack
|
|
76
|
+
file_type = "dicom"
|
|
77
|
+
|
|
78
|
+
elif all(isinstance(image_file_object, ImageDicomFile) for image_file_object in self.image_file_objects):
|
|
79
|
+
# General DICOM stacks
|
|
74
80
|
file_stack_class = ImageDicomFileStack
|
|
75
81
|
file_type = "dicom"
|
|
76
82
|
|
|
@@ -40,7 +40,7 @@ class ImageITKFile(ImageFile):
|
|
|
40
40
|
f"[{self.describe_self()}]"
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
def copy(self):
|
|
43
|
+
def copy(self, drop_image=False):
|
|
44
44
|
# Remove metadata during copying to prevent ITK SwigPyObjects from being pickled (which produces errors).
|
|
45
45
|
temporary_metadata = self.image_metadata
|
|
46
46
|
self.remove_metadata()
|
|
@@ -45,7 +45,10 @@ class ImageNumpyFile(ImageFile):
|
|
|
45
45
|
return False
|
|
46
46
|
|
|
47
47
|
# Read Numpy file.
|
|
48
|
-
|
|
48
|
+
if self.file_path is not None:
|
|
49
|
+
image_data = np.load(file=self.file_path, mmap_mode="r")
|
|
50
|
+
else:
|
|
51
|
+
image_data = self.image_data
|
|
49
52
|
|
|
50
53
|
# Check that the contents are in fact a ndarray.
|
|
51
54
|
if not isinstance(image_data, np.ndarray):
|
|
@@ -205,7 +205,7 @@ def match_file_name(
|
|
|
205
205
|
]))
|
|
206
206
|
|
|
207
207
|
if return_list:
|
|
208
|
-
return matches
|
|
208
|
+
return matches.tolist()
|
|
209
209
|
else:
|
|
210
210
|
return any(matches)
|
|
211
211
|
|
|
@@ -213,14 +213,14 @@ def match_file_name(
|
|
|
213
213
|
def isolate_sample_name(
|
|
214
214
|
x: str,
|
|
215
215
|
pattern: str,
|
|
216
|
-
|
|
216
|
+
file_extension: None | str | list[str]
|
|
217
217
|
) -> None | str:
|
|
218
218
|
|
|
219
219
|
# Pattern should only contain one sample name placeholder (#).
|
|
220
220
|
if pattern.count("#") != 1:
|
|
221
221
|
return None
|
|
222
222
|
|
|
223
|
-
x = bare_file_name(x, file_extension=
|
|
223
|
+
x = bare_file_name(x, file_extension=file_extension)
|
|
224
224
|
|
|
225
225
|
# Determine where the sample name placeholder is compared to other wildcards.
|
|
226
226
|
central_split_id = 0
|
|
@@ -359,7 +359,7 @@ def compute_file_distance(
|
|
|
359
359
|
|
|
360
360
|
def parse_image_correction(
|
|
361
361
|
dcm_seq: pydicom.Dataset,
|
|
362
|
-
tag: tuple[
|
|
362
|
+
tag: tuple[int, int],
|
|
363
363
|
correction_abbr: str
|
|
364
364
|
) -> bool:
|
|
365
365
|
"""
|
|
@@ -486,10 +486,10 @@ def convert_dicom_time(
|
|
|
486
486
|
|
|
487
487
|
def get_pydicom_meta_tag(
|
|
488
488
|
dcm_seq: pydicom.Dataset,
|
|
489
|
-
tag: tuple[
|
|
489
|
+
tag: tuple[int, int],
|
|
490
490
|
tag_type: None | str = None,
|
|
491
491
|
default: Any = None,
|
|
492
|
-
macro_dcm_seq: None | tuple[
|
|
492
|
+
macro_dcm_seq: None | tuple[int, int] = None,
|
|
493
493
|
frame_id: None | int = None,
|
|
494
494
|
test_tag: bool = False
|
|
495
495
|
) -> Any:
|
|
@@ -633,8 +633,8 @@ def get_pydicom_meta_tag(
|
|
|
633
633
|
|
|
634
634
|
def has_pydicom_meta_tag(
|
|
635
635
|
dcm_seq: FileDataset | Dataset,
|
|
636
|
-
tag: tuple[
|
|
637
|
-
macro_dcm_seq: None | tuple[
|
|
636
|
+
tag: tuple[int, int],
|
|
637
|
+
macro_dcm_seq: None | tuple[int, int] = None,
|
|
638
638
|
frame_id: None | int = None
|
|
639
639
|
) -> bool:
|
|
640
640
|
|
|
@@ -649,7 +649,7 @@ def has_pydicom_meta_tag(
|
|
|
649
649
|
|
|
650
650
|
def set_pydicom_meta_tag(
|
|
651
651
|
dcm_seq: FileDataset | Dataset,
|
|
652
|
-
tag: tuple[
|
|
652
|
+
tag: tuple[int, int] | list[int],
|
|
653
653
|
value: Any,
|
|
654
654
|
force_vr: None | str = None):
|
|
655
655
|
# Check tag
|
|
@@ -81,6 +81,13 @@ def discretise_image(
|
|
|
81
81
|
else:
|
|
82
82
|
min_intensity = intensity_range[0]
|
|
83
83
|
|
|
84
|
+
if not image.calibrated_units:
|
|
85
|
+
warnings.warn(
|
|
86
|
+
f"The intensities for this image ({type(image)}) do not represent calibrated values. Use the "
|
|
87
|
+
f"fixed bin size (`fixed_bin_size`) method instead.",
|
|
88
|
+
UserWarning
|
|
89
|
+
)
|
|
90
|
+
|
|
84
91
|
# Bin voxels.
|
|
85
92
|
discretised_voxels = np.floor((image.get_voxel_grid() - min_intensity) / (bin_width * 1.0)) + 1.0
|
|
86
93
|
|
|
@@ -97,7 +104,21 @@ def discretise_image(
|
|
|
97
104
|
# Set bin width.
|
|
98
105
|
image.discretisation_bin_width = bin_width
|
|
99
106
|
|
|
107
|
+
# Check that the discretised image is not sparse.
|
|
108
|
+
if np.all(discretised_voxels[mask_data] == discretised_voxels[mask_data][0]):
|
|
109
|
+
warnings.warn(
|
|
110
|
+
f"Fixed bin size discretisation causes all intensities in the masked region to be assigned to the same"
|
|
111
|
+
f"bin. A smaller `bin_width` (current: {bin_width}) is recommended."
|
|
112
|
+
)
|
|
113
|
+
|
|
100
114
|
elif discretisation_method == "fixed_bin_size_pyradiomics":
|
|
115
|
+
if not image.calibrated_units:
|
|
116
|
+
warnings.warn(
|
|
117
|
+
f"The intensities for this image ({type(image)}) do not represent calibrated values. Use the "
|
|
118
|
+
f"fixed bin size (`fixed_bin_size`) method instead.",
|
|
119
|
+
UserWarning
|
|
120
|
+
)
|
|
121
|
+
|
|
101
122
|
# PyRadiomics (up to at least version 3.1.0) used a version of fixed bin size that is not IBSI-compliant.
|
|
102
123
|
min_intensity = np.min(image.get_voxel_grid()[mask_data])
|
|
103
124
|
min_intensity -= min_intensity % bin_width
|
|
@@ -121,6 +142,12 @@ def discretise_image(
|
|
|
121
142
|
# Update IBSI compliance.
|
|
122
143
|
image.ibsi_compliant = False
|
|
123
144
|
|
|
145
|
+
if np.all(discretised_voxels[mask_data] == discretised_voxels[mask_data][0]):
|
|
146
|
+
warnings.warn(
|
|
147
|
+
f"Fixed bin size discretisation causes all intensities in the masked region to be assigned to the same"
|
|
148
|
+
f"bin. A smaller `bin_width` (current: {bin_width}) is recommended."
|
|
149
|
+
)
|
|
150
|
+
|
|
124
151
|
else:
|
|
125
152
|
raise ValueError(f"The discretisation_method argument was not recognised. Found: {discretisation_method}")
|
|
126
153
|
|
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
import copy
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
2
4
|
import numpy as np
|
|
5
|
+
import pandas as pd
|
|
3
6
|
|
|
4
7
|
from mirp._images.generic_image import GenericImage
|
|
5
|
-
from mirp._images.transformed_image import ExponentialTransformedImage
|
|
6
8
|
from mirp._imagefilters.generic import GenericFilter
|
|
9
|
+
from mirp._images.transformed_image import TransformedImage
|
|
7
10
|
from mirp.settings.generic import SettingsClass
|
|
8
11
|
|
|
9
12
|
|
|
13
|
+
class ExponentialTransformedImage(TransformedImage):
|
|
14
|
+
def __init__(
|
|
15
|
+
self,
|
|
16
|
+
template: None | GenericImage = None,
|
|
17
|
+
**kwargs
|
|
18
|
+
):
|
|
19
|
+
super().__init__(**kwargs)
|
|
20
|
+
|
|
21
|
+
# Update image parameters using the template.
|
|
22
|
+
if isinstance(template, GenericImage):
|
|
23
|
+
self.update_from_template(template=template)
|
|
24
|
+
|
|
25
|
+
def get_file_name_descriptor(self) -> list[str]:
|
|
26
|
+
descriptors = super().get_file_name_descriptor()
|
|
27
|
+
descriptors += ["exp"]
|
|
28
|
+
|
|
29
|
+
return descriptors
|
|
30
|
+
|
|
31
|
+
def get_export_attributes(self) -> dict[str, Any]:
|
|
32
|
+
parent_attributes = super().get_export_attributes()
|
|
33
|
+
attributes = [("filter_type", "exponential_transformation")]
|
|
34
|
+
parent_attributes.update(dict(attributes))
|
|
35
|
+
|
|
36
|
+
return parent_attributes
|
|
37
|
+
|
|
38
|
+
def parse_feature_names(self, x: None | pd.DataFrame) -> pd.DataFrame:
|
|
39
|
+
x = super().parse_feature_names(x=x)
|
|
40
|
+
feature_name_prefix = ["exp"]
|
|
41
|
+
|
|
42
|
+
if len(feature_name_prefix) > 0:
|
|
43
|
+
feature_name_prefix = "_".join(feature_name_prefix)
|
|
44
|
+
feature_name_prefix += "_"
|
|
45
|
+
x.columns = feature_name_prefix + x.columns
|
|
46
|
+
|
|
47
|
+
return x
|
|
48
|
+
|
|
49
|
+
|
|
10
50
|
class ExponentialTransformFilter(GenericFilter):
|
|
11
51
|
|
|
12
52
|
def __init__(self, image: GenericImage, settings: SettingsClass, name: str):
|
|
@@ -1,13 +1,130 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
1
3
|
import numpy as np
|
|
2
4
|
import copy
|
|
3
5
|
|
|
6
|
+
import pandas as pd
|
|
7
|
+
|
|
4
8
|
from mirp._images.generic_image import GenericImage
|
|
5
|
-
from mirp._images.transformed_image import GaborTransformedImage
|
|
6
9
|
from mirp._imagefilters.generic import GenericFilter
|
|
7
10
|
from mirp._imagefilters.utilities import pool_voxel_grids, FilterSet2D
|
|
11
|
+
from mirp._images.transformed_image import TransformedImage
|
|
8
12
|
from mirp.settings.generic import SettingsClass
|
|
9
13
|
|
|
10
14
|
|
|
15
|
+
class GaborTransformedImage(TransformedImage):
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
sigma_parameter: None | float = None,
|
|
19
|
+
gamma_parameter: None | float = None,
|
|
20
|
+
lambda_parameter: None | float = None,
|
|
21
|
+
theta_parameter: None | float = None,
|
|
22
|
+
pool_theta: None | bool = None,
|
|
23
|
+
response_type: None | str = None,
|
|
24
|
+
rotation_invariance: None | bool = None,
|
|
25
|
+
pooling_method: None | str = None,
|
|
26
|
+
boundary_condition: None | str = None,
|
|
27
|
+
riesz_order: None | int | list[int] = None,
|
|
28
|
+
riesz_steering: None | bool = None,
|
|
29
|
+
riesz_sigma_parameter: None | float = None,
|
|
30
|
+
template: None | GenericImage = None,
|
|
31
|
+
**kwargs
|
|
32
|
+
):
|
|
33
|
+
super().__init__(**kwargs)
|
|
34
|
+
|
|
35
|
+
# Filter parameters
|
|
36
|
+
self.sigma_parameter = sigma_parameter
|
|
37
|
+
self.gamma_parameter = gamma_parameter
|
|
38
|
+
self.lambda_parameter = lambda_parameter
|
|
39
|
+
self.theta_parameter = theta_parameter
|
|
40
|
+
self.pool_theta = pool_theta
|
|
41
|
+
self.response_type = response_type
|
|
42
|
+
self.rotation_invariance = rotation_invariance
|
|
43
|
+
self.pooling_method = pooling_method
|
|
44
|
+
self.boundary_condition = boundary_condition
|
|
45
|
+
self.riesz_transformed = riesz_order is not None
|
|
46
|
+
self.riesz_order = copy.deepcopy(riesz_order)
|
|
47
|
+
self.riesz_steering = riesz_steering
|
|
48
|
+
self.riesz_sigma_parameter = riesz_sigma_parameter
|
|
49
|
+
|
|
50
|
+
# Update image parameters using the template.
|
|
51
|
+
if isinstance(template, GenericImage):
|
|
52
|
+
self.update_from_template(template=template)
|
|
53
|
+
|
|
54
|
+
def get_file_name_descriptor(self) -> list[str]:
|
|
55
|
+
descriptors = super().get_file_name_descriptor()
|
|
56
|
+
|
|
57
|
+
descriptors += [
|
|
58
|
+
"gabor",
|
|
59
|
+
"s", str(self.sigma_parameter),
|
|
60
|
+
"g", str(self.gamma_parameter),
|
|
61
|
+
"l", str(self.lambda_parameter)
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
if not self.pool_theta:
|
|
65
|
+
descriptors += ["t", str(self.theta_parameter)]
|
|
66
|
+
|
|
67
|
+
descriptors += ["2D" if self.separate_slices else "3D"]
|
|
68
|
+
|
|
69
|
+
if self.rotation_invariance and not self.separate_slices:
|
|
70
|
+
descriptors += ["invar"]
|
|
71
|
+
|
|
72
|
+
return descriptors
|
|
73
|
+
|
|
74
|
+
def get_export_attributes(self) -> dict[str, Any]:
|
|
75
|
+
parent_attributes = super().get_export_attributes()
|
|
76
|
+
|
|
77
|
+
attributes = [
|
|
78
|
+
("filter_type", "gabor"),
|
|
79
|
+
("sigma_parameter", self.sigma_parameter),
|
|
80
|
+
("gamma_parameter", self.gamma_parameter),
|
|
81
|
+
("lambda_parameter", self.lambda_parameter),
|
|
82
|
+
("theta_parameter", self.theta_parameter),
|
|
83
|
+
("pool_theta", self.pool_theta),
|
|
84
|
+
("response_type", self.response_type),
|
|
85
|
+
("rotation_invariance", self.rotation_invariance),
|
|
86
|
+
("boundary_condition", self.boundary_condition)
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
if self.pooling_method is not None:
|
|
90
|
+
attributes += [("pooling_method", self.pooling_method)]
|
|
91
|
+
|
|
92
|
+
if self.riesz_transformed:
|
|
93
|
+
attributes += [("riesz_order", self.riesz_order)]
|
|
94
|
+
|
|
95
|
+
if self.riesz_steering:
|
|
96
|
+
attributes += [("riesz_sigma_parameter", self.riesz_sigma_parameter)]
|
|
97
|
+
|
|
98
|
+
parent_attributes.update(dict(attributes))
|
|
99
|
+
|
|
100
|
+
return parent_attributes
|
|
101
|
+
|
|
102
|
+
def parse_feature_names(self, x: None | pd.DataFrame) -> pd.DataFrame:
|
|
103
|
+
x = super().parse_feature_names(x=x)
|
|
104
|
+
|
|
105
|
+
feature_name_prefix = [
|
|
106
|
+
"gabor",
|
|
107
|
+
"s", str(self.sigma_parameter),
|
|
108
|
+
"g", str(self.gamma_parameter),
|
|
109
|
+
"l", str(self.lambda_parameter)
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
if not self.pool_theta:
|
|
113
|
+
feature_name_prefix += ["t", str(self.theta_parameter)]
|
|
114
|
+
|
|
115
|
+
feature_name_prefix += ["2D" if self.separate_slices else "3D"]
|
|
116
|
+
|
|
117
|
+
if self.rotation_invariance and not self.separate_slices:
|
|
118
|
+
feature_name_prefix += ["invar"]
|
|
119
|
+
|
|
120
|
+
if len(feature_name_prefix) > 0:
|
|
121
|
+
feature_name_prefix = "_".join(feature_name_prefix)
|
|
122
|
+
feature_name_prefix += "_"
|
|
123
|
+
x.columns = feature_name_prefix + x.columns
|
|
124
|
+
|
|
125
|
+
return x
|
|
126
|
+
|
|
127
|
+
|
|
11
128
|
class GaborFilter(GenericFilter):
|
|
12
129
|
|
|
13
130
|
def __init__(self, image: GenericImage, settings: SettingsClass, name: str):
|
|
@@ -176,7 +293,7 @@ class GaborFilter(GenericFilter):
|
|
|
176
293
|
def transform_grid(
|
|
177
294
|
self,
|
|
178
295
|
voxel_grid: np.ndarray,
|
|
179
|
-
spacing: np.
|
|
296
|
+
spacing: np.ndarray):
|
|
180
297
|
|
|
181
298
|
# Get in-plane spacing, i.e. not stack_axis.
|
|
182
299
|
spacing: float = max([
|