![]() |
Orthanc Plugin SDK
Documentation of the plugin interface of Orthanc
|
Generic functions to help with the creation of plugins. More...
Classes | |
struct | OrthancPluginHttpRequest |
The parameters of a REST request. More... | |
struct | OrthancPluginMemoryBuffer |
A memory buffer allocated by the core system of Orthanc. More... | |
struct | OrthancPluginDictionaryEntry |
An entry in the dictionary of DICOM tags. More... | |
Typedefs | |
typedef struct _OrthancPluginRestOutput_t | OrthancPluginRestOutput |
Opaque structure that represents the HTTP connection to the client application. | |
typedef struct _OrthancPluginDicomInstance_t | OrthancPluginDicomInstance |
Opaque structure that represents a DICOM instance received by Orthanc. | |
typedef void(* | OrthancPluginFree) (void *buffer) |
Signature of a function to free dynamic memory. | |
typedef struct _OrthancPluginContext_t | OrthancPluginContext |
Data structure that contains information about the Orthanc core. | |
Functions | |
void | OrthancPluginFreeString (OrthancPluginContext *context, char *str) |
Free a string. More... | |
void | OrthancPluginFreeMemoryBuffer (OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer) |
Free a memory buffer. More... | |
void | OrthancPluginLogError (OrthancPluginContext *context, const char *message) |
Log an error. More... | |
void | OrthancPluginLogWarning (OrthancPluginContext *context, const char *message) |
Log a warning. More... | |
void | OrthancPluginLogInfo (OrthancPluginContext *context, const char *message) |
Log an information. More... | |
char * | OrthancPluginGetOrthancPath (OrthancPluginContext *context) |
Return the path to the Orthanc executable. More... | |
char * | OrthancPluginGetOrthancDirectory (OrthancPluginContext *context) |
Return the directory containing the Orthanc. More... | |
char * | OrthancPluginGetConfigurationPath (OrthancPluginContext *context) |
Return the path to the configuration file(s). More... | |
void | OrthancPluginSetRootUri (OrthancPluginContext *context, const char *uri) |
Set the URI where the plugin provides its Web interface. More... | |
void | OrthancPluginSetDescription (OrthancPluginContext *context, const char *description) |
Set a description for this plugin. More... | |
void | OrthancPluginExtendOrthancExplorer (OrthancPluginContext *context, const char *javascript) |
Extend the JavaScript code of Orthanc Explorer. More... | |
uint32_t | OrthancPluginGetCommandLineArgumentsCount (OrthancPluginContext *context) |
Get the number of command-line arguments. More... | |
char * | OrthancPluginGetCommandLineArgument (OrthancPluginContext *context, uint32_t argument) |
Get the value of a command-line argument. More... | |
char * | OrthancPluginGetConfiguration (OrthancPluginContext *context) |
Return the content of the configuration file(s). More... | |
OrthancPluginErrorCode | OrthancPluginReadFile (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *path) |
Read a file. More... | |
OrthancPluginErrorCode | OrthancPluginWriteFile (OrthancPluginContext *context, const char *path, const void *data, uint32_t size) |
Write a file. More... | |
const char * | OrthancPluginGetErrorDescription (OrthancPluginContext *context, OrthancPluginErrorCode error) |
Get the description of a given error code. 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 char *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 char *body, uint32_t bodySize, const char *username, const char *password) |
Issue a HTTP PUT call. More... | |
OrthancPluginErrorCode | OrthancPluginHttpDelete (OrthancPluginContext *context, const char *url, const char *username, const char *password) |
Issue a HTTP DELETE call. More... | |
OrthancPluginErrorCode | OrthancPluginRegisterErrorCode (OrthancPluginContext *context, int32_t code, uint16_t httpStatus, const char *message) |
Declare a custom error code for this plugin. 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... | |
char * | OrthancPluginDicomBufferToJson (OrthancPluginContext *context, const char *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... | |
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... | |
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 | OrthancPluginLookupDictionary (OrthancPluginContext *context, OrthancPluginDictionaryEntry *target, const char *name) |
Get information about the given DICOM tag. More... | |
Flags to the creation of a DICOM file.
Enumerator | |
---|---|
OrthancPluginCreateDicomFlags_DecodeDataUriScheme |
Decode fields encoded using data URI scheme |
OrthancPluginCreateDicomFlags_GenerateIdentifiers |
Automatically generate DICOM identifiers |
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.
For Microsoft Visual Studio, a compatibility "stdint.h" can be downloaded at the following URL: https://orthanc.googlecode.com/hg/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 value representations present in the DICOM standard (version 2013).
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.
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. |
char* OrthancPluginDicomBufferToJson | ( | OrthancPluginContext * | context, |
const char * | 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. |
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 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 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* 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* 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(). |
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 char * | 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 char * | 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 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 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. |
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 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. |
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. |