Orthanc Plugin SDK: Toolbox

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

Classes | Typedefs | Enumerations | Functions
Toolbox

Generic functions to help with the creation of plugins. More...

## Classes
struct | OrthancPluginDictionaryEntry
| An entry in the dictionary of DICOM tags. More...
struct | OrthancPluginHttpRequest
| The parameters of a REST request. More...
struct | OrthancPluginMemoryBuffer
| A 32-bit memory buffer allocated by the core system of Orthanc. More...
struct | OrthancPluginMemoryBuffer64
| A 64-bit memory buffer allocated by the core system of Orthanc. More...

## Typedefs
typedef OrthancPluginErrorCode(* | OrthancPluginChunkedClientAnswerAddChunk) (void *answer, const void *data, uint32_t size)
| Callback executed when an answer chunk is received during a chunked transfer.
typedef OrthancPluginErrorCode(* | OrthancPluginChunkedClientAnswerAddHeader) (void *answer, const char *key, const char *value)
| Callback executed when a HTTP header is received during a chunked transfer.
typedef const void *(* | OrthancPluginChunkedClientRequestGetChunkData) (void *request)
| Callback to read the current chunk of the request body during a chunked transfer.
typedef uint32_t(* | OrthancPluginChunkedClientRequestGetChunkSize) (void *request)
| Callback to read the size of the current request chunk during a chunked transfer.
typedef uint8_t(* | OrthancPluginChunkedClientRequestIsDone) (void *request)
| Callback to know whether the request body is entirely read during a chunked transfer.
typedef OrthancPluginErrorCode(* | OrthancPluginChunkedClientRequestNext) (void *request)
| Callback to advance in the request body during a chunked transfer.
typedef struct _OrthancPluginContext_t | OrthancPluginContext
| Data structure that contains information about the Orthanc core.
typedef struct _OrthancPluginDicomWebNode_t | OrthancPluginDicomWebNode
| Opaque structure that represents a node in a JSON or XML document used in DICOMweb.
typedef struct _OrthancPluginFindMatcher_t | OrthancPluginFindMatcher
| Opaque structure to an object that can be used to check whether a DICOM instance matches a C-Find query.
typedef struct _OrthancPluginJob_t | OrthancPluginJob
| Opaque structure to a job to be executed by Orthanc.
typedef void(* | OrthancPluginJobFinalize) (void *job)
| Callback to finalize one custom job.
typedef const char *(* | OrthancPluginJobGetContent) (void *job)
| Callback to retrieve the content of one custom job.
typedef OrthancPluginErrorCode(* | OrthancPluginJobGetContent2) (OrthancPluginMemoryBuffer *target, void *job)
| Callback to retrieve the content of one custom job.
typedef float(* | OrthancPluginJobGetProgress) (void *job)
| Callback to check the progress of one custom job.
typedef const char *(* | OrthancPluginJobGetSerialized) (void *job)
| Callback to serialize one custom job.
typedef int32_t(* | OrthancPluginJobGetSerialized2) (OrthancPluginMemoryBuffer *target, void *job)
| Callback to serialize one custom job.
typedef OrthancPluginErrorCode(* | OrthancPluginJobReset) (void *job)
| Callback executed once one stopped custom job is started again.
typedef OrthancPluginJobStepStatus(* | OrthancPluginJobStep) (void *job)
| Callback to execute one step of a custom job.
typedef OrthancPluginErrorCode(* | OrthancPluginJobStop) (void *job, OrthancPluginJobStopReason reason)
| Callback executed once one custom job leaves the "running" state.
typedef struct _OrthancPluginPeers_t | OrthancPluginPeers
| Opaque structure to the set of remote Orthanc Peers that are known to the local Orthanc server.
typedef OrthancPluginErrorCode(* | OrthancPluginServerChunkedRequestReaderAddChunk) (OrthancPluginServerChunkedRequestReader *reader, const void *data, uint32_t size)
| Callback invoked whenever a new data chunk is available during a chunked transfer.
typedef OrthancPluginErrorCode(* | OrthancPluginServerChunkedRequestReaderExecute) (OrthancPluginServerChunkedRequestReader *reader, OrthancPluginRestOutput *output)
| Callback invoked whenever the request body is entirely received.
typedef OrthancPluginErrorCode(* | OrthancPluginServerChunkedRequestReaderFactory) (OrthancPluginServerChunkedRequestReader **reader, const char *url, const OrthancPluginHttpRequest *request)
| Callback to create a reader to handle incoming chunked HTTP transfers.
typedef void(* | OrthancPluginServerChunkedRequestReaderFinalize) (OrthancPluginServerChunkedRequestReader *reader)
| Callback invoked to release the resources associated with an incoming HTTP chunked transfer.

## Enumerations
enum | OrthancPluginConstraintType { OrthancPluginConstraintType_Equal , OrthancPluginConstraintType_SmallerOrEqual , OrthancPluginConstraintType_GreaterOrEqual , OrthancPluginConstraintType_Wildcard , OrthancPluginConstraintType_List , _OrthancPluginConstraintType_INTERNAL }
enum | OrthancPluginContentType { OrthancPluginContentType_Unknown , OrthancPluginContentType_Dicom , OrthancPluginContentType_DicomAsJson , OrthancPluginContentType_DicomUntilPixelData , _OrthancPluginContentType_INTERNAL }
enum | OrthancPluginCreateDicomFlags { OrthancPluginCreateDicomFlags_None , OrthancPluginCreateDicomFlags_DecodeDataUriScheme , OrthancPluginCreateDicomFlags_GenerateIdentifiers , _OrthancPluginCreateDicomFlags_INTERNAL }
enum | OrthancPluginDicomToJsonFlags { OrthancPluginDicomToJsonFlags_None , OrthancPluginDicomToJsonFlags_IncludeBinary , OrthancPluginDicomToJsonFlags_IncludePrivateTags , OrthancPluginDicomToJsonFlags_IncludeUnknownTags , OrthancPluginDicomToJsonFlags_IncludePixelData , OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii , OrthancPluginDicomToJsonFlags_ConvertBinaryToNull , OrthancPluginDicomToJsonFlags_StopAfterPixelData , OrthancPluginDicomToJsonFlags_SkipGroupLengths , _OrthancPluginDicomToJsonFlags_INTERNAL }
enum | OrthancPluginDicomToJsonFormat { OrthancPluginDicomToJsonFormat_Full , OrthancPluginDicomToJsonFormat_Short , OrthancPluginDicomToJsonFormat_Human , _OrthancPluginDicomToJsonFormat_INTERNAL }
enum | OrthancPluginDicomWebBinaryMode { OrthancPluginDicomWebBinaryMode_Ignore , OrthancPluginDicomWebBinaryMode_InlineBinary , OrthancPluginDicomWebBinaryMode_BulkDataUri }
enum | OrthancPluginErrorCode { OrthancPluginErrorCode_InternalError , OrthancPluginErrorCode_Success , OrthancPluginErrorCode_Plugin , OrthancPluginErrorCode_NotImplemented , OrthancPluginErrorCode_ParameterOutOfRange , OrthancPluginErrorCode_NotEnoughMemory , OrthancPluginErrorCode_BadParameterType , OrthancPluginErrorCode_BadSequenceOfCalls , OrthancPluginErrorCode_InexistentItem , OrthancPluginErrorCode_BadRequest , OrthancPluginErrorCode_NetworkProtocol , OrthancPluginErrorCode_SystemCommand , OrthancPluginErrorCode_Database , OrthancPluginErrorCode_UriSyntax , OrthancPluginErrorCode_InexistentFile , OrthancPluginErrorCode_CannotWriteFile , OrthancPluginErrorCode_BadFileFormat , OrthancPluginErrorCode_Timeout , OrthancPluginErrorCode_UnknownResource , OrthancPluginErrorCode_IncompatibleDatabaseVersion , OrthancPluginErrorCode_FullStorage , OrthancPluginErrorCode_CorruptedFile , OrthancPluginErrorCode_InexistentTag , OrthancPluginErrorCode_ReadOnly , OrthancPluginErrorCode_IncompatibleImageFormat , OrthancPluginErrorCode_IncompatibleImageSize , OrthancPluginErrorCode_SharedLibrary , OrthancPluginErrorCode_UnknownPluginService , OrthancPluginErrorCode_UnknownDicomTag , OrthancPluginErrorCode_BadJson , OrthancPluginErrorCode_Unauthorized , OrthancPluginErrorCode_BadFont , OrthancPluginErrorCode_DatabasePlugin , OrthancPluginErrorCode_StorageAreaPlugin , OrthancPluginErrorCode_EmptyRequest , OrthancPluginErrorCode_NotAcceptable , OrthancPluginErrorCode_NullPointer , OrthancPluginErrorCode_DatabaseUnavailable , OrthancPluginErrorCode_CanceledJob , OrthancPluginErrorCode_BadGeometry , OrthancPluginErrorCode_SslInitialization , OrthancPluginErrorCode_DiscontinuedAbi , OrthancPluginErrorCode_BadRange , OrthancPluginErrorCode_DatabaseCannotSerialize , OrthancPluginErrorCode_Revision , OrthancPluginErrorCode_MainDicomTagsMultiplyDefined , OrthancPluginErrorCode_ForbiddenAccess , OrthancPluginErrorCode_DuplicateResource , OrthancPluginErrorCode_IncompatibleConfigurations , OrthancPluginErrorCode_SQLiteNotOpened , OrthancPluginErrorCode_SQLiteAlreadyOpened , OrthancPluginErrorCode_SQLiteCannotOpen , OrthancPluginErrorCode_SQLiteStatementAlreadyUsed , OrthancPluginErrorCode_SQLiteExecute , OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction , OrthancPluginErrorCode_SQLiteCommitWithoutTransaction , OrthancPluginErrorCode_SQLiteRegisterFunction , OrthancPluginErrorCode_SQLiteFlush , OrthancPluginErrorCode_SQLiteCannotRun , OrthancPluginErrorCode_SQLiteCannotStep , OrthancPluginErrorCode_SQLiteBindOutOfRange , OrthancPluginErrorCode_SQLitePrepareStatement , OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted , OrthancPluginErrorCode_SQLiteTransactionCommit , OrthancPluginErrorCode_SQLiteTransactionBegin , OrthancPluginErrorCode_DirectoryOverFile , OrthancPluginErrorCode_FileStorageCannotWrite , OrthancPluginErrorCode_DirectoryExpected , OrthancPluginErrorCode_HttpPortInUse , OrthancPluginErrorCode_DicomPortInUse , OrthancPluginErrorCode_BadHttpStatusInRest , OrthancPluginErrorCode_RegularFileExpected , OrthancPluginErrorCode_PathToExecutable , OrthancPluginErrorCode_MakeDirectory , OrthancPluginErrorCode_BadApplicationEntityTitle , OrthancPluginErrorCode_NoCFindHandler , OrthancPluginErrorCode_NoCMoveHandler , OrthancPluginErrorCode_NoCStoreHandler , OrthancPluginErrorCode_NoApplicationEntityFilter , OrthancPluginErrorCode_NoSopClassOrInstance , OrthancPluginErrorCode_NoPresentationContext , OrthancPluginErrorCode_DicomFindUnavailable , OrthancPluginErrorCode_DicomMoveUnavailable , OrthancPluginErrorCode_CannotStoreInstance , OrthancPluginErrorCode_CreateDicomNotString , OrthancPluginErrorCode_CreateDicomOverrideTag , OrthancPluginErrorCode_CreateDicomUseContent , OrthancPluginErrorCode_CreateDicomNoPayload , OrthancPluginErrorCode_CreateDicomUseDataUriScheme , OrthancPluginErrorCode_CreateDicomBadParent , OrthancPluginErrorCode_CreateDicomParentIsInstance , OrthancPluginErrorCode_CreateDicomParentEncoding , OrthancPluginErrorCode_UnknownModality , OrthancPluginErrorCode_BadJobOrdering , OrthancPluginErrorCode_JsonToLuaTable , OrthancPluginErrorCode_CannotCreateLua , OrthancPluginErrorCode_CannotExecuteLua , OrthancPluginErrorCode_LuaAlreadyExecuted , OrthancPluginErrorCode_LuaBadOutput , OrthancPluginErrorCode_NotLuaPredicate , OrthancPluginErrorCode_LuaReturnsNoString , OrthancPluginErrorCode_StorageAreaAlreadyRegistered , OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered , OrthancPluginErrorCode_DatabaseNotInitialized , OrthancPluginErrorCode_SslDisabled , OrthancPluginErrorCode_CannotOrderSlices , OrthancPluginErrorCode_NoWorklistHandler , OrthancPluginErrorCode_AlreadyExistingTag , OrthancPluginErrorCode_NoStorageCommitmentHandler , OrthancPluginErrorCode_NoCGetHandler , OrthancPluginErrorCode_DicomGetUnavailable , OrthancPluginErrorCode_UnsupportedMediaType , _OrthancPluginErrorCode_INTERNAL }
enum | OrthancPluginHttpMethod { OrthancPluginHttpMethod_Get , OrthancPluginHttpMethod_Post , OrthancPluginHttpMethod_Put , OrthancPluginHttpMethod_Delete , _OrthancPluginHttpMethod_INTERNAL }
enum | OrthancPluginIdentifierConstraint { OrthancPluginIdentifierConstraint_Equal , OrthancPluginIdentifierConstraint_SmallerOrEqual , OrthancPluginIdentifierConstraint_GreaterOrEqual , OrthancPluginIdentifierConstraint_Wildcard , _OrthancPluginIdentifierConstraint_INTERNAL }
enum | OrthancPluginInstanceOrigin { OrthancPluginInstanceOrigin_Unknown , OrthancPluginInstanceOrigin_DicomProtocol , OrthancPluginInstanceOrigin_RestApi , OrthancPluginInstanceOrigin_Plugin , OrthancPluginInstanceOrigin_Lua , OrthancPluginInstanceOrigin_WebDav , _OrthancPluginInstanceOrigin_INTERNAL }
enum | OrthancPluginJobStepStatus { OrthancPluginJobStepStatus_Success , OrthancPluginJobStepStatus_Failure , OrthancPluginJobStepStatus_Continue }
enum | OrthancPluginJobStopReason { OrthancPluginJobStopReason_Success , OrthancPluginJobStopReason_Paused , OrthancPluginJobStopReason_Failure , OrthancPluginJobStopReason_Canceled }
enum | OrthancPluginLoadDicomInstanceMode { OrthancPluginLoadDicomInstanceMode_WholeDicom , OrthancPluginLoadDicomInstanceMode_UntilPixelData , OrthancPluginLoadDicomInstanceMode_EmptyPixelData , _OrthancPluginLoadDicomInstanceMode_INTERNAL }
enum | OrthancPluginLogCategory { OrthancPluginLogCategory_Generic , OrthancPluginLogCategory_Plugins , OrthancPluginLogCategory_Http , OrthancPluginLogCategory_Sqlite , OrthancPluginLogCategory_Dicom , OrthancPluginLogCategory_Jobs , OrthancPluginLogCategory_Lua , _OrthancPluginLogCategory_INTERNAL }
enum | OrthancPluginLogLevel { OrthancPluginLogLevel_Error , OrthancPluginLogLevel_Warning , OrthancPluginLogLevel_Info , OrthancPluginLogLevel_Trace , _OrthancPluginLogLevel_INTERNAL }
enum | OrthancPluginMetricsType { OrthancPluginMetricsType_Default , OrthancPluginMetricsType_Timer }
enum | OrthancPluginReceivedInstanceAction { OrthancPluginReceivedInstanceAction_KeepAsIs , OrthancPluginReceivedInstanceAction_Modify , OrthancPluginReceivedInstanceAction_Discard , _OrthancPluginReceivedInstanceAction_INTERNAL }
enum | OrthancPluginResourceType { OrthancPluginResourceType_Patient , OrthancPluginResourceType_Study , OrthancPluginResourceType_Series , OrthancPluginResourceType_Instance , OrthancPluginResourceType_None , _OrthancPluginResourceType_INTERNAL }
enum | OrthancPluginStorageCommitmentFailureReason { OrthancPluginStorageCommitmentFailureReason_Success , OrthancPluginStorageCommitmentFailureReason_ProcessingFailure , OrthancPluginStorageCommitmentFailureReason_NoSuchObjectInstance , OrthancPluginStorageCommitmentFailureReason_ResourceLimitation , OrthancPluginStorageCommitmentFailureReason_ReferencedSOPClassNotSupported , OrthancPluginStorageCommitmentFailureReason_ClassInstanceConflict , OrthancPluginStorageCommitmentFailureReason_DuplicateTransactionUID }
enum | OrthancPluginValueRepresentation { OrthancPluginValueRepresentation_AE , OrthancPluginValueRepresentation_AS , OrthancPluginValueRepresentation_AT , OrthancPluginValueRepresentation_CS , OrthancPluginValueRepresentation_DA , OrthancPluginValueRepresentation_DS , OrthancPluginValueRepresentation_DT , OrthancPluginValueRepresentation_FD , OrthancPluginValueRepresentation_FL , OrthancPluginValueRepresentation_IS , OrthancPluginValueRepresentation_LO , OrthancPluginValueRepresentation_LT , OrthancPluginValueRepresentation_OB , OrthancPluginValueRepresentation_OF , OrthancPluginValueRepresentation_OW , OrthancPluginValueRepresentation_PN , OrthancPluginValueRepresentation_SH , OrthancPluginValueRepresentation_SL , OrthancPluginValueRepresentation_SQ , OrthancPluginValueRepresentation_SS , OrthancPluginValueRepresentation_ST , OrthancPluginValueRepresentation_TM , OrthancPluginValueRepresentation_UI , OrthancPluginValueRepresentation_UL , OrthancPluginValueRepresentation_UN , OrthancPluginValueRepresentation_US , OrthancPluginValueRepresentation_UT , _OrthancPluginValueRepresentation_INTERNAL }

