Orthanc Plugin SDK  1.9.6
Documentation of the plugin interface of Orthanc
Classes | Typedefs | Enumerations | Functions
Callbacks

Functions to register and manage callbacks by the plugins. More...

Classes

struct  OrthancPluginHttpRequest
 The parameters of a REST request. More...
 

Typedefs

typedef OrthancPluginErrorCode(* OrthancPluginDecodeImageCallback) (OrthancPluginImage **target, const void *dicom, const uint32_t size, uint32_t frameIndex)
 Signature of a callback function to decode a DICOM instance as an image.
 
typedef void(* OrthancPluginDicomWebBinaryCallback) (OrthancPluginDicomWebNode *node, OrthancPluginDicomWebSetBinaryNode setter, uint32_t levelDepth, const uint16_t *levelTagGroup, const uint16_t *levelTagElement, const uint32_t *levelIndex, uint16_t tagGroup, uint16_t tagElement, OrthancPluginValueRepresentation vr)
 Callback executed to encode a binary tag in DICOMweb. More...
 
typedef void(* OrthancPluginDicomWebBinaryCallback2) (OrthancPluginDicomWebNode *node, OrthancPluginDicomWebSetBinaryNode setter, uint32_t levelDepth, const uint16_t *levelTagGroup, const uint16_t *levelTagElement, const uint32_t *levelIndex, uint16_t tagGroup, uint16_t tagElement, OrthancPluginValueRepresentation vr, void *payload)
 Callback executed to encode a binary tag in DICOMweb. More...
 
typedef void(* OrthancPluginDicomWebSetBinaryNode) (OrthancPluginDicomWebNode *node, OrthancPluginDicomWebBinaryMode mode, const char *bulkDataUri)
 Signature of a function to set the content of a node encoding a binary DICOM tag, into a JSON or XML document generated for DICOMweb.
 
typedef void(* OrthancPluginFree) (void *buffer)
 Signature of a function to free dynamic memory.
 
typedef OrthancPluginJob *(* OrthancPluginJobsUnserializer) (const char *jobType, const char *serialized)
 Callback executed to unserialize a custom job. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginOnChangeCallback) (OrthancPluginChangeType changeType, OrthancPluginResourceType resourceType, const char *resourceId)
 Signature of a callback function that is triggered when a change happens to some DICOM resource.
 
typedef OrthancPluginErrorCode(* OrthancPluginOnStoredInstanceCallback) (const OrthancPluginDicomInstance *instance, const char *instanceId)
 Signature of a callback function that is triggered when Orthanc stores a new DICOM instance.
 
typedef void(* OrthancPluginRefreshMetricsCallback) ()
 Callback executed to update the metrics of the plugin. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginRestCallback) (OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
 Signature of a callback function that answers to a REST request.
 
typedef OrthancPluginErrorCode(* OrthancPluginStorageCreate) (const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
 Callback for writing to the storage area. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginStorageRead) (void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
 Callback for reading from the storage area. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginStorageReadRange) (OrthancPluginMemoryBuffer64 *target, const char *uuid, OrthancPluginContentType type, uint64_t rangeStart)
 Callback for reading a range of a file from the storage area. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginStorageReadWhole) (OrthancPluginMemoryBuffer64 *target, const char *uuid, OrthancPluginContentType type)
 Callback for reading a whole file from the storage area. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginStorageRemove) (const char *uuid, OrthancPluginContentType type)
 Callback for removing a file from the storage area. More...
 
typedef OrthancPluginErrorCode(* OrthancPluginTranscoderCallback) (OrthancPluginMemoryBuffer *transcoded, const void *buffer, uint64_t size, const char *const *allowedSyntaxes, uint32_t countSyntaxes, uint8_t allowNewSopInstanceUid)
 Signature of a callback function to transcode a DICOM instance. More...
 

Enumerations

