ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkNumericTraitsRGBAPixel.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkNumericTraitsRGBAPixel_h
19#define itkNumericTraitsRGBAPixel_h
20
21#include "itkNumericTraits.h"
22#include "itkRGBAPixel.h"
23
24namespace itk
25{
42template <typename T>
44{
45private:
51
52public:
54 using ValueType = T;
55
57
60
63
67
70
73
76
79
85 static const Self
86 max(const Self &)
87 {
89 }
90
91 static const Self
92 min(const Self &)
93 {
95 }
96
97 static const Self
99 {
101 }
102
103 static const Self
105 {
107 }
108
109 static const Self
114
115 static const Self
117 {
118 return Self{};
119 }
120
121 static const Self
126
127 static const Self
129 {
130 return NonpositiveMin();
131 }
132
133 static const Self
135 {
136 return ZeroValue();
137 }
138
139 static const Self
140 OneValue(const Self &)
141 {
142 return OneValue();
143 }
144
146 static bool
151
153 static bool
158
160 static bool
165
167 static bool
172
173 static constexpr bool IsSigned = std::is_signed_v<ValueType>;
174 static constexpr bool IsInteger = std::is_integral_v<ValueType>;
176
180 static void
181 SetLength(RGBAPixel<T> & m, const unsigned int s)
182 {
183 if (s != 4)
184 {
185 itkGenericExceptionMacro("Cannot set the size of a RGBAPixel to anything other "
186 "than 4.");
187 }
188 m.Fill(T{});
189 }
190
191
193 static unsigned int
195 {
196 return 4;
197 }
198
200 static unsigned int
202 {
203 return 4;
204 }
205
206 static void
208 {
209 mv = v;
210 }
211
212 template <typename TArray>
213 static void
214 AssignToArray(const Self & v, TArray & mv)
215 {
216 for (unsigned int i = 0; i < 4; ++i)
217 {
218 mv[i] = v[i];
219 }
220 }
221
225 static const Self ITKCommon_EXPORT Zero;
226 static const Self ITKCommon_EXPORT One;
227};
228} // end namespace itk
229
230#endif // itkNumericTraitsRGBAPixel_h
void Fill(const ValueType &)
static void SetLength(RGBAPixel< T > &m, const unsigned int s)
static const Self ITKCommon_EXPORT One
RGBAPixel< ElementAccumulateType > AccumulateType
typename NumericTraits< T >::PrintType ElementPrintType
static void AssignToArray(const Self &v, TArray &mv)
typename NumericTraits< T >::AccumulateType ElementAccumulateType
typename NumericTraits< T >::FloatType ElementFloatType
typename NumericTraits< T >::RealType ElementRealType
static const Self ZeroValue(const Self &)
static const Self ITKCommon_EXPORT Zero
static void AssignToArray(const Self &v, MeasurementVectorType &mv)
typename NumericTraits< T >::AbsType ElementAbsType
static unsigned int GetLength(const RGBAPixel< T > &)
static const Self NonpositiveMin(const Self &)
Define additional traits for native types such as int or float.
static bool IsNegative(T val)
static constexpr T NonpositiveMin()
static constexpr T max(const T &)
static bool IsPositive(T val)
static constexpr T min(const T &)
static bool IsNonpositive(T val)
static bool IsNonnegative(T val)
static constexpr bool IsComplex
Represent Red, Green, Blue and Alpha components for color images.
LuminanceType GetLuminance() const
AddImageFilter Self
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
constexpr TContainer MakeFilled(typename TContainer::const_reference value)