Orthanc + Ambra: Query/Retrieve

Hi folks,

My company uses Ambra as a PACS vendor, and we’re attempting to test some new features that Ambra is building out for us around query/retrieve. In order to do so, I must setup a test environment to mimic what a provider/3rd party might see. Is anyone familiar with Ambra gateways?

I set up an Orthanc instance on a Windows machine (with PostgreSQL storage & index), and connected it to an Ambra dev environment via the Ambra gateway software installed on the same machine. All plugins from the 32-bit version of Orthanc 20.8.0 were loaded onto the Orthanc-1.7.3-Release.exe 32-bit command-line version.

I have attached my config file, and a few log extracts from both Orthanc and the Ambra gateway. Some information has been scrubbed.

To summarize the issue, I am able to successfully query studies stored in Orthanc, but the C-MOVE / MOVE-SCU fails, citing that there are no matching resources in Orthanc (see lines 254-297, qr_log_test-08242020.txt). I am able to Q/R studies in the reverse direction though, pulling studies into Orthanc from Ambra.

It almost seems as though the call to initiate C-MOVE doesnt have enough information to identify the study, despite including the StudyInstanceUID.

Any thoughts or advice would be greatly appreciated.

Thanks,
Joseph

qr_ambra_log_test-08242020.txt (10.3 KB)

qr_log_test-08242020.txt (30 KB)

orthanc_test.json (24.4 KB)

I’m a little familiar with that. We no longer have an account though. There is quite a bit of configuration that has to be setup correctly on both ends (in the AMBRA Control Panel Setups for the Gateways (i.e the IP, the ports (104 and 4006 by default for AMBRA, and a slew of others like verify_calling_ae, use_all_transfer_syntaxes, transcode_gdcm, etc. In addition, you need to check to make sure all of the used ports are open to the gateway (firewalls). And also Destinations. There is a setting for Q/R support under destinations. There is information in the AMBRA Gateway guide.

Is this the error you are getting ?

AMBRA

2020-08-24 19:13:01,171 [90] INFO DicomGrid.DicomClients.MyDicomCMoveClient - Executing STUDY level, STUDY ROOT MyDicom C-MOVE request to ORTHANC-TEST at 111.111.111.11:4545 with Calling AE Title: TEST-ADHOC and move-to AE Title: TEST-ADHOC for Study Uid: 1.3.6.1.4.1.34692.190280939648420613924105055404154243408 2020-08-24 19:13:01,173 [ORTHANC-TEST Initiator ACSE In Box Thread] INFO DicomGrid.DicomClients.MyDicomCMoveClient - Move completed: Status: UnableToProcess Study Uid: 1.3.6.1.4.1.34692.190280939648420613924105055404154243408 2020-08-24 19:13:04,235 [STP harvester.retrieveclient Thread #1] DEBUG DicomGrid.DicomClients.RetrieveClient - Checking for image count retrieved for study UID: 1.3.6.1.4.1.34692.190280939648420613924105055404154243408 2020-08-24 19:13:04,235 [STP harvester.retrieveclient Thread #1] INFO DicomGrid.DicomClients.RetrieveClient - 0 images previously in Storage folder, 0 of 222 images currently in Storage folder for study UID: 1.3.6.1.4.1.34692.190280939648420613924105055404154243408 2020-08-24 19:13:04,235 [STP harvester.retrieveclient Thread #1] INFO DicomGrid.DicomClients.RetrieveClient - No images retrieved for study UID: 1.3.6.1.4.1.34692.190280939648420613924105055404154243408. Setting status to ‘F’ for job Id b60745d9-06b7-47ce-bef6-d9ddb5084be4 and will not retry. Error received: Study retrieve for UID: 1.3.6.1.4.1.34692.190280939648420613924105055404154243408 returned error status UnableToProcess. 2020-08-24 19:13:04,236 [STP harvester.retrieveclient Thread #1] INFO DicomGrid.Common.Web.ServiceProxy - Sending retrieve job Status: [F] for Job ID: [b60745d9-06b7-47ce-bef6-d9ddb5084be4]

ORTHANC

I0824 19:13:01.171462 main.cpp:307] Incoming Move request from AET TEST-ADHOC on IP 111.111.111.11, calling AET ORTHANC-TEST
W0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:313] Move-SCU request received for AET “TEST-ADHOC”
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0020) StudyDate =
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0030) StudyTime =
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0050) AccessionNumber =
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0052) QueryRetrieveLevel = STUDY
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0054) RetrieveAETitle = TEST-ADHOC
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0020,000d) StudyInstanceUID = 1.3.6.1.4.1.34692.190280939648420613924105055404154243408
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0020,0010) StudyID =
E0824 19:13:01.172892 OrthancException.h:76] Bad request: C-MOVE request matching no resource stored in Orthanc
E0824 19:13:01.172892 MoveScp.cpp:198] IMoveRequestHandler Failed: Bad request
I0824 19:13:01.173904 CommandDispatcher.cpp:919] DUL Peer Requested Release
I0824 19:13:01.173904 CommandDispatcher.cpp:926] Association Release

