Orthanc as a cache server

Hi,
I am wondering if orthanc could be used as a cache-ish server. I am not good explaining it so I’ll put 2 examples to help you undertand better:

Case 1 (orthanc has the studies):

  • Workstation ask a study to orthanc server with ip 1.2.3.4 port 4242 (dicom protocol)
  • Orthanc check if it has that study and sends it back to the workstation
  • Workstation receives it and does whatever it needs to.

Case 2 (orthanc does not have the studies:

  • Workstation ask a study to orthanc server with ip 1.2.3.4 port 4242 (dicom protocol)
  • Orthanc check if it has that study, it does not, so orthanc retrieves automatically the study from other instance of orthanc (ip 11.12.13.14) that it does have the study
  • Orthanc instance with ip 1.2.3.4 send the study to Workstation
    Is it possible to do something like that, retrieve the study from other instance making this process invisible to the workstation (not having to ask the orthanc 11.12.13.14 directly)?
    I was thinking doing it via reverse proxy with apache, something like checking first if it has the study running some script or whatever and if it does not retrieving it, but im not to sure if it can be done like that.
    Wht’s your opinion? Help will be so much appreciated.

Hello,

An Apache reverse proxy won’t work, as you are dealing with the DICOM protocol (and not the HTTP protocol).

The behavior you request can be implemented as a C/C++ plugin for Orthanc:
http://book.orthanc-server.com/developers/creating-plugins.html

Check out the “OrthancPluginRegisterFindCallback()” and “OrthancPluginRegisterMoveCallback()” in the SDK documentation.

HTH,
Sébastien-

Thanks for your answer,

I’ve decided to implement my own plugin but I know nothing about cmake + export to a dll/so. I’ve tried to obtain it via eclipse, but when i tried to add it to my orthanc it says “does not declare the proper entry functions”. At the moment my plugin only has:

  • OrthancCPlugin.h
  • json.c and json.h
  • OrthancContext.cpp and OrthancContext.h
  • Plugin.cpp, this file contains OrthancPluginInitialize, OrthancPluginFinalize, OrthancPluginGetName, OrthancPluginGetVersion and OrthancPluginRegisterMoveCallback (not sure if this should be here)

Why Orthanc isn’t getting my entry points? How should this be made in a cmake file?

This question has been partly answered in another thread (please avoid opening many threads for discussing the same question):
https://groups.google.com/d/msg/orthanc-users/Gc8OZGGHHbg/pZ6oM7nIBgAJ

Your plugin is most probably not seeing your entry points because they are not tagged as “extern “C””:
https://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B#Linking_C_and_C++_code

Check out the code of the official C++ plugins, for instance “ServerFolders” that is probably the most simple sample:
https://bitbucket.org/sjodogne/orthanc/src/default/Plugins/Samples/ServeFolders/Plugin.cpp

Sébastien-