Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
2894:a27b0e9a3fd9 | 2895:da43ef7ff32a |
---|---|
32 | 32 |
33 | 33 |
34 #pragma once | 34 #pragma once |
35 | 35 |
36 #include "../Enumerations.h" | 36 #include "../Enumerations.h" |
37 #include "../OrthancException.h" | |
38 | 37 |
39 #include <limits> | 38 #include <limits> |
40 | 39 |
41 namespace Orthanc | 40 namespace Orthanc |
42 { | 41 { |
53 } | 52 } |
54 | 53 |
55 ORTHANC_FORCE_INLINE | 54 ORTHANC_FORCE_INLINE |
56 static PixelType IntegerToPixel(int64_t value) | 55 static PixelType IntegerToPixel(int64_t value) |
57 { | 56 { |
58 if (value < static_cast<int64_t>(std::numeric_limits<PixelType>::min()) || | 57 if (value < static_cast<int64_t>(std::numeric_limits<PixelType>::min())) |
59 value > static_cast<int64_t>(std::numeric_limits<PixelType>::max())) | 58 { |
60 { | 59 return std::numeric_limits<PixelType>::min(); |
61 throw OrthancException(ErrorCode_ParameterOutOfRange); | 60 } |
61 else if (value > static_cast<int64_t>(std::numeric_limits<PixelType>::max())) | |
62 { | |
63 return std::numeric_limits<PixelType>::max(); | |
62 } | 64 } |
63 else | 65 else |
64 { | 66 { |
65 return static_cast<PixelType>(value); | 67 return static_cast<PixelType>(value); |
66 } | 68 } |