## Functions
const char * | OrthancPluginAutodetectMimeType (OrthancPluginContext *context, const char *path)
| Detect the MIME type of a file.
OrthancPluginErrorCode | OrthancPluginCallPeerApi (OrthancPluginContext *context, OrthancPluginMemoryBuffer *answerBody, OrthancPluginMemoryBuffer *answerHeaders, uint16_t *httpStatus, const OrthancPluginPeers *peers, uint32_t peerIndex, OrthancPluginHttpMethod method, const char *uri, uint32_t additionalHeadersCount, const char *const *additionalHeadersKeys, const char *const *additionalHeadersValues, const void *body, uint32_t bodySize, uint32_t timeout)
| Call the REST API of an Orthanc peer.
OrthancPluginErrorCode | OrthancPluginChunkedHttpClient (OrthancPluginContext *context, void *answer, OrthancPluginChunkedClientAnswerAddChunk answerAddChunk, OrthancPluginChunkedClientAnswerAddHeader answerAddHeader, uint16_t *httpStatus, OrthancPluginHttpMethod method, const char *url, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, void *request, OrthancPluginChunkedClientRequestIsDone requestIsDone, OrthancPluginChunkedClientRequestGetChunkData requestChunkData, OrthancPluginChunkedClientRequestGetChunkSize requestChunkSize, OrthancPluginChunkedClientRequestNext requestNext, const char *username, const char *password, uint32_t timeout, const char *certificateFile, const char *certificateKeyFile, const char *certificateKeyPassword, uint8_t pkcs11)
| Issue a HTTP call, using chunked HTTP transfers.
char * | OrthancPluginComputeMd5 (OrthancPluginContext *context, const void *buffer, uint32_t size)
| Compute an MD5 hash.
char * | OrthancPluginComputeSha1 (OrthancPluginContext *context, const void *buffer, uint32_t size)
| Compute a SHA-1 hash.
OrthancPluginErrorCode | OrthancPluginCreateDicom (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *json, const OrthancPluginImage *pixelData, OrthancPluginCreateDicomFlags flags)
| Create a DICOM instance from a JSON string and an image.
OrthancPluginErrorCode | OrthancPluginCreateDicom2 (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *json, const OrthancPluginImage *pixelData, OrthancPluginCreateDicomFlags flags, const char *privateCreator)
| Create a DICOM instance from a JSON string and an image, with a private creator.
OrthancPluginFindMatcher * | OrthancPluginCreateFindMatcher (OrthancPluginContext *context, const void *query, uint32_t size)
| Create a C-Find matcher.
OrthancPluginJob * | OrthancPluginCreateJob (OrthancPluginContext *context, void *job, OrthancPluginJobFinalize finalize, const char *type, OrthancPluginJobGetProgress getProgress, OrthancPluginJobGetContent getContent, OrthancPluginJobGetSerialized getSerialized, OrthancPluginJobStep step, OrthancPluginJobStop stop, OrthancPluginJobReset reset)
| Create a custom job.
OrthancPluginJob * | OrthancPluginCreateJob2 (OrthancPluginContext *context, void *job, OrthancPluginJobFinalize finalize, const char *type, OrthancPluginJobGetProgress getProgress, OrthancPluginJobGetContent2 getContent, OrthancPluginJobGetSerialized2 getSerialized, OrthancPluginJobStep step, OrthancPluginJobStop stop, OrthancPluginJobReset reset)
| Create a custom job.
OrthancPluginErrorCode | OrthancPluginCreateMemoryBuffer (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, uint32_t size)
| Create a 32-bit memory buffer.
OrthancPluginErrorCode | OrthancPluginCreateMemoryBuffer64 (OrthancPluginContext *context, OrthancPluginMemoryBuffer64 *target, uint64_t size)
| Create a 64-bit memory buffer.
char * | OrthancPluginDicomBufferToJson (OrthancPluginContext *context, const void *buffer, uint32_t size, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, uint32_t maxStringLength)
| Format a DICOM memory buffer as a JSON string.
char * | OrthancPluginDicomInstanceToJson (OrthancPluginContext *context, const char *instanceId, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, uint32_t maxStringLength)
| Format a DICOM instance as a JSON string.
char * | OrthancPluginEncodeDicomWebJson (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback)
| Convert a DICOM instance to DICOMweb JSON.
char * | OrthancPluginEncodeDicomWebJson2 (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback2 callback, void *payload)
| Convert a DICOM instance to DICOMweb JSON.
char * | OrthancPluginEncodeDicomWebXml (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback)
| Convert a DICOM instance to DICOMweb XML.
char * | OrthancPluginEncodeDicomWebXml2 (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback2 callback, void *payload)
| Convert a DICOM instance to DICOMweb XML.
void | OrthancPluginExtendOrthancExplorer (OrthancPluginContext *context, const char *javascript)
| Extend the JavaScript code of Orthanc Explorer.
void | OrthancPluginExtendOrthancExplorer2 (OrthancPluginContext *context, const char *plugin, const char *javascript)
| Extend the JavaScript code of Orthanc Explorer.
int32_t | OrthancPluginFindMatcherIsMatch (OrthancPluginContext *context, const OrthancPluginFindMatcher *matcher, const void *dicom, uint32_t size)
| Test whether a DICOM instance matches a C-Find query.
void | OrthancPluginFreeFindMatcher (OrthancPluginContext *context, OrthancPluginFindMatcher *matcher)
| Free a C-Find matcher.
void | OrthancPluginFreeJob (OrthancPluginContext *context, OrthancPluginJob *job)
| Free a custom job.
void | OrthancPluginFreeMemoryBuffer (OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
| Free a memory buffer.
void | OrthancPluginFreeMemoryBuffer64 (OrthancPluginContext *context, OrthancPluginMemoryBuffer64 *buffer)
| Free a memory buffer.
void | OrthancPluginFreePeers (OrthancPluginContext *context, OrthancPluginPeers *peers)
| Free the list of available Orthanc peers.
void | OrthancPluginFreeString (OrthancPluginContext *context, char *str)
| Free a string.
char * | OrthancPluginGenerateUuid (OrthancPluginContext *context)
| Generate an UUID.
char * | OrthancPluginGetCommandLineArgument (OrthancPluginContext *context, uint32_t argument)
| Get the value of a command-line argument.
uint32_t | OrthancPluginGetCommandLineArgumentsCount (OrthancPluginContext *context)
| Get the number of command-line arguments.
char * | OrthancPluginGetConfiguration (OrthancPluginContext *context)
| Return the content of the configuration file(s).
char * | OrthancPluginGetConfigurationPath (OrthancPluginContext *context)
| Return the path to the configuration file(s).
const char * | OrthancPluginGetDatabaseServerIdentifier (OrthancPluginContext *context)
| Gets the DatabaseServerIdentifier.
const char * | OrthancPluginGetErrorDescription (OrthancPluginContext *context, OrthancPluginErrorCode error)
| Get the description of a given error code.
char * | OrthancPluginGetOrthancDirectory (OrthancPluginContext *context)
| Return the directory containing the Orthanc.
char * | OrthancPluginGetOrthancPath (OrthancPluginContext *context)
| Return the path to the Orthanc executable.
const char * | OrthancPluginGetPeerName (OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex)
| Get the symbolic name of an Orthanc peer.
OrthancPluginPeers * | OrthancPluginGetPeers (OrthancPluginContext *context)
| Return the list of available Orthanc peers.
uint32_t | OrthancPluginGetPeersCount (OrthancPluginContext *context, const OrthancPluginPeers *peers)
| Get the number of Orthanc peers.
const char * | OrthancPluginGetPeerUrl (OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex)
| Get the base URL of an Orthanc peer.
const char * | OrthancPluginGetPeerUserProperty (OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex, const char *userProperty)
| Get some user-defined property of an Orthanc peer.
char * | OrthancPluginGetTagName (OrthancPluginContext *context, uint16_t group, uint16_t element, const char *privateCreator)
| Returns the symbolic name of a DICOM tag.
OrthancPluginErrorCode | OrthancPluginHttpClient (OrthancPluginContext *context, OrthancPluginMemoryBuffer *answerBody, OrthancPluginMemoryBuffer *answerHeaders, uint16_t *httpStatus, OrthancPluginHttpMethod method, const char *url, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, const void *body, uint32_t bodySize, const char *username, const char *password, uint32_t timeout, const char *certificateFile, const char *certificateKeyFile, const char *certificateKeyPassword, uint8_t pkcs11)
| Issue a HTTP call with full flexibility.
OrthancPluginErrorCode | OrthancPluginHttpDelete (OrthancPluginContext *context, const char *url, const char *username, const char *password)
| Issue a HTTP DELETE call.
OrthancPluginErrorCode | OrthancPluginHttpGet (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password)
| Issue a HTTP GET call.
OrthancPluginErrorCode | OrthancPluginHttpPost (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const void *body, uint32_t bodySize, const char *username, const char *password)
| Issue a HTTP POST call.
OrthancPluginErrorCode | OrthancPluginHttpPut (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const void *body, uint32_t bodySize, const char *username, const char *password)
| Issue a HTTP PUT call.
void | OrthancPluginLogError (OrthancPluginContext *context, const char *message)
| Log an error.
void | OrthancPluginLogInfo (OrthancPluginContext *context, const char *message)
| Log an information.
void | OrthancPluginLogMessage (OrthancPluginContext *context, const char *message, const char *plugin, const char *file, uint32_t line, OrthancPluginLogCategory category, OrthancPluginLogLevel level)
| Log a message.
void | OrthancPluginLogWarning (OrthancPluginContext *context, const char *message)
| Log a warning.
OrthancPluginErrorCode | OrthancPluginLookupDictionary (OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name)
| Get information about the given DICOM tag.
OrthancPluginErrorCode | OrthancPluginReadFile (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path)
| Read a file.
OrthancPluginErrorCode | OrthancPluginRegisterDictionaryTag (OrthancPluginContext *context, uint16_t group, uint16_t element, OrthancPluginValueRepresentation vr, const char *name, uint32_t minMultiplicity, uint32_t maxMultiplicity)
| Register a new tag into the DICOM dictionary.
OrthancPluginErrorCode | OrthancPluginRegisterErrorCode (OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message)
| Declare a custom error code for this plugin.
OrthancPluginErrorCode | OrthancPluginRegisterPrivateDictionaryTag (OrthancPluginContext *context, uint16_t group, uint16_t element, OrthancPluginValueRepresentation vr, const char *name, uint32_t minMultiplicity, uint32_t maxMultiplicity, const char *privateCreator)
| Register a new private tag into the DICOM dictionary.
OrthancPluginErrorCode | OrthancPluginSetCurrentThreadName (OrthancPluginContext *context, const char *threadName)
| Set the name of the current thread.
void | OrthancPluginSetDescription (OrthancPluginContext *context, const char *description)
| Set a description for this plugin.
void | OrthancPluginSetDescription2 (OrthancPluginContext *context, const char *plugin, const char *description)
| Set a description for this plugin.
void | OrthancPluginSetMetricsIntegerValue (OrthancPluginContext *context, const char *name, int64_t value, OrthancPluginMetricsType type)
| Set the value of an integer metrics.
void | OrthancPluginSetMetricsValue (OrthancPluginContext *context, const char *name, float value, OrthancPluginMetricsType type)
| Set the value of a floating-point metrics.
void | OrthancPluginSetRootUri (OrthancPluginContext *context, const char *uri)
| Set the URI where the plugin provides its Web interface.
void | OrthancPluginSetRootUri2 (OrthancPluginContext *context, const char *plugin, const char *uri)
| Set the URI where the plugin provides its Web interface.
char * | OrthancPluginSubmitJob (OrthancPluginContext *context, OrthancPluginJob *job, int32_t priority)
| Submit a new job to the jobs engine of Orthanc.
OrthancPluginErrorCode | OrthancPluginWriteFile (OrthancPluginContext *context, const char *path, const void *data, uint32_t size)
| Write a file.

## Detailed Description

## Typedef Documentation

## ◆ OrthancPluginChunkedClientAnswerAddChunk

typedef OrthancPluginErrorCode(* OrthancPluginChunkedClientAnswerAddChunk) (void *answer, const void *data, uint32_t size)

Signature of a callback function that is called by Orthanc acting as a HTTP client during a chunked HTTP transfer, as soon as it receives one data chunk from the answer of the remote HTTP server.

See also
  OrthancPluginChunkedHttpClient()

Parameters

  answer | The user payload, as provided by the calling plugin.
  data | The content of the data chunk.
  size | The size of the data chunk.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginChunkedClientAnswerAddHeader

typedef OrthancPluginErrorCode(* OrthancPluginChunkedClientAnswerAddHeader) (void *answer, const char *key, const char *value)

Signature of a callback function that is called by Orthanc acting as a HTTP client during a chunked HTTP transfer, as soon as it receives one HTTP header from the answer of the remote HTTP server.

See also
  OrthancPluginChunkedHttpClient()

Parameters

  answer | The user payload, as provided by the calling plugin.
  key | The key of the HTTP header.
  value | The value of the HTTP header.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginChunkedClientRequestGetChunkData

typedef const void *(* OrthancPluginChunkedClientRequestGetChunkData) (void *request)

Signature of a callback function that is called by Orthanc acting as a HTTP client during a chunked HTTP transfer, while reading the body of a POST or PUT request. The plugin must provide the content of the current chunk of data of the request body.

See also
  OrthancPluginChunkedHttpClient()

Parameters

  request | The user payload, as provided by the calling plugin.

Returns
  The content of the current request chunk.

## ◆ OrthancPluginChunkedClientRequestGetChunkSize

typedef uint32_t(* OrthancPluginChunkedClientRequestGetChunkSize) (void *request)

Signature of a callback function that is called by Orthanc acting as a HTTP client during a chunked HTTP transfer, while reading the body of a POST or PUT request. The plugin must provide the size of the current chunk of data of the request body.

See also
  OrthancPluginChunkedHttpClient()

Parameters

  request | The user payload, as provided by the calling plugin.

Returns
  The size of the current request chunk.

## ◆ OrthancPluginChunkedClientRequestIsDone

typedef uint8_t(* OrthancPluginChunkedClientRequestIsDone) (void *request)

Signature of a callback function that is called by Orthanc acting as a HTTP client during a chunked HTTP transfer, while reading the body of a POST or PUT request. The plugin must answer "1" as soon as the body is entirely read: The "request" data structure must act as an iterator.

See also
  OrthancPluginChunkedHttpClient()

Parameters

  request | The user payload, as provided by the calling plugin.

Returns
  "1" if the body is over, or "0" if there is still data to be read.

## ◆ OrthancPluginChunkedClientRequestNext

typedef OrthancPluginErrorCode(* OrthancPluginChunkedClientRequestNext) (void *request)

Signature of a callback function that is called by Orthanc acting as a HTTP client during a chunked HTTP transfer, while reading the body of a POST or PUT request. This function asks the plugin to advance to the next chunk of data of the request body: The "request" data structure must act as an iterator.

See also
  OrthancPluginChunkedHttpClient()

Parameters

  request | The user payload, as provided by the calling plugin.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginJobFinalize

typedef void(* OrthancPluginJobFinalize) (void *job)

Signature of a callback function that releases all the resources allocated by the given job. This job is the argument provided to OrthancPluginCreateJob().

Parameters

  job | The job of interest.

## ◆ OrthancPluginJobGetContent

typedef const char *(* OrthancPluginJobGetContent) (void *job)

Signature of a callback function that returns human-readable statistics about the job. This statistics must be formatted as a JSON object. This information is notably displayed in the "Jobs" tab of "Orthanc Explorer".

Parameters

  job | The job of interest.

Returns
  The statistics, as a JSON object encoded as a string.

Deprecated
  This signature should not be used anymore since Orthanc SDK 1.11.3.

## ◆ OrthancPluginJobGetContent2

typedef OrthancPluginErrorCode(* OrthancPluginJobGetContent2) (OrthancPluginMemoryBuffer *target, void *job)

Signature of a callback function that returns human-readable statistics about the job. This statistics must be formatted as a JSON object. This information is notably displayed in the "Jobs" tab of "Orthanc Explorer".

Parameters

  target | The target memory buffer where to store the JSON string. This buffer must be allocated using OrthancPluginCreateMemoryBuffer() and will be freed by the Orthanc core.
  job | The job of interest.

Returns
  0 if success, other value if error.

## ◆ OrthancPluginJobGetProgress

typedef float(* OrthancPluginJobGetProgress) (void *job)

Signature of a callback function that returns the progress of the job.

Parameters

  job | The job of interest.

Returns
  The progress, as a floating-point number ranging from 0 to 1.

## ◆ OrthancPluginJobGetSerialized

typedef const char *(* OrthancPluginJobGetSerialized) (void *job)

Signature of a callback function that returns a serialized version of the job, formatted as a JSON object. This serialization is stored in the Orthanc database, and is used to reload the job on the restart of Orthanc. The "unserialization" callback (with OrthancPluginJobsUnserializer signature) will receive this serialized object.

Parameters

  job | The job of interest.

Returns
  The serialized job, as a JSON object encoded as a string.

See also
  OrthancPluginRegisterJobsUnserializer()

Deprecated
  This signature should not be used anymore since Orthanc SDK 1.11.3.

## ◆ OrthancPluginJobGetSerialized2

typedef int32_t(* OrthancPluginJobGetSerialized2) (OrthancPluginMemoryBuffer *target, void *job)

Signature of a callback function that returns a serialized version of the job, formatted as a JSON object. This serialization is stored in the Orthanc database, and is used to reload the job on the restart of Orthanc. The "unserialization" callback (with OrthancPluginJobsUnserializer signature) will receive this serialized object.

Parameters

  target | The target memory buffer where to store the JSON string. This buffer must be allocated using OrthancPluginCreateMemoryBuffer() and will be freed by the Orthanc core.
  job | The job of interest.

Returns
  1 if the serialization has succeeded, 0 if serialization is not implemented for this type of job, or -1 in case of error.

## ◆ OrthancPluginJobReset

typedef OrthancPluginErrorCode(* OrthancPluginJobReset) (void *job)

Signature of a callback function that is invoked once a job leaves the "failure/canceled" state, to be started again. This function will typically reset the progress to zero. Note that before being actually executed, the job would first be tagged as "pending" in the Orthanc jobs engine.

Parameters

  job | The job of interest.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginJobStep

typedef OrthancPluginJobStepStatus(* OrthancPluginJobStep) (void *job)

Signature of a callback function that executes one step in the job. The jobs engine of Orthanc will make successive calls to this method, as long as it returns OrthancPluginJobStepStatus_Continue.

Parameters

  job | The job of interest.

Returns
  The status of execution.

## ◆ OrthancPluginJobStop

typedef OrthancPluginErrorCode(* OrthancPluginJobStop) (void *job, OrthancPluginJobStopReason reason)

Signature of a callback function that is invoked once a job leaves the "running" state. This can happen if the previous call to OrthancPluginJobStep has failed/succeeded, if the host Orthanc server is being stopped, or if the user manually tags the job as paused/canceled. This callback allows the plugin to free resources allocated for running this custom job (e.g. to stop threads, or to remove temporary files).

Note that handling pauses might involves a specific treatment (such a stopping threads, but keeping temporary files on the disk). This "paused" situation can be checked by looking at the "reason" parameter.

Parameters

  job | The job of interest.
  reason | The reason for leaving the "running" state.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginServerChunkedRequestReaderAddChunk

typedef OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderAddChunk) (OrthancPluginServerChunkedRequestReader *reader, const void *data, uint32_t size)

