Orthanc Plugin SDK
1.12.5
Documentation of the plugin interface of Orthanc
|
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. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginChunkedClientAnswerAddHeader) (void *answer, const char *key, const char *value) |
Callback executed when a HTTP header is received during a chunked transfer. More... | |
typedef const void *(* | OrthancPluginChunkedClientRequestGetChunkData) (void *request) |
Callback to read the current chunk of the request body during a chunked transfer. More... | |
typedef uint32_t(* | OrthancPluginChunkedClientRequestGetChunkSize) (void *request) |
Callback to read the size of the current request chunk during a chunked transfer. More... | |
typedef uint8_t(* | OrthancPluginChunkedClientRequestIsDone) (void *request) |
Callback to know whether the request body is entirely read during a chunked transfer. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginChunkedClientRequestNext) (void *request) |
Callback to advance in the request body during a chunked transfer. More... | |
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. More... | |
typedef const char *(* | OrthancPluginJobGetContent) (void *job) |
Callback to retrieve the content of one custom job. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginJobGetContent2) (OrthancPluginMemoryBuffer *target, void *job) |
Callback to retrieve the content of one custom job. More... | |
typedef float(* | OrthancPluginJobGetProgress) (void *job) |
Callback to check the progress of one custom job. More... | |
typedef const char *(* | OrthancPluginJobGetSerialized) (void *job) |
Callback to serialize one custom job. More... | |
typedef int32_t(* | OrthancPluginJobGetSerialized2) (OrthancPluginMemoryBuffer *target, void *job) |
Callback to serialize one custom job. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginJobReset) (void *job) |
Callback executed once one stopped custom job is started again. More... | |
typedef OrthancPluginJobStepStatus(* | OrthancPluginJobStep) (void *job) |
Callback to execute one step of a custom job. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginJobStop) (void *job, OrthancPluginJobStopReason reason) |
Callback executed once one custom job leaves the "running" state. More... | |
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. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginServerChunkedRequestReaderExecute) (OrthancPluginServerChunkedRequestReader *reader, OrthancPluginRestOutput *output) |
Callback invoked whenever the request body is entirely received. More... | |
typedef OrthancPluginErrorCode(* | OrthancPluginServerChunkedRequestReaderFactory) (OrthancPluginServerChunkedRequestReader **reader, const char *url, const OrthancPluginHttpRequest *request) |
Callback to create a reader to handle incoming chunked HTTP transfers. More... | |
typedef void(* | OrthancPluginServerChunkedRequestReaderFinalize) (OrthancPluginServerChunkedRequestReader *reader) |
Callback invoked to release the resources associated with an incoming HTTP chunked transfer. More... | |
Functions | |
const char * | OrthancPluginAutodetectMimeType (OrthancPluginContext *context, const char *path) |
Detect the MIME type of a file. More... | |
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. More... | |
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. More... | |
char * | OrthancPluginComputeMd5 (OrthancPluginContext *context, const void *buffer, uint32_t size) |
Compute an MD5 hash. More... | |
char * | OrthancPluginComputeSha1 (OrthancPluginContext *context, const void *buffer, uint32_t size) |
Compute a SHA-1 hash. More... | |
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. More... | |
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. More... | |
OrthancPluginFindMatcher * | OrthancPluginCreateFindMatcher (OrthancPluginContext *context, const void *query, uint32_t size) |
Create a C-Find matcher. More... | |
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. More... | |
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. More... | |
OrthancPluginErrorCode | OrthancPluginCreateMemoryBuffer (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, uint32_t size) |
Create a 32-bit memory buffer. More... | |
OrthancPluginErrorCode | OrthancPluginCreateMemoryBuffer64 (OrthancPluginContext *context, OrthancPluginMemoryBuffer64 *target, uint64_t size) |
Create a 64-bit memory buffer. More... | |
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. More... | |
char * | OrthancPluginDicomInstanceToJson (OrthancPluginContext *context, const char *instanceId, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, uint32_t maxStringLength) |
Format a DICOM instance as a JSON string. More... | |
char * | OrthancPluginEncodeDicomWebJson (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback) |
Convert a DICOM instance to DICOMweb JSON. More... | |
char * | OrthancPluginEncodeDicomWebJson2 (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback2 callback, void *payload) |
Convert a DICOM instance to DICOMweb JSON. More... | |
char * | OrthancPluginEncodeDicomWebXml (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback callback) |
Convert a DICOM instance to DICOMweb XML. More... | |
char * | OrthancPluginEncodeDicomWebXml2 (OrthancPluginContext *context, const void *dicom, uint32_t dicomSize, OrthancPluginDicomWebBinaryCallback2 callback, void *payload) |
Convert a DICOM instance to DICOMweb XML. More... | |
void | OrthancPluginExtendOrthancExplorer (OrthancPluginContext *context, const char *javascript) |
Extend the JavaScript code of Orthanc Explorer. More... | |
void | OrthancPluginExtendOrthancExplorer2 (OrthancPluginContext *context, const char *plugin, const char *javascript) |
Extend the JavaScript code of Orthanc Explorer. More... | |
int32_t | OrthancPluginFindMatcherIsMatch (OrthancPluginContext *context, const OrthancPluginFindMatcher *matcher, const void *dicom, uint32_t size) |
Test whether a DICOM instance matches a C-Find query. More... | |
void | OrthancPluginFreeFindMatcher (OrthancPluginContext *context, OrthancPluginFindMatcher *matcher) |
Free a C-Find matcher. More... | |
void | OrthancPluginFreeJob (OrthancPluginContext *context, OrthancPluginJob *job) |
Free a custom job. More... | |
void | OrthancPluginFreeMemoryBuffer (OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer) |
Free a memory buffer. More... | |
void | OrthancPluginFreeMemoryBuffer64 (OrthancPluginContext *context, OrthancPluginMemoryBuffer64 *buffer) |
Free a memory buffer. More... | |
void | OrthancPluginFreePeers (OrthancPluginContext *context, OrthancPluginPeers *peers) |
Free the list of available Orthanc peers. More... | |
void | OrthancPluginFreeString (OrthancPluginContext *context, char *str) |
Free a string. More... | |
char * | OrthancPluginGenerateUuid (OrthancPluginContext *context) |
Generate an UUID. More... | |
char * | OrthancPluginGetCommandLineArgument (OrthancPluginContext *context, uint32_t argument) |
Get the value of a command-line argument. More... | |
uint32_t | OrthancPluginGetCommandLineArgumentsCount (OrthancPluginContext *context) |
Get the number of command-line arguments. More... | |
char * | OrthancPluginGetConfiguration (OrthancPluginContext *context) |
Return the content of the configuration file(s). More... | |
char * | OrthancPluginGetConfigurationPath (OrthancPluginContext *context) |
Return the path to the configuration file(s). More... | |
const char * | OrthancPluginGetDatabaseServerIdentifier (OrthancPluginContext *context) |
Gets the DatabaseServerIdentifier. More... | |
const char * | OrthancPluginGetErrorDescription (OrthancPluginContext *context, OrthancPluginErrorCode error) |
Get the description of a given error code. More... | |
char * | OrthancPluginGetOrthancDirectory (OrthancPluginContext *context) |
Return the directory containing the Orthanc. More... | |
char * | OrthancPluginGetOrthancPath (OrthancPluginContext *context) |
Return the path to the Orthanc executable. More... | |
const char * | OrthancPluginGetPeerName (OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex) |
Get the symbolic name of an Orthanc peer. More... | |
OrthancPluginPeers * | OrthancPluginGetPeers (OrthancPluginContext *context) |
Return the list of available Orthanc peers. More... | |
uint32_t | OrthancPluginGetPeersCount (OrthancPluginContext *context, const OrthancPluginPeers *peers) |
Get the number of Orthanc peers. More... | |
const char * | OrthancPluginGetPeerUrl (OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex) |
Get the base URL of an Orthanc peer. More... | |
const char * | OrthancPluginGetPeerUserProperty (OrthancPluginContext *context, const OrthancPluginPeers *peers, uint32_t peerIndex, const char *userProperty) |
Get some user-defined property of an Orthanc peer. More... | |
char * | OrthancPluginGetTagName (OrthancPluginContext *context, uint16_t group, uint16_t element, const char *privateCreator) |
Returns the symbolic name of a DICOM tag. More... | |
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. More... | |
OrthancPluginErrorCode | OrthancPluginHttpDelete (OrthancPluginContext *context, const char *url, const char *username, const char *password) |
Issue a HTTP DELETE call. More... | |
OrthancPluginErrorCode | OrthancPluginHttpGet (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *url, const char *username, const char *password) |
Issue a HTTP GET call. More... | |
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. More... | |
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. More... | |
void | OrthancPluginLogError (OrthancPluginContext *context, const char *message) |
Log an error. More... | |
void | OrthancPluginLogInfo (OrthancPluginContext *context, const char *message) |
Log an information. More... | |
void | OrthancPluginLogMessage (OrthancPluginContext *context, const char *message, const char *plugin, const char *file, uint32_t line, OrthancPluginLogCategory category, OrthancPluginLogLevel level) |
Log a message. More... | |
void | OrthancPluginLogWarning (OrthancPluginContext *context, const char *message) |
Log a warning. More... | |
OrthancPluginErrorCode | OrthancPluginLookupDictionary (OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name) |
Get information about the given DICOM tag. More... | |
OrthancPluginErrorCode | OrthancPluginReadFile (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path) |
Read a file. More... | |
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. More... | |
OrthancPluginErrorCode | OrthancPluginRegisterErrorCode (OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message) |
Declare a custom error code for this plugin. More... | |
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. More... | |
OrthancPluginErrorCode | OrthancPluginSetCurrentThreadName (OrthancPluginContext *context, const char *threadName) |
Set the name of the current thread. More... | |
void | OrthancPluginSetDescription (OrthancPluginContext *context, const char *description) |
Set a description for this plugin. More... | |
void | OrthancPluginSetDescription2 (OrthancPluginContext *context, const char *plugin, const char *description) |
Set a description for this plugin. More... | |
void | OrthancPluginSetMetricsIntegerValue (OrthancPluginContext *context, const char *name, int64_t value, OrthancPluginMetricsType type) |
Set the value of an integer metrics. More... | |
void | OrthancPluginSetMetricsValue (OrthancPluginContext *context, const char *name, float value, OrthancPluginMetricsType type) |
Set the value of a floating-point metrics. More... | |
void | OrthancPluginSetRootUri (OrthancPluginContext *context, const char *uri) |
Set the URI where the plugin provides its Web interface. More... | |
void | OrthancPluginSetRootUri2 (OrthancPluginContext *context, const char *plugin, const char *uri) |
Set the URI where the plugin provides its Web interface. More... | |
char * | OrthancPluginSubmitJob (OrthancPluginContext *context, OrthancPluginJob *job, int32_t priority) |
Submit a new job to the jobs engine of Orthanc. More... | |
OrthancPluginErrorCode | OrthancPluginWriteFile (OrthancPluginContext *context, const char *path, const void *data, uint32_t size) |
Write a file. More... | |
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.
answer | The user payload, as provided by the calling plugin. |
data | The content of the data chunk. |
size | The size of the data chunk. |
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.
answer | The user payload, as provided by the calling plugin. |
key | The key of the HTTP header. |
value | The value of the HTTP header. |
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.
request | The user payload, as provided by the calling plugin. |
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.
request | The user payload, as provided by the calling plugin. |
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.
request | The user payload, as provided by the calling plugin. |
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.
request | The user payload, as provided by the calling plugin. |
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().
job | The job of interest. |
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".
job | The job of interest. |
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".
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. |
typedef float(* OrthancPluginJobGetProgress) (void *job) |
Signature of a callback function that returns the progress of the job.
job | The job of interest. |
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.
job | The job of interest. |
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.
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. |
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.
job | The job of interest. |
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.
job | The job of interest. |
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.
job | The job of interest. |
reason | The reason for leaving the "running" state. |
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.
reader | The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback. |
data | The content of the data chunk. |
size | The size of the data chunk. |
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.
reader | The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback. |
output | The HTTP connection to the client application. |
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.
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. |
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.
reader | The user payload, as created by the OrthancPluginServerChunkedRequestReaderFactory() callback. |
The constraints on the tags (main DICOM tags and identifier tags) that must be supported by the database plugins.
Flags for the creation of a DICOM file.
Flags to customize a DICOM-to-JSON conversion. By default, binary tags are formatted using Data URI scheme.
The possible output formats for a DICOM-to-JSON conversion.
The available modes to export a binary DICOM tag into a DICOMweb JSON or XML document.
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.
The constraints on the DICOM identifiers that must be supported by the database plugins.
The origin of a DICOM instance that has been received by Orthanc.
The possible status for one single step of a job.
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).
Mode specifying how to load a DICOM instance.
The log categories supported by Orthanc.
These values must match those of enumeration "LogCategory" in the Orthanc Core.
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 |
The available types of metrics.
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
The value representations present in the DICOM standard (version 2013).
const char* OrthancPluginAutodetectMimeType | ( | OrthancPluginContext * | context, |
const char * | path | ||
) |
This function returns the MIME type of a file by inspecting its extension.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
path | Path to the 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 | ||
) |
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.
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). |
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).
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. |
char* OrthancPluginComputeMd5 | ( | OrthancPluginContext * | context, |
const void * | buffer, | ||
uint32_t | size | ||
) |
This functions computes the MD5 cryptographic hash of the given memory buffer.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
buffer | The source memory buffer. |
size | The size in bytes of the source buffer. |
char* OrthancPluginComputeSha1 | ( | OrthancPluginContext * | context, |
const void * | buffer, | ||
uint32_t | size | ||
) |
This functions computes the SHA-1 cryptographic hash of the given memory buffer.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
buffer | The source memory buffer. |
size | The size in bytes of the source buffer. |
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.
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. |
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.
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. |
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.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
query | The C-Find DICOM query. |
size | The size of the DICOM query. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
javascript | The custom JavaScript code. |
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.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
plugin | Identifier of your plugin (it must match "OrthancPluginGetName()"). |
javascript | The custom JavaScript code. |
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().
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. |
void OrthancPluginFreeFindMatcher | ( | OrthancPluginContext * | context, |
OrthancPluginFindMatcher * | matcher | ||
) |
This function frees a matcher that was created using OrthancPluginCreateFindMatcher().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
matcher | The matcher of interest. |
void OrthancPluginFreeJob | ( | OrthancPluginContext * | context, |
OrthancPluginJob * | job | ||
) |
This function frees an image that was created with OrthancPluginCreateJob().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
job | The job. |
void OrthancPluginFreeMemoryBuffer | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | buffer | ||
) |
Free a memory buffer that was allocated by the core system of Orthanc.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
buffer | The memory buffer to release. |
void OrthancPluginFreeMemoryBuffer64 | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer64 * | buffer | ||
) |
Free a memory buffer that was allocated by the core system of Orthanc.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
buffer | The memory buffer to release. |
void OrthancPluginFreePeers | ( | OrthancPluginContext * | context, |
OrthancPluginPeers * | peers | ||
) |
This function frees the data structure returned by OrthancPluginGetPeers().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
peers | The data structure describing the Orthanc peers. |
void OrthancPluginFreeString | ( | OrthancPluginContext * | context, |
char * | str | ||
) |
Free a string that was allocated by the core system of Orthanc.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
str | The string to be freed. |
char* OrthancPluginGenerateUuid | ( | OrthancPluginContext * | context | ) |
Generate a random GUID/UUID (globally unique identifier).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
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().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
argument | The index of the argument. |
uint32_t OrthancPluginGetCommandLineArgumentsCount | ( | OrthancPluginContext * | context | ) |
Retrieve the number of command-line arguments that were used to launch Orthanc.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
char* OrthancPluginGetConfiguration | ( | OrthancPluginContext * | context | ) |
This function returns the content of the configuration that is used by Orthanc, formatted as a JSON string.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
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().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
const char* OrthancPluginGetDatabaseServerIdentifier | ( | OrthancPluginContext * | context | ) |
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
const char* OrthancPluginGetErrorDescription | ( | OrthancPluginContext * | context, |
OrthancPluginErrorCode | error | ||
) |
This function returns the description of a given error code.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
error | The error code of interest. |
char* OrthancPluginGetOrthancDirectory | ( | OrthancPluginContext * | context | ) |
This function returns the path to the directory containing the Orthanc executable.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
char* OrthancPluginGetOrthancPath | ( | OrthancPluginContext * | context | ) |
This function returns the path to the Orthanc executable.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
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.
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(). |
OrthancPluginPeers* OrthancPluginGetPeers | ( | OrthancPluginContext * | context | ) |
This function returns the parameters of the Orthanc peers that are known to the Orthanc server hosting the plugin.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
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.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
peers | The data structure describing the Orthanc peers. |
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.
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(). |
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.
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. |
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.
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). |
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).
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. |
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.
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). |
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.
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). |
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.
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). |
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.
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). |
void OrthancPluginLogError | ( | OrthancPluginContext * | context, |
const char * | message | ||
) |
Log an error message using the Orthanc logging system.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
message | The message to be logged. |
void OrthancPluginLogInfo | ( | OrthancPluginContext * | context, |
const char * | message | ||
) |
Log an information message using the Orthanc logging system.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
message | The message to be logged. |
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.
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. |
void OrthancPluginLogWarning | ( | OrthancPluginContext * | context, |
const char * | message | ||
) |
Log a warning message using the Orthanc logging system.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
message | The message to be logged. |
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").
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. |
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.
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. |
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.
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>"). |
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.
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. |
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.
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. |
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.
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. |
void OrthancPluginSetDescription | ( | OrthancPluginContext * | context, |
const char * | description | ||
) |
Set a description for this plugin. It is displayed in the "Plugins" page of Orthanc Explorer.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
description | The description. |
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.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
plugin | Identifier of your plugin (it must match "OrthancPluginGetName()"). |
description | The description. |
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.
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. |
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.
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. |
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.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
uri | The root URI for this plugin. |
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.
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. |
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().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
job | The job, as received by OrthancPluginCreateJob(). |
priority | The priority of the job. |
OrthancPluginErrorCode OrthancPluginWriteFile | ( | OrthancPluginContext * | context, |
const char * | path, | ||
const void * | data, | ||
uint32_t | size | ||
) |
Write the content of a memory buffer to the filesystem.
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. |