Transfer syntax mismatch when sending a dataset to C-STORE SCP #1049
Replies: 1 comment 2 replies
-
pydicom can convert between uncompressed transfer syntaxes like Implicit VR Little Endian, Explicit VR Little Endian and Deflated Explicit VR Little Endian without any issues, so when sending uncompressed datasets pynetdicom should automatically convert to match the accepted presentation context's transfer syntax: from pydicom import examples
from pydicom.uid import ExplicitVRLittleEndian
from pynetdicom import AE, debug_logger
from pynetdicom.sop_class import RTDoseStorage
ds = examples.rt_dose
print(ds.file_meta.TransferSyntaxUID.name) # Implicit VR Little Endian
debug_logger()
ae = AE()
ae.add_requested_context(RTDoseStorage, ExplicitVRLittleEndian)
assoc = ae.associate("localhost", 11112) # To DCMTK's storescp
assoc.send_c_store(ds)
However, if Without seeing your code, an example anonymised dataset or any logging output I don't know why the conversion would be failing. I wouldn't recommend your patch, though, as (generally speaking) you'll be sending datasets that may be encoded with an incorrect transfer syntax. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a question about the way
pynetdicom
'sAssociation.send_c_store
method picks a presentation context for a dataset it is about to transfer.The method first obtains the Transfer Syntax from the dataset (file meta and the dataset itself), and then looks for a negotiated Presentation Context for that Transfer Syntax and SOP Class.
However, what if the negotiated Presentation Context for that SOP Class is for a different Transfer Syntax? For example, my dataset is encoded with
Implicit Little Endian
, but the destination Store SCP accepts onlyExplicit Little Endian
? In this case,send_c_store
will raise an exception (_get_valid_context
will fail to find a match). If I instead simply don't read the Transfer Syntax from the dataset, it will succeed. The Presentation Context will be with theExplicit Little Endian
TS, and the stream will be re-encoded to match it, further down insend_c_store
.I validated this by patching the method to not use the transfer syntax obtained from the dataset:
I'm implementing a C-MOVE proxy which receives datasets from a DICOM server modifies them (for compatibility reasons) before sending off to a legacy device. The legacy device only uses the
Explicit Little Endian
transfer syntax. I can force the DICOM server to also use this transfer syntax, so that the datasets don't have to be re-encoded in my proxy. But I don't see why I should have to do this, and why the Transfer Syntax from the dataset is matched to the list of negotiated Presentation Contexts at all. I'm sure there are pitfalls to my "naive" patch. I'm probably missing something and would appreciate any input.Beta Was this translation helpful? Give feedback.
All reactions