Mercurial > hg > orthanc
diff Core/Images/PixelTraits.h @ 3671:3c4269229566
Added functions to retrieve min and max possible values for floating-point pixels
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 14 Feb 2020 14:56:06 +0100 |
parents | 94f4a18a79cc |
children |
line wrap: on
line diff
--- a/Core/Images/PixelTraits.h Fri Feb 14 09:04:40 2020 +0100 +++ b/Core/Images/PixelTraits.h Fri Feb 14 14:56:06 2020 +0100 @@ -383,6 +383,20 @@ } ORTHANC_FORCE_INLINE + static void SetMinValue(PixelType& target) + { + // std::numeric_limits<float>::lowest is not supported on + // all compilers (for instance, Visual Studio 9.0 2008) + target = -std::numeric_limits<float>::max(); + } + + ORTHANC_FORCE_INLINE + static void SetMaxValue(PixelType& target) + { + target = std::numeric_limits<float>::max(); + } + + ORTHANC_FORCE_INLINE static void FloatToPixel(PixelType& target, float value) {