Orthanc Plugin SDK
1.12.4
Documentation of the plugin interface of Orthanc
|
Functions to deal with images and compressed buffers. More...
Typedefs | |
typedef struct _OrthancPluginImage_t | OrthancPluginImage |
Opaque structure that represents an image that is uncompressed in memory. | |
typedef struct _OrthancPluginStorageArea_t | OrthancPluginStorageArea |
Opaque structure that represents the storage area that is actually used by Orthanc. | |
Enumerations | |
enum | OrthancPluginCompressionType { OrthancPluginCompressionType_Zlib , OrthancPluginCompressionType_ZlibWithSize , OrthancPluginCompressionType_Gzip , OrthancPluginCompressionType_GzipWithSize , _OrthancPluginCompressionType_INTERNAL } |
enum | OrthancPluginImageFormat { OrthancPluginImageFormat_Png , OrthancPluginImageFormat_Jpeg , OrthancPluginImageFormat_Dicom , _OrthancPluginImageFormat_INTERNAL } |
enum | OrthancPluginPixelFormat { OrthancPluginPixelFormat_Grayscale8 , OrthancPluginPixelFormat_Grayscale16 , OrthancPluginPixelFormat_SignedGrayscale16 , OrthancPluginPixelFormat_RGB24 , OrthancPluginPixelFormat_RGBA32 , OrthancPluginPixelFormat_Unknown , OrthancPluginPixelFormat_RGB48 , OrthancPluginPixelFormat_Grayscale32 , OrthancPluginPixelFormat_Float32 , OrthancPluginPixelFormat_BGRA32 , OrthancPluginPixelFormat_Grayscale64 , _OrthancPluginPixelFormat_INTERNAL } |
Functions | |
OrthancPluginErrorCode | OrthancPluginBufferCompression (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const void *source, uint32_t size, OrthancPluginCompressionType compression, uint8_t uncompress) |
Compress or decompress a buffer. More... | |
OrthancPluginErrorCode | OrthancPluginCompressJpegImage (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer, uint8_t quality) |
Encode a JPEG image. More... | |
OrthancPluginErrorCode | OrthancPluginCompressPngImage (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer) |
Encode a PNG image. More... | |
OrthancPluginImage * | OrthancPluginConvertPixelFormat (OrthancPluginContext *context, const OrthancPluginImage *source, OrthancPluginPixelFormat targetFormat) |
Change the pixel format of an image. More... | |
OrthancPluginImage * | OrthancPluginCreateImage (OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height) |
Create an image. More... | |
OrthancPluginImage * | OrthancPluginCreateImageAccessor (OrthancPluginContext *context, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, void *buffer) |
Create an image pointing to a memory buffer. More... | |
OrthancPluginImage * | OrthancPluginDecodeDicomImage (OrthancPluginContext *context, const void *buffer, uint32_t bufferSize, uint32_t frameIndex) |
Decode one frame from a DICOM instance. More... | |
OrthancPluginErrorCode | OrthancPluginDrawText (OrthancPluginContext *context, OrthancPluginImage *image, uint32_t fontIndex, const char *utf8Text, int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b) |
Draw text on an image. More... | |
void | OrthancPluginFreeImage (OrthancPluginContext *context, OrthancPluginImage *image) |
Free an image. More... | |
const char * | OrthancPluginGetFontName (OrthancPluginContext *context, uint32_t fontIndex) |
Return the name of a font. More... | |
uint32_t | OrthancPluginGetFontsCount (OrthancPluginContext *context) |
Return the number of available fonts. More... | |
uint32_t | OrthancPluginGetFontSize (OrthancPluginContext *context, uint32_t fontIndex) |
Return the size of a font. More... | |
void * | OrthancPluginGetImageBuffer (OrthancPluginContext *context, const OrthancPluginImage *image) |
Return a pointer to the content of an image. More... | |
uint32_t | OrthancPluginGetImageHeight (OrthancPluginContext *context, const OrthancPluginImage *image) |
Return the height of an image. More... | |
uint32_t | OrthancPluginGetImagePitch (OrthancPluginContext *context, const OrthancPluginImage *image) |
Return the pitch of an image. More... | |
OrthancPluginPixelFormat | OrthancPluginGetImagePixelFormat (OrthancPluginContext *context, const OrthancPluginImage *image) |
Return the pixel format of an image. More... | |
uint32_t | OrthancPluginGetImageWidth (OrthancPluginContext *context, const OrthancPluginImage *image) |
Return the width of an image. More... | |
OrthancPluginImage * | OrthancPluginUncompressImage (OrthancPluginContext *context, const void *data, uint32_t size, OrthancPluginImageFormat format) |
Decode a compressed image. More... | |
The compression algorithms that are supported by the Orthanc core.
The memory layout of the pixels of an image.
OrthancPluginErrorCode OrthancPluginBufferCompression | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
const void * | source, | ||
uint32_t | size, | ||
OrthancPluginCompressionType | compression, | ||
uint8_t | uncompress | ||
) |
This function compresses or decompresses a buffer, using the version of the zlib library that is 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(). |
source | The source buffer. |
size | The size in bytes of the source buffer. |
compression | The compression algorithm. |
uncompress | If set to "0", the buffer must be compressed. If set to "1", the buffer must be uncompressed. |
OrthancPluginErrorCode OrthancPluginCompressJpegImage | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
OrthancPluginPixelFormat | format, | ||
uint32_t | width, | ||
uint32_t | height, | ||
uint32_t | pitch, | ||
const void * | buffer, | ||
uint8_t | quality | ||
) |
This function compresses the given memory buffer containing an image using the JPEG specification, and stores the result of the compression 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(). |
format | The memory layout of the uncompressed image. |
width | The width of the image. |
height | The height of the image. |
pitch | The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer). |
buffer | The memory buffer containing the uncompressed image. |
quality | The quality of the JPEG encoding, between 1 (worst quality, best compression) and 100 (best quality, worst compression). |
OrthancPluginErrorCode OrthancPluginCompressPngImage | ( | OrthancPluginContext * | context, |
OrthancPluginMemoryBuffer * | target, | ||
OrthancPluginPixelFormat | format, | ||
uint32_t | width, | ||
uint32_t | height, | ||
uint32_t | pitch, | ||
const void * | buffer | ||
) |
This function compresses the given memory buffer containing an image using the PNG specification, and stores the result of the compression 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(). |
format | The memory layout of the uncompressed image. |
width | The width of the image. |
height | The height of the image. |
pitch | The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer). |
buffer | The memory buffer containing the uncompressed image. |
OrthancPluginImage* OrthancPluginConvertPixelFormat | ( | OrthancPluginContext * | context, |
const OrthancPluginImage * | source, | ||
OrthancPluginPixelFormat | targetFormat | ||
) |
This function creates a new image, changing the memory layout of the pixels.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
source | The source image. |
targetFormat | The target pixel format. |
OrthancPluginImage* OrthancPluginCreateImage | ( | OrthancPluginContext * | context, |
OrthancPluginPixelFormat | format, | ||
uint32_t | width, | ||
uint32_t | height | ||
) |
This function creates an image of given size and format.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
format | The format of the pixels. |
width | The width of the image. |
height | The height of the image. |
OrthancPluginImage* OrthancPluginCreateImageAccessor | ( | OrthancPluginContext * | context, |
OrthancPluginPixelFormat | format, | ||
uint32_t | width, | ||
uint32_t | height, | ||
uint32_t | pitch, | ||
void * | buffer | ||
) |
This function creates an image whose content points to a memory buffer managed by the plugin. Note that the buffer is directly accessed, no memory is allocated and no data is copied.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
format | The format of the pixels. |
width | The width of the image. |
height | The height of the image. |
pitch | The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer). |
buffer | The memory buffer. |
OrthancPluginImage* OrthancPluginDecodeDicomImage | ( | OrthancPluginContext * | context, |
const void * | buffer, | ||
uint32_t | bufferSize, | ||
uint32_t | frameIndex | ||
) |
This function decodes one frame of a DICOM image that is stored in a memory buffer. This function will give the same result as OrthancPluginUncompressImage() for single-frame DICOM images.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
buffer | Pointer to a memory buffer containing the DICOM image. |
bufferSize | Size of the memory buffer containing the DICOM image. |
frameIndex | The index of the frame of interest in a multi-frame image. |
OrthancPluginErrorCode OrthancPluginDrawText | ( | OrthancPluginContext * | context, |
OrthancPluginImage * | image, | ||
uint32_t | fontIndex, | ||
const char * | utf8Text, | ||
int32_t | x, | ||
int32_t | y, | ||
uint8_t | r, | ||
uint8_t | g, | ||
uint8_t | b | ||
) |
This function draws some text on some image.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image upon which to draw the text. |
fontIndex | The index of the font. This value must be less than OrthancPluginGetFontsCount(). |
utf8Text | The text to be drawn, encoded as an UTF-8 zero-terminated string. |
x | The X position of the text over the image. |
y | The Y position of the text over the image. |
r | The value of the red color channel of the text. |
g | The value of the green color channel of the text. |
b | The value of the blue color channel of the text. |
void OrthancPluginFreeImage | ( | OrthancPluginContext * | context, |
OrthancPluginImage * | image | ||
) |
This function frees an image that was decoded with OrthancPluginUncompressImage().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image. |
const char* OrthancPluginGetFontName | ( | OrthancPluginContext * | context, |
uint32_t | fontIndex | ||
) |
This function returns the name of a font that is built in the Orthanc core.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
fontIndex | The index of the font. This value must be less than OrthancPluginGetFontsCount(). |
uint32_t OrthancPluginGetFontsCount | ( | OrthancPluginContext * | context | ) |
This function returns the number of fonts that are built in the Orthanc core. These fonts can be used to draw texts on images through OrthancPluginDrawText().
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
uint32_t OrthancPluginGetFontSize | ( | OrthancPluginContext * | context, |
uint32_t | fontIndex | ||
) |
This function returns the size of a font that is built in the Orthanc core.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
fontIndex | The index of the font. This value must be less than OrthancPluginGetFontsCount(). |
void* OrthancPluginGetImageBuffer | ( | OrthancPluginContext * | context, |
const OrthancPluginImage * | image | ||
) |
This function returns a pointer to the memory buffer that contains the pixels of the image.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image of interest. |
uint32_t OrthancPluginGetImageHeight | ( | OrthancPluginContext * | context, |
const OrthancPluginImage * | image | ||
) |
This function returns the height of the given image.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image of interest. |
uint32_t OrthancPluginGetImagePitch | ( | OrthancPluginContext * | context, |
const OrthancPluginImage * | image | ||
) |
This function returns the pitch of the given image. The pitch is defined as the number of bytes between 2 successive lines of the image in the memory buffer.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image of interest. |
OrthancPluginPixelFormat OrthancPluginGetImagePixelFormat | ( | OrthancPluginContext * | context, |
const OrthancPluginImage * | image | ||
) |
This function returns the type of memory layout for the pixels of the given image.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image of interest. |
uint32_t OrthancPluginGetImageWidth | ( | OrthancPluginContext * | context, |
const OrthancPluginImage * | image | ||
) |
This function returns the width of the given image.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
image | The image of interest. |
OrthancPluginImage* OrthancPluginUncompressImage | ( | OrthancPluginContext * | context, |
const void * | data, | ||
uint32_t | size, | ||
OrthancPluginImageFormat | format | ||
) |
This function decodes a compressed image from a memory buffer.
context | The Orthanc plugin context, as received by OrthancPluginInitialize(). |
data | Pointer to a memory buffer containing the compressed image. |
size | Size of the memory buffer containing the compressed image. |
format | The file format of the compressed image. |