From 53d00926714ef675fbc1e0f2c65aab2bb88bcdac Mon Sep 17 00:00:00 2001 From: Julien Lamy Date: Wed, 3 Apr 2024 18:16:28 +0200 Subject: [PATCH] Fix conversion of frame-dependent elements --- src/python/dicomifier/dicom_to_nifti/meta_data.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/python/dicomifier/dicom_to_nifti/meta_data.py b/src/python/dicomifier/dicom_to_nifti/meta_data.py index 5f3ca46..2a2a970 100644 --- a/src/python/dicomifier/dicom_to_nifti/meta_data.py +++ b/src/python/dicomifier/dicom_to_nifti/meta_data.py @@ -94,15 +94,14 @@ def get_meta_data(stack, cache=None): # Already converted elements[tag] = element if frame is not None: - # Fetch frame-specific elements + # Fetch frame-specific elements. Each frame will be part of only one + # stack, so caching is meaningless here groups = data_set[odil.registry.PerFrameFunctionalGroupsSequence][frame] - if tag not in elements or isinstance(elements[tag], dict): - _fill_meta_data_dictionary( - groups, - lambda tag, value: - elements.setdefault(tag, {}).update({i: value}), - skipped, no_recurse) - # Otherwise element has already been converted + _fill_meta_data_dictionary( + groups, + lambda tag, value: + elements.setdefault(tag, {}).update({i: value}), + skipped, no_recurse) # Convert dictionary with possible holes to list: iteration is quicker. elements = {