QR fails if remote node doesn't return ModalitiesInStudy key

Issue #666 resolved
Ed McDonagh created an issue

Normally this optional tag is supported - code assumes key will be returned even if it is empty or contains modalities we didn't ask for (ie not a matching key).

If it is not returned, Query-Retrieve code fails with:

[2018-09-21 10:45:12,251: ERROR/ForkPoolWorker-1] Task remapp.netdicom.qrscu.qrscu[5905e810-6adf-4ce9-bbd9-b8317e9453fe] raised unexpected: AttributeError("Dataset does not have attribute 'ModalitiesInStudy'.",)
Traceback (most recent call last):
  File "/var/dose/veopenrem/local/lib/python2.7/site-packages/celery/app/trace.py", line 382, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/var/dose/veopenrem/local/lib/python2.7/site-packages/celery/app/trace.py", line 641, in __protected_call__
    return self.run(*args, **kwargs)
  File "remapp/netdicom/qrscu.py", line 750, in qrscu
    modalities_returned, modality_matching = _query_for_each_modality(all_mods, query, d, assoc)
  File "remapp/netdicom/qrscu.py", line 592, in _query_for_each_modality
    _query_study(assoc, d, query, query_id)
  File "remapp/netdicom/qrscu.py", line 528, in _query_study
    if isinstance(ss[1].ModalitiesInStudy, str):   # if single modality, then type = string ('XA')
  File "/var/dose/veopenrem/local/lib/python2.7/site-packages/dicom/dataset.py", line 256, in __getattr__
    "'{0:s}'.".format(name))
AttributeError: Dataset does not have attribute 'ModalitiesInStudy'.

Comments (6)

  1. Log in to comment