Signature of a callback function that is called by Orthanc acting as a HTTP server that supports chunked HTTP transfers. This callback is invoked as soon as a new data chunk is available for the request body.

See also
  OrthancPluginRegisterChunkedRestCallback()

Parameters

  reader | The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback.
  data | The content of the data chunk.
  size | The size of the data chunk.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginServerChunkedRequestReaderExecute

typedef OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderExecute) (OrthancPluginServerChunkedRequestReader *reader, OrthancPluginRestOutput *output)

Signature of a callback function that is called by Orthanc acting as a HTTP server that supports chunked HTTP transfers. This callback is invoked as soon as the full body of the HTTP request is available. The plugin can then send its answer thanks to the provided "output" object.

See also
  OrthancPluginRegisterChunkedRestCallback()

Parameters

  reader | The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback.
  output | The HTTP connection to the client application.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginServerChunkedRequestReaderFactory

typedef OrthancPluginErrorCode(* OrthancPluginServerChunkedRequestReaderFactory) (OrthancPluginServerChunkedRequestReader **reader, const char *url, const OrthancPluginHttpRequest *request)

Signature of a callback function that is called by Orthanc acting as a HTTP server that supports chunked HTTP transfers. This callback is only invoked if the HTTP method is POST or PUT. The callback must create an user-specific "reader" object that will be fed with the body of the incoming body.

