changeset 2424:7ef9207f31d4

New pixel formats exposed in plugin SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Oct 2017 12:38:02 +0200
parents 5a7c5c541a1d
children 59b7aa77a8da
files NEWS Plugins/Engine/PluginsEnumerations.cpp Plugins/Include/orthanc/OrthancCPlugin.h Plugins/Samples/Common/OrthancPluginCppWrapper.h Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp
diffstat 5 files changed, 82 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Oct 09 21:58:08 2017 +0200
+++ b/NEWS	Tue Oct 10 12:38:02 2017 +0200
@@ -13,6 +13,11 @@
 * New argument "ignore-length" to force the inclusion of too long tags in JSON
 * New argument "/.../media?extended" to include additional type-3 tags in DICOMDIR
 
+Plugins
+-------
+
+* New pixel formats exposed in SDK: BGRA32, Float32, Grayscale32, RGB48
+
 Maintenance
 -----------
 
--- a/Plugins/Engine/PluginsEnumerations.cpp	Mon Oct 09 21:58:08 2017 +0200
+++ b/Plugins/Engine/PluginsEnumerations.cpp	Tue Oct 10 12:38:02 2017 +0200
@@ -139,15 +139,27 @@
     {
       switch (format)
       {
+        case PixelFormat_BGRA32:
+          return OrthancPluginPixelFormat_BGRA32;
+
+        case PixelFormat_Float32:
+          return OrthancPluginPixelFormat_Float32;
+
         case PixelFormat_Grayscale16:
           return OrthancPluginPixelFormat_Grayscale16;
 
+        case PixelFormat_Grayscale32:
+          return OrthancPluginPixelFormat_Grayscale32;
+
         case PixelFormat_Grayscale8:
           return OrthancPluginPixelFormat_Grayscale8;
 
         case PixelFormat_RGB24:
           return OrthancPluginPixelFormat_RGB24;
 
+        case PixelFormat_RGB48:
+          return OrthancPluginPixelFormat_RGB48;
+
         case PixelFormat_RGBA32:
           return OrthancPluginPixelFormat_RGBA32;
 
@@ -164,15 +176,27 @@
     {
       switch (format)
       {
+        case OrthancPluginPixelFormat_BGRA32:
+          return PixelFormat_BGRA32;
+
+        case OrthancPluginPixelFormat_Float32:
+          return PixelFormat_Float32;
+
         case OrthancPluginPixelFormat_Grayscale16:
           return PixelFormat_Grayscale16;
 
+        case OrthancPluginPixelFormat_Grayscale32:
+          return PixelFormat_Grayscale32;
+
         case OrthancPluginPixelFormat_Grayscale8:
           return PixelFormat_Grayscale8;
 
         case OrthancPluginPixelFormat_RGB24:
           return PixelFormat_RGB24;
 
+        case OrthancPluginPixelFormat_RGB48:
+          return PixelFormat_RGB48;
+
         case OrthancPluginPixelFormat_RGBA32:
           return PixelFormat_RGBA32;
 
--- a/Plugins/Include/orthanc/OrthancCPlugin.h	Mon Oct 09 21:58:08 2017 +0200
+++ b/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Oct 10 12:38:02 2017 +0200
@@ -118,7 +118,17 @@
 
 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER     1
 #define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER     3
-#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER  0
+#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER  1
+
+
+#if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
+#define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
+  (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major ||               \
+   (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major &&             \
+    (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor ||             \
+     (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor &&           \
+      ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
+#endif
 
 
 
@@ -570,6 +580,38 @@
 
     OrthancPluginPixelFormat_Unknown = 6,   /*!< Unknown pixel format */
 
+    /**
+     * @brief Color image in RGB48 format.
+     *
+     * This format describes a color image. The pixels are stored in 6
+     * consecutive bytes. The memory layout is RRGGBB.
+     **/
+    OrthancPluginPixelFormat_RGB48 = 7,
+
+    /**
+     * @brief Graylevel, unsigned 32bpp image.
+     *
+     * The image is graylevel. Each pixel is unsigned and stored in
+     * four bytes.
+     **/
+    OrthancPluginPixelFormat_Grayscale32 = 8,
+
+    /**
+     * @brief Graylevel, floating-point 32bpp image.
+     *
+     * The image is graylevel. Each pixel is floating-point and stored
+     * in four bytes.
+     **/
+    OrthancPluginPixelFormat_Float32 = 9,
+
+    /**
+     * @brief Color image in BGRA32 format.
+     *
+     * This format describes a color image. The pixels are stored in 4
+     * consecutive bytes. The memory layout is BGRA.
+     **/
+    OrthancPluginPixelFormat_BGRA32 = 10,
+
     _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
   } OrthancPluginPixelFormat;
 
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Mon Oct 09 21:58:08 2017 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Tue Oct 10 12:38:02 2017 +0200
@@ -44,13 +44,15 @@
 
 
 
+#if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
 #define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
   (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major ||               \
    (ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major &&             \
     (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor ||             \
      (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor &&           \
       ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
-  
+#endif
+
 
 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 2, 0)
 // The "OrthancPluginFindMatcher()" primitive was introduced in Orthanc 1.2.0
--- a/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp	Mon Oct 09 21:58:08 2017 +0200
+++ b/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.cpp	Tue Oct 10 12:38:02 2017 +0200
@@ -199,6 +199,13 @@
         case gdcm::PixelFormat::UINT8:
           return OrthancPluginPixelFormat_RGB24;
 
+        case gdcm::PixelFormat::UINT16:
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 3, 1)
+          return OrthancPluginPixelFormat_RGB48;
+#else
+          throw std::runtime_error("RGB48 pixel format is only supported by Orthanc >= 1.3.1");
+#endif
+          
         default:
           break;
       }