From 6c1ddd0f1027b18bbec422876307264c52bdf6e5 Mon Sep 17 00:00:00 2001 From: David Wikler Date: Thu, 17 Oct 2024 16:24:41 +0200 Subject: [PATCH] Fixing DICOM dataset issues (#80) * Fixing DICOM dataset issues - fix #78 - fix #79 * Update ncreatescu.py to add one more space before comment to satisfy the linter * Update upsdb.py to add one more space before comment to satisfy the linter * Update ncreatescu.py to eliminate trailing white space to satisfy flake8 linter --------- Co-authored-by: sjswerdloff --- tdwii_plus_examples/ncreatescu.py | 2 +- tdwii_plus_examples/upsdb.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tdwii_plus_examples/ncreatescu.py b/tdwii_plus_examples/ncreatescu.py index 0018618..074989d 100755 --- a/tdwii_plus_examples/ncreatescu.py +++ b/tdwii_plus_examples/ncreatescu.py @@ -293,7 +293,7 @@ def main(args=None): for fpath in lfiles: APP_LOGGER.info(f"Sending file: {fpath}") try: - ds = dcmread(fpath) + ds = dcmread(fpath, force=True) # set force flag to allow raw DICOM files status = assoc.send_n_create( ds, UnifiedProcedureStepPush, diff --git a/tdwii_plus_examples/upsdb.py b/tdwii_plus_examples/upsdb.py index bb3d0d2..db8aea3 100644 --- a/tdwii_plus_examples/upsdb.py +++ b/tdwii_plus_examples/upsdb.py @@ -489,7 +489,10 @@ def search(model, identifier, session): for elem in identifier: kw = elem.keyword if kw != "QueryRetrieveLevel" and kw not in _ATTRIBUTES: - delattr(identifier, kw) + if elem.tag.element == 0: # deletion by name fails for group length elements + del identifier[elem.tag] + else: + delattr(identifier, kw) if model in _C_GET or model in _C_MOVE: # Part 4, C.2.2.1.2: remove required keys from C-GET/C-MOVE