See also
  OrthancPluginRegisterChunkedRestCallback()

Parameters

  reader | Memory location that must be filled with the newly-created reader.
  url | The URI that is accessed.
  request | The body of the HTTP request. Note that "body" and "bodySize" are not used.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginServerChunkedRequestReaderFinalize

typedef void(* OrthancPluginServerChunkedRequestReaderFinalize) (OrthancPluginServerChunkedRequestReader *reader)

Signature of a callback function that is called by Orthanc acting as a HTTP server that supports chunked HTTP transfers. This callback is invoked to release all the resources allocated by the given reader. Note that this function might be invoked even if the entire body was not read, to deal with client error or disconnection.

See also
  OrthancPluginRegisterChunkedRestCallback()

Parameters

  reader | The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback.

## Enumeration Type Documentation

## ◆ OrthancPluginConstraintType

enum OrthancPluginConstraintType

The constraints on the tags (main DICOM tags and identifier tags) that must be supported by the database plugins.

Enumerator
OrthancPluginConstraintType_Equal | Equal
OrthancPluginConstraintType_SmallerOrEqual | Less or equal
OrthancPluginConstraintType_GreaterOrEqual | More or equal
OrthancPluginConstraintType_Wildcard | Wildcard matching
OrthancPluginConstraintType_List | List of values

## ◆ OrthancPluginContentType

enum OrthancPluginContentType

The content types that are supported by Orthanc plugins.

Enumerator
OrthancPluginContentType_Unknown | Unknown content type
OrthancPluginContentType_Dicom | DICOM
OrthancPluginContentType_DicomAsJson | JSON summary of a DICOM file
OrthancPluginContentType_DicomUntilPixelData | DICOM Header till pixel data

## ◆ OrthancPluginCreateDicomFlags

enum OrthancPluginCreateDicomFlags

Flags for the creation of a DICOM file.

See also
  OrthancPluginCreateDicom()

Enumerator
OrthancPluginCreateDicomFlags_None | Default mode
OrthancPluginCreateDicomFlags_DecodeDataUriScheme | Decode fields encoded using data URI scheme
OrthancPluginCreateDicomFlags_GenerateIdentifiers | Automatically generate DICOM identifiers

## ◆ OrthancPluginDicomToJsonFlags

enum OrthancPluginDicomToJsonFlags

Flags to customize a DICOM-to-JSON conversion. By default, binary tags are formatted using Data URI scheme.

Enumerator
OrthancPluginDicomToJsonFlags_None | Default formatting
OrthancPluginDicomToJsonFlags_IncludeBinary | Include the binary tags
OrthancPluginDicomToJsonFlags_IncludePrivateTags | Include the private tags
OrthancPluginDicomToJsonFlags_IncludeUnknownTags | Include the tags unknown by the dictionary
OrthancPluginDicomToJsonFlags_IncludePixelData | Include the pixel data
OrthancPluginDicomToJsonFlags_ConvertBinaryToAscii | Output binary tags as-is, dropping non-ASCII
OrthancPluginDicomToJsonFlags_ConvertBinaryToNull | Signal binary tags as null values
OrthancPluginDicomToJsonFlags_StopAfterPixelData | Stop processing after pixel data (new in 1.9.1)
OrthancPluginDicomToJsonFlags_SkipGroupLengths | Skip tags whose element is zero (new in 1.9.1)

## ◆ OrthancPluginDicomToJsonFormat

enum OrthancPluginDicomToJsonFormat

The possible output formats for a DICOM-to-JSON conversion.

See also
  OrthancPluginDicomToJson()

Enumerator
OrthancPluginDicomToJsonFormat_Full | Full output, with most details
OrthancPluginDicomToJsonFormat_Short | Tags output as hexadecimal numbers
OrthancPluginDicomToJsonFormat_Human | Human-readable JSON

## ◆ OrthancPluginDicomWebBinaryMode

enum OrthancPluginDicomWebBinaryMode

The available modes to export a binary DICOM tag into a DICOMweb JSON or XML document.

Enumerator
OrthancPluginDicomWebBinaryMode_Ignore | Don't include binary tags
OrthancPluginDicomWebBinaryMode_InlineBinary | Inline encoding using Base64
OrthancPluginDicomWebBinaryMode_BulkDataUri | Use a bulk data URI field

## ◆ OrthancPluginErrorCode

enum OrthancPluginErrorCode

For Microsoft Visual Studio, a compatibility "stdint.h" can be downloaded at the following URL: https://orthanc.uclouvain.be/hg/orthanc/raw-file/default/OrthancFramework/Resources/ThirdParty/VisualStudio/stdint.h The various error codes that can be returned by the Orthanc core.

Enumerator
OrthancPluginErrorCode_InternalError | Internal error
OrthancPluginErrorCode_Success | Success
OrthancPluginErrorCode_Plugin | Error encountered within the plugin engine
OrthancPluginErrorCode_NotImplemented | Not implemented yet
OrthancPluginErrorCode_ParameterOutOfRange | Parameter out of range
OrthancPluginErrorCode_NotEnoughMemory | The server hosting Orthanc is running out of memory
OrthancPluginErrorCode_BadParameterType | Bad type for a parameter
OrthancPluginErrorCode_BadSequenceOfCalls | Bad sequence of calls
OrthancPluginErrorCode_InexistentItem | Accessing an inexistent item
OrthancPluginErrorCode_BadRequest | Bad request
OrthancPluginErrorCode_NetworkProtocol | Error in the network protocol
OrthancPluginErrorCode_SystemCommand | Error while calling a system command
OrthancPluginErrorCode_Database | Error with the database engine
OrthancPluginErrorCode_UriSyntax | Badly formatted URI
OrthancPluginErrorCode_InexistentFile | Inexistent file
OrthancPluginErrorCode_CannotWriteFile | Cannot write to file
OrthancPluginErrorCode_BadFileFormat | Bad file format
OrthancPluginErrorCode_Timeout | Timeout
OrthancPluginErrorCode_UnknownResource | Unknown resource
OrthancPluginErrorCode_IncompatibleDatabaseVersion | Incompatible version of the database
OrthancPluginErrorCode_FullStorage | The file storage is full
OrthancPluginErrorCode_CorruptedFile | Corrupted file (e.g. inconsistent MD5 hash)
OrthancPluginErrorCode_InexistentTag | Inexistent tag
OrthancPluginErrorCode_ReadOnly | Cannot modify a read-only data structure
OrthancPluginErrorCode_IncompatibleImageFormat | Incompatible format of the images
OrthancPluginErrorCode_IncompatibleImageSize | Incompatible size of the images
OrthancPluginErrorCode_SharedLibrary | Error while using a shared library (plugin)
OrthancPluginErrorCode_UnknownPluginService | Plugin invoking an unknown service
OrthancPluginErrorCode_UnknownDicomTag | Unknown DICOM tag
OrthancPluginErrorCode_BadJson | Cannot parse a JSON document
OrthancPluginErrorCode_Unauthorized | Bad credentials were provided to an HTTP request
OrthancPluginErrorCode_BadFont | Badly formatted font file
OrthancPluginErrorCode_DatabasePlugin | The plugin implementing a custom database back-end does not fulfill the proper interface
OrthancPluginErrorCode_StorageAreaPlugin | Error in the plugin implementing a custom storage area
OrthancPluginErrorCode_EmptyRequest | The request is empty
OrthancPluginErrorCode_NotAcceptable | Cannot send a response which is acceptable according to the Accept HTTP header
OrthancPluginErrorCode_NullPointer | Cannot handle a NULL pointer
OrthancPluginErrorCode_DatabaseUnavailable | The database is currently not available (probably a transient situation)
OrthancPluginErrorCode_CanceledJob | This job was canceled
OrthancPluginErrorCode_BadGeometry | Geometry error encountered in Stone
OrthancPluginErrorCode_SslInitialization | Cannot initialize SSL encryption, check out your certificates
OrthancPluginErrorCode_DiscontinuedAbi | Calling a function that has been removed from the Orthanc Framework
OrthancPluginErrorCode_BadRange | Incorrect range request
OrthancPluginErrorCode_DatabaseCannotSerialize | Database could not serialize access due to concurrent update, the transaction should be retried
OrthancPluginErrorCode_Revision | A bad revision number was provided, which might indicate conflict between multiple writers
OrthancPluginErrorCode_MainDicomTagsMultiplyDefined | A main DICOM Tag has been defined multiple times for the same resource level
OrthancPluginErrorCode_ForbiddenAccess | Access to a resource is forbidden
OrthancPluginErrorCode_DuplicateResource | Duplicate resource
OrthancPluginErrorCode_IncompatibleConfigurations | Your configuration file contains configuration that are mutually incompatible
OrthancPluginErrorCode_SQLiteNotOpened | SQLite: The database is not opened
OrthancPluginErrorCode_SQLiteAlreadyOpened | SQLite: Connection is already open
OrthancPluginErrorCode_SQLiteCannotOpen | SQLite: Unable to open the database
OrthancPluginErrorCode_SQLiteStatementAlreadyUsed | SQLite: This cached statement is already being referred to
OrthancPluginErrorCode_SQLiteExecute | SQLite: Cannot execute a command
OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction | SQLite: Rolling back a nonexistent transaction (have you called Begin()?)
OrthancPluginErrorCode_SQLiteCommitWithoutTransaction | SQLite: Committing a nonexistent transaction
OrthancPluginErrorCode_SQLiteRegisterFunction | SQLite: Unable to register a function
OrthancPluginErrorCode_SQLiteFlush | SQLite: Unable to flush the database
OrthancPluginErrorCode_SQLiteCannotRun | SQLite: Cannot run a cached statement
OrthancPluginErrorCode_SQLiteCannotStep | SQLite: Cannot step over a cached statement
OrthancPluginErrorCode_SQLiteBindOutOfRange | SQLite: Bind a value while out of range (serious error)
OrthancPluginErrorCode_SQLitePrepareStatement | SQLite: Cannot prepare a cached statement
OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted | SQLite: Beginning the same transaction twice
OrthancPluginErrorCode_SQLiteTransactionCommit | SQLite: Failure when committing the transaction
OrthancPluginErrorCode_SQLiteTransactionBegin | SQLite: Cannot start a transaction
OrthancPluginErrorCode_DirectoryOverFile | The directory to be created is already occupied by a regular file
OrthancPluginErrorCode_FileStorageCannotWrite | Unable to create a subdirectory or a file in the file storage
OrthancPluginErrorCode_DirectoryExpected | The specified path does not point to a directory
OrthancPluginErrorCode_HttpPortInUse | The TCP port of the HTTP server is privileged or already in use
OrthancPluginErrorCode_DicomPortInUse | The TCP port of the DICOM server is privileged or already in use
OrthancPluginErrorCode_BadHttpStatusInRest | This HTTP status is not allowed in a REST API
OrthancPluginErrorCode_RegularFileExpected | The specified path does not point to a regular file
OrthancPluginErrorCode_PathToExecutable | Unable to get the path to the executable
OrthancPluginErrorCode_MakeDirectory | Cannot create a directory
OrthancPluginErrorCode_BadApplicationEntityTitle | An application entity title (AET) cannot be empty or be longer than 16 characters
OrthancPluginErrorCode_NoCFindHandler | No request handler factory for DICOM C-FIND SCP
OrthancPluginErrorCode_NoCMoveHandler | No request handler factory for DICOM C-MOVE SCP
OrthancPluginErrorCode_NoCStoreHandler | No request handler factory for DICOM C-STORE SCP
OrthancPluginErrorCode_NoApplicationEntityFilter | No application entity filter
OrthancPluginErrorCode_NoSopClassOrInstance | DicomUserConnection: Unable to find the SOP class and instance
OrthancPluginErrorCode_NoPresentationContext | DicomUserConnection: No acceptable presentation context for modality
OrthancPluginErrorCode_DicomFindUnavailable | DicomUserConnection: The C-FIND command is not supported by the remote SCP
OrthancPluginErrorCode_DicomMoveUnavailable | DicomUserConnection: The C-MOVE command is not supported by the remote SCP
OrthancPluginErrorCode_CannotStoreInstance | Cannot store an instance
OrthancPluginErrorCode_CreateDicomNotString | Only string values are supported when creating DICOM instances
OrthancPluginErrorCode_CreateDicomOverrideTag | Trying to override a value inherited from a parent module
OrthancPluginErrorCode_CreateDicomUseContent | Use "Content" to inject an image into a new DICOM instance
OrthancPluginErrorCode_CreateDicomNoPayload | No payload is present for one instance in the series
OrthancPluginErrorCode_CreateDicomUseDataUriScheme | The payload of the DICOM instance must be specified according to Data URI scheme
OrthancPluginErrorCode_CreateDicomBadParent | Trying to attach a new DICOM instance to an inexistent resource
OrthancPluginErrorCode_CreateDicomParentIsInstance | Trying to attach a new DICOM instance to an instance (must be a series, study or patient)
OrthancPluginErrorCode_CreateDicomParentEncoding | Unable to get the encoding of the parent resource
OrthancPluginErrorCode_UnknownModality | Unknown modality
OrthancPluginErrorCode_BadJobOrdering | Bad ordering of filters in a job
OrthancPluginErrorCode_JsonToLuaTable | Cannot convert the given JSON object to a Lua table
OrthancPluginErrorCode_CannotCreateLua | Cannot create the Lua context
OrthancPluginErrorCode_CannotExecuteLua | Cannot execute a Lua command
OrthancPluginErrorCode_LuaAlreadyExecuted | Arguments cannot be pushed after the Lua function is executed
OrthancPluginErrorCode_LuaBadOutput | The Lua function does not give the expected number of outputs
OrthancPluginErrorCode_NotLuaPredicate | The Lua function is not a predicate (only true/false outputs allowed)
OrthancPluginErrorCode_LuaReturnsNoString | The Lua function does not return a string
OrthancPluginErrorCode_StorageAreaAlreadyRegistered | Another plugin has already registered a custom storage area
OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered | Another plugin has already registered a custom database back-end
OrthancPluginErrorCode_DatabaseNotInitialized | Plugin trying to call the database during its initialization
OrthancPluginErrorCode_SslDisabled | Orthanc has been built without SSL support
OrthancPluginErrorCode_CannotOrderSlices | Unable to order the slices of the series
OrthancPluginErrorCode_NoWorklistHandler | No request handler factory for DICOM C-Find Modality SCP
OrthancPluginErrorCode_AlreadyExistingTag | Cannot override the value of a tag that already exists
OrthancPluginErrorCode_NoStorageCommitmentHandler | No request handler factory for DICOM N-ACTION SCP (storage commitment)
OrthancPluginErrorCode_NoCGetHandler | No request handler factory for DICOM C-GET SCP
OrthancPluginErrorCode_DicomGetUnavailable | DicomUserConnection: The C-GET command is not supported by the remote SCP
OrthancPluginErrorCode_UnsupportedMediaType | Unsupported media type

