Mercurial > hg > orthanc
diff Plugins/Include/orthanc/OrthancCPlugin.h @ 1608:adc6a5704cdb
OrthancPluginConvertPixelFormat
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 02 Sep 2015 13:58:08 +0200 |
parents | 31f4adefb88f |
children | c74495267acf |
line wrap: on
line diff
--- a/Plugins/Include/orthanc/OrthancCPlugin.h Tue Sep 01 17:40:45 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Wed Sep 02 13:58:08 2015 +0200 @@ -437,6 +437,7 @@ _OrthancPluginService_UncompressImage = 6005, _OrthancPluginService_FreeImage = 6006, _OrthancPluginService_CompressImage = 6007, + _OrthancPluginService_ConvertPixelFormat = 6008, _OrthancPluginService_INTERNAL = 0x7fffffff } _OrthancPluginService; @@ -3272,6 +3273,48 @@ + typedef struct + { + OrthancPluginImage** target; + const OrthancPluginImage* source; + OrthancPluginPixelFormat targetFormat; + } _OrthancPluginConvertPixelFormat; + + + /** + * @brief Change the pixel format of an image. + * + * This function creates a new image, changing the memory layout of the pixels. + * + * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). + * @param source The source image. + * @param targetFormat The target pixel format. + * @return The resulting image. It must be freed with OrthancPluginFreeImage(). + * @ingroup Compression + **/ + ORTHANC_PLUGIN_INLINE OrthancPluginImage *OrthancPluginConvertPixelFormat( + OrthancPluginContext* context, + const OrthancPluginImage* source, + OrthancPluginPixelFormat targetFormat) + { + OrthancPluginImage* target = NULL; + + _OrthancPluginConvertPixelFormat params; + params.target = ⌖ + params.source = source; + params.targetFormat = targetFormat; + + if (context->InvokeService(context, _OrthancPluginService_ConvertPixelFormat, ¶ms) != OrthancPluginErrorCode_Success) + { + return NULL; + } + else + { + return target; + } + } + + #ifdef __cplusplus } #endif