Skip to content

Commit

Permalink
Fix repeated conversion of frame-specific elements
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Mar 11, 2024
1 parent e31b657 commit 8a767a7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/python/dicomifier/dicom_to_nifti/meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ def get_meta_data(stack, cache=None):
if frame is not None:
# Fetch frame-specific elements
groups = data_set[odil.registry.PerFrameFunctionalGroupsSequence][frame]
_fill_meta_data_dictionary(
groups,
lambda tag, value:
elements.setdefault(tag, {}).update({i: value}),
skipped, no_recurse)
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

# Convert dictionary with possible holes to list: iteration is quicker.
elements = {
Expand Down

0 comments on commit 8a767a7

Please sign in to comment.