![]() |
Orthanc Plugin SDK
1.9.1
Documentation of the plugin interface of Orthanc
|
Functions to access the content of the Orthanc server. More...
Functions | |
char * | OrthancPluginGenerateRestApiAuthorizationToken (OrthancPluginContext *context) |
Generate a token to grant full access to the REST API of Orthanc. More... | |
OrthancPluginErrorCode | OrthancPluginGetDicomForInstance (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId) |
Retrieve a DICOM instance using its Orthanc identifier. More... | |
char * | OrthancPluginGetGlobalProperty (OrthancPluginContext *context, int32_t property, const char *defaultValue) |
Get the value of a global property. More... | |
char * | OrthancPluginLookupInstance (OrthancPluginContext *context, const char *sopInstanceUID) |
Look for an instance. More... | |
char * | OrthancPluginLookupPatient (OrthancPluginContext *context, const char *patientID) |
Look for a patient. More... | |
char * | OrthancPluginLookupSeries (OrthancPluginContext *context, const char *seriesUID) |
Look for a series. More... | |
char * | OrthancPluginLookupStudy (OrthancPluginContext *context, const char *studyUID) |
Look for a study. More... | |
char * | OrthancPluginLookupStudyWithAccessionNumber (OrthancPluginContext *context, const char *accessionNumber) |
Look for a study, using the accession number. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiDelete (OrthancPluginContext *context, const char *uri) |
Make a DELETE call to the built-in Orthanc REST API. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiDeleteAfterPlugins (OrthancPluginContext *context, const char *uri) |
Make a DELETE call to the REST API, as tainted by the plugins. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiGet (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri) |
Make a GET call to the built-in Orthanc REST API. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiGet2 (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, uint32_t headersCount, const char *const *headersKeys, const char *const *headersValues, int32_t afterPlugins) |
Make a GET call to the Orthanc REST API, with custom HTTP headers. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiGetAfterPlugins (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri) |
Make a GET call to the REST API, as tainted by the plugins. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiPost (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize) |
Make a POST call to the built-in Orthanc REST API. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiPostAfterPlugins (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize) |
Make a POST call to the REST API, as tainted by the plugins. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiPut (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize) |
Make a PUT call to the built-in Orthanc REST API. More... | |
OrthancPluginErrorCode | OrthancPluginRestApiPutAfterPlugins (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const void *body, uint32_t bodySize) |
Make a PUT call to the REST API, as tainted by the plugins. More... | |
OrthancPluginErrorCode | OrthancPluginSetGlobalProperty (OrthancPluginContext *context, int32_t property, const char *value) |
Set the value of a global property. More... | |
char* OrthancPluginGenerateRestApiAuthorizationToken | ( | OrthancPluginContext * | context | ) |
This function generates a token that can be set in the HTTP header "Authorization" so as to grant full access to the REST API of Orthanc using an external HTTP client. Using this function avoids the need of adding a separate user in the "RegisteredUsers" configuration of Orthanc, which eases deployments.
This feature is notably useful in multiprocess scenarios, where a subprocess created by a plugin has no access to the "OrthancPluginContext", and thus cannot call "OrthancPluginRestApi[Get|Post|Put|Delete]()".
This situation is frequently encountered in Python plugins, where the "multiprocessing" package can be used to bypass the Global Interpreter Lock (GIL) and thus to improve performance and concurrency.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
OrthancPluginErrorCode OrthancPluginGetDicomForInstance | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | instanceId | ||
) |
Retrieve a DICOM instance using its Orthanc identifier. The DICOM file is stored 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(). |
instanceId | The Orthanc identifier of the DICOM instance of interest. |
char* OrthancPluginGetGlobalProperty | ( | OrthancPluginContext * | context, |
int32_t | property, | ||
const char * | defaultValue | ||
) |
Get the value of a global property that is stored in the Orthanc database. Global properties whose index is below 1024 are reserved by Orthanc.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
property | The global property of interest. |
defaultValue | The value to return, if the global property is unset. |
char* OrthancPluginLookupInstance | ( | OrthancPluginContext * | context, |
const char * | sopInstanceUID | ||
) |
Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018). This function uses the database index to run as fast as possible (it does not loop over all the stored instances).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
sopInstanceUID | The SOP Instance UID of interest. |
char* OrthancPluginLookupPatient | ( | OrthancPluginContext * | context, |
const char * | patientID | ||
) |
Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020). This function uses the database index to run as fast as possible (it does not loop over all the stored patients).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
patientID | The Patient ID of interest. |
char* OrthancPluginLookupSeries | ( | OrthancPluginContext * | context, |
const char * | seriesUID | ||
) |
Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e). This function uses the database index to run as fast as possible (it does not loop over all the stored series).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
seriesUID | The Series Instance UID of interest. |
char* OrthancPluginLookupStudy | ( | OrthancPluginContext * | context, |
const char * | studyUID | ||
) |
Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d). This function uses the database index to run as fast as possible (it does not loop over all the stored studies).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
studyUID | The Study Instance UID of interest. |
char* OrthancPluginLookupStudyWithAccessionNumber | ( | OrthancPluginContext * | context, |
const char * | accessionNumber | ||
) |
Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050). This function uses the database index to run as fast as possible (it does not loop over all the stored studies).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
accessionNumber | The Accession Number of interest. |
OrthancPluginErrorCode OrthancPluginRestApiDelete | ( | OrthancPluginContext * | context, |
const char * | uri | ||
) |
Make a DELETE call to the built-in Orthanc REST API.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
uri | The URI to delete in the built-in Orthanc API. |
OrthancPluginErrorCode OrthancPluginRestApiDeleteAfterPlugins | ( | OrthancPluginContext * | context, |
const char * | uri | ||
) |
Make a DELETE call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
uri | The URI to delete in the built-in Orthanc API. |
OrthancPluginErrorCode OrthancPluginRestApiGet | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri | ||
) |
Make a GET call to the built-in Orthanc REST API. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
OrthancPluginErrorCode OrthancPluginRestApiGet2 | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri, | ||
uint32_t | headersCount, | ||
const char *const * | headersKeys, | ||
const char *const * | headersValues, | ||
int32_t | afterPlugins | ||
) |
Make a GET call to the Orthanc REST API with extended parameters. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
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). |
afterPlugins | If 0, the built-in API of Orthanc is used. If 1, the API is tainted by the plugins. |
OrthancPluginErrorCode OrthancPluginRestApiGetAfterPlugins | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri | ||
) |
Make a GET call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
OrthancPluginErrorCode OrthancPluginRestApiPost | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri, | ||
const void * | body, | ||
uint32_t | bodySize | ||
) |
Make a POST call to the built-in Orthanc REST API. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
body | The body of the POST request. |
bodySize | The size of the body. |
OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri, | ||
const void * | body, | ||
uint32_t | bodySize | ||
) |
Make a POST call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
body | The body of the POST request. |
bodySize | The size of the body. |
OrthancPluginErrorCode OrthancPluginRestApiPut | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri, | ||
const void * | body, | ||
uint32_t | bodySize | ||
) |
Make a PUT call to the built-in Orthanc REST API. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
body | The body of the PUT request. |
bodySize | The size of the body. |
OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const char * | uri, | ||
const void * | body, | ||
uint32_t | bodySize | ||
) |
Make a PUT call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin. The result to the query is stored 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(). |
uri | The URI in the built-in Orthanc API. |
body | The body of the PUT request. |
bodySize | The size of the body. |
OrthancPluginErrorCode OrthancPluginSetGlobalProperty | ( | OrthancPluginContext * | context, |
int32_t | property, | ||
const char * | value | ||
) |
Set the value of a global property into the Orthanc database. Setting a global property can be used by plugins to save their internal parameters. Plugins are only allowed to set properties whose index are above or equal to 1024 (properties below 1024 are read-only and reserved by Orthanc).
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
property | The global property of interest. |
value | The value to be set in the global property. |