LUA script for Worklist C-FIND

Hi everybody,
I’m implementing Orthanc in quite a large clinic and I’m having issues with some GE hardware.
I noticed that they send some non standard tags when querying Orthanc and I’ve managed to fix this issue by using a LUA script to filter those nasty tags out:

– Remove non standard tags coming from GE equipment:

– 0008,0000 GenericGroupLength

– 0010,0000 GenericGroupLength

– 0020,0000 GenericGroupLength

– Nick, 7/02/2017

function IncomingFindRequestFilter**(source, origin)**

– First display the content of the C-Find query

PrintRecursive**(‘Removing non standard tags…’)**

PrintRecursive**(source)**

PrintRecursive**(origin)**

– Remove the non standard tags from the query

local v = source

v**[‘0008,0000’]** = nil

v**[‘0010,0000’]** = nil

v**[‘0020,0000’]** = nil

return v

end

So far so good but now I’m having the same problem when the GE hardware queries Orthanc for WorkLists, here’s the query from the verbose log, the user entered only the modality “0008,0060” : “CT” and date “0040,0002” : “20170208-20170208”, all the rest is self generated by the GE hardware and I need to filter it out:

I0208 18:40:29.689256 CommandDispatcher.cpp:491] Association Received from AET ct99 on IP 192.192.192.41

I0208 18:40:29.689586 CommandDispatcher.cpp:689] Association Acknowledged (Max Send PDV: 65452)

I0208 18:40:29.690033 main.cpp:119] No limit on the number of C-FIND results at the Patient, Study and Series levels

I0208 18:40:29.690051 main.cpp:129] No limit on the number of C-FIND results at the Instance level

I0208 18:40:29.728139 PluginsManager.cpp:171] Received worklist query from remote modality ct99:

{

“0008,0000” : “106”,

“0008,0005” : “ISO_IR 100”,

“0008,0050” : “”,

“0008,0080” : “”,

“0008,0090” : “”,

“0008,1110” : [

{

“0008,1150” : “”,

“0008,1155” : “”

}

],

“0008,1120” : [

{

“0008,1150” : “”,

“0008,1155” : “”

}

],

“0010,0000” : “120”,

“0010,0010” : “”,

“0010,0020” : “”,

“0010,0030” : “”,

“0010,0040” : “”,

“0010,1000” : “”,

“0010,1020” : “”,

“0010,1030” : “”,

“0010,1040” : “”,

“0010,2000” : “”,

“0010,2110” : “”,

“0010,2154” : “”,

“0010,2160” : “”,

“0010,21b0” : “”,

“0010,21c0” : null,

“0010,4000” : “”,

“0020,0000” : “8”,

“0020,000d” : “”,

“0032,0000” : “64”,

“0032,1032” : “”,

“0032,1033” : “”,

“0032,1060” : “”,

“0032,1064” : [

{

“0008,0100” : “”,

“0008,0102” : “”,

“0008,0104” : “”

}

],

“0038,0000” : “32”,

“0038,0010” : “”,

“0038,0050” : “”,

“0038,0300” : “”,

“0038,0500” : “”,

“0040,0000” : “236”,

“0040,0100” : [

{

“0008,0060” : “CT”,

“0032,1070” : “”,

“0040,0001” : “”,

“0040,0002” : “20170208-20170208”,

“0040,0003” : “”,

“0040,0006” : “”,

“0040,0007” : “”,

“0040,0008” : [

{

“0008,0100” : “”,

“0008,0102” : “”,

“0008,0104” : “”

}

],

“0040,0009” : “”,

“0040,0010” : “”,

“0040,0011” : “”,

“0040,0012” : “”

}

],

“0040,1001” : “”,

“0040,1003” : “”,

“0040,1004” : “”,

“0040,1005” : “”,

“0040,1008” : “”,

“0040,1010” : “”,

“0040,1400” : “”,

“0040,2400” : “”,

“0040,3001” : “”

}

The problem is that the IncomingFindRequestFilter script is not triggered when the WL query gets in.

I checked the docs and the forum but I wasn’t able to find a solution, so my question is: how do I run a LUA script to process a Worklist query?

Can anybody point me to some docs that I missed or help me somehow?

Thanks in advance

Hi Nicola,

About the pregnancy status, it seems to be a touchy one but, Orthanc already removes it from the C-Find request when it’s null.

I have tried to reproduce your problem with no luck … which means I do find the worklist with a request that is very similar to the one GE is sending.

these are the commands I use to issue to perform the C-Find:

dump2dcm -d -v …/…/WorklistsDatabase/nicola.wl.txt …/…/WorklistsDatabase/nicola.wl
dump2dcm -d -v nicola.find.txt nicola.find.dcm
findscu -v --call ORTHANC --aetitle CT99 -W 127.0.0.1 4243 nicola.find.dcm

The output from orthanc is attached below. As you might see, it’s very similar to yours (except for the empty sequences 0008,1110 & 0008,1120 that I could not reproduce).

Could you try to issue my request with findscu on your system ? I have attached the output of my command ?
If this succeeds but the C-find from GE still fails, that would be nice to capture the C-Find request from GE with http://support.dcmtk.org/docs/wlmscpfs.html. With this, we should have a dump file of the C-Find request and re-issue it with findscu to try to reproduce your problem.

nicola.find.txt (5.74 KB)

nicola.find.dcm (1002 Bytes)

nicola.wl.dcm (832 Bytes)

nicola.wl.txt (3.19 KB)

findscu.nicola.out.txt (10.8 KB)

Thanks Alain, I owe you a beer!
I’ve found the problem: I was using 1.1.0. We have 2 Orthanc servers and I found out that only one was running 1.2.0, the other one was running 1.1.0 compiled from the mainline and that made difficult to check the version (it always reported “mainline”).

So to recap and help others that could have the same issue:

  • Hint: don’t clone the mainline repo (as I did), download the src tarball for the desired version instead.
  • Worklists queries from GE CT machines work just fine with Orthanc 1.2.0 but don’t work with 1.1.0, I suppose because of the GenericGroupLegth tags (when I tried to send the query with findscu I received no results).
  • Studies C-FIND queries don’t work unless you strip out the GenericGroupLegth tags with a LUA script like this:
/home/orthanc/LuaScripts/IncomingFindRequestFilter.lua

`

function IncomingFindRequestFilter**(source, origin)**

– First display the content of the C-Find query

PrintRecursive**(‘Removing non standard tags…’)**

PrintRecursive**(source)**

PrintRecursive**(origin)**

– Remove the non standard tags from the query

local v = source

v**[‘0008,0000’]** = nil

v**[‘0010,0000’]** = nil

v**[‘0020,0000’]** = nil

return v

end

`

and in the Configuration.json:

`

"LuaScripts" : [
        "/home/orthanc/LuaScripts/IncomingFindRequestFilter.lua"
  ],

`

Hi Nicola,

Thanks for the nice problem/workaround recap for other users (and for the beer !).

Note that, when we’ll implement this issue: https://bitbucket.org/sjodogne/orthanc/issues/31/create-new-modality-types-for-philips-adw in the next release, you’ll not need the IncomingFindRequestFilter anymore since we’ll ignore group length in all C-Find queries (whatever the manufacturer is).

Best regards,

Alain.

Great! Especially since my next step is to integrate and test Philips hardware… :slight_smile: