ITK  6.0.0
Insight Toolkit
itkNumericTraitsDiffusionTensor3DPixel.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 itkNumericTraitsDiffusionTensor3DPixel_h
19#define itkNumericTraitsDiffusionTensor3DPixel_h
20
21#include "itkNumericTraits.h"
23
24// This file is meant to define numeric traits for tensor pixels types in itk
25
26namespace itk
27{
44template <typename T>
46{
47private:
53
54public:
56 using ValueType = T;
57
59
62
65
69
72
75
78
81
87 static const Self
88 max(const Self &)
89 {
90 return MakeFilled<Self>(NumericTraits<T>::max());
91 }
92
93 static const Self
94 min(const Self &)
95 {
96 return MakeFilled<Self>(NumericTraits<T>::min());
97 }
98
99 static const Self
101 {
102 return MakeFilled<Self>(NumericTraits<T>::max());
103 }
104
105 static const Self
107 {
108 return MakeFilled<Self>(NumericTraits<T>::min());
109 }
110
111 static const Self
113 {
114 return MakeFilled<Self>(NumericTraits<T>::NonpositiveMin());
115 }
116
117 static const Self
119 {
120 return Self{};
121 }
122
123 static const Self
125 {
126 return MakeFilled<Self>(NumericTraits<T>::OneValue());
127 }
128
129 static const Self
131 {
132 return NonpositiveMin();
133 }
134
135 static const Self
137 {
138 return ZeroValue();
139 }
140
141 static const Self
142 OneValue(const Self &)
143 {
144 return OneValue();
145 }
146
147 static constexpr bool IsSigned = std::is_signed_v<ValueType>;
148 static constexpr bool IsInteger = std::is_integral_v<ValueType>;
150
155 static void
156 SetLength(DiffusionTensor3D<T> & m, const unsigned int s)
157 {
158 if (s != 6)
159 {
160 itkGenericExceptionMacro("Cannot set the size of a DiffusionTensor3D "
161 "to anything other than 6.");
162 }
163 m.Fill(T{});
164 }
168 static unsigned int
170 {
171 return 6;
172 }
173
175 static unsigned int
177 {
178 return 6;
179 }
180
181 static void
183 {
184 mv = v;
185 }
186
187 template <typename TArray>
188 static void
189 AssignToArray(const Self & v, TArray & mv)
190 {
191 for (unsigned int i = 0; i < 6; ++i)
192 {
193 mv[i] = v[i];
194 }
195 }
196
200 static const Self ITKCommon_EXPORT Zero;
201 static const Self ITKCommon_EXPORT One;
202};
203} // end namespace itk
204
205#endif // itkNumericTraitsTensorPixel_h
Pixel-wise addition of two images.
Represent a diffusion tensor as used in DTI images.
void Fill(const ValueType &)
static void SetLength(DiffusionTensor3D< T > &m, const unsigned int s)
typename NumericTraits< T >::AccumulateType ElementAccumulateType
static void AssignToArray(const Self &v, MeasurementVectorType &mv)
static unsigned int GetLength(const DiffusionTensor3D< T > &)
Define additional traits for native types such as int or float.
static constexpr bool IsInteger
static constexpr bool IsSigned
static constexpr T NonpositiveMin()
static constexpr bool IsComplex
AddImageFilter Self
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....