## ◆ OrthancPluginHttpMethod

enum OrthancPluginHttpMethod

The various HTTP methods for a REST call.

Enumerator
OrthancPluginHttpMethod_Get | GET request
OrthancPluginHttpMethod_Post | POST request
OrthancPluginHttpMethod_Put | PUT request
OrthancPluginHttpMethod_Delete | DELETE request

## ◆ OrthancPluginIdentifierConstraint

enum OrthancPluginIdentifierConstraint

The constraints on the DICOM identifiers that must be supported by the database plugins.

Deprecated
  Plugins using OrthancPluginConstraintType will be faster

Enumerator
OrthancPluginIdentifierConstraint_Equal | Equal
OrthancPluginIdentifierConstraint_SmallerOrEqual | Less or equal
OrthancPluginIdentifierConstraint_GreaterOrEqual | More or equal
OrthancPluginIdentifierConstraint_Wildcard | Case-sensitive wildcard matching (with * and ?)

## ◆ OrthancPluginInstanceOrigin

enum OrthancPluginInstanceOrigin

The origin of a DICOM instance that has been received by Orthanc.

Enumerator
OrthancPluginInstanceOrigin_Unknown | Unknown origin
OrthancPluginInstanceOrigin_DicomProtocol | Instance received through DICOM protocol
OrthancPluginInstanceOrigin_RestApi | Instance received through REST API of Orthanc
OrthancPluginInstanceOrigin_Plugin | Instance added to Orthanc by a plugin
OrthancPluginInstanceOrigin_Lua | Instance added to Orthanc by a Lua script
OrthancPluginInstanceOrigin_WebDav | Instance received through WebDAV (new in 1.8.0)

## ◆ OrthancPluginJobStepStatus

enum OrthancPluginJobStepStatus

The possible status for one single step of a job.

Enumerator
OrthancPluginJobStepStatus_Success | The job has successfully executed all its steps
OrthancPluginJobStepStatus_Failure | The job has failed while executing this step
OrthancPluginJobStepStatus_Continue | The job has still data to process after this step

## ◆ OrthancPluginJobStopReason

enum OrthancPluginJobStopReason

Explains why the job should stop and release the resources it has allocated. This is especially important to disambiguate between the "paused" condition and the "final" conditions (success, failure, or canceled).

Enumerator
OrthancPluginJobStopReason_Success | The job has succeeded
OrthancPluginJobStopReason_Paused | The job was paused, and will be resumed later
OrthancPluginJobStopReason_Failure | The job has failed, and might be resubmitted later
OrthancPluginJobStopReason_Canceled | The job was canceled, and might be resubmitted later

## ◆ OrthancPluginLoadDicomInstanceMode

enum OrthancPluginLoadDicomInstanceMode

Mode specifying how to load a DICOM instance.

See also
  OrthancPluginLoadDicomInstance()

Enumerator
OrthancPluginLoadDicomInstanceMode_WholeDicom | Load the whole DICOM file, including pixel data
OrthancPluginLoadDicomInstanceMode_UntilPixelData | Load the whole DICOM file until pixel data, which speeds up the loading
OrthancPluginLoadDicomInstanceMode_EmptyPixelData | Load the whole DICOM file until pixel data, and replace pixel data by an empty tag whose VR (value representation) is the same as those of the original DICOM file

## ◆ OrthancPluginLogCategory

enum OrthancPluginLogCategory

The log categories supported by Orthanc.

These values must match those of enumeration "LogCategory" in the Orthanc Core.

Enumerator
OrthancPluginLogCategory_Generic | Generic (default) category
OrthancPluginLogCategory_Plugins | Plugin engine related logs (shall not be used by plugins)
OrthancPluginLogCategory_Http | HTTP related logs
OrthancPluginLogCategory_Sqlite | SQLite related logs (shall not be used by plugins)
OrthancPluginLogCategory_Dicom | DICOM related logs
OrthancPluginLogCategory_Jobs | jobs related logs
OrthancPluginLogCategory_Lua | Lua related logs (shall not be used by plugins)

## ◆ OrthancPluginLogLevel

enum OrthancPluginLogLevel

The log levels supported by Orthanc.

These values must match those of enumeration "LogLevel" in the Orthanc Core.

Enumerator
OrthancPluginLogLevel_Error | Error log level
OrthancPluginLogLevel_Warning | Warning log level
OrthancPluginLogLevel_Info | Info log level
OrthancPluginLogLevel_Trace | Trace log level

## ◆ OrthancPluginMetricsType

enum OrthancPluginMetricsType

The available types of metrics.

Enumerator
OrthancPluginMetricsType_Default | Default metrics
OrthancPluginMetricsType_Timer | This metrics represents a time duration. Orthanc will keep the maximum value of the metrics over a sliding window of ten seconds, which is useful if the metrics is sampled frequently.

## ◆ OrthancPluginReceivedInstanceAction

enum OrthancPluginReceivedInstanceAction

The action to be taken after ReceivedInstanceCallback is triggered

Enumerator
OrthancPluginReceivedInstanceAction_KeepAsIs | Keep the instance as is
OrthancPluginReceivedInstanceAction_Modify | Modify the instance
OrthancPluginReceivedInstanceAction_Discard | Discard the instance

## ◆ OrthancPluginResourceType

enum OrthancPluginResourceType

The supported types of DICOM resources.

Enumerator
OrthancPluginResourceType_Patient | Patient
OrthancPluginResourceType_Study | Study
OrthancPluginResourceType_Series | Series
OrthancPluginResourceType_Instance | Instance
OrthancPluginResourceType_None | Unavailable resource type

## ◆ OrthancPluginStorageCommitmentFailureReason

enum OrthancPluginStorageCommitmentFailureReason

The available values for the Failure Reason (0008,1197) during storage commitment. http://dicom.nema.org/medical/dicom/2019e/output/chtml/part03/sect_C.14.html#sect_C.14.1.1

Enumerator
OrthancPluginStorageCommitmentFailureReason_Success | Success: The DICOM instance is properly stored in the SCP
OrthancPluginStorageCommitmentFailureReason_ProcessingFailure | 0110H: A general failure in processing the operation was encountered
OrthancPluginStorageCommitmentFailureReason_NoSuchObjectInstance | 0112H: One or more of the elements in the Referenced SOP Instance Sequence was not available
OrthancPluginStorageCommitmentFailureReason_ResourceLimitation | 0213H: The SCP does not currently have enough resources to store the requested SOP Instance(s)
OrthancPluginStorageCommitmentFailureReason_ReferencedSOPClassNotSupported | 0122H: Storage Commitment has been requested for a SOP Instance with a SOP Class that is not supported by the SCP
OrthancPluginStorageCommitmentFailureReason_ClassInstanceConflict | 0119H: The SOP Class of an element in the Referenced SOP Instance Sequence did not correspond to the SOP class registered for this SOP Instance at the SCP
OrthancPluginStorageCommitmentFailureReason_DuplicateTransactionUID | 0131H: The Transaction UID of the Storage Commitment Request is already in use

## ◆ OrthancPluginValueRepresentation

enum OrthancPluginValueRepresentation

The value representations present in the DICOM standard (version 2013).

Enumerator
OrthancPluginValueRepresentation_AE | Application Entity
OrthancPluginValueRepresentation_AS | Age String
OrthancPluginValueRepresentation_AT | Attribute Tag
OrthancPluginValueRepresentation_CS | Code String
OrthancPluginValueRepresentation_DA | Date
OrthancPluginValueRepresentation_DS | Decimal String
OrthancPluginValueRepresentation_DT | Date Time
OrthancPluginValueRepresentation_FD | Floating Point Double
OrthancPluginValueRepresentation_FL | Floating Point Single
OrthancPluginValueRepresentation_IS | Integer String
OrthancPluginValueRepresentation_LO | Long String
OrthancPluginValueRepresentation_LT | Long Text
OrthancPluginValueRepresentation_OB | Other Byte String
OrthancPluginValueRepresentation_OF | Other Float String
OrthancPluginValueRepresentation_OW | Other Word String
OrthancPluginValueRepresentation_PN | Person Name
OrthancPluginValueRepresentation_SH | Short String
OrthancPluginValueRepresentation_SL | Signed Long
OrthancPluginValueRepresentation_SQ | Sequence of Items
OrthancPluginValueRepresentation_SS | Signed Short
OrthancPluginValueRepresentation_ST | Short Text
OrthancPluginValueRepresentation_TM | Time
OrthancPluginValueRepresentation_UI | Unique Identifier (UID)
OrthancPluginValueRepresentation_UL | Unsigned Long
OrthancPluginValueRepresentation_UN | Unknown
OrthancPluginValueRepresentation_US | Unsigned Short
OrthancPluginValueRepresentation_UT | Unlimited Text

## Function Documentation

## ◆ OrthancPluginAutodetectMimeType()

const char * OrthancPluginAutodetectMimeType | ( | OrthancPluginContext * | context,
|  | const char * | path )

This function returns the MIME type of a file by inspecting its extension.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  path | Path to the file.

Returns
  The MIME type. This is a statically-allocated string, do not free it.

## ◆ OrthancPluginCallPeerApi()

OrthancPluginErrorCode OrthancPluginCallPeerApi | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | answerBody,
|  | OrthancPluginMemoryBuffer * | answerHeaders,
|  | uint16_t * | httpStatus,
|  | const OrthancPluginPeers * | peers,
|  | uint32_t | peerIndex,
|  | OrthancPluginHttpMethod | method,
|  | const char * | uri,
|  | uint32_t | additionalHeadersCount,
|  | const char *const * | additionalHeadersKeys,
|  | const char *const * | additionalHeadersValues,
|  | const void * | body,
|  | uint32_t | bodySize,
|  | uint32_t | timeout )

Make a REST call to the given URI in the REST API of a remote Orthanc peer. The result to the query is stored into a newly allocated memory buffer. The HTTP request will be done according to the "OrthancPeers" configuration option of Orthanc.