ORTHANC Config:

// The list of the known DICOM modalities “DicomModalities” : { “TEST-GATEWAY” : [ “TEST-ADHOC”, “111.111.111.11”, 4006 ]

I’d have to know more about the setup, but it looks like your gateway is running on 111.111.111.11:4006. Orthanc itself is probably is on 111.111.111.11:4545. It could just be a firewall setting. I presume that you have Orthanc setup as a Destination also in Ambra ?

Dear Joseph,

I think the issue is at the following place in the Orthanc logs:

I0824 19:13:01.171462 main.cpp:307] Incoming Move request from AET TEST-ADHOC on IP 111.111.111.11, calling AET ORTHANC-TEST
W0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:313] Move-SCU request received for AET “TEST-ADHOC”
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0020) StudyDate =
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0030) StudyTime =
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0050) AccessionNumber =
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0052) QueryRetrieveLevel = STUDY
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0008,0054) RetrieveAETitle = TEST-ADHOC
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0020,000d) StudyInstanceUID = 1.3.6.1.4.1.34692.190280939648420613924105055404154243408
I0824 19:13:01.171462 OrthancMoveRequestHandler.cpp:321] (0020,0010) StudyID =
E0824 19:13:01.172892 OrthancException.h:76] Bad request: C-MOVE request matching no resource stored in Orthanc

As can be seen, Orthanc cannot find a study that matches the request, so it returns nothing to Ambra. I feel that the issue is with the “RetrieveAETitle = TEST-ADHOC” filter: I guess that this tag “0008,0054” is not stored within the DICOM tags of the study, so matching fails.

I think that you can solve this issue by using the “IncomingFindRequestFilter()” callback in Lua:
https://book.orthanc-server.com/users/lua.html#fixing-c-find-requests

The following Lua script might do the job (untested):

function IncomingFindRequestFilter(query, origin)
query[‘0008,0054’] = nil

return query
end

Please let us know whether this solves your issue.

Regards,
Sébastien-

Hi,

Thanks for responding so quickly.

To respond to Stephen, yes there is quite a bit of configuration that needs to be done. I’m not familiar with the gateway options you referenced but I’ll take a look at the guide and reach out to our Ambra representative. I believe the general configuration (to establish connection) is appropriate, as the agreement takes place and studies can be found via Q/R from both sides. I’ll also look to see if there are any firewalls blocking these ports.

Sébastien, thank you for pointing me to these Lua scripts. I implemented your suggestion and see that the Lua script was engaged but it still fails with the same message during the Move-SCU operation (examples below). It seems that identifying the study with C-FIND isn’t an issue, but perhaps it breaks down because RetrieveAETitle (0008,0054) is included in the C-MOVE request? Is there a similar filter script that can be applied to this stage of the Q/R [IncomingMoveRequestFilter]? Ambra performs a 2-step Q/R, and it looks like this tag is inserted into the retrieve/move request.

Thanks,
Joseph

Hello,

My bad. Sorry for my erroneous answer.

The problem with the C-MOVE SCU requests issued by Ambra is that they have an empty “AccessNumber” together with a non-empty “StudyInstanceUID”. This is fixed by the following changeset that will be part of the next release of Orthanc:
https://hg.orthanc-server.com/orthanc/rev/e34c89e89aac

An integration test to avoid any future regression was added as well:
https://hg.orthanc-server.com/orthanc-tests/rev/dc41bfa4bda5

You’ll now have to compile Orthanc from source to take advantage of this patch until a new release is available:
https://book.orthanc-server.com/faq/compiling.html

Kind Regards,
Sébastien-

Hello,
Thanks for your reply. I look forward to the next release. In the interim, I compiled Orthanc from source within Orthanc/Build as directed.

