Orthanc Plugin SDK 1.12.7
Documentation of the plugin interface of Orthanc
Orthanc Plugin SDK

This C/C++ SDK allows external developers to create plugins that can be loaded into Orthanc to extend its functionality. Each Orthanc plugin must expose 4 public functions with the following signatures:

  1. int32_t OrthancPluginInitialize(const OrthancPluginContext* context): This function is invoked by Orthanc when it loads the plugin on startup. The plugin must:
    • Check its compatibility with the Orthanc version using OrthancPluginCheckVersion().
    • Store the context pointer so that it can use the plugin services of Orthanc.
    • Register all its REST callbacks using OrthancPluginRegisterRestCallback().
    • Possibly register its callback for received DICOM instances using OrthancPluginRegisterOnStoredInstanceCallback().
    • Possibly register its callback for changes to the DICOM store using OrthancPluginRegisterOnChangeCallback().
    • Possibly register a custom storage area using OrthancPluginRegisterStorageArea2().
    • Possibly register a custom database back-end area using OrthancPluginRegisterDatabaseBackendV4().
    • Possibly register a handler for C-Find SCP using OrthancPluginRegisterFindCallback().
    • Possibly register a handler for C-Find SCP against DICOM worklists using OrthancPluginRegisterWorklistCallback().
    • Possibly register a handler for C-Move SCP using OrthancPluginRegisterMoveCallback().
    • Possibly register a custom decoder for DICOM images using OrthancPluginRegisterDecodeImageCallback().
    • Possibly register a callback to filter incoming HTTP requests using OrthancPluginRegisterIncomingHttpRequestFilter2().
    • Possibly register a callback to unserialize jobs using OrthancPluginRegisterJobsUnserializer().
    • Possibly register a callback to refresh its metrics using OrthancPluginRegisterRefreshMetricsCallback().
    • Possibly register a callback to answer chunked HTTP transfers using OrthancPluginRegisterChunkedRestCallback().
    • Possibly register a callback for Storage Commitment SCP using OrthancPluginRegisterStorageCommitmentScpCallback().
    • Possibly register a callback to keep/discard/modify incoming DICOM instances using OrthancPluginRegisterReceivedInstanceCallback().
    • Possibly register a custom transcoder for DICOM images using OrthancPluginRegisterTranscoderCallback().
    • Possibly register a callback to discard instances received through DICOM C-STORE using OrthancPluginRegisterIncomingCStoreInstanceFilter().
    • Possibly register a callback to branch a WebDAV virtual filesystem using OrthancPluginRegisterWebDavCollection().
  2. void OrthancPluginFinalize(): This function is invoked by Orthanc during its shutdown. The plugin must free all its memory.
  3. const char* OrthancPluginGetName(): The plugin must return a short string to identify itself.
  4. const char* OrthancPluginGetVersion(): The plugin must return a string containing its version number.

The name and the version of a plugin is only used to prevent it from being loaded twice. Note that, in C++, it is mandatory to declare these functions within an extern "C" section.

To ensure multi-threading safety, the various REST callbacks are guaranteed to be executed in mutual exclusion since Orthanc 0.8.5. If this feature is undesired (notably when developing high-performance plugins handling simultaneous requests), use OrthancPluginRegisterRestCallbackNoLock().