Orthanc Plugin SDK  1.3.1
Documentation of the plugin interface of Orthanc
Functions
Orthanc

Functions to access the content of the Orthanc server. More...

Functions

OrthancPluginErrorCode OrthancPluginGetDicomForInstance (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
 Retrieve a DICOM instance using its Orthanc identifier. More...
 
OrthancPluginErrorCode OrthancPluginRestApiGet (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
 Make a GET call to the built-in Orthanc REST API. 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 char *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 char *body, uint32_t bodySize)
 Make a POST call to the REST API, as tainted by the plugins. 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 OrthancPluginRestApiPut (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *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 char *body, uint32_t bodySize)
 Make a PUT call to the REST API, as tainted by the plugins. More...
 
char * OrthancPluginLookupPatient (OrthancPluginContext *context, const char *patientID)
 Look for a patient. 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...
 
char * OrthancPluginLookupSeries (OrthancPluginContext *context, const char *seriesUID)
 Look for a series. More...
 
char * OrthancPluginLookupInstance (OrthancPluginContext *context, const char *sopInstanceUID)
 Look for an instance. More...
 
char * OrthancPluginGetGlobalProperty (OrthancPluginContext *context, int32_t property, const char *defaultValue)
 Get the value of a global property. More...
 
OrthancPluginErrorCode OrthancPluginSetGlobalProperty (OrthancPluginContext *context, int32_t property, const char *value)
 Set the value of a global property. 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...
 

Detailed Description

Function Documentation

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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
instanceIdThe Orthanc identifier of the DICOM instance of interest.
Returns
0 if success, or the error code if failure.
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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
propertyThe global property of interest.
defaultValueThe value to return, if the global property is unset.
Returns
The value of the global property, or NULL in the case of an error. This string must be freed by OrthancPluginFreeString().
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).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
sopInstanceUIDThe SOP Instance UID of interest.
Returns
The NULL value if the instance is non-existent, or a string containing the Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
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).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
patientIDThe Patient ID of interest.
Returns
The NULL value if the patient is non-existent, or a string containing the Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
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).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
seriesUIDThe Series Instance UID of interest.
Returns
The NULL value if the series is non-existent, or a string containing the Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
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).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
studyUIDThe Study Instance UID of interest.
Returns
The NULL value if the study is non-existent, or a string containing the Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
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).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
accessionNumberThe Accession Number of interest.
Returns
The NULL value if the study is non-existent, or a string containing the Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
OrthancPluginErrorCode OrthancPluginRestApiDelete ( OrthancPluginContext context,
const char *  uri 
)

Make a DELETE call to the built-in Orthanc REST API.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
uriThe URI to delete in the built-in Orthanc API.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiDeleteAfterPlugins
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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
uriThe URI to delete in the built-in Orthanc API.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiDelete
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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiGetAfterPlugins
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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
headersCountThe number of HTTP headers.
headersKeysArray containing the keys of the HTTP headers (can be NULL if no header).
headersValuesArray containing the values of the HTTP headers (can be NULL if no header).
afterPluginsIf 0, the built-in API of Orthanc is used. If 1, the API is tainted by the plugins.
Returns
0 if success, or the error code if failure.
See also
OrthancPluginRestApiGet, OrthancPluginRestApiGetAfterPlugins
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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiGet
OrthancPluginErrorCode OrthancPluginRestApiPost ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri,
const char *  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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
bodyThe body of the POST request.
bodySizeThe size of the body.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiPostAfterPlugins
OrthancPluginErrorCode OrthancPluginRestApiPostAfterPlugins ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri,
const char *  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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
bodyThe body of the POST request.
bodySizeThe size of the body.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiPost
OrthancPluginErrorCode OrthancPluginRestApiPut ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri,
const char *  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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
bodyThe body of the PUT request.
bodySizeThe size of the body.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiPutAfterPlugins
OrthancPluginErrorCode OrthancPluginRestApiPutAfterPlugins ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri,
const char *  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.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer().
uriThe URI in the built-in Orthanc API.
bodyThe body of the PUT request.
bodySizeThe size of the body.
Returns
0 if success, or the error code if failure.
Note
If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
See also
OrthancPluginRestApiPut
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).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
propertyThe global property of interest.
valueThe value to be set in the global property.
Returns
0 if success, or the error code if failure.