Auto Routing

Hi!

I’m testing the script HighPerformanceAutoRouting.py

Two observations:

  1. Filter AE Title: In DicomModalities, i messed up the AE Title and yet sent the images to remote modality. Only the host and port to send the images. Variable AE Title is not necessary? Note: Orthanc – to —> Orthanc.

  2. Is possible to adapt the script to use the “OrthancPeers” section?

Very thanks!

Vinicius

Hello,

I’m testing the script HighPerformBy default, Orthanc does not filter incoming images with the AE Title of the remote modality. You can enable this filtering by setting the option “DicomCheckCalledAet” to “true” in the configuration file:anceAutoRouting.py

Two observations:

  1. Filter AE Title: In DicomModalities, i messed up the AE Title and yet sent the images to remote modality. Only the host and port to send the images. Variable AE Title is not necessary? Note: Orthanc – to —> Orthanc.

By default, Orthanc does not filter incoming images with the AE Title of the remote modality. You can enable this filtering by setting the option “DicomCheckCalledAet” to “true” in the configuration file:http://orthanc.googlecode.com/hg-history/Orthanc-0.6.2/Resources/Configuration.json

  1. Is possible to adapt the script to use the “OrthancPeers” section?

Sure, you just have to replace “/modalities/” by “/peers/” at the following line:
https://code.google.com/p/orthanc/source/browse/Resources/Samples/Python/HighPerformanceAutoRouting.py#96

By making this substitution, the images will be sent through HTTP (i.e. through the REST API) rather than through the DICOM protocol.

Sébastien-

Surprising features of Orthanc.
Thanks Sébastien.

Vinicius

Hi!

I tried but did not work.

I’m using the latest version with Python 2.7, both Windows and Linux.

First attempt, prompts to install the module httplib2.

My Configuration.json

“OrthancPeers” : {

“pacsbr” : [ “https://my.ip”, “user”, “pass” ]
},

My HighPerformanceAutoRouting.py

lines: 5-6
URL = ‘http://localhost:8042

TARGET = ‘pacsbr’

line: 96
RestToolbox.DoPost(‘%s/peers/pacsbr/store’ % URL, instances)

Result in Linux:

Samples/Python# python ./HighPerformanceAutoRouting.py

Current queue size: 0
Exception in thread Thread-2:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 552, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 505, in run
self.__target(*self.__args, **self.__kwargs)
File “./HighPerformanceAutoRouting.py”, line 50, in Producer
‘limit’ : 4 # Retrieve at most 4 changes at once
File “/home/OrthancUser/Orthanc/Resources/Samples/Python/RestToolbox.py”, line 25, in DoGet
raise Exception(resp.status)
Exception: 401

Current queue size: 0
Current queue size: 0
Current queue size: 0

Result in Windwos:

C:>Python27\python.exe Orthanc\HighPerformanceAutoRouting.py
Current queue size: 0
Current queue size: 0
Exception in thread Thread-2:
Traceback (most recent call last):
File “C:\Python27\lib\threading.py”, line 808, in __bootstrap_inner
self.run()
File “C:\Python27\lib\threading.py”, line 761, in run
self.__target(*self.__args, **self.__kwargs)
File “Orthanc\HighPerformanceAutoRouting.py”, line 46, in Producer
‘limit’ : 4 # Retrieve at most 4 changes at once
File “C:\Orthanc\RestToolbox.py”, line 25, in DoGet
raise Exception(resp.status)
Exception: 401

401 is for The request failed with HTTP status 401: Unauthorized

Thanks,

Vinicius

I Forgot To Tell, works great with the HTTP GUI.

Thanks,

Vinicius

Vinicius,

It looks as if you have setup a password for the REST API of the “sender Orthanc”, but the autorouting script (that continuously monitors the incoming instances in Orthanc) is not aware of this password. You need to write a line such as the following one at the beginning of your Python script:

RestToolbox.SetCredentials(“username”, “password”)

If adding such a line does not help, please could you send me your full configuration files (for the “sender Orthanc” as well as for the “receiver Orthanc”), as well as your full autorouting script (of course, hiding your true passwords :wink: )?

Sébastien-

Sébastien,

Sorry for the delay in replying.
Well there is a lot of work here

I tested on Linux and Windows.

It worked perfectly.

I have another scenario here:

The “receiver Orthanc” is behind a proxy server (Nginx with SSL).

Example: “sender Orthanc” —> HTTPS ----> NGINX —> HTTP —> “receiver Orthanc”

Return:

Sending a packet of 1 instances
Current queue size: 0
Exception in thread Thread-3:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 552, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 505, in run
self.__target(*self.__args, **self.__kwargs)
File “./HighPerformanceAutoRouting.py”, line 95, in Consumer
RestToolbox.DoPost(‘%s/peers/matrix/store’ % URL, instances)
File “/root/OrthancDev/Orthanc/Resources/Samples/Python/RestToolbox.py”, line 82, in DoPost
return _DoPutOrPost(uri, ‘POST’, data, contentType)
File “/root/OrthancDev/Orthanc/Resources/Samples/Python/RestToolbox.py”, line 55, in _DoPutOrPost
raise Exception(resp.status)
Exception: 400

I have not had time yet to configure SSL-Offloader.
http://wiki.nginx.org/SSL-Offloader

Soon I will share the experience.

Thank you very much, Sébastien.