Mercurial > hg > orthanc
changeset 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 | 445bda258245 |
children | ea8c1c0e81eb |
files | Core/Images/PixelTraits.h |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
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) {