ITK  5.2.0
Insight Toolkit
itkNumericTraitsCovariantVectorPixel.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 itkNumericTraitsCovariantVectorPixel_h
19 #define itkNumericTraitsCovariantVectorPixel_h
20 
21 #include "itkNumericTraits.h"
22 #include "itkCovariantVector.h"
23 
24 namespace itk
25 {
43 template <typename T, unsigned int D>
45 {
46 private:
52 
53 public:
55  using ValueType = T;
56 
58 
61 
64 
68 
71 
74 
77 
80 
86  static const Self
87  max(const Self &)
88  {
89  return Self(NumericTraits<T>::max());
90  }
91 
92  static const Self
93  min(const Self &)
94  {
95  return Self(NumericTraits<T>::min());
96  }
97 
98  static const Self
99  max()
100  {
101  return Self(NumericTraits<T>::max());
102  }
103 
104  static const Self
105  min()
106  {
107  return Self(NumericTraits<T>::min());
108  }
109 
110  static const Self
112  {
114  }
115 
116  static const Self
118  {
120  }
121 
122  static const Self
124  {
126  }
127 
128  static const Self
130  {
131  return NonpositiveMin();
132  }
133 
134  static const Self
135  ZeroValue(const Self &)
136  {
137  return ZeroValue();
138  }
139 
140  static const Self
141  OneValue(const Self &)
142  {
143  return OneValue();
144  }
145 
149 
153  static void
154  SetLength(CovariantVector<T, D> & m, const unsigned int s)
155  {
156  if (s != D)
157  {
158  itkGenericExceptionMacro(<< "Cannot set the size of a CovariantVector of length " << D << " to " << s);
159  }
161  }
163 
165  static unsigned int
167  {
168  return D;
169  }
170 
172  static unsigned int
174  {
175  return D;
176  }
177 
178  static void
180  {
181  mv = v;
182  }
183 
184  template <typename TArray>
185  static void
186  AssignToArray(const Self & v, TArray & mv)
187  {
188  for (unsigned int i = 0; i < D; i++)
189  {
190  mv[i] = v[i];
191  }
192  }
193 
197  static const Self ITKCommon_EXPORT Zero;
198  static const Self ITKCommon_EXPORT One;
199 };
200 } // end namespace itk
201 
202 #endif // itkNumericTraitsCovariantVectorPixel_h
itk::NumericTraits< CovariantVector< T, D > >::ZeroValue
static const Self ZeroValue()
Definition: itkNumericTraitsCovariantVectorPixel.h:117
itk::NumericTraits< CovariantVector< T, D > >::AssignToArray
static void AssignToArray(const Self &v, MeasurementVectorType &mv)
Definition: itkNumericTraitsCovariantVectorPixel.h:179
itk::NumericTraits< CovariantVector< T, D > >::min
static const Self min()
Definition: itkNumericTraitsCovariantVectorPixel.h:105
itkCovariantVector.h
itk::NumericTraits< CovariantVector< T, D > >::AssignToArray
static void AssignToArray(const Self &v, TArray &mv)
Definition: itkNumericTraitsCovariantVectorPixel.h:186
itk::NumericTraits< CovariantVector< T, D > >::ElementAccumulateType
typename NumericTraits< T >::AccumulateType ElementAccumulateType
Definition: itkNumericTraitsCovariantVectorPixel.h:48
itk::NumericTraits< CovariantVector< T, D > >::max
static const Self max(const Self &)
Definition: itkNumericTraitsCovariantVectorPixel.h:87
itk::NumericTraits< CovariantVector< T, D > >::ElementFloatType
typename NumericTraits< T >::FloatType ElementFloatType
Definition: itkNumericTraitsCovariantVectorPixel.h:49
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:97
itk::NumericTraits< CovariantVector< T, D > >::OneValue
static const Self OneValue(const Self &)
Definition: itkNumericTraitsCovariantVectorPixel.h:141
itk::NumericTraits< CovariantVector< T, D > >::ZeroValue
static const Self ZeroValue(const Self &)
Definition: itkNumericTraitsCovariantVectorPixel.h:135
itk::NumericTraits::AccumulateType
double AccumulateType
Definition: itkNumericTraits.h:74
itk::NumericTraits< CovariantVector< T, D > >::SetLength
static void SetLength(CovariantVector< T, D > &m, const unsigned int s)
Definition: itkNumericTraitsCovariantVectorPixel.h:154
itk::NumericTraits< CovariantVector< T, D > >::Zero
static const Self ITKCommon_EXPORT Zero
Definition: itkNumericTraitsCovariantVectorPixel.h:197
itk::NumericTraits< CovariantVector< T, D > >::NonpositiveMin
static const Self NonpositiveMin(const Self &)
Definition: itkNumericTraitsCovariantVectorPixel.h:129
itk::NumericTraits::IsSigned
static constexpr bool IsSigned
Definition: itkNumericTraits.h:133
itk::NumericTraits< CovariantVector< T, D > >::ValueType
T ValueType
Definition: itkNumericTraitsCovariantVectorPixel.h:55
itk::NumericTraits< CovariantVector< T, D > >::GetLength
static unsigned int GetLength()
Definition: itkNumericTraitsCovariantVectorPixel.h:173
itk::NumericTraits::IsInteger
static constexpr bool IsInteger
Definition: itkNumericTraits.h:138
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:156
itk::NumericTraits::PrintType
T PrintType
Definition: itkNumericTraits.h:68
itk::NumericTraits< CovariantVector< T, D > >::NonpositiveMin
static const Self NonpositiveMin()
Definition: itkNumericTraitsCovariantVectorPixel.h:111
itk::NumericTraits< CovariantVector< T, D > >::ElementAbsType
typename NumericTraits< T >::AbsType ElementAbsType
Definition: itkNumericTraitsCovariantVectorPixel.h:47
itk::NumericTraits< CovariantVector< T, D > >::GetLength
static unsigned int GetLength(const CovariantVector< T, D > &)
Definition: itkNumericTraitsCovariantVectorPixel.h:166
itk::NumericTraits< CovariantVector< T, D > >::min
static const Self min(const Self &)
Definition: itkNumericTraitsCovariantVectorPixel.h:93
itk::NumericTraits< CovariantVector< T, D > >::max
static const Self max()
Definition: itkNumericTraitsCovariantVectorPixel.h:99
itk::NumericTraits< CovariantVector< T, D > >::OneValue
static const Self OneValue()
Definition: itkNumericTraitsCovariantVectorPixel.h:123
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:148
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
itk::NumericTraits< CovariantVector< T, D > >::One
static const Self ITKCommon_EXPORT One
Definition: itkNumericTraitsCovariantVectorPixel.h:198
itk::NumericTraits< CovariantVector< T, D > >::ElementPrintType
typename NumericTraits< T >::PrintType ElementPrintType
Definition: itkNumericTraitsCovariantVectorPixel.h:50
itkNumericTraits.h
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::NumericTraits::FloatType
float FloatType
Definition: itkNumericTraits.h:81
itk::NumericTraits< CovariantVector< T, D > >::ScalarRealType
ElementRealType ScalarRealType
Definition: itkNumericTraitsCovariantVectorPixel.h:76
itk::NumericTraits< CovariantVector< T, D > >::ElementRealType
typename NumericTraits< T >::RealType ElementRealType
Definition: itkNumericTraitsCovariantVectorPixel.h:51
itk::NumericTraits::AbsType
T AbsType
Definition: itkNumericTraits.h:71
itk::FixedArray< T, NVectorDimension >::Fill
void Fill(const ValueType &)