/find-worklist from Lua Script and/or Python Plug-in

131 views
Skip to first unread message

Stephen Douglas Scotti

unread,
Jun 23, 2021, 11:51:07 PM6/23/21
to Orthanc Users

I've been using the REST API from a webapp to query an Orthanc Server for MWL files and to get a JSON response from the query.  That seems to work fine from the webapp using a path like: 

'modalities/PACS1/find-worklist, where PACS1 is defined in my modalities as an Orthanc Server.  The find-worklist path alone does not work, which I guess is my design ?

If I try to call that from a Lua Script or a Python Script I get an error.

Just as a test, I have this in a Python script:

    mwlquery = dict()
    mwlquery["AccessionNumber"] = 'DEVACC00000023'
    MWL = orthanc.RestApiPost('/modalities/PACS1/find-worklist',json.dumps(mwlquery))
    print(MWL)

It does seem to 'partially' work in that the request is received and even processed, but there is an error in the callback. 

In the log there is this:

I0624 03:37:58.474952 PluginsManager.cpp:172] (plugins) Worklist matched: /var/lib/orthanc/worklists/DEVACC00000023.wl
I0624 03:37:58.475618 PluginsManager.cpp:172] (plugins) Worklist C-Find: parsed 2 files, found 1 match(es)
T0624 03:37:58.476197 FindScp.cpp:326] (dicom) Sending C-FIND Response 1/1:

# Dicom-Data-Set
# Used TransferSyntax: Little Endian Explicit
(0008,0005) CS [ISO_IR 192]                             #  10, 1 SpecificCharacterSet
(0008,0050) SH [DEVACC00000023]                         #  14, 1 AccessionNumber

but 'MWL" does not get set and there is also this error:

E0624 03:37:48.466308 OrthancException.cpp:57] Error in the network protocol: DicomAssociation - C-FIND to AET "SCOTTI_CUSTOM": DIMSE No data available (timeout in non-blocking mode)

Is that because there is no support for that from within a Python script or Lua ?

Sébastien Jodogne

unread,
Jun 24, 2021, 2:28:58 AM6/24/21
to Orthanc Users
You will find attached to this message a complete environment (orthanc configuration + Python script) demonstrating that "find-worklist" works fine.

Here are the Orthanc logs with this sample:

[...]
I0624 08:25:34.702448 main.cpp:344] Incoming Find request from AET ORTHANC on IP 127.0.0.1, calling AET ORTHANC
I0624 08:25:34.702468 main.cpp:232] No limit on the number of C-FIND results at the Patient, Study and Series levels
I0624 08:25:34.702473 main.cpp:242] No limit on the number of C-FIND results at the Instance level
I0624 08:25:34.702604 PluginsManager.cpp:172] (plugins) Received worklist query from remote modality ORTHANC:
{
   "0008,0005" : "ISO_IR 100",
   "0008,0050" : "00007"
}
I0624 08:25:34.703190 PluginsManager.cpp:172] (plugins) Worklist matched: /home/jodogne/orthanc/OrthancServer/Plugins/Samples/ModalityWorklists/WorklistsDatabase/wklist7.wl
I0624 08:25:34.703347 PluginsManager.cpp:172] (plugins) Worklist C-Find: parsed 10 files, found 1 match(es)
I0624 08:25:34.703520 CommandDispatcher.cpp:917] (dicom) Finishing association with AET ORTHANC on IP 127.0.0.1: DUL Peer Requested Release
I0624 08:25:34.703538 CommandDispatcher.cpp:925] (dicom) Association Release with AET ORTHANC on IP 127.0.0.1
[
   {
      "AccessionNumber" : "00007",
      "SpecificCharacterSet" : "ISO_IR 100"
   }
]
[...]

scotti.py
scotti.json
Reply all
Reply to author
Forward
0 new messages