ITK  5.2.0
Insight Toolkit
itkNumericTraitsPointPixel.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  * http://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 itkNumericTraitsPointPixel_h
19 #define itkNumericTraitsPointPixel_h
20 
21 #include "itkNumericTraits.h"
22 #include "itkPoint.h"
23 
24 namespace itk
25 {
31 template <typename T, unsigned int D>
32 class NumericTraits<Point<T, D>>
33 {
34 private:
40 
41 public:
43  using ValueType = T;
44  using Self = Point<T, D>;
45 
48 
51 
55 
58 
61 
64 
67 
73  static const Self
74  max(const Self &)
75  {
76  return Self(NumericTraits<T>::max());
77  }
78 
79  static const Self
80  min(const Self &)
81  {
82  return Self(NumericTraits<T>::min());
83  }
84 
85  static const Self
86  max()
87  {
88  return Self(NumericTraits<T>::max());
89  }
90 
91  static const Self
92  min()
93  {
94  return Self(NumericTraits<T>::min());
95  }
96 
97  static const Self
99  {
101  }
102 
103  static const Self
105  {
107  }
108 
109  static const Self
111  {
113  }
114 
115  static const Self
117  {
118  return NonpositiveMin();
119  }
120 
121  static const Self
122  ZeroValue(const Self &)
123  {
124  return ZeroValue();
125  }
126 
127  static const Self
128  OneValue(const Self &)
129  {
130  return OneValue();
131  }
132 
136 
140  static void
141  SetLength(Point<T, D> & m, const unsigned int s)
142  {
143  if (s != D)
144  {
145  itkGenericExceptionMacro(<< "Cannot set the size of a Point of length " << D << " to " << s);
146  }
148  }
150 
152  static unsigned int
154  {
155  return D;
156  }
157 
159  static unsigned int
161  {
162  return D;
163  }
164 
165  static void
167  {
168  mv = v;
169  }
170 
171  template <typename TArray>
172  static void
173  AssignToArray(const Self & v, TArray & mv)
174  {
175  for (unsigned int i = 0; i < D; i++)
176  {
177  mv[i] = v[i];
178  }
179  }
180 
184  static const Self ITKCommon_EXPORT Zero;
185  static const Self ITKCommon_EXPORT One;
186 };
187 } // end namespace itk
188 
189 #endif // itkNumericTraitsPointPixel_h
itk::NumericTraits< Point< T, D > >::ElementPrintType
typename NumericTraits< T >::PrintType ElementPrintType
Definition: itkNumericTraitsPointPixel.h:38
itk::NumericTraits< Point< T, D > >::max
static const Self max()
Definition: itkNumericTraitsPointPixel.h:86
itk::NumericTraits< Point< T, D > >::min
static const Self min(const Self &)
Definition: itkNumericTraitsPointPixel.h:80
itk::NumericTraits< Point< T, D > >::min
static const Self min()
Definition: itkNumericTraitsPointPixel.h:92
itk::NumericTraits< Point< T, D > >::AssignToArray
static void AssignToArray(const Self &v, TArray &mv)
Definition: itkNumericTraitsPointPixel.h:173
itk::NumericTraits< Point< T, D > >::GetLength
static unsigned int GetLength(const Point< T, D > &)
Definition: itkNumericTraitsPointPixel.h:153
itk::NumericTraits< Point< T, D > >::OneValue
static const Self OneValue()
Definition: itkNumericTraitsPointPixel.h:110
itk::NumericTraits< Point< T, D > >::ScalarRealType
ElementRealType ScalarRealType
Definition: itkNumericTraitsPointPixel.h:63
itk::NumericTraits< Point< T, D > >::ElementFloatType
typename NumericTraits< T >::FloatType ElementFloatType
Definition: itkNumericTraitsPointPixel.h:37
itkPoint.h
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:97
itk::NumericTraits::AccumulateType
double AccumulateType
Definition: itkNumericTraits.h:74
itk::NumericTraits< Point< T, D > >::NonpositiveMin
static const Self NonpositiveMin(const Self &)
Definition: itkNumericTraitsPointPixel.h:116
itk::NumericTraits< Point< T, D > >::ElementAccumulateType
typename NumericTraits< T >::AccumulateType ElementAccumulateType
Definition: itkNumericTraitsPointPixel.h:36
itk::NumericTraits::IsSigned
static constexpr bool IsSigned
Definition: itkNumericTraits.h:133
itk::NumericTraits< Point< T, D > >::max
static const Self max(const Self &)
Definition: itkNumericTraitsPointPixel.h:74
itk::NumericTraits< Point< T, D > >::Zero
static const Self ITKCommon_EXPORT Zero
Definition: itkNumericTraitsPointPixel.h:184
itk::NumericTraits< Point< T, D > >::GetLength
static unsigned int GetLength()
Definition: itkNumericTraitsPointPixel.h:160
itk::NumericTraits< Point< T, D > >::NonpositiveMin
static const Self NonpositiveMin()
Definition: itkNumericTraitsPointPixel.h:98
itk::NumericTraits::IsInteger
static constexpr bool IsInteger
Definition: itkNumericTraits.h:138
itk::NumericTraits< Point< T, D > >::One
static const Self ITKCommon_EXPORT One
Definition: itkNumericTraitsPointPixel.h:185
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:156
itk::NumericTraits< Point< T, D > >::AssignToArray
static void AssignToArray(const Self &v, MeasurementVectorType &mv)
Definition: itkNumericTraitsPointPixel.h:166
itk::NumericTraits::PrintType
T PrintType
Definition: itkNumericTraits.h:68
itk::NumericTraits< Point< T, D > >::OneValue
static const Self OneValue(const Self &)
Definition: itkNumericTraitsPointPixel.h:128
itk::NumericTraits< Point< T, D > >::ZeroValue
static const Self ZeroValue(const Self &)
Definition: itkNumericTraitsPointPixel.h:122
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:148
itk::NumericTraits< Point< T, D > >::ZeroValue
static const Self ZeroValue()
Definition: itkNumericTraitsPointPixel.h:104
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::NumericTraits::IsComplex
static constexpr bool IsComplex
Definition: itkNumericTraits.h:143
itkNumericTraits.h
itk::NumericTraits< Point< T, D > >::SetLength
static void SetLength(Point< T, D > &m, const unsigned int s)
Definition: itkNumericTraitsPointPixel.h:141
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::NumericTraits::FloatType
float FloatType
Definition: itkNumericTraits.h:81
itk::NumericTraits< Point< T, D > >::ElementRealType
typename NumericTraits< T >::RealType ElementRealType
Definition: itkNumericTraitsPointPixel.h:39
itk::NumericTraits::AbsType
T AbsType
Definition: itkNumericTraits.h:71
itk::FixedArray< TCoordRep, NPointDimension >::Fill
void Fill(const ValueType &)
itk::NumericTraits< Point< T, D > >::ElementAbsType
typename NumericTraits< T >::AbsType ElementAbsType
Definition: itkNumericTraitsPointPixel.h:35
itk::NumericTraits< Point< T, D > >::ValueType
T ValueType
Definition: itkNumericTraitsPointPixel.h:43