enum  OrthancPluginChangeType {
  OrthancPluginChangeType_CompletedSeries,
  OrthancPluginChangeType_Deleted,
  OrthancPluginChangeType_NewChildInstance,
  OrthancPluginChangeType_NewInstance,
  OrthancPluginChangeType_NewPatient,
  OrthancPluginChangeType_NewSeries,
  OrthancPluginChangeType_NewStudy,
  OrthancPluginChangeType_StablePatient,
  OrthancPluginChangeType_StableSeries,
  OrthancPluginChangeType_StableStudy,
  OrthancPluginChangeType_OrthancStarted,
  OrthancPluginChangeType_OrthancStopped,
  OrthancPluginChangeType_UpdatedAttachment,
  OrthancPluginChangeType_UpdatedMetadata,
  OrthancPluginChangeType_UpdatedPeers,
  OrthancPluginChangeType_UpdatedModalities,
  OrthancPluginChangeType_JobSubmitted,
  OrthancPluginChangeType_JobSuccess,
  OrthancPluginChangeType_JobFailure
}
 

Functions

int OrthancPluginCheckVersion (OrthancPluginContext *context)
 Check the compatibility of the plugin wrt. the version of its hosting Orthanc. More...
 
int OrthancPluginCheckVersionAdvanced (OrthancPluginContext *context, int expectedMajor, int expectedMinor, int expectedRevision)
 Check that the version of the hosting Orthanc is above a given version. More...
 
uint32_t OrthancPluginGetExpectedDatabaseVersion (OrthancPluginContext *context)
 Get the expected version of the database schema. More...
 
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags (OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, OrthancPluginResourceType level)
 Reconstruct the main DICOM tags. More...
 
void OrthancPluginRegisterChunkedRestCallback (OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback getHandler, OrthancPluginServerChunkedRequestReaderFactory postHandler, OrthancPluginRestCallback deleteHandler, OrthancPluginServerChunkedRequestReaderFactory putHandler, OrthancPluginServerChunkedRequestReaderAddChunk addChunk, OrthancPluginServerChunkedRequestReaderExecute execute, OrthancPluginServerChunkedRequestReaderFinalize finalize)
 Register a REST callback to handle chunked HTTP transfers. More...
 
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback (OrthancPluginContext *context, OrthancPluginDecodeImageCallback callback)
 Register a callback to handle the decoding of DICOM images. More...
 
OrthancPluginErrorCode OrthancPluginRegisterIncomingDicomInstanceFilter (OrthancPluginContext *context, OrthancPluginIncomingDicomInstanceFilter callback)
 Register a callback to filter incoming DICOM instances. More...
 
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter (OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter callback)
 Register a callback to filter incoming HTTP requests. More...
 
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2 (OrthancPluginContext *context, OrthancPluginIncomingHttpRequestFilter2 callback)
 Register a callback to filter incoming HTTP requests. More...
 
void OrthancPluginRegisterJobsUnserializer (OrthancPluginContext *context, OrthancPluginJobsUnserializer unserializer)
 Register an unserializer for custom jobs. More...
 
void OrthancPluginRegisterOnChangeCallback (OrthancPluginContext *context, OrthancPluginOnChangeCallback callback)
 Register a callback to monitor changes. More...
 
