Automatic Query/Retrieve (On Demand)

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

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,

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.

Thank you very much!
Marcelo

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-

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 info@osimis.io.

Kind regards,

Frédéric Lambrechts

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

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”

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

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-

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 (11.3 KB)

response.txt (19.3 KB)

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

I know, but nothing changes even dropping that brackets.:anguished:

Please post the full log in “–verbose” mode of Orthanc:
http://book.orthanc-server.com/faq/log.html

Also, check the logs in your Fuji modality.

BTW, have you properly tested the DICOM communication?
http://book.orthanc-server.com/faq/dicom.html

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.