Automatic Query/Retrieve (On Demand)

998 views
Skip to first unread message

Marcelo Ribeiro

unread,
Jul 28, 2016, 9:45:42 AM7/28/16
to Orthanc Users
Hello

I have a PACS server (Synapse - Fuji), but the tools are very limited, a basic example, it does not offer WADO.

The goal is to use Orthanc to consume the studies that are stored in PACS (Synapse), but need to do this on demand example:

We call Orthanc URI passing as parameter the AcessionNumber or Study, then the Orthanc would have to run a query on Synapse (Fuji) and retrieve the images, after 1 hour I call another Orthanc URI for him to remove the study of bank Orthanc data, keeping Orthanc as an intermediary.

It is possible?

Orthanc  -->  Synapse
Orthanc  <--  Synapse

Thank you very much!
Marcelo

Chico Venancio

unread,
Jul 28, 2016, 10:25:35 AM7/28/16
to Marcelo Ribeiro, Orthanc Users
Yeah,
That certainly is possible in a couple of different ways.
To me it seems that using an outside script seems more apropriate, maybe in a nice interface depending who is the operator of this flow.
The query syntax is a POST request to http://orthanc:port/modalites/{synapse}/query with data that you are querying and the fields you need in the response blank.
Something like:
{
    'Level' : 'Study',
    'Query' : {
      'AccessionNumber' : '{acession Number}',
      'PatientID' : '',
      'PatientName' : '',
      'PatientSex' : '',
      'StudyDescription' : ''
    }

It will respond with a query id, you then call a get with http://orthanc:port/queries/{queryID}/answers to get the answers and you can retrieve it by index with http://orthanc:port/queries/{queryID}/answers/{index}/retrieve or the whole query with http://orthanc:port/queries/{queryID}/retrieve.

I'm not sure what you meant by "after 1 hour I call another Orthanc URI for him to remove the study of bank Orthanc data, keeping Orthanc as an intermediary." If the intention is to delete this study you could call a delete method on http://orthanc:port/studies/{id} but you could also simply leave a small storage limit in the config so orthanc auto-deletes old studies. 

Hope it helps,


Chico Venancio 
(98) 9 8800 2743
CEO - VM TECH 

Marcelo Ribeiro

unread,
Jul 28, 2016, 11:02:22 AM7/28/16
to Orthanc Users, marcelo...@sysline.inf.br
Hello Chico,

His answer was perfect!

Just to confirm, when I call "http://orthanc:port/queries/{queryID}/retrieve" at that time it retrieves all the images from the study that is the Synapse to Orthanc, correct?

Everything indicates that this is exactly what I need, that is, when the study is in Orthanc I can already deliver images with WADO of Orthanc, correct?

I liked also the suggestion to set limit storage Orthanc.

Sébastien Jodogne

unread,
Aug 16, 2016, 6:29:50 AM8/16/16
to Orthanc Users, marcelo...@sysline.inf.br
Hello,


Just to confirm, when I call "http://orthanc:port/queries/{queryID}/retrieve" at that time it retrieves all the images from the study that is the Synapse to Orthanc, correct?

Yes, such a call would ask Synapse to send the queried resources to Orthanc.
 
Everything indicates that this is exactly what I need, that is, when the study is in Orthanc I can already deliver images with WADO of Orthanc, correct?

Yes, once the DICOM image is received by Orthanc, it will be available through WADO (of course provided the DICOMweb plugin is properly installed).

Regards,
Sébastien-

Message has been deleted

Frédéric Lambrechts

unread,
Aug 18, 2016, 10:28:08 AM8/18/16
to Orthanc Users, marcelo...@sysline.inf.br
Hi,

alternatively, you can use a Dicom Proxy plugin that we created for Orthanc here at Osimis.

It enables to connect multiple external connections to one PACS.

For more info, please contact us on in...@osimis.io.

Kind regards,

Frédéric Lambrechts

paolo...@gmail.com

unread,
Nov 21, 2016, 10:26:08 AM11/21/16
to Orthanc Users
Good Evening,
i'm sorry for eventually trivial questions, but when I set this type of http post request to my orthanc server (and finally do a retrieve to Synapse) i get a BAD REQUEST response.

See the attached images.
How can i probably solve this issue?

My request is this:
curl http://localhost:8042/modalities/aoupacs/query -v -d { 'Level' : 'Series','Query' : { 'AccessionNumber' : '2415885', PatientID' : '', 'PatientName' : '', 'PatientSex' : '', 'StudyDescription' : ''}}

Screen Shot 2016-11-21 at 16.22.30.png

Alain Mazy

unread,
Nov 21, 2016, 3:05:58 PM11/21/16
to paolo...@gmail.com, Orthanc Users
You should probably set the content-type of your request content.  By default, it's set to application/x-www-form-urlencoded.
in curl, add this argument: -H "Content-Type: application/json"


--

Alain Mazy / CTO 
a...@osimis.io / +32 494 31 67 27

Osimis

OSIMIS S.A. 
Rue bois Saint-Jean 15/1BE-4102 Seraing 
www.osimis.io

Twitter LinkedIn


Chico Venancio

unread,
Nov 22, 2016, 7:11:54 AM11/22/16
to Alain Mazy, paolo...@gmail.com, Orthanc Users

There is a quote missing before PatientID. I would also stick with double quotes " as single quotes ', unfortunately, are not json complaint, tough I am not sure Orthanc will enforce this.

Chico Venancio
VM TECH - (98)8800-2743

Sébastien Jodogne

unread,
Nov 24, 2016, 4:00:27 AM11/24/16
to Orthanc Users, a...@osimis.io, paolo...@gmail.com
I confirm Chico's answer: Besides the missing quote before PatientID, the JSON syntax requires strings to be enclosed within double quotes, and not single quotes. Concretely, the following command-line should work as expected:

# curl http://localhost:8042/modalities/aoupacs/query -X POST -v -d '{ "Level" : "Series","Query" : { "AccessionNumber" : "2415885", "PatientID" : "", "PatientName" : "", "PatientSex" : "", "StudyDescription" : ""}}'

Also notice that:
  1. The "-X POST" option is required for curl to issue a HTTP POST request, as expected by the ".../query" URI.
  2. The "-d" option (that specifies the body of the POST request) must be followed by a single-quote-escaped string, so as to be correctly interpreted by the bash command-line.
HTH,
Sébastien-

paolo...@gmail.com

unread,
Nov 24, 2016, 11:42:05 AM11/24/16
to Orthanc Users
Sorry again, but the response is always the same BAD REQUEST.
This time i put this request:

curl http://localhost:8042/modalities/FUJI/query -v -X POST -d '{ "Level" : "Series","Query" : { "AccessionNumber" : “{37467364}”, "PatientID" : "", "PatientName" : "", "PatientSex" : "", "StudyDescription" : ""}}'

and the response is that in the attached file (a list of PHP errors). I send also my configuration file.

I hope this is the last time I trouble you.
Configuration.json
response.txt

Chico Venancio

unread,
Nov 24, 2016, 11:46:22 AM11/24/16
to paolo...@gmail.com, Orthanc Users

That's not json either, lose the brackets arround the 37467364.

curl http://localhost:8042/modalities/FUJI/query -v -X POST -d '{ "Level" : "Series","Query" : { "AccessionNumber" : “37467364”, "PatientID" : "", "PatientName" : "", "PatientSex" : "", "StudyDescription" : ""}}'

Chico Venancio 
VM TECH - (98)8800-2743

Paolo Scirè Scappuzzo

unread,
Nov 24, 2016, 11:49:48 AM11/24/16
to Chico Venancio, Orthanc Users
I know, but nothing changes even dropping that brackets.😧

Sébastien Jodogne

unread,
Nov 25, 2016, 2:54:02 AM11/25/16
to Orthanc Users, chicocv...@gmail.com, paolo...@gmail.com
Please post the full log in "--verbose" mode of Orthanc:

Also, check the logs in your Fuji modality.

BTW, have you properly tested the DICOM communication?

In particular, are you sure that your Fuji modality knows about the Orthanc modality? Have you successfully issued a C-ECHO? If this is not the case, the Fuji modality might not accept any query coming from Orthanc.
Reply all
Reply to author
Forward
0 new messages