# HG changeset patch # User Sebastien Jodogne # Date 1720004178 -7200 # Node ID 315e1720a35f0c1cfa2ee50798a56685aa72731f # Parent 968dbd6982bb968da0f0feb3e52229400168cf9a documented orthanc.CreateImageFromBuffer() diff -r 968dbd6982bb -r 315e1720a35f CodeAnalysis/CustomFunctions.json --- a/CodeAnalysis/CustomFunctions.json Wed Jul 03 12:38:31 2024 +0200 +++ b/CodeAnalysis/CustomFunctions.json Wed Jul 03 12:56:18 2024 +0200 @@ -107,5 +107,47 @@ } ], "return_sdk_type" : "Dictionary" + }, + + { + "comment" : "New in release 3.2", + "short_name" : "CreateImageFromBuffer", + "implementation" : "CreateImageFromBuffer", + "documentation" : { + "description" : [ "This function creates an image of given size and format, and initializes its pixel data from a memory buffer." ], + "args" : { + "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." + }, + "return" : "The newly allocated image." + }, + "args" : [ + { + "sdk_name" : "format", + "sdk_type" : "enumeration", + "sdk_enumeration" : "OrthancPluginPixelFormat" + }, + { + "sdk_name" : "width", + "sdk_type" : "uint32_t" + }, + { + "sdk_name" : "height", + "sdk_type" : "uint32_t" + }, + { + "sdk_name" : "pitch", + "sdk_type" : "uint32_t" + }, + { + "sdk_name" : "buffer", + "sdk_type" : "const void *" + } + ], + "return_sdk_type" : "object", + "return_sdk_class" : "OrthancPluginImage" } ] diff -r 968dbd6982bb -r 315e1720a35f Sources/Autogenerated/orthanc.pyi --- a/Sources/Autogenerated/orthanc.pyi Wed Jul 03 12:38:31 2024 +0200 +++ b/Sources/Autogenerated/orthanc.pyi Wed Jul 03 12:56:18 2024 +0200 @@ -2156,6 +2156,23 @@ """ ... +# This function creates an image of given size and format, and initializes its pixel data from a memory buffer +def CreateImageFromBuffer(format: PixelFormat, width: int, height: int, pitch: int, buffer: bytes) -> Image: + """ + This function creates an image of given size and format, and initializes its pixel data from a memory buffer. + + Args: + format (PixelFormat): The format of the pixels. + width (int): The width of the image. + height (int): The height of the image. + pitch (int): The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer). + buffer (bytes): The memory buffer. + + Returns: + Image: The newly allocated image. + """ + ... + # Get information about the given DICOM tag def LookupDictionary(name: str) -> dict: """ diff -r 968dbd6982bb -r 315e1720a35f Sources/Autogenerated/sdk_GlobalFunctions.impl.h --- a/Sources/Autogenerated/sdk_GlobalFunctions.impl.h Wed Jul 03 12:38:31 2024 +0200 +++ b/Sources/Autogenerated/sdk_GlobalFunctions.impl.h Wed Jul 03 12:56:18 2024 +0200 @@ -23,6 +23,7 @@ // Forward declaration of the custom global functions +extern PyObject *CreateImageFromBuffer(PyObject* module, PyObject *args); extern PyObject *LookupDictionary(PyObject* module, PyObject *args); extern PyObject *RegisterIncomingHttpRequestFilter(PyObject* module, PyObject *args); extern PyObject *RegisterOnChangeCallback(PyObject* module, PyObject *args); @@ -2021,6 +2022,8 @@ "Generated from C function OrthancPluginUncompressImage()" }, { "WriteFile", sdk_OrthancPluginWriteFile, METH_VARARGS, "Generated from C function OrthancPluginWriteFile()" }, + { "CreateImageFromBuffer", CreateImageFromBuffer, METH_VARARGS, + "Implemented in C++ function CreateImageFromBuffer()" }, { "LookupDictionary", LookupDictionary, METH_VARARGS, "Implemented in C++ function LookupDictionary()" }, { "RegisterIncomingHttpRequestFilter", RegisterIncomingHttpRequestFilter, METH_VARARGS, diff -r 968dbd6982bb -r 315e1720a35f Sources/Plugin.cpp --- a/Sources/Plugin.cpp Wed Jul 03 12:38:31 2024 +0200 +++ b/Sources/Plugin.cpp Wed Jul 03 12:56:18 2024 +0200 @@ -289,11 +289,6 @@ **/ { - PyMethodDef f = { "CreateImageFromBuffer", CreateImageFromBuffer, METH_VARARGS, "" }; - functions.push_back(f); - } - - { PyMethodDef f = { "RegisterFindCallback", RegisterFindCallback, METH_VARARGS, "" }; functions.push_back(f); }