Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when sending the plan, use Explicit Little Endian only in the transfer syntax. #69

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tdwii_plus_examples/rtbdi_creator/storescu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging

from pydicom import Dataset
from pydicom.uid import ExplicitVRLittleEndian

# from pydicom.errors import InvalidDicomError
# from pydicom.uid import UID
Expand Down Expand Up @@ -32,7 +33,12 @@ def store(self, iods: list[Dataset], receiving_ae_title: str = None) -> bool:
dest_ae_title = self.receiving_ae_title
if receiving_ae_title is not None:
dest_ae_title = receiving_ae_title
contexts_in_iods = [build_context(x.SOPClassUID) for x in iods]
# Favouring ExplicitLittleEndian to avoid issues with QRSCP when there are private elements
# There is a catch-22 if you have privates *and* a string type element with length > 64K
# For RT SS with way too much data in the contours or RT Ion Plan with compensator voxel thickness with
# a large number of rows and columns... some of the elements can exceed 64K and then the explicit syntax
# doesn't have room in the 16 bit unsigned integer for lengths (in bytes) > 64k
contexts_in_iods = [build_context(x.SOPClassUID, transfer_syntax=[ExplicitVRLittleEndian]) for x in iods]
assoc = ae.associate(
tdwii_config.known_ae_ipaddr[dest_ae_title],
tdwii_config.known_ae_port[dest_ae_title],
Expand All @@ -54,4 +60,10 @@ def store(self, iods: list[Dataset], receiving_ae_title: str = None) -> bool:
logging.error(error_msg)
break
assoc.release()
else:
assoc.rejected_contexts
error_msg = f"Failed to form association with {dest_ae_title}"
logging.error(error_msg)
logging.error("Rejected contexts:")
logging.error(assoc.rejected_contexts)
return success
Loading