This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  answerBody | The target memory buffer (out argument). It must be freed with OrthancPluginFreeMemoryBuffer(). The value of this argument is ignored if the HTTP method is DELETE.
  answerHeaders | The target memory buffer for the HTTP headers in the answers (out argument). The answer headers are formatted as a JSON object (associative array). The buffer must be freed with OrthancPluginFreeMemoryBuffer(). This argument can be set to NULL if the plugin has no interest in the HTTP headers.
  httpStatus | The HTTP status after the execution of the request (out argument).
  peers | The data structure describing the Orthanc peers.
  peerIndex | The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().
  method | HTTP method to be used.
  uri | The URI of interest in the REST API.
  additionalHeadersCount | The number of HTTP headers to be added to the HTTP headers provided in the global configuration of Orthanc.
  additionalHeadersKeys | Array containing the keys of the HTTP headers (can be NULL if no header).
  additionalHeadersValues | Array containing the values of the HTTP headers (can be NULL if no header).
  body | The HTTP body for a POST or PUT request.
  bodySize | The size of the body.
  timeout | Timeout in seconds (0 for default timeout).

Returns
  0 if success, or the error code if failure.

See also
  OrthancPluginHttpClient()

## ◆ OrthancPluginChunkedHttpClient()

OrthancPluginErrorCode OrthancPluginChunkedHttpClient | ( | OrthancPluginContext * | context,
|  | void * | answer,
|  | OrthancPluginChunkedClientAnswerAddChunk | answerAddChunk,
|  | OrthancPluginChunkedClientAnswerAddHeader | answerAddHeader,
|  | uint16_t * | httpStatus,
|  | OrthancPluginHttpMethod | method,
|  | const char * | url,
|  | uint32_t | headersCount,
|  | const char *const * | headersKeys,
|  | const char *const * | headersValues,
|  | void * | request,
|  | OrthancPluginChunkedClientRequestIsDone | requestIsDone,
|  | OrthancPluginChunkedClientRequestGetChunkData | requestChunkData,
|  | OrthancPluginChunkedClientRequestGetChunkSize | requestChunkSize,
|  | OrthancPluginChunkedClientRequestNext | requestNext,
|  | const char * | username,
|  | const char * | password,
|  | uint32_t | timeout,
|  | const char * | certificateFile,
|  | const char * | certificateKeyFile,
|  | const char * | certificateKeyPassword,
|  | uint8_t | pkcs11 )

Make a HTTP call to the given URL using chunked HTTP transfers. The request body is provided as an iterator over data chunks. The answer is provided as a sequence of function calls with the individual HTTP headers and answer chunks.

Contrarily to OrthancPluginHttpClient() that entirely stores the request body and the answer body in memory buffers, this function uses chunked HTTP transfers. This results in a lower memory consumption. Pay attention to the fact that Orthanc servers with version <= 1.5.6 do not support chunked transfers: You must use OrthancPluginHttpClient() if contacting such older servers.

The HTTP request will be done accordingly to the global configuration of Orthanc (in particular, the options "HttpProxy", "HttpTimeout", "HttpsVerifyPeers", "HttpsCACertificates", and "Pkcs11" will be taken into account).

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  answer | The user payload for the answer body. It will be provided to the callbacks for the answer.
  answerAddChunk | Callback function to report a data chunk from the answer body.
  answerAddHeader | Callback function to report an HTTP header sent by the remote server.
  httpStatus | The HTTP status after the execution of the request (out argument).
  method | HTTP method to be used.
  url | The URL of interest.
  headersCount | The number of HTTP headers.
  headersKeys | Array containing the keys of the HTTP headers (can be NULL if no header).
  headersValues | Array containing the values of the HTTP headers (can be NULL if no header).
  request | The user payload containing the request body, and acting as an iterator. It will be provided to the callbacks for the request.
  requestIsDone | Callback function to tell whether the request body is entirely read.
  requestChunkData | Callback function to get the content of the current data chunk of the request body.
  requestChunkSize | Callback function to get the size of the current data chunk of the request body.
  requestNext | Callback function to advance to the next data chunk of the request body.
  username | The username (can be NULL if no password protection).
  password | The password (can be NULL if no password protection).
  timeout | Timeout in seconds (0 for default timeout).
  certificateFile | Path to the client certificate for HTTPS, in PEM format (can be NULL if no client certificate or if not using HTTPS).
  certificateKeyFile | Path to the key of the client certificate for HTTPS, in PEM format (can be NULL if no client certificate or if not using HTTPS).
  certificateKeyPassword | Password to unlock the key of the client certificate (can be NULL if no client certificate or if not using HTTPS).
  pkcs11 | Enable PKCS#11 client authentication for hardware security modules and smart cards.

Returns
  0 if success, or the error code if failure.

See also
  OrthancPluginHttpClient()

## ◆ OrthancPluginComputeMd5()

char * OrthancPluginComputeMd5 | ( | OrthancPluginContext * | context,
|  | const void * | buffer,
|  | uint32_t | size )

This functions computes the MD5 cryptographic hash of the given memory buffer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  buffer | The source memory buffer.
  size | The size in bytes of the source buffer.

Returns
  The NULL value in case of error, or a string containing the cryptographic hash. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginComputeSha1()

char * OrthancPluginComputeSha1 | ( | OrthancPluginContext * | context,
|  | const void * | buffer,
|  | uint32_t | size )

This functions computes the SHA-1 cryptographic hash of the given memory buffer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  buffer | The source memory buffer.
  size | The size in bytes of the source buffer.

Returns
  The NULL value in case of error, or a string containing the cryptographic hash. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginCreateDicom()

OrthancPluginErrorCode OrthancPluginCreateDicom | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | const char * | json,
|  | const OrthancPluginImage * | pixelData,
|  | OrthancPluginCreateDicomFlags | flags )

This function takes as input a string containing a JSON file describing the content of a DICOM instance. As an output, it writes the corresponding DICOM instance to a newly allocated memory buffer. Additionally, an image to be encoded within the DICOM instance can also be provided.

Private tags will be associated with the private creator whose value is specified in the "DefaultPrivateCreator" configuration option of Orthanc. The function OrthancPluginCreateDicom2() can be used if another private creator must be used to create this instance.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  json | The input JSON file.
  pixelData | The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
  flags | Flags governing the output.

Returns
  0 if success, other value if error.

See also
  OrthancPluginCreateDicom2()
  OrthancPluginDicomBufferToJson()

## ◆ OrthancPluginCreateDicom2()

OrthancPluginErrorCode OrthancPluginCreateDicom2 | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | const char * | json,
|  | const OrthancPluginImage * | pixelData,
|  | OrthancPluginCreateDicomFlags | flags,
|  | const char * | privateCreator )

This function takes as input a string containing a JSON file describing the content of a DICOM instance. As an output, it writes the corresponding DICOM instance to a newly allocated memory buffer. Additionally, an image to be encoded within the DICOM instance can also be provided.

Contrarily to the function OrthancPluginCreateDicom(), this function can be explicitly provided with a private creator.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  json | The input JSON file.
  pixelData | The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
  flags | Flags governing the output.
  privateCreator | The private creator to be used for the private DICOM tags. Check out the global configuration option "Dictionary" of Orthanc.

Returns
  0 if success, other value if error.

See also
  OrthancPluginCreateDicom()
  OrthancPluginDicomBufferToJson()

## ◆ OrthancPluginCreateFindMatcher()

OrthancPluginFindMatcher * OrthancPluginCreateFindMatcher | ( | OrthancPluginContext * | context,
|  | const void * | query,
|  | uint32_t | size )

This function creates a "matcher" object that can be used to check whether a DICOM instance matches a C-Find query. The C-Find query must be expressed as a DICOM buffer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  query | The C-Find DICOM query.
  size | The size of the DICOM query.

Returns
  The newly allocated matcher. It must be freed with OrthancPluginFreeFindMatcher().

## ◆ OrthancPluginCreateJob()

OrthancPluginJob * OrthancPluginCreateJob | ( | OrthancPluginContext * | context,
|  | void * | job,
|  | OrthancPluginJobFinalize | finalize,
|  | const char * | type,
|  | OrthancPluginJobGetProgress | getProgress,
|  | OrthancPluginJobGetContent | getContent,
|  | OrthancPluginJobGetSerialized | getSerialized,
|  | OrthancPluginJobStep | step,
|  | OrthancPluginJobStop | stop,
|  | OrthancPluginJobReset | reset )

This function creates a custom job to be run by the jobs engine of Orthanc.

Orthanc starts one dedicated thread per custom job that is running. It is guaranteed that all the callbacks will only be called from this single dedicated thread, in mutual exclusion: As a consequence, it is not mandatory to protect the various callbacks by mutexes.

The custom job can nonetheless launch its own processing threads on the first call to the "step()" callback, and stop them once the "stop()" callback is called.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  job | The job to be executed.
  finalize | The finalization callback.
  type | The type of the job, provided to the job unserializer. See OrthancPluginRegisterJobsUnserializer().
  getProgress | The progress callback.
  getContent | The content callback.
  getSerialized | The serialization callback.
  step | The callback to execute the individual steps of the job.
  stop | The callback that is invoked once the job leaves the "running" state.
  reset | The callback that is invoked if a stopped job is started again.

Returns
  The newly allocated job. It must be freed with OrthancPluginFreeJob(), as long as it is not submitted with OrthancPluginSubmitJob().

Deprecated
  This signature should not be used anymore since Orthanc SDK 1.11.3.

## ◆ OrthancPluginCreateJob2()

OrthancPluginJob * OrthancPluginCreateJob2 | ( | OrthancPluginContext * | context,
|  | void * | job,
|  | OrthancPluginJobFinalize | finalize,
|  | const char * | type,
|  | OrthancPluginJobGetProgress | getProgress,
|  | OrthancPluginJobGetContent2 | getContent,
|  | OrthancPluginJobGetSerialized2 | getSerialized,
|  | OrthancPluginJobStep | step,
|  | OrthancPluginJobStop | stop,
|  | OrthancPluginJobReset | reset )

This function creates a custom job to be run by the jobs engine of Orthanc.

Orthanc starts one dedicated thread per custom job that is running. It is guaranteed that all the callbacks will only be called from this single dedicated thread, in mutual exclusion: As a consequence, it is not mandatory to protect the various callbacks by mutexes.

The custom job can nonetheless launch its own processing threads on the first call to the "step()" callback, and stop them once the "stop()" callback is called.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  job | The job to be executed.
  finalize | The finalization callback.
  type | The type of the job, provided to the job unserializer. See OrthancPluginRegisterJobsUnserializer().
  getProgress | The progress callback.
  getContent | The content callback.
  getSerialized | The serialization callback.
  step | The callback to execute the individual steps of the job.
  stop | The callback that is invoked once the job leaves the "running" state.
  reset | The callback that is invoked if a stopped job is started again.

Returns
  The newly allocated job. It must be freed with OrthancPluginFreeJob(), as long as it is not submitted with OrthancPluginSubmitJob().

## ◆ OrthancPluginCreateMemoryBuffer()

OrthancPluginErrorCode OrthancPluginCreateMemoryBuffer | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | uint32_t | size )

This function creates a memory buffer that is managed by the Orthanc core. The main use case of this function is for plugins that act as DICOM transcoders.

Your plugin should never call "free()" on the resulting memory buffer, as the C library that is used by the plugin is in general not the same as the one used by the Orthanc core.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  size | Size of the memory buffer to be created.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginCreateMemoryBuffer64()

OrthancPluginErrorCode OrthancPluginCreateMemoryBuffer64 | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer64 * | target,
|  | uint64_t | size )

This function creates a 64-bit memory buffer that is managed by the Orthanc core. The main use case of this function is for plugins that read files from the storage area.

Your plugin should never call "free()" on the resulting memory buffer, as the C library that is used by the plugin is in general not the same as the one used by the Orthanc core.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  size | Size of the memory buffer to be created.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginDicomBufferToJson()

char * OrthancPluginDicomBufferToJson | ( | OrthancPluginContext * | context,
|  | const void * | buffer,
|  | uint32_t | size,
|  | OrthancPluginDicomToJsonFormat | format,
|  | OrthancPluginDicomToJsonFlags | flags,
|  | uint32_t | maxStringLength )

This function takes as input a memory buffer containing a DICOM file, and outputs a JSON string representing the tags of this DICOM file.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  buffer | The memory buffer containing the DICOM file.
  size | The size of the memory buffer.
  format | The output format.
  flags | Flags governing the output.
  maxStringLength | The maximum length of a field. Too long fields will be output as "null". The 0 value means no maximum length.

Returns
  The NULL value if the case of an error, or the JSON string. This string must be freed by OrthancPluginFreeString().

See also
  OrthancPluginDicomInstanceToJson()

## ◆ OrthancPluginDicomInstanceToJson()

char * OrthancPluginDicomInstanceToJson | ( | OrthancPluginContext * | context,
|  | const char * | instanceId,
|  | OrthancPluginDicomToJsonFormat | format,
|  | OrthancPluginDicomToJsonFlags | flags,
|  | uint32_t | maxStringLength )

