mirp 2.2.4__tar.gz → 2.3.0__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.2.4 → mirp-2.3.0}/NEWS.md +25 -0
- {mirp-2.2.4 → mirp-2.3.0}/PKG-INFO +11 -9
- {mirp-2.2.4 → mirp-2.3.0}/README.md +8 -7
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file.py +254 -60
- mirp-2.3.0/mirp/_data_import/dicom_file_cr.py +6 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file_ct.py +32 -62
- mirp-2.3.0/mirp/_data_import/dicom_file_dx.py +6 -0
- mirp-2.3.0/mirp/_data_import/dicom_file_mg.py +6 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file_mr.py +98 -57
- mirp-2.3.0/mirp/_data_import/dicom_file_mr_adc.py +38 -0
- mirp-2.3.0/mirp/_data_import/dicom_file_mr_dce.py +15 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file_pet.py +45 -102
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file_rtdose.py +4 -33
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file_rtstruct.py +3 -3
- mirp-2.3.0/mirp/_data_import/dicom_file_seg.py +326 -0
- mirp-2.3.0/mirp/_data_import/dicom_multi_frame.py +221 -0
- mirp-2.3.0/mirp/_data_import/dicom_planar_image.py +131 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/directory.py +16 -2
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/generic_file.py +6 -6
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/generic_file_stack.py +3 -3
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/itk_file.py +5 -35
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/mask_contour.py +3 -3
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/numpy_file.py +5 -35
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/utilities.py +100 -11
- mirp-2.3.0/mirp/_features/base_feature.py +40 -0
- mirp-2.3.0/mirp/_features/cm_features.py +602 -0
- mirp-2.3.0/mirp/_features/cm_matrix.py +150 -0
- mirp-2.3.0/mirp/_features/dzm_features.py +415 -0
- mirp-2.3.0/mirp/_features/dzm_matrix.py +106 -0
- mirp-2.3.0/mirp/_features/feature_generator.py +67 -0
- mirp-2.3.0/mirp/_features/histogram.py +106 -0
- mirp-2.3.0/mirp/_features/ih_features.py +556 -0
- mirp-2.3.0/mirp/_features/ivh_features.py +456 -0
- mirp-2.3.0/mirp/_features/local_intensity_features.py +260 -0
- mirp-2.3.0/mirp/_features/morph_3d_data.py +743 -0
- mirp-2.3.0/mirp/_features/morph_3d_features.py +836 -0
- mirp-2.3.0/mirp/_features/ngldm_features.py +462 -0
- mirp-2.3.0/mirp/_features/ngldm_matrix.py +147 -0
- mirp-2.3.0/mirp/_features/ngtdm_features.py +262 -0
- mirp-2.3.0/mirp/_features/ngtdm_matrix.py +173 -0
- mirp-2.3.0/mirp/_features/rlm_features.py +413 -0
- mirp-2.3.0/mirp/_features/rlm_matrix.py +159 -0
- mirp-2.3.0/mirp/_features/stat_features.py +415 -0
- mirp-2.3.0/mirp/_features/szm_features.py +407 -0
- mirp-2.3.0/mirp/_features/szm_matrix.py +105 -0
- mirp-2.3.0/mirp/_features/texture_features.py +28 -0
- mirp-2.3.0/mirp/_features/texture_matrix.py +343 -0
- mirp-2.3.0/mirp/_features/utilities.py +15 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/alter_mask.py +1 -8
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/anti_aliasing.py +2 -2
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/cropping.py +2 -3
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/discretise_image.py +3 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/randomise_mask.py +3 -6
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/split_mask.py +4 -4
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/exponential_transform.py +6 -5
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/gabor.py +9 -6
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/gaussian.py +11 -7
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/generic.py +7 -2
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/laplacian_of_gaussian.py +11 -7
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/laws.py +7 -6
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/log_transform.py +6 -5
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/mean.py +7 -6
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/nonseparable_wavelet.py +12 -8
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/separable_wavelet.py +6 -5
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/square_root_transform.py +6 -5
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/square_transform.py +6 -5
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/base_image.py +6 -2
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/ct_image.py +8 -0
- mirp-2.3.0/mirp/_images/digital_xray_image.py +21 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/generic_image.py +41 -28
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/mask_image.py +10 -27
- mirp-2.3.0/mirp/_images/mr_adc_image.py +67 -0
- mirp-2.3.0/mirp/_images/mr_dce_image.py +58 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/pet_image.py +8 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/rtdose_image.py +8 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/transformed_image.py +4 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_masks/base_mask.py +11 -12
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_workflows/standardWorkflow.py +50 -222
- {mirp-2.2.4 → mirp-2.3.0}/mirp.egg-info/PKG-INFO +11 -9
- {mirp-2.2.4 → mirp-2.3.0}/mirp.egg-info/SOURCES.txt +35 -13
- {mirp-2.2.4 → mirp-2.3.0}/mirp.egg-info/requires.txt +1 -3
- {mirp-2.2.4 → mirp-2.3.0}/pyproject.toml +7 -6
- mirp-2.2.4/mirp/_data_import/dicom_file_seg.py +0 -518
- mirp-2.2.4/mirp/_featuresets/cm.py +0 -558
- mirp-2.2.4/mirp/_featuresets/dzm.py +0 -326
- mirp-2.2.4/mirp/_featuresets/intensity_histogram.py +0 -193
- mirp-2.2.4/mirp/_featuresets/intensity_volume_histogram.py +0 -314
- mirp-2.2.4/mirp/_featuresets/local_intensity.py +0 -181
- mirp-2.2.4/mirp/_featuresets/morphology_3d.py +0 -814
- mirp-2.2.4/mirp/_featuresets/ngldm.py +0 -382
- mirp-2.2.4/mirp/_featuresets/ngtdm.py +0 -352
- mirp-2.2.4/mirp/_featuresets/rlm.py +0 -502
- mirp-2.2.4/mirp/_featuresets/statistics.py +0 -129
- mirp-2.2.4/mirp/_featuresets/szm.py +0 -314
- mirp-2.2.4/mirp/_featuresets/utilities.py +0 -94
- {mirp-2.2.4 → mirp-2.3.0}/CONTRIBUTING.md +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/LICENSE.txt +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/MANIFEST.in +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/dicom_file_stack.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/itk_file_stack.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/numpy_file_stack.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/read_data.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_data_import/suv.py +0 -0
- {mirp-2.2.4/mirp/_featuresets → mirp-2.3.0/mirp/_features}/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/tissue_mask.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_image_processing/utilities.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_imagefilters/utilities.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/mr_image.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_images/utilities.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_masks/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_workflows/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/_workflows/baseWorkflow.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/config_data.xml +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/config_settings.xml +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/data_import/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/data_import/import_image.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/data_import/import_image_and_mask.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/data_import/import_mask.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/deep_learning_preprocessing.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/deprecated.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/extract_features_and_images.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/extract_image_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/extract_mask_labels.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/feature_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/general_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/generic.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/image_processing_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/import_config_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/import_data_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/interpolation_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/perturbation_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/resegmentation_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/transformation_parameters.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/settings/utilities.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/utilities/__init__.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/utilities/config_utilities.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/utilities/parallel.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp/utilities/utilities.py +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp.egg-info/dependency_links.txt +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/mirp.egg-info/top_level.txt +0 -0
- {mirp-2.2.4 → mirp-2.3.0}/setup.cfg +0 -0
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
# Version 2.3.0
|
|
2
|
+
|
|
3
|
+
## Major changes
|
|
4
|
+
|
|
5
|
+
- The proper ancient feature computation code running in the background of MIRP has been completely refactored. We
|
|
6
|
+
moved from a functional backend where all features were computed per feature family to a more flexible
|
|
7
|
+
object-oriented approach. Although this change is not visible at the user-end, it offers several new possibilities:
|
|
8
|
+
- Single features can now be computed. In addition, for some features (e.g. percentile statistics), a flexible
|
|
9
|
+
percentile value could be passed.
|
|
10
|
+
- Creation of feature maps.
|
|
11
|
+
- Output of features and their metadata to machine-readable formats, instead of just tabular data.
|
|
12
|
+
|
|
13
|
+
**Important**: Though the *name* of features in the tabular exports has not changed, their *ordering* may have.
|
|
14
|
+
Avoid using column position when processing or analysing feature data.
|
|
15
|
+
|
|
16
|
+
- Apparent diffusion coefficient (ADC) maps, diffusion contrast-enhanced (DCE) MRI and multi-frame DICOM objects in
|
|
17
|
+
general are now supported.
|
|
18
|
+
- Planar imaging, i.e. computed radiography, digital X-ray and digital mammography DICOM files are now supported.
|
|
19
|
+
- Python version 3.12 is now supported thanks to recent updates by the maintainers of `ray` and `itk`.
|
|
20
|
+
This means that `mirp` now supports Python version 3.10 and later.
|
|
21
|
+
|
|
22
|
+
## Fixes
|
|
23
|
+
|
|
24
|
+
- Internal use of `numpy.cross` no longer produces deprecation warnings.
|
|
25
|
+
|
|
1
26
|
# Version 2.2.4
|
|
2
27
|
|
|
3
28
|
## Fixes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mirp
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
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
|
|
@@ -284,6 +284,7 @@ Project-URL: Changelog, https://github.com/oncoray/mirp/blob/master/NEWS.md
|
|
|
284
284
|
Classifier: Programming Language :: Python :: 3
|
|
285
285
|
Classifier: Programming Language :: Python :: 3.10
|
|
286
286
|
Classifier: Programming Language :: Python :: 3.11
|
|
287
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
287
288
|
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
|
|
288
289
|
Classifier: Operating System :: OS Independent
|
|
289
290
|
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
@@ -299,8 +300,8 @@ Requires-Dist: pydicom>=2.4.0
|
|
|
299
300
|
Requires-Dist: pywavelets>=1.4.0
|
|
300
301
|
Requires-Dist: scikit-image>=0.20.0
|
|
301
302
|
Requires-Dist: scipy>=1.11
|
|
303
|
+
Requires-Dist: ray>=2.34.0
|
|
302
304
|
Requires-Dist: typing-extensions>=4.10; python_version < "3.11"
|
|
303
|
-
Requires-Dist: ray>=2.10.0; python_version <= "3.11"
|
|
304
305
|
Provides-Extra: test
|
|
305
306
|
Requires-Dist: pytest>=7.4.0; extra == "test"
|
|
306
307
|
Provides-Extra: docs
|
|
@@ -349,18 +350,19 @@ MIRP currently supports the following Python versions and operating systems:
|
|
|
349
350
|
|--------|-----------|-----------|-----------|
|
|
350
351
|
| 3.10 | Supported | Supported | Supported |
|
|
351
352
|
| 3.11 | Supported | Supported | Supported |
|
|
353
|
+
| 3.12 | Supported | Supported | Supported |
|
|
352
354
|
|
|
353
355
|
## Supported imaging and mask modalities
|
|
354
356
|
|
|
355
357
|
MIRP currently supports the following image modalities:
|
|
356
358
|
|
|
357
|
-
| File format | File type | Supported modality
|
|
358
|
-
|
|
359
|
-
| DICOM | image | CT, MR, PT, RTDOSE |
|
|
360
|
-
| DICOM | mask | RTSTRUCT, SEG
|
|
361
|
-
| NIfTI | any | any
|
|
362
|
-
| NRRD | any | any
|
|
363
|
-
| numpy | any | any
|
|
359
|
+
| File format | File type | Supported modality |
|
|
360
|
+
|-------------|-----------|-------------------------------------------------|
|
|
361
|
+
| DICOM | image | CT, MR (incl. ADC, DCE), PT, RTDOSE, CR, DX, MG |
|
|
362
|
+
| DICOM | mask | RTSTRUCT, SEG |
|
|
363
|
+
| NIfTI | any | any |
|
|
364
|
+
| NRRD | any | any |
|
|
365
|
+
| numpy | any | any |
|
|
364
366
|
|
|
365
367
|
NIfTI, NRRD, and numpy files support any kind of (single-channel) image. MIRP cannot process RGB or 4D images.
|
|
366
368
|
|
|
@@ -39,18 +39,19 @@ MIRP currently supports the following Python versions and operating systems:
|
|
|
39
39
|
|--------|-----------|-----------|-----------|
|
|
40
40
|
| 3.10 | Supported | Supported | Supported |
|
|
41
41
|
| 3.11 | Supported | Supported | Supported |
|
|
42
|
+
| 3.12 | Supported | Supported | Supported |
|
|
42
43
|
|
|
43
44
|
## Supported imaging and mask modalities
|
|
44
45
|
|
|
45
46
|
MIRP currently supports the following image modalities:
|
|
46
47
|
|
|
47
|
-
| File format | File type | Supported modality
|
|
48
|
-
|
|
49
|
-
| DICOM | image | CT, MR, PT, RTDOSE |
|
|
50
|
-
| DICOM | mask | RTSTRUCT, SEG
|
|
51
|
-
| NIfTI | any | any
|
|
52
|
-
| NRRD | any | any
|
|
53
|
-
| numpy | any | any
|
|
48
|
+
| File format | File type | Supported modality |
|
|
49
|
+
|-------------|-----------|-------------------------------------------------|
|
|
50
|
+
| DICOM | image | CT, MR (incl. ADC, DCE), PT, RTDOSE, CR, DX, MG |
|
|
51
|
+
| DICOM | mask | RTSTRUCT, SEG |
|
|
52
|
+
| NIfTI | any | any |
|
|
53
|
+
| NRRD | any | any |
|
|
54
|
+
| numpy | any | any |
|
|
54
55
|
|
|
55
56
|
NIfTI, NRRD, and numpy files support any kind of (single-channel) image. MIRP cannot process RGB or 4D images.
|
|
56
57
|
|
|
@@ -1,51 +1,27 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
import datetime
|
|
2
3
|
import os.path
|
|
3
4
|
import hashlib
|
|
4
5
|
import numpy as np
|
|
5
6
|
|
|
7
|
+
if sys.version_info >= (3, 11):
|
|
8
|
+
from typing import Self
|
|
9
|
+
else:
|
|
10
|
+
from typing_extensions import Self
|
|
6
11
|
from typing import Any
|
|
7
12
|
|
|
8
13
|
from pydicom import dcmread
|
|
9
14
|
from warnings import warn
|
|
15
|
+
from copy import deepcopy
|
|
10
16
|
|
|
11
17
|
from mirp._data_import.generic_file import ImageFile, MaskFile
|
|
12
18
|
from mirp._data_import.utilities import supported_image_modalities, stacking_dicom_image_modalities, \
|
|
13
|
-
supported_mask_modalities, get_pydicom_meta_tag, convert_dicom_time
|
|
19
|
+
supported_mask_modalities, get_pydicom_meta_tag, convert_dicom_time, has_pydicom_meta_tag
|
|
14
20
|
|
|
15
21
|
|
|
16
22
|
class ImageDicomFile(ImageFile):
|
|
17
|
-
def __init__(
|
|
18
|
-
|
|
19
|
-
file_path: None | str = None,
|
|
20
|
-
dir_path: None | str = None,
|
|
21
|
-
sample_name: None | str | list[str] = None,
|
|
22
|
-
file_name: None | str = None,
|
|
23
|
-
image_name: None | str = None,
|
|
24
|
-
image_modality: None | str = None,
|
|
25
|
-
image_file_type: None | str = None,
|
|
26
|
-
image_data: None | np.ndarray = None,
|
|
27
|
-
image_origin: None | tuple[float, ...] = None,
|
|
28
|
-
image_orientation: None | np.ndarray = None,
|
|
29
|
-
image_spacing: None | tuple[float, ...] = None,
|
|
30
|
-
image_dimensions: None | tuple[int, ...] = None,
|
|
31
|
-
**kwargs
|
|
32
|
-
):
|
|
33
|
-
|
|
34
|
-
super().__init__(
|
|
35
|
-
file_path=file_path,
|
|
36
|
-
dir_path=dir_path,
|
|
37
|
-
sample_name=sample_name,
|
|
38
|
-
file_name=file_name,
|
|
39
|
-
image_name=image_name,
|
|
40
|
-
image_modality=image_modality,
|
|
41
|
-
image_file_type=image_file_type,
|
|
42
|
-
image_data=image_data,
|
|
43
|
-
image_origin=image_origin,
|
|
44
|
-
image_orientation=image_orientation,
|
|
45
|
-
image_spacing=image_spacing,
|
|
46
|
-
image_dimensions=image_dimensions,
|
|
47
|
-
**kwargs
|
|
48
|
-
)
|
|
23
|
+
def __init__(self, **kwargs):
|
|
24
|
+
super().__init__(**kwargs)
|
|
49
25
|
|
|
50
26
|
# These are set using the 'complete' method.
|
|
51
27
|
self.series_instance_uid: None | str = None
|
|
@@ -103,6 +79,13 @@ class ImageDicomFile(ImageFile):
|
|
|
103
79
|
|
|
104
80
|
def _check_modality(self, raise_error: bool) -> bool:
|
|
105
81
|
dicom_modality = get_pydicom_meta_tag(dcm_seq=self.image_metadata, tag=(0x0008, 0x0060), tag_type="str")
|
|
82
|
+
|
|
83
|
+
# Check for ADC images
|
|
84
|
+
if self._check_is_mr_adc():
|
|
85
|
+
dicom_modality = "adc"
|
|
86
|
+
if self._check_is_mr_dce():
|
|
87
|
+
dicom_modality = "dce"
|
|
88
|
+
|
|
106
89
|
support_modalities = supported_image_modalities(self.modality)
|
|
107
90
|
if dicom_modality.lower() not in support_modalities:
|
|
108
91
|
if raise_error:
|
|
@@ -164,8 +147,14 @@ class ImageDicomFile(ImageFile):
|
|
|
164
147
|
# Import locally to prevent circular references.
|
|
165
148
|
from mirp._data_import.dicom_file_ct import ImageDicomFileCT
|
|
166
149
|
from mirp._data_import.dicom_file_mr import ImageDicomFileMR
|
|
150
|
+
from mirp._data_import.dicom_file_mr_adc import ImageDicomFileMRADC
|
|
151
|
+
from mirp._data_import.dicom_file_mr_dce import ImageDicomFileMRDCE
|
|
167
152
|
from mirp._data_import.dicom_file_pet import ImageDicomFilePT
|
|
168
153
|
from mirp._data_import.dicom_file_rtdose import ImageDicomFileRTDose
|
|
154
|
+
from mirp._data_import.dicom_file_cr import ImageDicomFileCR
|
|
155
|
+
from mirp._data_import.dicom_file_dx import ImageDicomFileDX
|
|
156
|
+
from mirp._data_import.dicom_file_mg import ImageDicomFileMG
|
|
157
|
+
from mirp._data_import.dicom_multi_frame import ImageDicomMultiFrame
|
|
169
158
|
|
|
170
159
|
# Load metadata so that the modality tag can be read.
|
|
171
160
|
self.load_metadata(limited=True)
|
|
@@ -174,39 +163,75 @@ class ImageDicomFile(ImageFile):
|
|
|
174
163
|
if modality is None:
|
|
175
164
|
raise TypeError(f"Modality attribute could not be obtained from DICOM file. [{self.describe_self()}]")
|
|
176
165
|
|
|
166
|
+
if modality == "mr" and self._check_is_mr_adc():
|
|
167
|
+
modality = "adc"
|
|
168
|
+
if modality == "mr" and self._check_is_mr_dce():
|
|
169
|
+
modality = "dce"
|
|
170
|
+
|
|
177
171
|
if modality == "ct":
|
|
178
172
|
file_class = ImageDicomFileCT
|
|
179
173
|
elif modality == "pt":
|
|
180
174
|
file_class = ImageDicomFilePT
|
|
181
175
|
elif modality == "mr":
|
|
182
176
|
file_class = ImageDicomFileMR
|
|
177
|
+
elif modality == "adc":
|
|
178
|
+
file_class = ImageDicomFileMRADC
|
|
179
|
+
elif modality == "dce":
|
|
180
|
+
file_class = ImageDicomFileMRDCE
|
|
183
181
|
elif modality == "rtdose":
|
|
184
182
|
file_class = ImageDicomFileRTDose
|
|
183
|
+
elif modality == "cr":
|
|
184
|
+
file_class = ImageDicomFileCR
|
|
185
|
+
elif modality == "dx":
|
|
186
|
+
file_class = ImageDicomFileDX
|
|
187
|
+
elif modality == "mg":
|
|
188
|
+
file_class = ImageDicomFileMG
|
|
185
189
|
else:
|
|
186
190
|
# This will return a base class, which will fail to pass the modality check.
|
|
187
191
|
return None
|
|
188
192
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
image_origin=self.image_origin,
|
|
199
|
-
image_orientation=self.image_orientation,
|
|
200
|
-
image_spacing=self.image_spacing,
|
|
201
|
-
image_dimensions=self.image_dimension,
|
|
202
|
-
)
|
|
193
|
+
if has_pydicom_meta_tag(dcm_seq=self.image_metadata, tag=(0x5200, 0x9299)) or \
|
|
194
|
+
has_pydicom_meta_tag(dcm_seq=self.image_metadata, tag=(0x5200, 0x9230)):
|
|
195
|
+
file_class = ImageDicomMultiFrame
|
|
196
|
+
|
|
197
|
+
# Instantiate subclass, and update using current object.
|
|
198
|
+
# Modality is updated here to reflect the choices made above.
|
|
199
|
+
image = file_class()
|
|
200
|
+
image.update_from_template(template=self)
|
|
201
|
+
image.modality = modality
|
|
203
202
|
|
|
204
|
-
#
|
|
205
|
-
image
|
|
206
|
-
|
|
203
|
+
# Multi-frame images need additional work.
|
|
204
|
+
if isinstance(image, ImageDicomMultiFrame):
|
|
205
|
+
image = image.create()
|
|
207
206
|
|
|
208
207
|
return image
|
|
209
208
|
|
|
209
|
+
def update_from_template(self, template: Self):
|
|
210
|
+
if not isinstance(template, ImageDicomFile):
|
|
211
|
+
raise TypeError(
|
|
212
|
+
f"The new class object should inherit from an ImageDicomFile object. Found: {type(template)}"
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
# Attributes from the template Image Dicom File. Note that image_data and image_metadata are shallow copies.
|
|
216
|
+
self.file_path = deepcopy(template.file_path)
|
|
217
|
+
self.dir_path = deepcopy(template.dir_path)
|
|
218
|
+
self.sample_name = deepcopy(template.sample_name)
|
|
219
|
+
self.file_name = deepcopy(template.file_name)
|
|
220
|
+
self.modality = deepcopy(template.modality)
|
|
221
|
+
self.image_name = deepcopy(template.image_name)
|
|
222
|
+
self.file_type = deepcopy(template.file_type)
|
|
223
|
+
self.image_data = template.image_data
|
|
224
|
+
self.image_origin = deepcopy(template.image_origin)
|
|
225
|
+
self.image_orientation = deepcopy(template.image_orientation)
|
|
226
|
+
self.image_spacing = deepcopy(template.image_spacing)
|
|
227
|
+
self.image_dimension = deepcopy(template.image_dimension)
|
|
228
|
+
self.frame_of_reference_uid = deepcopy(template.frame_of_reference_uid)
|
|
229
|
+
self.image_metadata = template.image_metadata
|
|
230
|
+
self.is_limited_metadata = deepcopy(template.is_limited_metadata)
|
|
231
|
+
self.series_instance_uid = deepcopy(template.series_instance_uid)
|
|
232
|
+
self.sop_instance_uid = deepcopy(template.sop_instance_uid)
|
|
233
|
+
self.associated_masks = template.associated_masks
|
|
234
|
+
|
|
210
235
|
def complete(self, remove_metadata=False, force=False):
|
|
211
236
|
|
|
212
237
|
# complete loads metadata.
|
|
@@ -283,7 +308,7 @@ class ImageDicomFile(ImageFile):
|
|
|
283
308
|
else:
|
|
284
309
|
self.sample_name = None
|
|
285
310
|
|
|
286
|
-
def _complete_image_origin(self, force=False):
|
|
311
|
+
def _complete_image_origin(self, force=False, frame_id=None):
|
|
287
312
|
if self.image_origin is None:
|
|
288
313
|
# Origin needs to be determined at the stack-level for slice-based dicom, not for each slice.
|
|
289
314
|
if self.modality in stacking_dicom_image_modalities() and not force:
|
|
@@ -292,10 +317,16 @@ class ImageDicomFile(ImageFile):
|
|
|
292
317
|
# Load relevant metadata.
|
|
293
318
|
self.load_metadata(limited=True)
|
|
294
319
|
|
|
295
|
-
origin = get_pydicom_meta_tag(
|
|
320
|
+
origin = get_pydicom_meta_tag(
|
|
321
|
+
dcm_seq=self.image_metadata,
|
|
322
|
+
tag=(0x0020, 0x0032),
|
|
323
|
+
tag_type="mult_float",
|
|
324
|
+
macro_dcm_seq=(0x0020, 0x9113),
|
|
325
|
+
frame_id=frame_id
|
|
326
|
+
)[::-1]
|
|
296
327
|
self.image_origin = tuple(origin)
|
|
297
328
|
|
|
298
|
-
def _complete_image_orientation(self, force=False):
|
|
329
|
+
def _complete_image_orientation(self, force=False, frame_id=None):
|
|
299
330
|
if self.image_orientation is None:
|
|
300
331
|
# Orientation needs to be determined at the stack-level for slice-based dicom, not for each slice.
|
|
301
332
|
if self.modality in stacking_dicom_image_modalities() and not force:
|
|
@@ -307,14 +338,17 @@ class ImageDicomFile(ImageFile):
|
|
|
307
338
|
orientation: list[float] = get_pydicom_meta_tag(
|
|
308
339
|
dcm_seq=self.image_metadata,
|
|
309
340
|
tag=(0x0020, 0x0037),
|
|
310
|
-
tag_type="mult_float"
|
|
341
|
+
tag_type="mult_float",
|
|
342
|
+
macro_dcm_seq=(0x0020, 0x9116),
|
|
343
|
+
frame_id=frame_id
|
|
311
344
|
)
|
|
312
345
|
|
|
313
346
|
# First compute z-orientation.
|
|
347
|
+
# noinspection PyUnreachableCode
|
|
314
348
|
orientation += list(np.cross(orientation[0:3], orientation[3:6]))
|
|
315
349
|
self.image_orientation = np.reshape(orientation[::-1], [3, 3], order="F")
|
|
316
350
|
|
|
317
|
-
def _complete_image_spacing(self, force=False):
|
|
351
|
+
def _complete_image_spacing(self, force=False, frame_id=None):
|
|
318
352
|
if self.image_spacing is None:
|
|
319
353
|
# Image spacing needs to be determined at the stack-level for slice-based dicom, not for each slice.
|
|
320
354
|
if self.modality in stacking_dicom_image_modalities() and not force:
|
|
@@ -324,14 +358,36 @@ class ImageDicomFile(ImageFile):
|
|
|
324
358
|
self.load_metadata(limited=True)
|
|
325
359
|
|
|
326
360
|
# Get pixel-spacing.
|
|
327
|
-
spacing = get_pydicom_meta_tag(
|
|
361
|
+
spacing = get_pydicom_meta_tag(
|
|
362
|
+
dcm_seq=self.image_metadata,
|
|
363
|
+
tag=(0x0028, 0x0030),
|
|
364
|
+
tag_type="mult_float",
|
|
365
|
+
macro_dcm_seq=(0x0028, 0x9110),
|
|
366
|
+
frame_id=frame_id
|
|
367
|
+
)
|
|
328
368
|
|
|
329
|
-
#
|
|
369
|
+
# First try to get spacing between slices.
|
|
330
370
|
z_spacing = get_pydicom_meta_tag(
|
|
331
371
|
dcm_seq=self.image_metadata,
|
|
332
|
-
tag=(0x0018,
|
|
372
|
+
tag=(0x0018, 0x0088),
|
|
333
373
|
tag_type="float",
|
|
334
|
-
|
|
374
|
+
macro_dcm_seq=(0x0028, 0x9110),
|
|
375
|
+
frame_id=frame_id
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
# If spacing between slices is not set, get slice thickness.
|
|
379
|
+
if z_spacing is None:
|
|
380
|
+
z_spacing = get_pydicom_meta_tag(
|
|
381
|
+
dcm_seq=self.image_metadata,
|
|
382
|
+
tag=(0x0018, 0x0050),
|
|
383
|
+
tag_type="float",
|
|
384
|
+
macro_dcm_seq=(0x0028, 0x9110),
|
|
385
|
+
frame_id=frame_id
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
# If slice thickness is not set, use a default value.
|
|
389
|
+
if z_spacing is None:
|
|
390
|
+
z_spacing = 1.0
|
|
335
391
|
spacing += [z_spacing]
|
|
336
392
|
|
|
337
393
|
self.image_spacing = tuple(spacing[::-1])
|
|
@@ -496,10 +552,145 @@ class ImageDicomFile(ImageFile):
|
|
|
496
552
|
# Update object_metadata
|
|
497
553
|
self.object_metadata.update(dict(metadata))
|
|
498
554
|
|
|
555
|
+
def export_metadata(self, self_only=False, **kwargs) -> None | dict[str, Any]:
|
|
556
|
+
if not self_only:
|
|
557
|
+
metadata = super().export_metadata()
|
|
558
|
+
else:
|
|
559
|
+
metadata = {}
|
|
560
|
+
|
|
561
|
+
self.load_metadata()
|
|
562
|
+
|
|
563
|
+
dcm_meta_data = []
|
|
564
|
+
|
|
565
|
+
# Scanner type
|
|
566
|
+
scanner_type = get_pydicom_meta_tag(
|
|
567
|
+
dcm_seq=self.image_metadata,
|
|
568
|
+
tag=(0x0008, 0x1090),
|
|
569
|
+
tag_type="str"
|
|
570
|
+
)
|
|
571
|
+
if scanner_type is not None:
|
|
572
|
+
dcm_meta_data += [("scanner_type", scanner_type)]
|
|
573
|
+
|
|
574
|
+
# Scanner manufacturer
|
|
575
|
+
manufacturer = get_pydicom_meta_tag(
|
|
576
|
+
dcm_seq=self.image_metadata,
|
|
577
|
+
tag=(0x0008, 0x0070),
|
|
578
|
+
tag_type="str"
|
|
579
|
+
)
|
|
580
|
+
if manufacturer is not None:
|
|
581
|
+
dcm_meta_data += [("manufacturer", manufacturer)]
|
|
582
|
+
|
|
583
|
+
# Image type
|
|
584
|
+
image_type = get_pydicom_meta_tag(
|
|
585
|
+
dcm_seq=self.image_metadata,
|
|
586
|
+
tag=(0x0008, 0x0008),
|
|
587
|
+
tag_type="str"
|
|
588
|
+
)
|
|
589
|
+
if image_type is not None:
|
|
590
|
+
dcm_meta_data += [("image_type", image_type)]
|
|
591
|
+
|
|
592
|
+
# Patient orientation
|
|
593
|
+
patient_orientation = get_pydicom_meta_tag(
|
|
594
|
+
dcm_seq=self.image_metadata,
|
|
595
|
+
tag=(0x0020, 0x0020),
|
|
596
|
+
tag_type="str"
|
|
597
|
+
)
|
|
598
|
+
if patient_orientation is not None:
|
|
599
|
+
dcm_meta_data += [("patient_orientation", patient_orientation)]
|
|
600
|
+
|
|
601
|
+
metadata.update(dict(dcm_meta_data))
|
|
602
|
+
|
|
603
|
+
return metadata
|
|
604
|
+
|
|
605
|
+
def _check_is_mr_adc(self):
|
|
606
|
+
# Check for ADC images. ADC can sometimes by identified the ADC value in the Image Type (0008,0008) tag,
|
|
607
|
+
# the frame type tag (0008, 9007) or acquisition contrast (0008, 9209) [though this typically should be
|
|
608
|
+
# DIFFUSION].
|
|
609
|
+
image_type = get_pydicom_meta_tag(
|
|
610
|
+
dcm_seq=self.image_metadata,
|
|
611
|
+
tag=(0x0008, 0x0008),
|
|
612
|
+
tag_type="mult_str"
|
|
613
|
+
)
|
|
614
|
+
frame_type = get_pydicom_meta_tag(
|
|
615
|
+
dcm_seq=self.image_metadata,
|
|
616
|
+
tag=(0x0008, 0x9007),
|
|
617
|
+
tag_type="mult_str",
|
|
618
|
+
macro_dcm_seq=(0x0018, 0x9226),
|
|
619
|
+
frame_id=0
|
|
620
|
+
)
|
|
621
|
+
alt_frame_type = get_pydicom_meta_tag(
|
|
622
|
+
dcm_seq=self.image_metadata,
|
|
623
|
+
tag=(0x0008, 0x9007),
|
|
624
|
+
tag_type="mult_str",
|
|
625
|
+
macro_dcm_seq=(0x0040, 0x9092),
|
|
626
|
+
frame_id=0
|
|
627
|
+
)
|
|
628
|
+
acquisition_contrast = get_pydicom_meta_tag(
|
|
629
|
+
dcm_seq=self.image_metadata,
|
|
630
|
+
tag=(0x0008, 0x9209),
|
|
631
|
+
tag_type="str",
|
|
632
|
+
macro_dcm_seq=(0x0018, 0x9226),
|
|
633
|
+
frame_id=0
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
if image_type is not None and any(x.lower() == "adc" for x in image_type):
|
|
637
|
+
return True
|
|
638
|
+
elif frame_type is not None and any(x.lower() == "adc" for x in frame_type):
|
|
639
|
+
return True
|
|
640
|
+
elif alt_frame_type is not None and any(x.lower() == "adc" for x in alt_frame_type):
|
|
641
|
+
return True
|
|
642
|
+
elif acquisition_contrast is not None and acquisition_contrast.lower() == "adc":
|
|
643
|
+
return True
|
|
644
|
+
|
|
645
|
+
return False
|
|
646
|
+
|
|
647
|
+
def _check_is_mr_dce(self):
|
|
648
|
+
# Check for DCE images. DCE can sometimes by identified the DCE value in the Image Type (0008,0008) tag,
|
|
649
|
+
# the frame type tag (0008, 9007) or acquisition contrast (0008, 9209) [though this typically should be
|
|
650
|
+
# DIFFUSION].
|
|
651
|
+
image_type = get_pydicom_meta_tag(
|
|
652
|
+
dcm_seq=self.image_metadata,
|
|
653
|
+
tag=(0x0008, 0x0008),
|
|
654
|
+
tag_type="mult_str"
|
|
655
|
+
)
|
|
656
|
+
frame_type = get_pydicom_meta_tag(
|
|
657
|
+
dcm_seq=self.image_metadata,
|
|
658
|
+
tag=(0x0008, 0x9007),
|
|
659
|
+
tag_type="mult_str",
|
|
660
|
+
macro_dcm_seq=(0x0018, 0x9226),
|
|
661
|
+
frame_id=0
|
|
662
|
+
)
|
|
663
|
+
alt_frame_type = get_pydicom_meta_tag(
|
|
664
|
+
dcm_seq=self.image_metadata,
|
|
665
|
+
tag=(0x0008, 0x9007),
|
|
666
|
+
tag_type="mult_str",
|
|
667
|
+
macro_dcm_seq=(0x0040, 0x9092),
|
|
668
|
+
frame_id=0
|
|
669
|
+
)
|
|
670
|
+
acquisition_contrast = get_pydicom_meta_tag(
|
|
671
|
+
dcm_seq=self.image_metadata,
|
|
672
|
+
tag=(0x0008, 0x9209),
|
|
673
|
+
tag_type="str",
|
|
674
|
+
macro_dcm_seq=(0x0018, 0x9226),
|
|
675
|
+
frame_id=0
|
|
676
|
+
)
|
|
677
|
+
|
|
678
|
+
if image_type is not None and any(x.lower() == "dce" for x in image_type):
|
|
679
|
+
return True
|
|
680
|
+
elif frame_type is not None and any(x.lower() == "dce" for x in frame_type):
|
|
681
|
+
return True
|
|
682
|
+
elif alt_frame_type is not None and any(x.lower() == "dce" for x in alt_frame_type):
|
|
683
|
+
return True
|
|
684
|
+
elif acquisition_contrast is not None and acquisition_contrast.lower() == "dce":
|
|
685
|
+
return True
|
|
686
|
+
|
|
687
|
+
return False
|
|
688
|
+
|
|
499
689
|
@staticmethod
|
|
500
690
|
def _get_limited_metadata_tags():
|
|
501
691
|
# Limited tags are read to populate basic
|
|
502
692
|
return [
|
|
693
|
+
(0x0008, 0x0008), # image type
|
|
503
694
|
(0x0008, 0x0018), # SOP instance UID
|
|
504
695
|
(0x0008, 0x0060), # modality
|
|
505
696
|
(0x0008, 0x1030), # study description
|
|
@@ -507,6 +698,7 @@ class ImageDicomFile(ImageFile):
|
|
|
507
698
|
(0x0010, 0x0010), # patient name
|
|
508
699
|
(0x0010, 0x0020), # patient id
|
|
509
700
|
(0x0018, 0x0050), # slice thickness
|
|
701
|
+
(0x0018, 0x9087), # diffusion b-value
|
|
510
702
|
(0x0020, 0x000E), # series instance UID
|
|
511
703
|
(0x0020, 0x0010), # study id
|
|
512
704
|
(0x0020, 0x0032), # origin
|
|
@@ -516,7 +708,9 @@ class ImageDicomFile(ImageFile):
|
|
|
516
708
|
(0x0028, 0x0010), # pixel rows
|
|
517
709
|
(0x0028, 0x0011), # pixel columns
|
|
518
710
|
(0x0028, 0x0030), # pixel spacing
|
|
519
|
-
(0x3004, 0x000C) # grid frame offset vector
|
|
711
|
+
(0x3004, 0x000C), # grid frame offset vector
|
|
712
|
+
(0x5200, 0x9229), # shared functional groups sequence
|
|
713
|
+
(0x5200, 0x9230) # per-frame functional groups sequence
|
|
520
714
|
]
|
|
521
715
|
|
|
522
716
|
def _get_acquisition_start_time(self) -> datetime.datetime:
|
|
@@ -1,42 +1,12 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
|
|
3
1
|
from typing import Any
|
|
4
2
|
from mirp._data_import.dicom_file import ImageDicomFile
|
|
3
|
+
from mirp._data_import.dicom_multi_frame import ImageDicomMultiFrame
|
|
5
4
|
from mirp._data_import.utilities import get_pydicom_meta_tag
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
class ImageDicomFileCT(ImageDicomFile):
|
|
9
|
-
def __init__(
|
|
10
|
-
|
|
11
|
-
file_path: None | str = None,
|
|
12
|
-
dir_path: None | str = None,
|
|
13
|
-
sample_name: None | str | list[str] = None,
|
|
14
|
-
file_name: None | str = None,
|
|
15
|
-
image_name: None | str = None,
|
|
16
|
-
image_modality: None | str = None,
|
|
17
|
-
image_file_type: None | str = None,
|
|
18
|
-
image_data: None | np.ndarray = None,
|
|
19
|
-
image_origin: None | tuple[float, float, float] = None,
|
|
20
|
-
image_orientation: None | np.ndarray = None,
|
|
21
|
-
image_spacing: None | tuple[float, float, float] = None,
|
|
22
|
-
image_dimensions: None | tuple[int, int, int] = None,
|
|
23
|
-
**kwargs
|
|
24
|
-
):
|
|
25
|
-
|
|
26
|
-
super().__init__(
|
|
27
|
-
file_path=file_path,
|
|
28
|
-
dir_path=dir_path,
|
|
29
|
-
sample_name=sample_name,
|
|
30
|
-
file_name=file_name,
|
|
31
|
-
image_name=image_name,
|
|
32
|
-
image_modality=image_modality,
|
|
33
|
-
image_file_type=image_file_type,
|
|
34
|
-
image_data=image_data,
|
|
35
|
-
image_origin=image_origin,
|
|
36
|
-
image_orientation=image_orientation,
|
|
37
|
-
image_spacing=image_spacing,
|
|
38
|
-
image_dimensions=image_dimensions
|
|
39
|
-
)
|
|
8
|
+
def __init__(self, **kwargs):
|
|
9
|
+
super().__init__(**kwargs)
|
|
40
10
|
|
|
41
11
|
def is_stackable(self, stack_images: str):
|
|
42
12
|
return True
|
|
@@ -57,47 +27,32 @@ class ImageDicomFileCT(ImageDicomFile):
|
|
|
57
27
|
|
|
58
28
|
dcm_meta_data = []
|
|
59
29
|
|
|
60
|
-
# Scanner type
|
|
61
|
-
scanner_type = get_pydicom_meta_tag(
|
|
62
|
-
dcm_seq=self.image_metadata,
|
|
63
|
-
tag=(0x0008, 0x1090),
|
|
64
|
-
tag_type="str"
|
|
65
|
-
)
|
|
66
|
-
if scanner_type is not None:
|
|
67
|
-
dcm_meta_data += [("scanner_type", scanner_type)]
|
|
68
|
-
|
|
69
|
-
# Scanner manufacturer
|
|
70
|
-
manufacturer = get_pydicom_meta_tag(
|
|
71
|
-
dcm_seq=self.image_metadata,
|
|
72
|
-
tag=(0x0008, 0x0070),
|
|
73
|
-
tag_type="str"
|
|
74
|
-
)
|
|
75
|
-
if manufacturer is not None:
|
|
76
|
-
dcm_meta_data += [("manufacturer", manufacturer)]
|
|
77
|
-
|
|
78
|
-
# Image type
|
|
79
|
-
image_type = get_pydicom_meta_tag(
|
|
80
|
-
dcm_seq=self.image_metadata,
|
|
81
|
-
tag=(0x0008, 0x0008),
|
|
82
|
-
tag_type="str"
|
|
83
|
-
)
|
|
84
|
-
if image_type is not None:
|
|
85
|
-
dcm_meta_data += [("image_type", image_type)]
|
|
86
|
-
|
|
87
30
|
# Convolution kernel
|
|
88
31
|
kernel = get_pydicom_meta_tag(
|
|
89
32
|
dcm_seq=self.image_metadata,
|
|
90
33
|
tag=(0x0018, 0x1210),
|
|
91
|
-
tag_type="str"
|
|
34
|
+
tag_type="str",
|
|
35
|
+
macro_dcm_seq=(0x0018, 0x9314)
|
|
92
36
|
)
|
|
93
37
|
if kernel is not None:
|
|
94
38
|
dcm_meta_data += [("kernel", kernel)]
|
|
95
39
|
|
|
40
|
+
# Reconstruction algorithm
|
|
41
|
+
reconstruction_algorithm = get_pydicom_meta_tag(
|
|
42
|
+
dcm_seq=self.image_metadata,
|
|
43
|
+
tag=(0x0018, 0x9315),
|
|
44
|
+
tag_type="str",
|
|
45
|
+
macro_dcm_seq=(0x0018, 0x9314)
|
|
46
|
+
)
|
|
47
|
+
if reconstruction_algorithm is not None:
|
|
48
|
+
dcm_meta_data += [("reconstruction_algorithm", reconstruction_algorithm)]
|
|
49
|
+
|
|
96
50
|
# Peak kilo voltage output
|
|
97
51
|
kvp = get_pydicom_meta_tag(
|
|
98
52
|
dcm_seq=self.image_metadata,
|
|
99
53
|
tag=(0x0018, 0x0060),
|
|
100
|
-
tag_type="float"
|
|
54
|
+
tag_type="float",
|
|
55
|
+
macro_dcm_seq=(0x0018, 0x9325)
|
|
101
56
|
)
|
|
102
57
|
if kvp is not None:
|
|
103
58
|
dcm_meta_data += [("kvp", kvp)]
|
|
@@ -138,5 +93,20 @@ class ImageDicomFileCT(ImageDicomFile):
|
|
|
138
93
|
if contrast_agent is not None:
|
|
139
94
|
dcm_meta_data += [("contrast_agent", contrast_agent)]
|
|
140
95
|
|
|
96
|
+
# Contrast/bolus agent phase
|
|
97
|
+
contrast_agent_phase = get_pydicom_meta_tag(
|
|
98
|
+
dcm_seq=self.image_metadata,
|
|
99
|
+
tag=(0x0018, 0x9344),
|
|
100
|
+
tag_type="str",
|
|
101
|
+
macro_dcm_seq=(0x0018, 0x9341)
|
|
102
|
+
)
|
|
103
|
+
if contrast_agent_phase is not None:
|
|
104
|
+
dcm_meta_data += [("contrast_agent_phase", contrast_agent_phase)]
|
|
105
|
+
|
|
141
106
|
metadata.update(dict(dcm_meta_data))
|
|
142
107
|
return metadata
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class ImageDicomFileCTMultiFrame(ImageDicomMultiFrame, ImageDicomFileCT):
|
|
111
|
+
def __init__(self, **kwargs):
|
|
112
|
+
super().__init__(**kwargs)
|