You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with a PACS that has a weird implementation bug. It returns two NumberOf*Suboperations fields in C-Move responses.
When parsing the command set, pydicom parses it as MultiValue, and this in turn causes pydicom to raise: TypeError: Number of Remaining Suboperations must be an int
Expected behavior
We are trying to migrate from dcmtk/dcm4che3 cli utilities, and encountered this bug only here.
Since both are popular implementations, I assume that taking the first value is ok for these cases.
I have a fork that before setting any field of a DIMSEPrimitive from the command dataset, verifies the VM of the tag against dictionary_VM and takes the first value if needed. If this solution is acceptable, I can open a PR.
It's probably easier to assume the VM should be 1 as only Offending Element and Attribute Identifier List are 1-n
This should be faster than the dictionary_VM lookup
foreleminself.command_set:
ifhasattr(primitive, elem.keyword):
ifelem.VM>1andelem.tagnotin [0x00000901, 0x00001005]:
LOGGER.warning(f"Non-conformant VM {elem.VM} for '{elem.keyword}', taking the first value")
elem.value=elem.value[0]
setattr(primitive, elem.keyword, elem.value)
If you want to submit a PR that'd be great, otherwise I'm happy to do it.
Describe the bug
Hi,
I am working with a PACS that has a weird implementation bug. It returns two
NumberOf*Suboperations
fields in C-Move responses.When parsing the command set, pydicom parses it as MultiValue, and this in turn causes pydicom to raise:
TypeError: Number of Remaining Suboperations must be an int
Expected behavior
We are trying to migrate from dcmtk/dcm4che3 cli utilities, and encountered this bug only here.
From looking at both implementations, it seems that dcmtk takes the first value:
https://github.com/DCMTK/dcmtk/blob/a9561f364d50adf5344d45e01fda0b2ae784877f/dcmnet/libsrc/dimcmd.cc#L1044
https://github.com/DCMTK/dcmtk/blob/a9561f364d50adf5344d45e01fda0b2ae784877f/dcmnet/libsrc/dimcmd.cc#L280
And if I didn't miss anything, dcm4che3 seems to completely ignore it (checks only the Status field, and takes the first value there, too):
https://github.com/dcm4che/dcm4che/blob/5b3f94cc8816490e6e0cf5dc82516901b828fecf/dcm4che-tool/dcm4che-tool-movescu/src/main/java/org/dcm4che3/tool/movescu/MoveSCU.java#L357
Since both are popular implementations, I assume that taking the first value is ok for these cases.
I have a fork that before setting any field of a DIMSEPrimitive from the command dataset, verifies the VM of the tag against
dictionary_VM
and takes the first value if needed. If this solution is acceptable, I can open a PR.Steps To Reproduce
Your environment
Almost Latest pynetdicom development code (93ef29c)
pydicom 2.0.0
python 3.7
The text was updated successfully, but these errors were encountered: