Mercurial > hg > orthanc
diff OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h @ 4477:0a2c9790cb41
new primitive in plugin SDK: OrthancPluginCreateDicom2()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 27 Jan 2021 16:54:03 +0100 |
parents | f77ee6e6cf47 |
children | a926f8995d0b |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h Tue Jan 26 18:25:52 2021 +0100 +++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h Wed Jan 27 16:54:03 2021 +0100 @@ -439,6 +439,7 @@ _OrthancPluginService_CreateMemoryBuffer = 38, /* New in Orthanc 1.7.0 */ _OrthancPluginService_GenerateRestApiAuthorizationToken = 39, /* New in Orthanc 1.8.1 */ _OrthancPluginService_CreateMemoryBuffer64 = 40, /* New in Orthanc 1.9.0 */ + _OrthancPluginService_CreateDicom2 = 41, /* New in Orthanc 1.9.0 */ /* Registration of callbacks */ _OrthancPluginService_RegisterRestCallback = 1000, @@ -5317,6 +5318,12 @@ * memory buffer. Additionally, an image to be encoded within the * DICOM instance can also be provided. * + * Private tags will be associated with the private creator whose + * value is specified in the "DefaultPrivateCreator" configuration + * option of Orthanc. The function OrthancPluginCreateDicom2() can + * be used if another private creator must be used to create this + * instance. + * * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer(). * @param json The input JSON file. @@ -5324,6 +5331,7 @@ * @param flags Flags governing the output. * @return 0 if success, other value if error. * @ingroup Toolbox + * @see OrthancPluginCreateDicom2 * @see OrthancPluginDicomBufferToJson **/ ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateDicom( @@ -8423,6 +8431,56 @@ context->InvokeService(context, _OrthancPluginService_RegisterStorageArea2, ¶ms); } + + + typedef struct + { + _OrthancPluginCreateDicom createDicom; + const char* privateCreator; + } _OrthancPluginCreateDicom2; + + /** + * @brief Create a DICOM instance from a JSON string and an image, with a private creator. + * + * 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. + * + * Contrarily to the function OrthancPluginCreateDicom(), this + * function can be explicitly provided with a private creator. + * + * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). + * @param target The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer(). + * @param json The input JSON file. + * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme. + * @param flags Flags governing the output. + * @param privateCreator The private creator to be used for the private DICOM tags. + * Check out the global configuration option "Dictionary" of Orthanc. + * @return 0 if success, other value if error. + * @ingroup Toolbox + * @see OrthancPluginCreateDicom + * @see OrthancPluginDicomBufferToJson + **/ + ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginCreateDicom2( + OrthancPluginContext* context, + OrthancPluginMemoryBuffer* target, + const char* json, + const OrthancPluginImage* pixelData, + OrthancPluginCreateDicomFlags flags, + const char* privateCreator) + { + _OrthancPluginCreateDicom2 params; + params.createDicom.target = target; + params.createDicom.json = json; + params.createDicom.pixelData = pixelData; + params.createDicom.flags = flags; + params.privateCreator = privateCreator; + + return context->InvokeService(context, _OrthancPluginService_CreateDicom2, ¶ms); + } + #ifdef __cplusplus } #endif