Orthanc as middleware dicom interface.

Hello there!

I stumble upon orthanc few days ago looking for libs/apps for handling dicom.
I read a little and still have a hard time to decide, so i figured i will ask here.
Does orthanc can be used as middleware for dicom rather than server ?
Our usecase is that we want to have ability to make query/retrieve's, send some structured reports and obtain data from dicom tags, but implementing dicom protocol and writing custom listeners and senders seems a bit too complicated tasks (especially given that dicom-related stuff isn't core functionality). Reading about orthanc i figured that we may be able to use simplicity of its api and lua scripting possibility to use it as our dicom middleware/communication interface.
Would that be a proper usage ? Does orthanc really would apply to this kind of problem ? Or maybe there are some issues which prevent the whole idea ?

I really appreciate any opinions and/or substantive responses.
Thanks in advance
Marek

Dear Marek,

Yes, Orthanc can definitely answer your use case!

If you do not need the DICOM server, you can easily turn it off in the configuration file (cf. the option “DicomServerEnabled”) [1]. You will then be able to use only the REST API of Orthanc as a middleware to the DICOM protocol. Any HTTP library (such as libcurl, or those provided with the Java/.NET frameworks) can be used to use this API.

The only limitation of the approach is that Orthanc will have to be started as a separate, background process, that will use a dedicated TCP port for the REST API. This should not be a big deal, as you can always filter out this HTTP port with your firewall rules.

Please also note that Lua will not help you in this task, as it is essentially useful to automate the routing between DICOM modalities. On the other hand, depending on your task, you could also consider developing a plugin to Orthanc. There is a CodeProject article on this newly-introduced feature [2].

Let us know whether you need more information.

Cheers,
Sébastien-

[1] https://code.google.com/p/orthanc/wiki/OrthancConfiguration
[2] http://www.codeproject.com/Articles/797118/Implementing-a-WADO-Server-using-Orthanc

Hi Sébastien!

I’m glad, cause this is definitely a good news for us, i have then a few more questions:
Doesn’t disabling dicom server in orthanc cripple its ability to receive dicom files ?
Why lua wouldn’t help us ? One of usages for it (according to orthanc cookbook) is to filter incoming dicoms; couldn’t it trigger external (meaning connecting with our software) script on receiving specific types of messages ?

I really appreciate such fast response
Regards

I’m glad, cause this is definitely a good news for us, i have then a few more questions:

Doesn’t disabling dicom server in orthanc cripple its ability to receive dicom files ?

Even if the DICOM server is disabled, you can still upload DICOM files through the REST API.

But, of course, if you need to receive DICOM files through the DICOM protocol, you are free to keep the DICOM server enabled! I initially thought you were interested in using Orthanc as a library on the localhost to achieve DICOM SCU. :slight_smile:

Why lua wouldn’t help us ? One of usages for it (according to orthanc cookbook) is to filter incoming dicoms; couldn’t it trigger external (meaning connecting with our software) script on receiving specific types of messages ?

You are right: Lua scripting will allow you to filter incoming messages. However, our Lua support is not (currently) designed to trigger external scripts. I have just added a feature on our roadmap to be able to issue HTTP/REST calls from Lua scripts: https://trello.com/c/dgxwy3YJ

In the meantime, you should use the “changes” part of the REST API of Orthanc to monitor the incoming of DICOM files: https://code.google.com/p/orthanc/wiki/RestChanges

HTH,
Sébastien-

Frankly, i don’t have much experience with lua, but isn’t ability to fire external scripts matter of language (and/or some kind of os library) ?
If i can trigger script from lua at all i should be able to trigger script from lua in orthanc, shouldn’t I ?
Also, does Orthanc support receiving structured reports, or we’ll have to apply some hacks to get this functionality or is it not possible at all ?

Marek

Frankly, i don’t have much experience with lua, but isn’t ability to fire external scripts matter of language (and/or some kind of os library) ?
If i can trigger script from lua at all i should be able to trigger script from lua in orthanc, shouldn’t I ?

No, because the version of Lua that is built into Orthanc does not include extensions to call external scripts, such as LuaSocket:
http://w3.impa.br/~diego/software/luasocket/http.html

There is some work to be done in Orthanc to make such calls possible.

Also, does Orthanc support receiving structured reports, or we’ll have to apply some hacks to get this functionality or is it not possible at all ?

Orthanc can receive any kind of DICOM files, including structured reports. If this does not work, this is a bug :wink:

Sébastien-

I’m not sure if i understood you correctly. By saying external script i meant script on the very same physical machine on which orthanc would be installed, just not lua script (bash or python for instance).

Thanks for Your time and responses, i guess we will happily use orthanc :slight_smile:

I’m not sure if i understood you correctly. By saying external script i meant script on the very same physical machine on which orthanc would be installed, just not lua script (bash or python for instance).

OK, got it. You would like to make a call from Lua to an external utility (and not to a Web service).

Just added a card on our roadmap: https://trello.com/c/fPc2ojMk

This feature should be integrated in Orthanc 0.8.1.

Sébastien-

Orthanc 0.8.1 has just been released, with this requested feature implemented.

You can find a sample Lua script that makes a system call at the following location:
https://code.google.com/p/orthanc/source/browse/Resources/Samples/Lua/CallDcm2Xml.lua

This script will call “dcm2xml” as soon as Orthanc receives a DICOM instance.

HTH,
Sébastien-