Forgive my ignorance, but should I expect to see an executable file after the CMake build?

Im not familiar with this process and its not immediately clear to me what the next steps are.

Thanks,
Joseph

I’m only really familiar with builds on OS X and LINUX. It sounds like you are using Windows ? On LINUX and OS X, the executable is in the build directory with the name “Orthanc” after executing Make. I think make install will then put those in the default folders. Osimis also apparently has installers for windows:

Osimis Orthanc Installers for Windows

For Windows it is different, but it says something about: Orthanc\Build\Orthanc.sln" with Visual Studio.

Sebastian provided links earlier:

Compiling Orthanc - Orthanc Book

Mercurial Install Details

Hello,

If you are on GNU/Linux, you’ll have to run “make” after “cmake” to create the “Orthanc” executable.

If you are on Microsoft Windows, you’ll have to open the “Orthanc.sln” file that has been created by cmake using Microsoft Visual Studio.

This is explained in the Orthanc Book:
https://book.orthanc-server.com/faq/compiling.html

https://hg.orthanc-server.com/orthanc/file/default/LinuxCompilation.txt

https://hg.orthanc-server.com/orthanc/file/default/INSTALL

Sébastien-

Hi,

Thank you both for your help. I managed to compile from source (Orthanc-1.7.3.tar.gz) and create the Orthanc executable through Visual Studio. I repurposed the Orthanc.json configuration file that I had used for the release setup. After launching the program and attempting Q/R, I’m still getting the same error message:

W0828 08:25:25.738842 main.cpp:1625] Orthanc version: 1.7.3
W0828 08:25:25.739840 main.cpp:1460] Performance warning: Non-release build, runtime debug assertions are turned on
I0828 08:25:25.739840 main.cpp:1657] Architecture: 64-bit, little endian
W0828 08:25:25.740837 OrthancConfiguration.cpp:62] Reading the configuration from: “orthanc.json”
I0828 08:25:25.764772 Toolbox.cpp:1440] Using locale: “” for case-insensitive comparison of strings
I0828 08:25:25.767764 FromDcmtkBridge.cpp:247] Using DCTMK version: 365
I0828 08:25:25.768762 FromDcmtkBridge.cpp:255] Loading the embedded dictionaries
I0828 08:25:25.878796 FromDcmtkBridge.cpp:267] Loading the embedded dictionary of private tags
I0828 08:25:25.945618 FromDcmtkBridge.cpp:2044] Registering JPEG Lossless codecs in DCMTK
I0828 08:25:25.945618 FromDcmtkBridge.cpp:2052] Registering JPEG codecs in DCMTK
I0828 08:25:25.945618 FromDcmtkBridge.cpp:2059] Registering RLE codecs in DCMTK
I0828 08:25:25.945618 Enumerations.cpp:2279] Default encoding for DICOM was changed to: Latin1
W0828 08:25:26.101203 main.cpp:802] Loading plugin(s) from: C:\Orthanc\Build\Debug\Plugins
I0828 08:25:26.101203 PluginsManager.cpp:288] Scanning folder C:\Orthanc\Build\Debug\Plugins\ for plugins
I0828 08:25:26.101203 PluginsManager.cpp:311] Found a shared library: “C:\Orthanc\Build\Debug\Plugins\ModalityWorklists.dll”
W0828 08:25:26.103198 PluginsManager.cpp:269] Registering plugin ‘worklists’ (version 1.7.3)
//
//

