Lua Auto-routing by requesting IP address

81 views
Skip to first unread message

jaso...@gmail.com

unread,
Jun 13, 2017, 11:13:27 AM6/13/17
to Orthanc Users
Is there a way in Lua to filter incoming studies based on the requesting DICOM node's IP address?

As in:

if (<requesting node's IP address> == 192.168.6.19)then

SendToModality(instanceId, '9-MIM-CD')


end

...where I need to know how to assign <requesting node's IP address> to a variable.


...I read the documentation regarding origin but don't have enough Lua knowledge to grasp it and I cant find anything pertinent on the forum.

Thanks for any help!

Jason McDonald

Sébastien Jodogne

unread,
Jun 13, 2017, 11:31:36 AM6/13/17
to Orthanc Users, jaso...@gmail.com
Hello,

If I understand you request correctly, you have several users that share the same imaging database, but these users should have permissions that prevent them from accessing each and every individual imaging study.

So far, this feature is not available on the side of the DICOM protocol. It could definitely be implemented, but this is clearly not on our short-term roadmap.

In the meantime, in order to isolate several users, you will have to deploy one separate Orthanc server for each of your users.

Regards,
Sébastien-

PS: You might find an interest in the authorization plugin developed by Osimis, that can be used to protect the REST API of Orthanc:

jaso...@gmail.com

unread,
Jun 13, 2017, 1:29:35 PM6/13/17
to Orthanc Users, jaso...@gmail.com
Thanks for the response!

My problem is much simpler than that. I have a lua auto-routing script that sets orthanc to forward all incoming studies to 2 other DICOM nodes. I need to add code to have it also send to a 3rd node ONLY if the incoming studies are coming from a particular DICOM node, and hoped to use the transmitting DICOM node's IP address to filter the incoming studies for that purpose.

Thanks again,
Jason McDonald

Chico Venancio

unread,
Jun 13, 2017, 2:02:45 PM6/13/17
to jaso...@gmail.com, Orthanc Users
You can use a simple if to have any arbitrary logic to route the Dicom instances. Assuming the studies come from a Dicom node, the following example script will do the trick, attention to substitute the IP and AET for the correct values. 

function OnStoredInstance(instanceId, tags, metadata, origin)
    if origin['RemoteIp'] == 'xxx.xxx.xxx.xx' then 
        SendToModality(instanceId, "AET")
    end
end

Chico Venancio
(98)9 8800-2743

jaso...@gmail.com

unread,
Jun 13, 2017, 2:49:28 PM6/13/17
to Orthanc Users

Chico,

Thanks for your reply! I actually had origin['RemoteIp] at one point, but my problem was I had forgotten to add the origin parameter to the function. Dumb mistake on my part.

Thanks again!

Jason McDonald


Reply all
Reply to author
Forward
0 new messages