Mercurial > hg > orthanc
diff Core/Images/PixelTraits.h @ 2895:da43ef7ff32a db-changes
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Oct 2018 10:43:24 +0200 |
parents | 65699fcb4e99 |
children | 4e43e67f8ecf |
line wrap: on
line diff
--- a/Core/Images/PixelTraits.h Thu Oct 18 10:35:09 2018 +0200 +++ b/Core/Images/PixelTraits.h Thu Oct 18 10:43:24 2018 +0200 @@ -34,7 +34,6 @@ #pragma once #include "../Enumerations.h" -#include "../OrthancException.h" #include <limits> @@ -55,10 +54,13 @@ ORTHANC_FORCE_INLINE static PixelType IntegerToPixel(int64_t value) { - if (value < static_cast<int64_t>(std::numeric_limits<PixelType>::min()) || - value > static_cast<int64_t>(std::numeric_limits<PixelType>::max())) + if (value < static_cast<int64_t>(std::numeric_limits<PixelType>::min())) { - throw OrthancException(ErrorCode_ParameterOutOfRange); + return std::numeric_limits<PixelType>::min(); + } + else if (value > static_cast<int64_t>(std::numeric_limits<PixelType>::max())) + { + return std::numeric_limits<PixelType>::max(); } else {