How to change from orthanc Peer to DICOMweb?

All,

I currently have a lua script which uses the native orthanc peer connectivity to move instances from orthancA to orthancB and I’m exploring options how to make this connectivity perform better over the internet. Talking to Alain, he mentioned that using DICOMweb, the full study is sent in a single post versus the peer connection whichs posts the instances one by one. This would probably improve the speed a lot given the overheads and lag of TCP to optimize the transfer. However I don’t know how to change to the DICOMweb method. would someone please give me a hand how to change the following line in the lua script?

RestApiPost('/peers/orthancB/store', modifiedId)

thank you!

Please refer to the DICOMweb plugin documentation:

http://book.orthanc-server.com/plugins/dicomweb.html

You'll want to look for STOW-RS. The plugin abstracts many particulars,
but it is defined here:

http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.6.html

You shall not expect tremendous performance gains; HTTP overhead is
dwarfed by the size of typical DICOM payloads. TCP overhead would, too,
though HTTP pipelining (and later HTTP/2 when supported) allow for
connection reuse.

That being said, using standards is heavily encouraged. You might also
find other advantages to the RS DICOMweb interfaces, such as better
potential tracking of whole-study transfer completions.

Since your mention establishing connections over the Internet and
although this is a concern for both the DICOMweb and the Orthanc
peering interfaces whenever you transfer data over the WAN, you'll also
want to look at HTTP reverse proxies to do things like mutual TLS
authentication via X.509 certificates and encryption (or whatever else
you might like). You may find a sample setup here:

https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/full-tls/

Thanks for the feedback.

having installed and configured the dicom-web plugin including the server connections, I now make the following call directly from lua:

RestApiPost('/dicom-web/servers/orthancB/stow', modifiedId)

the modifiedId variable is a patient

I get the following error in the log:

`
E0803 12:22:13.807971 PluginsManager.cpp:164] A request to the DICOMweb
STOW-RS client must provide a JSON object with the field “Resources”
containing an array of resources to be sent
E0803 12:22:13.807971 PluginsErrorDictionary.cpp:111] Exception inside the plugin engine: Bad file format
E0803 12:22:13.807971 LuaScripting.cpp:151] Lua: Bad file format
E0803 12:22:13.807971 LuaScripting.cpp:154] Lua: Error in RestApiPost() for URI: /dicom-web/servers/orthancB/stow

`

the connectivity parameters are exactly the same as for the peer connection which works fine using:

`

RestApiPost('/peers/orthancB/store', modifiedId)

`

any further hint how to get this working?
thanks, Pär

Actually I don't think it is the same.

https://docs.google.com/spreadsheets/d/e/2PACX-1vSBEymDKGZgskFEFF6yzge5JovGHPK_FIbEnW5a6SWUbPkX06tkoObUHh6T1XQhgj-HqFd0AWSnVFOv/pubhtml?gid=645684588&single=true

This says that the /peers/{peer}/store resource accepts, in the HTTP
entity body, either one of:

- UUID series
- UUID instance (which is what you were using I think)
- raw DICOM file

http://book.orthanc-server.com/plugins/dicomweb.html

This says that the /{dicom-web}/servers/{server}/stow resource accepts,
in the HTTP entity body, a JSON document containing a JSON object
itself containing a Resources property (which is a JSON array of
Orthanc resource UUIDs to transfer).

I admit I'm not fully aware of the particulars of the RestApiPost API
(nor am I a Lua programmer by any stretch) though I would imagine that,
in place of the `modifiedId`, you can pass a JSON string. The DumpJson
function should help: you may create a Lua "table" that would be mapped
to the corresponding JSON object by the DumpJson serializer.

Something like RestApiPost('/peers/orthancB/store',
                           DumpJson({["Resources"] = {modifiedId}}))

https://www.lua.org/pil/contents.html#P2

(This call is probably wrong, by I hope it can put you on the right
track. Don't hesitate to check the samples for some inspiration:
https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Lua/
.)

Dear Pär,

Sorry for the delay, I did not notice this question that you asked while I was on holidays.

Let’s consider the following call to transfer a DICOM study whose Orthanc identifier is “66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e”, to the Orthanc peer called “orthancB”:

curl http://localhost:8042/peers/orthancB/store -d “66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e”

Here is how to translate this call to use DICOMweb STOW-RS:

curl http://localhost:8042/dicom-web/servers/orthancB/stow -d ‘{“Resources”:[“66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e”]}’

For the sake of completeness, here is the corresponding Orthanc configuration:

{
“Plugins”: [ “.” ],
“OrthancPeers” : {
“orthancB” : [ “http://localhost:8001/” ]
},
“DicomWeb” : {
“Servers” : {
“orthancB” : [ “http://localhost:8001/dicom-web/” ]
}
}
}

HTH,
Sébastien-