I0828 08:32:09.027308 OrthancFindRequestHandler.cpp:634] DICOM C-Find request at level: Study
I0828 08:32:09.027308 OrthancFindRequestHandler.cpp:640] (0008,0020) StudyDate =
I0828 08:32:09.027308 OrthancFindRequestHandler.cpp:640] (0008,0030) StudyTime =
I0828 08:32:09.027308 OrthancFindRequestHandler.cpp:640] (0008,0050) AccessionNumber = 398202
I0828 08:32:09.028306 OrthancFindRequestHandler.cpp:640] (0008,0052) QueryRetrieveLevel = STUDY
I0828 08:32:09.028306 OrthancFindRequestHandler.cpp:640] (0008,0061) ModalitiesInStudy =
I0828 08:32:09.028306 OrthancFindRequestHandler.cpp:640] (0008,0080) InstitutionName =
I0828 08:32:09.028306 OrthancFindRequestHandler.cpp:640] (0008,0090) ReferringPhysicianName =
I0828 08:32:09.028306 OrthancFindRequestHandler.cpp:640] (0008,1030) StudyDescription =
I0828 08:32:09.028306 OrthancFindRequestHandler.cpp:640] (0010,0010) PatientName =
I0828 08:32:09.029303 OrthancFindRequestHandler.cpp:640] (0010,0020) PatientID = 129000
I0828 08:32:09.029303 OrthancFindRequestHandler.cpp:640] (0010,0030) PatientBirthDate =
I0828 08:32:09.029303 OrthancFindRequestHandler.cpp:640] (0010,0040) PatientSex =
I0828 08:32:09.029303 OrthancFindRequestHandler.cpp:640] (0020,000d) StudyInstanceUID = 1.3.6.1.4.1.34692.190280939648420613924105055404154243408
I0828 08:32:09.029303 OrthancFindRequestHandler.cpp:640] (0020,0010) StudyID =
I0828 08:32:09.029303 OrthancFindRequestHandler.cpp:640] (0020,1206) NumberOfStudyRelatedSeries =
I0828 08:32:09.030300 OrthancFindRequestHandler.cpp:640] (0020,1208) NumberOfStudyRelatedInstances =
I0828 08:32:09.032296 ServerContext.cpp:958] Number of candidate resources after fast DB filtering on main DICOM tags: 1
I0828 08:32:09.041271 ServerContext.cpp:1095] Number of matching resources: 1
I0828 08:32:09.041271 CommandDispatcher.cpp:919] DUL Peer Requested Release

I0828 08:32:09.308586 CommandDispatcher.cpp:327] Association Received from AET TEST-ADHOC on IP 111.111.111.11
I0828 08:32:09.308586 main.cpp:287] Incoming connection from AET TEST-ADHOC on IP 111.111.111.11, calling AET ORTHANC-TEST
I0828 08:32:09.309612 CommandDispatcher.cpp:680] Association Acknowledged (Max Send PDV: 16372)
I0828 08:32:09.313573 main.cpp:307] Incoming Move request from AET TEST-ADHOC on IP 111.111.111.11, calling AET ORTHANC-TEST
W0828 08:32:09.314599 OrthancMoveRequestHandler.cpp:313] Move-SCU request received for AET “TEST-ADHOC”
I0828 08:32:09.314599 OrthancMoveRequestHandler.cpp:321] (0008,0020) StudyDate =
I0828 08:32:09.314599 OrthancMoveRequestHandler.cpp:321] (0008,0030) StudyTime =
I0828 08:32:09.314599 OrthancMoveRequestHandler.cpp:321] (0008,0050) AccessionNumber =
I0828 08:32:09.314599 OrthancMoveRequestHandler.cpp:321] (0008,0052) QueryRetrieveLevel = STUDY
I0828 08:32:09.314599 OrthancMoveRequestHandler.cpp:321] (0008,0054) RetrieveAETitle = TEST-ADHOC
I0828 08:32:09.315595 OrthancMoveRequestHandler.cpp:321] (0020,000d) StudyInstanceUID = 1.3.6.1.4.1.34692.190280939648420613924105055404154243408
I0828 08:32:09.315595 OrthancMoveRequestHandler.cpp:321] (0020,0010) StudyID =
E0828 08:32:09.316565 OrthancException.h:76] Bad request: C-MOVE request matching no resource stored in Orthanc
E0828 08:32:09.316565 MoveScp.cpp:198] IMoveRequestHandler Failed: Bad request
I0828 08:32:09.319557 CommandDispatcher.cpp:919] DUL Peer Requested Release
I0828 08:32:09.319557 CommandDispatcher.cpp:926] Association Release

Cheers,
Joseph

Hello,

As written above, the fix is not in Orthanc 1.7.3, but in the mainline (the “development version”).

You must download the source code from our Mercurial server, through read-only access (“hg clone https://hg.orthanc-server.com/orthanc/”):
https://book.orthanc-server.com/developers/repositories.html#accessing-mercurial

Sébastien-

Hi,
Thanks again for your guidance. I had to adjust some configurations to get the source code to compile, but I’m happy to report that I was able to successfully query-retrieve a study via tha Ambra gateway.

Cheers,
Joseph

Hi,

Great, thanks for your feedback!

Sébastien-