Orthanc as a DICOM router

Hi Everyone,

i would like to use Orthanc as a DICOM router but i’m missing some functionality (or it is available but not documented, or my searching skills are lacking :slight_smile: ).

  1. if i send dicom images to Orthanc i would like to use the Called AE title in a forward lua script (i think it’s possible to use the calling AE in a lua script but not the called AE).
  2. i would like to change the transfer syntax in a forward script, or have an option under DicomModalities to configure the desired outgoing compression for that Modality.
  3. Is Orthanc able to send a DICOM study with multiple threads to speedup the transfer?

Regards,
Robert

I currently use orthanc to auto-route images using Lua., and its working great for me.

Please see this: https://code.google.com/p/orthanc/wiki/ServerSideScripting#Auto-Routing_of_DICOM_Images

Hi Cobin,

I already using Orthanc to auto-route images, but i’m missing the the ability to use the Called AE instead of the Calling AE in a LUA script. If the Called AE could also be made available in the metadata that would be great.

I tried to build from source but my c++ skills are lacking.

Dear Robert,

Sorry for the delay.

i would like to use Orthanc as a DICOM router but i’m missing some functionality (or it is available but not documented, or my searching skills are lacking :slight_smile: ).

  1. if i send dicom images to Orthanc i would like to use the Called AE title in a forward lua script (i think it’s possible to use the calling AE in a lua script but not the called AE).

Couldn’t you simply deploy 2 separate instances of Orthanc on the same host? In theory, the AET must be unique to any modality.

If you want to auto-route the incoming images differently according to modality that generated the image, you can also check the value of the “StationName” tag with your Lua script to choose the target modality:
https://code.google.com/p/orthanc/source/browse/Resources/Samples/Lua/AutoroutingConditional.lua

  1. i would like to change the transfer syntax in a forward script, or have an option under DicomModalities to configure the desired outgoing compression for that Modality.

Orthanc never modifies/transcodes/compresses its incoming images: It is a DICOM store (or, in other words, a vendor neutral archive), meaning that its outputs are always the same as its inputs.

If you want to carry on things such as on-the-fly JPEG2k compression, you should either use the REST API or the plugin SDK of Orthanc.

  1. Is Orthanc able to send a DICOM study with multiple threads to speedup the transfer?

No, Orthanc routing is single-threaded. According to the scenario you describe, I think you should deploy separate instances of Orthanc, one for each imaging flow: This will effectively speedup the transfer.

Hi Sébastien,

  1. Yes i could deploy multiple instances, but it would be neat to have all config in one instance. Also the called AE will be unique. So this way i can configure multiple AE titles on a modality that when chosen will route to different places. I know i could do the same with multiple AE titles and different port numbers if i deploy multiple Othanc instances but it would be extra work and Orthanc already has the ability to not check the Called AE (DicomCheckCalledAet).

  2. will take a look at the plugin SDK.

  3. I need to speedup the transfer of a single big study (more then 10K CT images) over a VPN connection. The VPN connection is fast but the latency is killing the speed with all the DICOM associations for every CT image.

Dear Robert,

Once again, sorry for the delay: This is quite a busy period for Orthanc.

  1. Yes i could deploy multiple instances, but it would be neat to have all config in one instance. Also the called AE will be unique. So this way i can configure multiple AE titles on a modality that when chosen will route to different places. I know i could do the same with multiple AE titles and different port numbers if i deploy multiple Othanc instances but it would be extra work and Orthanc already has the ability to not check the Called AE (DicomCheckCalledAet).

OK, got it. I have just added a task in our roadmap:
https://trello.com/c/A0vjGiKQ

This will be part of Orthanc 0.8.6.

  1. will take a look at the plugin SDK.

As always, here is the starting point to understand Orthanc plugins:
http://www.codeproject.com/Articles/797118/Implementing-a-WADO-Server-using-Orthanc

  1. I need to speedup the transfer of a single big study (more then 10K CT images) over a VPN connection. The VPN connection is fast but the latency is killing the speed with all the DICOM associations for every CT image.

To avoid opening new DICOM associations for every CT image, you have 2 possibilites:

  1. Wait for a series to become stable (by inspecting the “IsStable” field returned by the URI “/series/{series_id}”), then send it at once (“curl -X POST http://localhost:8042/modalities/sample/store” -d “{series_id}”). This will result in a single DICOM association for the entire series.
  2. Increase the time before DICOM associations are automatically closed (defaults to 5 second). To close after e.g. 1 minute, it is sufficient to write “scu_.SetMillisecondsBeforeClose(60 * 1000)” at the following code location: http://goo.gl/qbJVLq . I have just added a task to introduce a parameter to modify this option from the configuration file (https://trello.com/c/sVeBX1tX).
    HTH,

Sébastien-

Hello,

function OnStoredInstance(instanceId, tags, metadata, remoteAet, calledAet)

i have missed this last year and i have to use multiple instances.

Sebastian, thanks for your work.

i do not know, but maybe somebody else needs a way to “concentrate” multiple MWL?
Are there functions for MWL planned?

For example:
Orthanc Querying multiple MWL SCP, building a new MWL on Orthanc instance
Orthanc is MWL SCP for dicom modalities.
Modalities are sending dicom studies to orthanc.
Routing of studies to Destination PACS based on MWL original source.

Regards

Marc

Dear Marc,

Thanks for your feedback!

The support of DICOM worklists is planned in the official roadmap after the release of Orthanc 1.0.0:
https://trello.com/c/49dD3u6d

I have integrated your suggestion into this card.

Regards,
Sébastien-

Hello Sebastien,

is this working in Orthanc 1.3.1:

function OnStoredInstance(instanceId, tags, metadata, remoteAet, calledAet)

i tried to use the calledAet parameter in LUA but when i print it to the log-file it always says “nil” = null. Am i doing something wrong there?

Code:

function OnStoredInstance(instanceId, tags, metadata, origin, calledAet, callingAet)
print(callingAet)

end

The “CalledAet” information is provided in the “origin” variable.

Sample Lua script:

function OnStoredInstance(instanceId, tags, metadata, origin)
PrintRecursive(origin)
end

Resulting Orthanc log:

W1115 11:57:07.657301 main.cpp:672] Orthanc has started
W1115 11:57:15.619878 LuaContext.cpp:103] Lua says: table
W1115 11:57:15.620000 LuaContext.cpp:103] Lua says: [CalledAet], string, ANY-SCP
W1115 11:57:15.620031 LuaContext.cpp:103] Lua says: [RequestOrigin], string, DicomProtocol
W1115 11:57:15.620048 LuaContext.cpp:103] Lua says: [RemoteIp], string, 127.0.0.1
W1115 11:57:15.620079 LuaContext.cpp:103] Lua says: [RemoteAet], string, STORESCU

Thanks Sébastien, that was exactly what i was looking for! :slight_smile:

Is there any why to access the content of CalledAet and RemoteAet from within a python script?
I would like to monitor /change within a python script, but get access to the AETs.

Basically I would like to the the same routing possibility as described here via a Lua script with a python script.

Hi Hanno,

You can get the RemoteAet using the dedicated API route:

http://localhost:8042/instances/cb855110-5f4da420-ec9dc9cb-2af6a9bb-dcbd180e/metadata/RemoteAet

More info here:
https://book.orthanc-server.com/faq/features.html#accessing-metadata

“Requests” python library will make call to this API easy:
https://pypi.org/project/requests/

Regards,

Hi Benoît,

the RestAPI call for metadata was exactly what I was looking for! Thanks for the quick responds!

Regards