This function formats a DICOM instance that is stored in Orthanc, and outputs a JSON string representing the tags of this DICOM instance.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  instanceId | The Orthanc identifier of the instance.
  format | The output format.
  flags | Flags governing the output.
  maxStringLength | The maximum length of a field. Too long fields will be output as "null". The 0 value means no maximum length.

Returns
  The NULL value if the case of an error, or the JSON string. This string must be freed by OrthancPluginFreeString().

See also
  OrthancPluginDicomInstanceToJson()

## ◆ OrthancPluginEncodeDicomWebJson()

char * OrthancPluginEncodeDicomWebJson | ( | OrthancPluginContext * | context,
|  | const void * | dicom,
|  | uint32_t | dicomSize,
|  | OrthancPluginDicomWebBinaryCallback | callback )

This function converts a memory buffer containing a DICOM instance, into its DICOMweb JSON representation.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  dicom | Pointer to the DICOM instance.
  dicomSize | Size of the DICOM instance.
  callback | Callback to set the value of the binary tags.

See also
  OrthancPluginCreateDicom()

Returns
  The NULL value in case of error, or the JSON document. This string must be freed by OrthancPluginFreeString().

Deprecated
  OrthancPluginEncodeDicomWebJson2()

## ◆ OrthancPluginEncodeDicomWebJson2()

char * OrthancPluginEncodeDicomWebJson2 | ( | OrthancPluginContext * | context,
|  | const void * | dicom,
|  | uint32_t | dicomSize,
|  | OrthancPluginDicomWebBinaryCallback2 | callback,
|  | void * | payload )

This function converts a memory buffer containing a DICOM instance, into its DICOMweb JSON representation.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  dicom | Pointer to the DICOM instance.
  dicomSize | Size of the DICOM instance.
  callback | Callback to set the value of the binary tags.
  payload | User payload.

Returns
  The NULL value in case of error, or the JSON document. This string must be freed by OrthancPluginFreeString().

See also
  OrthancPluginCreateDicom()

## ◆ OrthancPluginEncodeDicomWebXml()

char * OrthancPluginEncodeDicomWebXml | ( | OrthancPluginContext * | context,
|  | const void * | dicom,
|  | uint32_t | dicomSize,
|  | OrthancPluginDicomWebBinaryCallback | callback )

This function converts a memory buffer containing a DICOM instance, into its DICOMweb XML representation.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  dicom | Pointer to the DICOM instance.
  dicomSize | Size of the DICOM instance.
  callback | Callback to set the value of the binary tags.

Returns
  The NULL value in case of error, or the XML document. This string must be freed by OrthancPluginFreeString().

See also
  OrthancPluginCreateDicom()

Deprecated
  OrthancPluginEncodeDicomWebXml2()

## ◆ OrthancPluginEncodeDicomWebXml2()

char * OrthancPluginEncodeDicomWebXml2 | ( | OrthancPluginContext * | context,
|  | const void * | dicom,
|  | uint32_t | dicomSize,
|  | OrthancPluginDicomWebBinaryCallback2 | callback,
|  | void * | payload )

This function converts a memory buffer containing a DICOM instance, into its DICOMweb XML representation.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  dicom | Pointer to the DICOM instance.
  dicomSize | Size of the DICOM instance.
  callback | Callback to set the value of the binary tags.
  payload | User payload.

Returns
  The NULL value in case of error, or the XML document. This string must be freed by OrthancPluginFreeString().

See also
  OrthancPluginCreateDicom()

## ◆ OrthancPluginExtendOrthancExplorer()

void OrthancPluginExtendOrthancExplorer | ( | OrthancPluginContext * | context,
|  | const char * | javascript )

Add JavaScript code to customize the default behavior of Orthanc Explorer. This can for instance be used to add new buttons.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  javascript | The custom JavaScript code.

Deprecated
  This function should not be used anymore because the result of the call to "OrthancPluginGetName()" depends on the system. Use "OrthancPluginExtendOrthancExplorer2()" instead.

## ◆ OrthancPluginExtendOrthancExplorer2()

void OrthancPluginExtendOrthancExplorer2 | ( | OrthancPluginContext * | context,
|  | const char * | plugin,
|  | const char * | javascript )

Add JavaScript code to customize the default behavior of Orthanc Explorer. This can for instance be used to add new buttons.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  plugin | Identifier of your plugin (it must match "OrthancPluginGetName()").
  javascript | The custom JavaScript code.

## ◆ OrthancPluginFindMatcherIsMatch()

int32_t OrthancPluginFindMatcherIsMatch | ( | OrthancPluginContext * | context,
|  | const OrthancPluginFindMatcher * | matcher,
|  | const void * | dicom,
|  | uint32_t | size )

This function checks whether one DICOM instance matches C-Find matcher that was previously allocated using OrthancPluginCreateFindMatcher().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  matcher | The matcher of interest.
  dicom | The DICOM instance to be matched.
  size | The size of the DICOM instance.

Returns
  1 if the DICOM instance matches the query, 0 otherwise.

## ◆ OrthancPluginFreeFindMatcher()

void OrthancPluginFreeFindMatcher | ( | OrthancPluginContext * | context,
|  | OrthancPluginFindMatcher * | matcher )

This function frees a matcher that was created using OrthancPluginCreateFindMatcher().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  matcher | The matcher of interest.

## ◆ OrthancPluginFreeJob()

void OrthancPluginFreeJob | ( | OrthancPluginContext * | context,
|  | OrthancPluginJob * | job )

This function frees an image that was created with OrthancPluginCreateJob().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  job | The job.

## ◆ OrthancPluginFreeMemoryBuffer()

void OrthancPluginFreeMemoryBuffer | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | buffer )

Free a memory buffer that was allocated by the core system of Orthanc.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  buffer | The memory buffer to release.

## ◆ OrthancPluginFreeMemoryBuffer64()

void OrthancPluginFreeMemoryBuffer64 | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer64 * | buffer )

Free a memory buffer that was allocated by the core system of Orthanc.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  buffer | The memory buffer to release.

## ◆ OrthancPluginFreePeers()

void OrthancPluginFreePeers | ( | OrthancPluginContext * | context,
|  | OrthancPluginPeers * | peers )

This function frees the data structure returned by OrthancPluginGetPeers().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  peers | The data structure describing the Orthanc peers.

## ◆ OrthancPluginFreeString()

void OrthancPluginFreeString | ( | OrthancPluginContext * | context,
|  | char * | str )

Free a string that was allocated by the core system of Orthanc.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  str | The string to be freed.

## ◆ OrthancPluginGenerateUuid()

char * OrthancPluginGenerateUuid | ( | OrthancPluginContext * | context | ) |

Generate a random GUID/UUID (globally unique identifier).

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  NULL in the case of an error, or a newly allocated string containing the UUID. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginGetCommandLineArgument()

char * OrthancPluginGetCommandLineArgument | ( | OrthancPluginContext * | context,
|  | uint32_t | argument )

Get the value of one of the command-line arguments that were used to launch Orthanc. The number of available arguments can be retrieved by OrthancPluginGetCommandLineArgumentsCount().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  argument | The index of the argument.

Returns
  The value of the argument, or NULL in the case of an error. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginGetCommandLineArgumentsCount()

uint32_t OrthancPluginGetCommandLineArgumentsCount | ( | OrthancPluginContext * | context | ) |

Retrieve the number of command-line arguments that were used to launch Orthanc.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  The number of arguments.

## ◆ OrthancPluginGetConfiguration()

char * OrthancPluginGetConfiguration | ( | OrthancPluginContext * | context | ) |

This function returns the content of the configuration that is used by Orthanc, formatted as a JSON string.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  NULL in the case of an error, or a newly allocated string containing the configuration. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginGetConfigurationPath()

char * OrthancPluginGetConfigurationPath | ( | OrthancPluginContext * | context | ) |

This function returns the path to the configuration file(s) that was specified when starting Orthanc. Since version 0.9.1, this path can refer to a folder that stores a set of configuration files. This function is deprecated in favor of OrthancPluginGetConfiguration().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().

See also
  OrthancPluginGetConfiguration()

## ◆ OrthancPluginGetDatabaseServerIdentifier()

const char * OrthancPluginGetDatabaseServerIdentifier | ( | OrthancPluginContext * | context | ) |

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  the database server identifier. This is a statically-allocated string, do not free it.

## ◆ OrthancPluginGetErrorDescription()

const char * OrthancPluginGetErrorDescription | ( | OrthancPluginContext * | context,
|  | OrthancPluginErrorCode | error )

This function returns the description of a given error code.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  error | The error code of interest.

Returns
  The error description. This is a statically-allocated string, do not free it.

## ◆ OrthancPluginGetOrthancDirectory()

char * OrthancPluginGetOrthancDirectory | ( | OrthancPluginContext * | context | ) |

This function returns the path to the directory containing the Orthanc executable.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginGetOrthancPath()

char * OrthancPluginGetOrthancPath | ( | OrthancPluginContext * | context | ) |

This function returns the path to the Orthanc executable.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginGetPeerName()

const char * OrthancPluginGetPeerName | ( | OrthancPluginContext * | context,
|  | const OrthancPluginPeers * | peers,
|  | uint32_t | peerIndex )

This function returns the symbolic name of the Orthanc peer, which corresponds to the key of the "OrthancPeers" configuration option of Orthanc.

This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  peers | The data structure describing the Orthanc peers.
  peerIndex | The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().

Returns
  The symbolic name, or NULL in the case of an error.

## ◆ OrthancPluginGetPeers()

OrthancPluginPeers * OrthancPluginGetPeers | ( | OrthancPluginContext * | context | ) |

This function returns the parameters of the Orthanc peers that are known to the Orthanc server hosting the plugin.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().

Returns
  NULL if error, or a newly allocated opaque data structure containing the peers. This structure must be freed with OrthancPluginFreePeers().

## ◆ OrthancPluginGetPeersCount()

uint32_t OrthancPluginGetPeersCount | ( | OrthancPluginContext * | context,
|  | const OrthancPluginPeers * | peers )

This function returns the number of Orthanc peers.

This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  peers | The data structure describing the Orthanc peers.

Returns
  The number of peers.

## ◆ OrthancPluginGetPeerUrl()

const char * OrthancPluginGetPeerUrl | ( | OrthancPluginContext * | context,
|  | const OrthancPluginPeers * | peers,
|  | uint32_t | peerIndex )

This function returns the base URL to the REST API of some Orthanc peer.

This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  peers | The data structure describing the Orthanc peers.
  peerIndex | The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().

Returns
  The URL, or NULL in the case of an error.

## ◆ OrthancPluginGetPeerUserProperty()

const char * OrthancPluginGetPeerUserProperty | ( | OrthancPluginContext * | context,
|  | const OrthancPluginPeers * | peers,
|  | uint32_t | peerIndex,
|  | const char * | userProperty )

This function returns some user-defined property of some Orthanc peer. An user-defined property is a property that is associated with the peer in the Orthanc configuration file, but that is not recognized by the Orthanc core.

This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  peers | The data structure describing the Orthanc peers.
  peerIndex | The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().
  userProperty | The user property of interest.

Returns
  The value of the user property, or NULL if it is not defined.

## ◆ OrthancPluginGetTagName()

char * OrthancPluginGetTagName | ( | OrthancPluginContext * | context,
|  | uint16_t | group,
|  | uint16_t | element,
|  | const char * | privateCreator )

This function makes a lookup to the dictionary of DICOM tags that are known to Orthanc, and returns the symbolic name of a DICOM tag.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  group | The group of the tag.
  element | The element of the tag.
  privateCreator | For private tags, the name of the private creator (can be NULL).

Returns
  NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginHttpClient()

OrthancPluginErrorCode OrthancPluginHttpClient | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | answerBody,
|  | OrthancPluginMemoryBuffer * | answerHeaders,
|  | uint16_t * | httpStatus,
|  | OrthancPluginHttpMethod | method,
|  | const char * | url,
|  | uint32_t | headersCount,
|  | const char *const * | headersKeys,
|  | const char *const * | headersValues,
|  | const void * | body,
|  | uint32_t | bodySize,
|  | const char * | username,
|  | const char * | password,
|  | uint32_t | timeout,
|  | const char * | certificateFile,
|  | const char * | certificateKeyFile,
|  | const char * | certificateKeyPassword,
|  | uint8_t | pkcs11 )

