C-FIND and Sequence Matching

Hi!

We would like to use a C-FIND query with Sequence Matching, to limit the responses send over the wire and keep the filter responsibilities at the right place.

From the logs it’s clear that Orthanc supports only sequence matching on worklists (btw thanks for that clear log message and being permissive to still return results!)

Therefore we tried to apply the filtering in a python plugin, unfortunately we failed in accessing the sequence with the sample code provided from the orthanc book (here

log output:
Received incoming C-FIND request from XXX:​
orthanc | SOPClassUID (0008,0016) = [1.2.840.10008.5.1.4.1.1.481.7]​
orthanc | QueryRetrieveLevel (0008,0052) = [IMAGE]
orthanc | ReferencedRTPlanSequence (300c,0002) =
orthanc | E0411 09:30:00.616550 DICOM-1 OrthancException.cpp:61] Bad file format: While creating a DICOM instance, tag (300c,0002) has out-of-range value: "HELLO2-"​
orthanc | E0411 09:30:00.629414 DICOM-1 PluginsManager.cpp:153] Error in the Python C-FIND SCP callback, traceback:​
orthanc | <class ‘ValueError’>​
orthanc | Cannot create the DICOM instance

Is there any known way to apply this kind of filtering on Orthanc?

Thanks in advance
Regards Christian

Hi,

The python script is actually just responding with dummy “HELLO-TAG” responses. Therefore, “HELLO-2” is not a valid content for a sequence but this kind of json shall be valid:

[{
  "ReferencedSOPClassUID": "1.2.3.4",
  "ReferencedSOPInstanceUID": "2.3.4.5"
}]

HTH,

Alain.

Hi Alain

Thanks for your quick reply!

Indeed the error is because the answer is not valid.

What I’m missing is how I can retrieve the values of the sequence Tag from the C-FIND Query.

Given the output

from the print statement in python

        print('  %s (%04x,%04x) = [%s]' % (query.GetFindQueryTagName(i),
                                           query.GetFindQueryTagGroup(i),
                                           query.GetFindQueryTagElement(i),
                                           query.GetFindQueryValue(i)))

It returns an empty value when calling query.GetFindQueryValue(i) for a sequence Tag. I did not find a suitable method on the FindQuery Class.

The dcmtk query looks like this:

findscu <ip> -aec TEST-AGENT -aet TEST-TARGET -S `
    -k QueryRetrieveLevel=IMAGE -k SOPClassUID=1.2.840.10008.5.1.4.1.1.481.7 `
    -k "(300C,0002)[0].ReferencedSOPClassUID=1.2.840.10008.5.1.4.1.1.481.5" `
    -k "(300C,0002)[0].ReferencedSOPInstanceUID=<uid>" `
    -k SOPInstanceUID

Any advice?

Regards,
Christian

I’m afraid this is not possible at all. The sequences content are removed before being handed over to the python plugin and are replaced by “”:

So it seems that the comment “Orthanc only supports sequence matching on worklists” is true :wink: And it’s not straightforward to change this. That would, at least, require new primitives in the plugin SDK.

Seems like using pynetdicom is your only solution at short term: Python plugin for Orthanc — Orthanc Book documentation