# HG changeset patch # User Sebastien Jodogne # Date 1527748282 -7200 # Node ID 89b7893665963401774a57ffdb71eaa4b10a1f9a # Parent 5094369664f04b627241e38961910df0092d10e4 Grayscale64 pixel format diff -r 5094369664f0 -r 89b789366596 Core/Enumerations.cpp --- a/Core/Enumerations.cpp Mon May 28 10:54:59 2018 +0200 +++ b/Core/Enumerations.cpp Thu May 31 08:31:22 2018 +0200 @@ -759,6 +759,9 @@ case PixelFormat_Grayscale32: return "Grayscale (unsigned 32bpp)"; + case PixelFormat_Grayscale64: + return "Grayscale (unsigned 64bpp)"; + case PixelFormat_RGB48: return "RGB48"; @@ -1459,6 +1462,9 @@ case PixelFormat_RGB48: return 6; + case PixelFormat_Grayscale64: + return 8; + default: throw OrthancException(ErrorCode_ParameterOutOfRange); } diff -r 5094369664f0 -r 89b789366596 Core/Enumerations.h --- a/Core/Enumerations.h Mon May 28 10:54:59 2018 +0200 +++ b/Core/Enumerations.h Thu May 31 08:31:22 2018 +0200 @@ -224,7 +224,13 @@ * {description}{This format describes a color image. The pixels are stored in 6 * consecutive bytes. The memory layout is RGB.} **/ - PixelFormat_RGB48 = 9 + PixelFormat_RGB48 = 9, + + /** + * {summary}{Graylevel, unsigned 64bpp image.} + * {description}{The image is graylevel. Each pixel is unsigned and stored in 4 bytes.} + **/ + PixelFormat_Grayscale64 = 10 }; diff -r 5094369664f0 -r 89b789366596 Core/Images/ImageAccessor.cpp --- a/Core/Images/ImageAccessor.cpp Mon May 28 10:54:59 2018 +0200 +++ b/Core/Images/ImageAccessor.cpp Thu May 31 08:31:22 2018 +0200 @@ -222,6 +222,10 @@ ToMatlabStringInternal(buffer, *this); break; + case PixelFormat_Grayscale64: + ToMatlabStringInternal(buffer, *this); + break; + case PixelFormat_SignedGrayscale16: ToMatlabStringInternal(buffer, *this); break; diff -r 5094369664f0 -r 89b789366596 Core/Images/ImageProcessing.cpp --- a/Core/Images/ImageProcessing.cpp Mon May 28 10:54:59 2018 +0200 +++ b/Core/Images/ImageProcessing.cpp Thu May 31 08:31:22 2018 +0200 @@ -705,6 +705,17 @@ } return; + case PixelFormat_Grayscale64: + if (value == 0) + { + memset(image.GetBuffer(), 0, image.GetPitch() * image.GetHeight()); + } + else + { + SetInternal(image, value); + } + return; + case PixelFormat_SignedGrayscale16: if (value == 0) { diff -r 5094369664f0 -r 89b789366596 Core/Images/PixelTraits.h --- a/Core/Images/PixelTraits.h Mon May 28 10:54:59 2018 +0200 +++ b/Core/Images/PixelTraits.h Thu May 31 08:31:22 2018 +0200 @@ -150,6 +150,20 @@ template <> + struct PixelTraits : + public IntegerPixelTraits + { + }; + + + template <> + struct PixelTraits : + public IntegerPixelTraits + { + }; + + + template <> struct PixelTraits { struct PixelType @@ -264,4 +278,57 @@ target.alpha_ = 255; } }; + + + template <> + struct PixelTraits + { + typedef float PixelType; + + ORTHANC_FORCE_INLINE + static PixelFormat GetPixelFormat() + { + return PixelFormat_Float32; + } + + ORTHANC_FORCE_INLINE + static void SetZero(PixelType& target) + { + target = 0.0f; + } + + ORTHANC_FORCE_INLINE + static void Copy(PixelType& target, + const PixelType& source) + { + target = source; + } + + ORTHANC_FORCE_INLINE + static bool IsEqual(const PixelType& a, + const PixelType& b) + { + float tmp = (a - b); + + if (tmp < 0) + { + tmp = -tmp; + } + + return tmp <= std::numeric_limits::epsilon(); + } + + ORTHANC_FORCE_INLINE + static void FloatToPixel(PixelType& target, + float value) + { + target = value; + } + + ORTHANC_FORCE_INLINE + static float PixelToFloat(const PixelType& source) + { + return source; + } + }; } diff -r 5094369664f0 -r 89b789366596 Plugins/Engine/PluginsEnumerations.cpp --- a/Plugins/Engine/PluginsEnumerations.cpp Mon May 28 10:54:59 2018 +0200 +++ b/Plugins/Engine/PluginsEnumerations.cpp Thu May 31 08:31:22 2018 +0200 @@ -151,6 +151,9 @@ case PixelFormat_Grayscale32: return OrthancPluginPixelFormat_Grayscale32; + case PixelFormat_Grayscale64: + return OrthancPluginPixelFormat_Grayscale64; + case PixelFormat_Grayscale8: return OrthancPluginPixelFormat_Grayscale8; @@ -188,6 +191,9 @@ case OrthancPluginPixelFormat_Grayscale32: return PixelFormat_Grayscale32; + case OrthancPluginPixelFormat_Grayscale64: + return PixelFormat_Grayscale64; + case OrthancPluginPixelFormat_Grayscale8: return PixelFormat_Grayscale8; diff -r 5094369664f0 -r 89b789366596 Plugins/Include/orthanc/OrthancCPlugin.h --- a/Plugins/Include/orthanc/OrthancCPlugin.h Mon May 28 10:54:59 2018 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Thu May 31 08:31:22 2018 +0200 @@ -117,8 +117,8 @@ #endif #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1 -#define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 3 -#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 2 +#define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 4 +#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 0 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) @@ -613,6 +613,14 @@ **/ OrthancPluginPixelFormat_BGRA32 = 10, + /** + * @brief Graylevel, unsigned 64bpp image. + * + * The image is graylevel. Each pixel is unsigned and stored in + * eight bytes. + **/ + OrthancPluginPixelFormat_Grayscale64 = 11, + _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff } OrthancPluginPixelFormat;