Make a HTTP call to the given URL. The result to the query is stored into a newly allocated memory buffer. The HTTP request will be done accordingly to the global configuration of Orthanc (in particular, the options "HttpProxy", "HttpTimeout", "HttpsVerifyPeers", "HttpsCACertificates", and "Pkcs11" will be taken into account).

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  answerBody | The target memory buffer (out argument). It must be freed with OrthancPluginFreeMemoryBuffer(). The value of this argument is ignored if the HTTP method is DELETE.
  answerHeaders | The target memory buffer for the HTTP headers in the answers (out argument). The answer headers are formatted as a JSON object (associative array). The buffer must be freed with OrthancPluginFreeMemoryBuffer(). This argument can be set to NULL if the plugin has no interest in the HTTP headers.
  httpStatus | The HTTP status after the execution of the request (out argument).
  method | HTTP method to be used.
  url | The URL of interest.
  headersCount | The number of HTTP headers.
  headersKeys | Array containing the keys of the HTTP headers (can be NULL if no header).
  headersValues | Array containing the values of the HTTP headers (can be NULL if no header).
  username | The username (can be NULL if no password protection).
  password | The password (can be NULL if no password protection).
  body | The HTTP body for a POST or PUT request.
  bodySize | The size of the body.
  timeout | Timeout in seconds (0 for default timeout).
  certificateFile | Path to the client certificate for HTTPS, in PEM format (can be NULL if no client certificate or if not using HTTPS).
  certificateKeyFile | Path to the key of the client certificate for HTTPS, in PEM format (can be NULL if no client certificate or if not using HTTPS).
  certificateKeyPassword | Password to unlock the key of the client certificate (can be NULL if no client certificate or if not using HTTPS).
  pkcs11 | Enable PKCS#11 client authentication for hardware security modules and smart cards.

Returns
  0 if success, or the error code if failure.

See also
  OrthancPluginCallPeerApi()

## ◆ OrthancPluginHttpDelete()

OrthancPluginErrorCode OrthancPluginHttpDelete | ( | OrthancPluginContext * | context,
|  | const char * | url,
|  | const char * | username,
|  | const char * | password )

Make a HTTP DELETE call to the given URL. Favor OrthancPluginRestApiDelete() if calling the built-in REST API of the Orthanc instance that hosts this plugin.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  url | The URL of interest.
  username | The username (can be NULL if no password protection).
  password | The password (can be NULL if no password protection).

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginHttpGet()

OrthancPluginErrorCode OrthancPluginHttpGet | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | const char * | url,
|  | const char * | username,
|  | const char * | password )

Make a HTTP GET call to the given URL. The result to the query is stored into a newly allocated memory buffer. Favor OrthancPluginRestApiGet() if calling the built-in REST API of the Orthanc instance that hosts this plugin.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  url | The URL of interest.
  username | The username (can be NULL if no password protection).
  password | The password (can be NULL if no password protection).

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginHttpPost()

OrthancPluginErrorCode OrthancPluginHttpPost | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | const char * | url,
|  | const void * | body,
|  | uint32_t | bodySize,
|  | const char * | username,
|  | const char * | password )

Make a HTTP POST call to the given URL. The result to the query is stored into a newly allocated memory buffer. Favor OrthancPluginRestApiPost() if calling the built-in REST API of the Orthanc instance that hosts this plugin.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  url | The URL of interest.
  body | The content of the body of the request.
  bodySize | The size of the body of the request.
  username | The username (can be NULL if no password protection).
  password | The password (can be NULL if no password protection).

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginHttpPut()

OrthancPluginErrorCode OrthancPluginHttpPut | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | const char * | url,
|  | const void * | body,
|  | uint32_t | bodySize,
|  | const char * | username,
|  | const char * | password )

Make a HTTP PUT call to the given URL. The result to the query is stored into a newly allocated memory buffer. Favor OrthancPluginRestApiPut() if calling the built-in REST API of the Orthanc instance that hosts this plugin.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  url | The URL of interest.
  body | The content of the body of the request.
  bodySize | The size of the body of the request.
  username | The username (can be NULL if no password protection).
  password | The password (can be NULL if no password protection).

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginLogError()

void OrthancPluginLogError | ( | OrthancPluginContext * | context,
|  | const char * | message )

Log an error message using the Orthanc logging system.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  message | The message to be logged.

## ◆ OrthancPluginLogInfo()

void OrthancPluginLogInfo | ( | OrthancPluginContext * | context,
|  | const char * | message )

Log an information message using the Orthanc logging system.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  message | The message to be logged.

## ◆ OrthancPluginLogMessage()

void OrthancPluginLogMessage | ( | OrthancPluginContext * | context,
|  | const char * | message,
|  | const char * | plugin,
|  | const char * | file,
|  | uint32_t | line,
|  | OrthancPluginLogCategory | category,
|  | OrthancPluginLogLevel | level )

Log a message using the Orthanc logging system.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  message | The message to be logged.
  plugin | The plugin name.
  file | The filename in the plugin code.
  line | The file line in the plugin code.
  category | The category.
  level | The level of the message.

## ◆ OrthancPluginLogWarning()

void OrthancPluginLogWarning | ( | OrthancPluginContext * | context,
|  | const char * | message )

Log a warning message using the Orthanc logging system.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  message | The message to be logged.

## ◆ OrthancPluginLookupDictionary()

OrthancPluginErrorCode OrthancPluginLookupDictionary | ( | OrthancPluginContext * | context,
|  | OrthancPluginDictionaryEntry * | target,
|  | const char * | name )

This functions makes a lookup in the dictionary of DICOM tags that are known to Orthanc, and returns information about this tag. The tag can be specified using its human-readable name (e.g. "PatientName") or a set of two hexadecimal numbers (e.g. "0010-0020").

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | Where to store the information about the tag.
  name | The name of the DICOM tag.

Returns
  0 if success, other value if error.

## ◆ OrthancPluginReadFile()

OrthancPluginErrorCode OrthancPluginReadFile | ( | OrthancPluginContext * | context,
|  | OrthancPluginMemoryBuffer * | target,
|  | const char * | path )

Read the content of a file on the filesystem, and returns it into a newly allocated memory buffer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  target | The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
  path | The path of the file to be read.

Returns
  0 if success, or the error code if failure.

## ◆ OrthancPluginRegisterDictionaryTag()

OrthancPluginErrorCode OrthancPluginRegisterDictionaryTag | ( | OrthancPluginContext * | context,
|  | uint16_t | group,
|  | uint16_t | element,
|  | OrthancPluginValueRepresentation | vr,
|  | const char * | name,
|  | uint32_t | minMultiplicity,
|  | uint32_t | maxMultiplicity )

This function declares a new public tag in the dictionary of DICOM tags that are known to Orthanc. This function should be used in the OrthancPluginInitialize() callback.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  group | The group of the tag.
  element | The element of the tag.
  vr | The value representation of the tag.
  name | The nickname of the tag.
  minMultiplicity | The minimum multiplicity of the tag (must be above 0).
  maxMultiplicity | The maximum multiplicity of the tag. A value of 0 means an arbitrary multiplicity ("<tt>n</tt>").

Returns
  0 if success, other value if error.

See also
  OrthancPluginRegisterPrivateDictionaryTag()

## ◆ OrthancPluginRegisterErrorCode()

OrthancPluginErrorCode OrthancPluginRegisterErrorCode | ( | OrthancPluginContext * | context,
|  | int32_t | code,
|  | uint16_t | httpStatus,
|  | const char * | message )

This function declares a custom error code that can be generated by this plugin. This declaration is used to enrich the body of the HTTP answer in the case of an error, and to set the proper HTTP status code.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  code | The error code that is internal to this plugin.
  httpStatus | The HTTP status corresponding to this error.
  message | The description of the error.

Returns
  The error code that has been assigned inside the Orthanc core.

## ◆ OrthancPluginRegisterPrivateDictionaryTag()

OrthancPluginErrorCode OrthancPluginRegisterPrivateDictionaryTag | ( | OrthancPluginContext * | context,
|  | uint16_t | group,
|  | uint16_t | element,
|  | OrthancPluginValueRepresentation | vr,
|  | const char * | name,
|  | uint32_t | minMultiplicity,
|  | uint32_t | maxMultiplicity,
|  | const char * | privateCreator )

This function declares a new private tag in the dictionary of DICOM tags that are known to Orthanc. This function should be used in the OrthancPluginInitialize() callback.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  group | The group of the tag.
  element | The element of the tag.
  vr | The value representation of the tag.
  name | The nickname of the tag.
  minMultiplicity | The minimum multiplicity of the tag (must be above 0).
  maxMultiplicity | The maximum multiplicity of the tag. A value of 0 means an arbitrary multiplicity ("<tt>n</tt>").
  privateCreator | The private creator of this private tag.

Returns
  0 if success, other value if error.

See also
  OrthancPluginRegisterDictionaryTag()

## ◆ OrthancPluginSetCurrentThreadName()

OrthancPluginErrorCode OrthancPluginSetCurrentThreadName | ( | OrthancPluginContext * | context,
|  | const char * | threadName )

This function gives a name to the thread that is calling this function. This name is used in the Orthanc logs. This function must only be called from threads that the plugin has created itself.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  threadName | The name of the current thread. A thread name cannot be longer than 16 characters.

Returns
  0 if success, other value if error.

## ◆ OrthancPluginSetDescription()

void OrthancPluginSetDescription | ( | OrthancPluginContext * | context,
|  | const char * | description )

Set a description for this plugin. It is displayed in the "Plugins" page of Orthanc Explorer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  description | The description.

Deprecated
  This function should not be used anymore because the result of the call to "OrthancPluginGetName()" depends on the system. Use "OrthancPluginSetDescription2()" instead.

## ◆ OrthancPluginSetDescription2()

void OrthancPluginSetDescription2 | ( | OrthancPluginContext * | context,
|  | const char * | plugin,
|  | const char * | description )

Set a description for this plugin. It is displayed in the "Plugins" page of Orthanc Explorer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  plugin | Identifier of your plugin (it must match "OrthancPluginGetName()").
  description | The description.

## ◆ OrthancPluginSetMetricsIntegerValue()

void OrthancPluginSetMetricsIntegerValue | ( | OrthancPluginContext * | context,
|  | const char * | name,
|  | int64_t | value,
|  | OrthancPluginMetricsType | type )

This function sets the value of an integer metrics to monitor the behavior of the plugin through tools such as Prometheus. The values of all the metrics are stored within the Orthanc context.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  name | The name of the metrics to be set.
  value | The value of the metrics.
  type | The type of the metrics. This parameter is only taken into consideration the first time this metrics is set.

See also
  OrthancPluginSetMetricsValue()

## ◆ OrthancPluginSetMetricsValue()

void OrthancPluginSetMetricsValue | ( | OrthancPluginContext * | context,
|  | const char * | name,
|  | float | value,
|  | OrthancPluginMetricsType | type )

This function sets the value of a floating-point metrics to monitor the behavior of the plugin through tools such as Prometheus. The values of all the metrics are stored within the Orthanc context.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  name | The name of the metrics to be set.
  value | The value of the metrics.
  type | The type of the metrics. This parameter is only taken into consideration the first time this metrics is set.

See also
  OrthancPluginSetMetricsIntegerValue()

## ◆ OrthancPluginSetRootUri()

void OrthancPluginSetRootUri | ( | OrthancPluginContext * | context,
|  | const char * | uri )

For plugins that come with a Web interface, this function declares the entry path where to find this interface. This information is notably used in the "Plugins" page of Orthanc Explorer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  uri | The root URI for this plugin.

Deprecated
  This function should not be used anymore because the result of the call to "OrthancPluginGetName()" depends on the system. Use "OrthancPluginSetRootUri2()" instead.

## ◆ OrthancPluginSetRootUri2()

void OrthancPluginSetRootUri2 | ( | OrthancPluginContext * | context,
|  | const char * | plugin,
|  | const char * | uri )

For plugins that come with a Web interface, this function declares the entry path where to find this interface. This information is notably used in the "Plugins" page of Orthanc Explorer.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  plugin | Identifier of your plugin (it must match "OrthancPluginGetName()").
  uri | The root URI for this plugin.

## ◆ OrthancPluginSubmitJob()

char * OrthancPluginSubmitJob | ( | OrthancPluginContext * | context,
|  | OrthancPluginJob * | job,
|  | int32_t | priority )

This function adds the given job to the pending jobs of Orthanc. Orthanc will take take of freeing it by invoking the finalization callback provided to OrthancPluginCreateJob().

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  job | The job, as received by OrthancPluginCreateJob().
  priority | The priority of the job.

Returns
  ID of the newly-submitted job. This string must be freed by OrthancPluginFreeString().

## ◆ OrthancPluginWriteFile()

OrthancPluginErrorCode OrthancPluginWriteFile | ( | OrthancPluginContext * | context,
|  | const char * | path,
|  | const void * | data,
|  | uint32_t | size )

Write the content of a memory buffer to the filesystem.

Parameters

  context | The Orthanc plugin context, as received by OrthancPluginInitialize().
  path | The path of the file to be written.
  data | The content of the memory buffer.
  size | The size of the memory buffer.

Returns
  0 if success, or the error code if failure.