Orthanc C Plugins: Issuing C-Find Requests

Hello!

I’ve searched through the http://sdk.orthanc-server.com docs and found out how to handle C-Find requests. They’re located on the DicomCallbacks group.

But…

What I really need is to issue a query to another PACS, not necessarily an Orthanc instance. I belive OrthancPluginCallPeerApi would be the way if every other PACS was an Orthanc. Alas, that is not the case.

I believe there is code to handle that since I can issue a find to any PACS through the Explorer interface. I just need to access that through a plugin callback.

Bigger picture: I need Orthanc (*) to periodically query an existing PACS to import its images. Our own solution might perform these queries outside of Orthanc, but I’d rather have it do it, since he is responsible for knowing the DICOM protocol.

Thanks in advance!

Hi Luiz,

You can actually call the Rest API from a plugin with OrthancPluginRestApiPost. It will actually not send an HTTP request but will access the API interpreter directly. Therefore, the uri shall not include the hostname but only something like “/modalities/sample/query”.

Here’s a sample usage: https://bitbucket.org/sjodogne/orthanc/src/b89a4288d60521c924be884141d490d7ed938bef/Plugins/Samples/Basic/Plugin.c#lines-239

Check how to perform C-Find through the Rest API here.

Best regards

Thank you so much, Alain!

Here’s a snippet of what I’ve came up with curl:

[valmont@alis-sol Exames569]$ curl -X POST --data ‘{ “Level”: “Instance”, “Query”: { “StudyDate”: “20170308-20170310” } }’ http://localhost:8042/modalities/pacs/query
{
“ID” : “d52c667a-beb3-4608-8b4a-dab1fbe36a8a”,
“Path” : “/queries/d52c667a-beb3-4608-8b4a-dab1fbe36a8a”
}
[valmont@alis-sol Exames569]$ curl -X GET http://localhost:8042/queries/d52c667a-beb3-4608-8b4a-dab1fbe36a8a
[ “answers”, “level”, “modality”, “query”, “retrieve” ]
[valmont@alis-sol Exames569]$ curl -X GET http://localhost:8042/queries/d52c667a-beb3-4608-8b4a-dab1fbe36a8a/answers
[
“0”,
“1”,
“2”,
(…)
[valmont@alis-sol Exames569]$ curl -X GET http://localhost:8042/queries/d52c667a-beb3-4608-8b4a-dab1fbe36a8a/answers/500/content
{
“0002,0003” : {
“Name” : “MediaStorageSOPInstanceUID”,
“Type” : “String”,
“Value” : “1.2.840.113619.2.359.3.352977429.158.1489085762.358.240”
},
(…)

“0020,000e” : {
“Name” : “SeriesInstanceUID”,
“Type” : “String”,
“Value” : “1.2.840.113619.2.359.3.352977429.158.1489085762.356”
}
}
[valmont@alis-sol Exames569]$

Now it’s just a matter of coding the appropriate URL in a REST callback of our own plugin. Lovely!

Thanks! =)