void OrthancPluginRegisterOnStoredInstanceCallback (OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
 Register a callback for received instances. More...
 
void OrthancPluginRegisterRefreshMetricsCallback (OrthancPluginContext *context, OrthancPluginRefreshMetricsCallback callback)
 Register a callback to refresh the metrics. More...
 
void OrthancPluginRegisterRestCallback (OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
 Register a REST callback. More...
 
void OrthancPluginRegisterRestCallbackNoLock (OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
 Register a REST callback, without locking. More...
 
void OrthancPluginRegisterStorageArea (OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
 Register a custom storage area. More...
 
void OrthancPluginRegisterStorageArea2 (OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageReadWhole readWhole, OrthancPluginStorageReadRange readRange, OrthancPluginStorageRemove remove)
 Register a custom storage area, with support for range request. More...
 
OrthancPluginErrorCode OrthancPluginRegisterTranscoderCallback (OrthancPluginContext *context, OrthancPluginTranscoderCallback callback)
 Register a callback to handle the transcoding of DICOM images. More...
 
OrthancPluginErrorCode OrthancPluginStorageAreaCreate (OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, const void *content, uint64_t size, OrthancPluginContentType type)
 Create a file inside the storage area. More...
 
OrthancPluginErrorCode OrthancPluginStorageAreaRead (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
 Read a file from the storage area. More...
 
OrthancPluginErrorCode OrthancPluginStorageAreaRemove (OrthancPluginContext *context, OrthancPluginStorageArea *storageArea, const char *uuid, OrthancPluginContentType type)
 Remove a file from the storage area. More...
 
typedef struct _OrthancPluginDatabaseContext_t OrthancPluginDatabaseContext
 
typedef struct _OrthancPluginDatabaseTransaction_t OrthancPluginDatabaseTransaction
 
OrthancPluginDatabaseContextOrthancPluginRegisterDatabaseBackend (OrthancPluginContext *context, const OrthancPluginDatabaseBackend *backend, void *payload)
 
OrthancPluginDatabaseContextOrthancPluginRegisterDatabaseBackendV2 (OrthancPluginContext *context, const OrthancPluginDatabaseBackend *backend, const OrthancPluginDatabaseExtensions *extensions, void *payload)
 
OrthancPluginErrorCode OrthancPluginRegisterDatabaseBackendV3 (OrthancPluginContext *context, const OrthancPluginDatabaseBackendV3 *backend, uint32_t backendSize, uint32_t maxDatabaseRetries, void *database)
 

Detailed Description

Typedef Documentation

typedef struct _OrthancPluginDatabaseContext_t OrthancPluginDatabaseContext

Orthanc - A Lightweight, RESTful DICOM Store Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics Department, University Hospital of Liege, Belgium Copyright (C) 2017-2021 Osimis S.A., Belgium

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. Opaque structure that represents the context of a custom database engine.

typedef struct _OrthancPluginDatabaseTransaction_t OrthancPluginDatabaseTransaction

Opaque structure that represents a transaction of a custom database engine. New in Orthanc 1.9.2.

typedef void(* OrthancPluginDicomWebBinaryCallback) (OrthancPluginDicomWebNode *node, OrthancPluginDicomWebSetBinaryNode setter, uint32_t levelDepth, const uint16_t *levelTagGroup, const uint16_t *levelTagElement, const uint32_t *levelIndex, uint16_t tagGroup, uint16_t tagElement, OrthancPluginValueRepresentation vr)

Signature of a callback function that is called by Orthanc whenever a DICOM tag that contains a binary value must be written to a JSON or XML node, while a DICOMweb document is being generated. The value representation (VR) of the DICOM tag can be OB, OD, OF, OL, OW, or UN.

See also
OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Parameters
nodeThe node being generated, as provided by Orthanc.
setterThe setter to be used to encode the content of the node. If the setter is not called, the binary tag is not written to the output document.
levelDepthThe depth of the node in the DICOM hierarchy of sequences. This parameter gives the number of elements in the "levelTagGroup", "levelTagElement", and "levelIndex" arrays.
levelTagGroupThe group of the parent DICOM tags in the hierarchy.
levelTagElementThe element of the parent DICOM tags in the hierarchy.
levelIndexThe index of the node in the parent sequences of the hierarchy.
tagGroupThe group of the DICOM tag of interest.
tagElementThe element of the DICOM tag of interest.
vrThe value representation of the binary DICOM node.
typedef void(* OrthancPluginDicomWebBinaryCallback2) (OrthancPluginDicomWebNode *node, OrthancPluginDicomWebSetBinaryNode setter, uint32_t levelDepth, const uint16_t *levelTagGroup, const uint16_t *levelTagElement, const uint32_t *levelIndex, uint16_t tagGroup, uint16_t tagElement, OrthancPluginValueRepresentation vr, void *payload)

Signature of a callback function that is called by Orthanc whenever a DICOM tag that contains a binary value must be written to a JSON or XML node, while a DICOMweb document is being generated. The value representation (VR) of the DICOM tag can be OB, OD, OF, OL, OW, or UN.

See also
OrthancPluginEncodeDicomWebJson() and OrthancPluginEncodeDicomWebXml()
Parameters
nodeThe node being generated, as provided by Orthanc.
setterThe setter to be used to encode the content of the node. If the setter is not called, the binary tag is not written to the output document.
levelDepthThe depth of the node in the DICOM hierarchy of sequences. This parameter gives the number of elements in the "levelTagGroup", "levelTagElement", and "levelIndex" arrays.
levelTagGroupThe group of the parent DICOM tags in the hierarchy.
levelTagElementThe element of the parent DICOM tags in the hierarchy.
levelIndexThe index of the node in the parent sequences of the hierarchy.
tagGroupThe group of the DICOM tag of interest.
tagElementThe element of the DICOM tag of interest.
vrThe value representation of the binary DICOM node.
payloadThe user payload.
typedef OrthancPluginJob*(* OrthancPluginJobsUnserializer) (const char *jobType, const char *serialized)

Signature of a callback function that unserializes a job that was saved in the Orthanc database.

Parameters
jobTypeThe type of the job, as provided to OrthancPluginCreateJob().
serializedThe serialization of the job, as provided by OrthancPluginJobGetSerialized.
Returns
The unserialized job (as created by OrthancPluginCreateJob()), or NULL if this unserializer cannot handle this job type.
See also
OrthancPluginRegisterJobsUnserializer()
typedef void(* OrthancPluginRefreshMetricsCallback) ()

Signature of a callback function that is called by Orthanc whenever a monitoring tool (such as Prometheus) asks the current values of the metrics. This callback gives the plugin a chance to update its metrics, by calling OrthancPluginSetMetricsValue(). This is typically useful for metrics that are expensive to acquire.

See also
OrthancPluginRegisterRefreshMetrics()
typedef OrthancPluginErrorCode(* OrthancPluginStorageCreate) (const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc writes a file to the storage area.

Parameters
uuidThe UUID of the file.
contentThe content of the file.
sizeThe size of the file.
typeThe content type corresponding to this file.
Returns
0 if success, other value if error.
typedef OrthancPluginErrorCode(* OrthancPluginStorageRead) (void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc reads a file from the storage area.

Parameters
contentThe content of the file (output).
sizeThe size of the file (output).
uuidThe UUID of the file of interest.
typeThe content type corresponding to this file.
Returns
0 if success, other value if error.
Deprecated:
New plugins should use OrthancPluginStorageRead2
Warning
The "content" buffer must have been allocated using the "malloc()" function of your C standard library (i.e. nor "new[]", neither a pointer to a buffer). The "free()" function of your C standard library will automatically be invoked on the "content" pointer.
typedef OrthancPluginErrorCode(* OrthancPluginStorageReadRange) (OrthancPluginMemoryBuffer64 *target, const char *uuid, OrthancPluginContentType type, uint64_t rangeStart)

Signature of a callback function that is triggered when Orthanc reads a portion of a file from the storage area. Orthanc indicates the start position and the length of the range.

Parameters
targetMemory buffer where to store the content of the range. The memory buffer is allocated and freed by Orthanc. The length of the range of interest corresponds to the size of this buffer.
uuidThe UUID of the file of interest.
typeThe content type corresponding to this file.
rangeStartStart position of the requested range in the file.
Returns
0 if success, other value if error.
typedef OrthancPluginErrorCode(* OrthancPluginStorageReadWhole) (OrthancPluginMemoryBuffer64 *target, const char *uuid, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc reads a whole file from the storage area.

Parameters
targetMemory buffer where to store the content of the file. It must be allocated by the plugin using OrthancPluginCreateMemoryBuffer64(). The core of Orthanc will free it.
uuidThe UUID of the file of interest.
typeThe content type corresponding to this file.
typedef OrthancPluginErrorCode(* OrthancPluginStorageRemove) (const char *uuid, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.

Parameters
uuidThe UUID of the file to be removed.
typeThe content type corresponding to this file.
Returns
0 if success, other value if error.
typedef OrthancPluginErrorCode(* OrthancPluginTranscoderCallback) (OrthancPluginMemoryBuffer *transcoded, const void *buffer, uint64_t size, const char *const *allowedSyntaxes, uint32_t countSyntaxes, uint8_t allowNewSopInstanceUid)
Parameters
transcodedTarget memory buffer. It must be allocated by the plugin using OrthancPluginCreateMemoryBuffer().
bufferMemory buffer containing the source DICOM instance.
sizeSize of the source memory buffer.
allowedSyntaxesA C array of possible transfer syntaxes UIDs for the result of the transcoding. The plugin must choose by itself the transfer syntax that will be used for the resulting DICOM image.
countSyntaxesThe number of transfer syntaxes that are contained in the "allowedSyntaxes" array.
allowNewSopInstanceUidWhether the transcoding plugin can select a transfer syntax that will change the SOP instance UID (or, in other terms, whether the plugin can transcode using lossy compression).
Returns
0 if success (i.e. image successfully transcoded and stored into "transcoded"), or the error code if failure.

Enumeration Type Documentation

The supported types of changes that can be signaled to the change callback.

Enumerator
OrthancPluginChangeType_CompletedSeries 

Series is now complete

OrthancPluginChangeType_Deleted 

Deleted resource

OrthancPluginChangeType_NewChildInstance 

A new instance was added to this resource

OrthancPluginChangeType_NewInstance 

New instance received

OrthancPluginChangeType_NewPatient 

New patient created

OrthancPluginChangeType_NewSeries 

New series created

OrthancPluginChangeType_NewStudy 

New study created

OrthancPluginChangeType_StablePatient 

Timeout: No new instance in this patient

OrthancPluginChangeType_StableSeries 

Timeout: No new instance in this series

OrthancPluginChangeType_StableStudy 

Timeout: No new instance in this study

OrthancPluginChangeType_OrthancStarted 

Orthanc has started

OrthancPluginChangeType_OrthancStopped 

Orthanc is stopping

OrthancPluginChangeType_UpdatedAttachment 

Some user-defined attachment has changed for this resource

OrthancPluginChangeType_UpdatedMetadata 

Some user-defined metadata has changed for this resource

OrthancPluginChangeType_UpdatedPeers 

The list of Orthanc peers has changed

OrthancPluginChangeType_UpdatedModalities 

The list of DICOM modalities has changed

OrthancPluginChangeType_JobSubmitted 

New Job submitted

OrthancPluginChangeType_JobSuccess 

A Job has completed successfully

OrthancPluginChangeType_JobFailure 

A Job has failed

Function Documentation

int OrthancPluginCheckVersion ( OrthancPluginContext context)

This function checks whether the version of the Orthanc server running this plugin, is above the version of the current Orthanc SDK header. This guarantees that the plugin is compatible with the hosting Orthanc (i.e. it will not call unavailable services). The result of this function should always be checked in the OrthancPluginInitialize() entry point of the plugin.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
Returns
1 if and only if the versions are compatible. If the result is 0, the initialization of the plugin should fail.
See also
OrthancPluginCheckVersionAdvanced
int OrthancPluginCheckVersionAdvanced ( OrthancPluginContext context,
int  expectedMajor,
int  expectedMinor,
int  expectedRevision 
)

This function checks whether the version of the Orthanc server running this plugin, is above the given version. Contrarily to OrthancPluginCheckVersion(), it is up to the developer of the plugin to make sure that all the Orthanc SDK services called by the plugin are actually implemented in the given version of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
expectedMajorExpected major version.
expectedMinorExpected minor version.
expectedRevisionExpected revision.
Returns
1 if and only if the versions are compatible. If the result is 0, the initialization of the plugin should fail.
See also
OrthancPluginCheckVersion
uint32_t OrthancPluginGetExpectedDatabaseVersion ( OrthancPluginContext context)

Retrieve the expected version of the database schema.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
Returns
The version.
OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags ( OrthancPluginContext context,
OrthancPluginStorageArea storageArea,
OrthancPluginResourceType  level 
)

This function requests the Orthanc core to reconstruct the main DICOM tags of all the resources of the given type. This function can only be used as a part of the upgrade of a custom database back-end. A database transaction will be automatically setup.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
storageAreaThe storage area.
levelThe type of the resources of interest.
Returns
0 if success, other value if error.
void OrthancPluginRegisterChunkedRestCallback ( OrthancPluginContext context,
const char *  pathRegularExpression,
OrthancPluginRestCallback  getHandler,
OrthancPluginServerChunkedRequestReaderFactory  postHandler,
OrthancPluginRestCallback  deleteHandler,
OrthancPluginServerChunkedRequestReaderFactory  putHandler,
OrthancPluginServerChunkedRequestReaderAddChunk  addChunk,
OrthancPluginServerChunkedRequestReaderExecute  execute,
OrthancPluginServerChunkedRequestReaderFinalize  finalize 
)

This function registers a REST callback against a regular expression for a URI. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Contrarily to OrthancPluginRegisterRestCallback(), the callbacks will NOT be invoked in mutual exclusion, so it is up to the plugin to implement the required locking mechanisms.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
pathRegularExpressionRegular expression for the URI. May contain groups.
getHandlerThe callback function to handle REST calls using the GET HTTP method.
postHandlerThe callback function to handle REST calls using the POST HTTP method.
deleteHandlerThe callback function to handle REST calls using the DELETE HTTP method.
putHandlerThe callback function to handle REST calls using the PUT HTTP method.
addChunkThe callback invoked when a new chunk is available for the request body of a POST or PUT call.
executeThe callback invoked once the entire body of a POST or PUT call is read.
finalizeThe callback invoked to release the resources associated with a POST or PUT call.
See also
OrthancPluginRegisterRestCallbackNoLock()
Note
The regular expression is case sensitive and must follow the Perl syntax.
OrthancPluginDatabaseContext* OrthancPluginRegisterDatabaseBackend ( OrthancPluginContext context,
const OrthancPluginDatabaseBackend *  backend,
void *  payload 
)

Register a custom database back-end (for legacy plugins).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
backendThe callbacks of the custom database engine.
payloadPointer containing private information for the database engine.
Returns
The context of the database engine (it must not be manually freed).
Deprecated:
See also
OrthancPluginRegisterDatabaseBackendV2
OrthancPluginDatabaseContext* OrthancPluginRegisterDatabaseBackendV2 ( OrthancPluginContext context,
const OrthancPluginDatabaseBackend *  backend,
const OrthancPluginDatabaseExtensions *  extensions,
void *  payload 
)

Register a custom database back-end.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
backendThe callbacks of the custom database engine.
payloadPointer containing private information for the database engine.
extensionsExtensions to the base database SDK that was shipped until Orthanc 0.9.3.
Returns
The context of the database engine (it must not be manually freed).
OrthancPluginErrorCode OrthancPluginRegisterDecodeImageCallback ( OrthancPluginContext context,
OrthancPluginDecodeImageCallback  callback 
)

This function registers a custom callback to decode DICOM images, extending the built-in decoder of Orthanc that uses DCMTK. Starting with Orthanc 1.7.0, the exact behavior is affected by the configuration option "BuiltinDecoderTranscoderOrder" of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback.
Returns
0 if success, other value if error.
OrthancPluginErrorCode OrthancPluginRegisterIncomingDicomInstanceFilter ( OrthancPluginContext context,
OrthancPluginIncomingDicomInstanceFilter  callback 
)

This function registers a custom callback to filter incoming DICOM instances received by Orthanc (either through the REST API or through the DICOM protocol).

Warning
Your callback function will be called synchronously with the core of Orthanc. This implies that deadlocks might emerge if you call other core primitives of Orthanc in your callback (such deadlocks are particular visible in the presence of other plugins or Lua scripts). It is thus strongly advised to avoid any call to the REST API of Orthanc in the callback. If you have to call other primitives of Orthanc, you should make these calls in a separate thread, passing the pending events to be processed through a message queue.
Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback.
Returns
0 if success, other value if error.
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter ( OrthancPluginContext context,
OrthancPluginIncomingHttpRequestFilter  callback 
)

This function registers a custom callback to filter incoming HTTP/REST requests received by the HTTP server of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback.
Returns
0 if success, other value if error.
Deprecated:
Please instead use OrthancPluginRegisterIncomingHttpRequestFilter2()
OrthancPluginErrorCode OrthancPluginRegisterIncomingHttpRequestFilter2 ( OrthancPluginContext context,
OrthancPluginIncomingHttpRequestFilter2  callback 
)

This function registers a custom callback to filter incoming HTTP/REST requests received by the HTTP server of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback.
Returns
0 if success, other value if error.
void OrthancPluginRegisterJobsUnserializer ( OrthancPluginContext context,
OrthancPluginJobsUnserializer  unserializer 
)

This function registers an unserializer that decodes custom jobs from a JSON string. This callback is invoked when the jobs engine of Orthanc is started (on Orthanc initialization), for each job that is stored in the Orthanc database.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
unserializerThe job unserializer.
void OrthancPluginRegisterOnChangeCallback ( OrthancPluginContext context,
OrthancPluginOnChangeCallback  callback 
)

This function registers a callback function that is called whenever a change happens to some DICOM resource.

Warning
Your callback function will be called synchronously with the core of Orthanc. This implies that deadlocks might emerge if you call other core primitives of Orthanc in your callback (such deadlocks are particular visible in the presence of other plugins or Lua scripts). It is thus strongly advised to avoid any call to the REST API of Orthanc in the callback. If you have to call other primitives of Orthanc, you should make these calls in a separate thread, passing the pending events to be processed through a message queue.
Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback function.
void OrthancPluginRegisterOnStoredInstanceCallback ( OrthancPluginContext context,
OrthancPluginOnStoredInstanceCallback  callback 
)

This function registers a callback function that is called whenever a new DICOM instance is stored into the Orthanc core.

Warning
Your callback function will be called synchronously with the core of Orthanc. This implies that deadlocks might emerge if you call other core primitives of Orthanc in your callback (such deadlocks are particular visible in the presence of other plugins or Lua scripts). It is thus strongly advised to avoid any call to the REST API of Orthanc in the callback. If you have to call other primitives of Orthanc, you should make these calls in a separate thread, passing the pending events to be processed through a message queue.
Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback function.
void OrthancPluginRegisterRefreshMetricsCallback ( OrthancPluginContext context,
OrthancPluginRefreshMetricsCallback  callback 
)

This function registers a callback to refresh the metrics. The callback must make calls to OrthancPluginSetMetricsValue().

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback function to handle the refresh.
void OrthancPluginRegisterRestCallback ( OrthancPluginContext context,
const char *  pathRegularExpression,
OrthancPluginRestCallback  callback 
)

This function registers a REST callback against a regular expression for a URI. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Each REST callback is guaranteed to run in mutual exclusion.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
pathRegularExpressionRegular expression for the URI. May contain groups.
callbackThe callback function to handle the REST call.
See also
OrthancPluginRegisterRestCallbackNoLock()
Note
The regular expression is case sensitive and must follow the Perl syntax.
void OrthancPluginRegisterRestCallbackNoLock ( OrthancPluginContext context,
const char *  pathRegularExpression,
OrthancPluginRestCallback  callback 
)

This function registers a REST callback against a regular expression for a URI. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Contrarily to OrthancPluginRegisterRestCallback(), the callback will NOT be invoked in mutual exclusion. This can be useful for high-performance plugins that must handle concurrent requests (Orthanc uses a pool of threads, one thread being assigned to each incoming HTTP request). Of course, if using this function, it is up to the plugin to implement the required locking mechanisms.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
pathRegularExpressionRegular expression for the URI. May contain groups.
callbackThe callback function to handle the REST call.
See also
OrthancPluginRegisterRestCallback()
Note
The regular expression is case sensitive and must follow the Perl syntax.
void OrthancPluginRegisterStorageArea ( OrthancPluginContext context,
OrthancPluginStorageCreate  create,
OrthancPluginStorageRead  read,
OrthancPluginStorageRemove  remove 
)

This function registers a custom storage area, to replace the built-in way Orthanc stores its files on the filesystem. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
createThe callback function to store a file on the custom storage area.
readThe callback function to read a file from the custom storage area.
removeThe callback function to remove a file from the custom storage area.
Deprecated:
Please use OrthancPluginRegisterStorageArea2()
void OrthancPluginRegisterStorageArea2 ( OrthancPluginContext context,
OrthancPluginStorageCreate  create,
OrthancPluginStorageReadWhole  readWhole,
OrthancPluginStorageReadRange  readRange,
OrthancPluginStorageRemove  remove 
)

This function registers a custom storage area, to replace the built-in way Orthanc stores its files on the filesystem. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
createThe callback function to store a file on the custom storage area.
readWholeThe callback function to read a whole file from the custom storage area.
readRangeThe callback function to read some range of a file from the custom storage area. If this feature is not supported by the plugin, this value can be set to NULL.
removeThe callback function to remove a file from the custom storage area.
OrthancPluginErrorCode OrthancPluginRegisterTranscoderCallback ( OrthancPluginContext context,
OrthancPluginTranscoderCallback  callback 
)

This function registers a custom callback to transcode DICOM images, extending the built-in transcoder of Orthanc that uses DCMTK. The exact behavior is affected by the configuration option "BuiltinDecoderTranscoderOrder" of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback.
Returns
0 if success, other value if error.
OrthancPluginErrorCode OrthancPluginStorageAreaCreate ( OrthancPluginContext context,
OrthancPluginStorageArea storageArea,
const char *  uuid,
const void *  content,
uint64_t  size,
OrthancPluginContentType  type 
)

This function creates a new file inside the storage area that is currently used by Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
storageAreaThe storage area.
uuidThe identifier of the file to be created.
contentThe content to store in the newly created file.
sizeThe size of the content.
typeThe type of the file content.
Returns
0 if success, other value if error.
Deprecated:
This function should not be used anymore. Use "OrthancPluginRestApiPut()" on "/{patients|studies|series|instances}/{id}/attachments/{name}" instead.
OrthancPluginErrorCode OrthancPluginStorageAreaRead ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
OrthancPluginStorageArea storageArea,
const char *  uuid,
OrthancPluginContentType  type 
)

This function reads the content of a given file from the storage area that is currently used by Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
storageAreaThe storage area.
uuidThe identifier of the file to be read.
typeThe type of the file content.
Returns
0 if success, other value if error.
Deprecated:
This function should not be used anymore. Use "OrthancPluginRestApiGet()" on "/{patients|studies|series|instances}/{id}/attachments/{name}" instead.
OrthancPluginErrorCode OrthancPluginStorageAreaRemove ( OrthancPluginContext context,
OrthancPluginStorageArea storageArea,
const char *  uuid,
OrthancPluginContentType  type 
)

This function removes a given file from the storage area that is currently used by Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
storageAreaThe storage area.
uuidThe identifier of the file to be removed.
typeThe type of the file content.
Returns
0 if success, other value if error.
Deprecated:
This function should not be used anymore. Use "OrthancPluginRestApiDelete()" on "/{patients|studies|series|instances}/{id}/attachments/{name}" instead.