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"
22 #include "itkDiffusionTensor3D.h"
23 
24 // This file is meant to define numeric traits for tensor pixels types in itk
25 
26 namespace itk
27 {
44 template <typename T>
46 {
47 private:
53 
54 public:
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
100  max()
101  {
102  return MakeFilled<Self>(NumericTraits<T>::max());
103  }
104 
105  static const Self
106  min()
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
136  ZeroValue(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
itk::NumericTraits< DiffusionTensor3D< T > >::ElementAbsType
typename NumericTraits< T >::AbsType ElementAbsType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:48
itk::NumericTraits< DiffusionTensor3D< T > >::One
static const Self ITKCommon_EXPORT One
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:201
Self
AddImageFilter Self
Definition: itkAddImageFilter.h:89
itk::NumericTraits< DiffusionTensor3D< T > >::max
static const Self max()
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:100
itk::NumericTraits< DiffusionTensor3D< T > >::ZeroValue
static const Self ZeroValue(const Self &)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:136
itk::NumericTraits< DiffusionTensor3D< T > >::GetLength
static unsigned int GetLength()
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:176
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:99
itkDiffusionTensor3D.h
itk::NumericTraits< DiffusionTensor3D< T > >::ElementFloatType
typename NumericTraits< T >::FloatType ElementFloatType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:50
itk::NumericTraits::AccumulateType
double AccumulateType
Definition: itkNumericTraits.h:76
itk::DiffusionTensor3D
Represent a diffusion tensor as used in DTI images.
Definition: itkDiffusionTensor3D.h:79
itk::NumericTraits< DiffusionTensor3D< T > >::ValueType
T ValueType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:56
itk::NumericTraits< DiffusionTensor3D< T > >::min
static const Self min()
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:106
itk::NumericTraits< DiffusionTensor3D< T > >::ElementPrintType
typename NumericTraits< T >::PrintType ElementPrintType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:51
itk::NumericTraits::IsSigned
static constexpr bool IsSigned
Definition: itkNumericTraits.h:135
itk::NumericTraits< DiffusionTensor3D< T > >::NonpositiveMin
static const Self NonpositiveMin()
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:112
itk::NumericTraits< DiffusionTensor3D< T > >::OneValue
static const Self OneValue(const Self &)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:142
itk::NumericTraits::IsInteger
static constexpr bool IsInteger
Definition: itkNumericTraits.h:140
itk::NumericTraits< DiffusionTensor3D< T > >::NonpositiveMin
static const Self NonpositiveMin(const Self &)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:130
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:158
itk::NumericTraits< DiffusionTensor3D< T > >::GetLength
static unsigned int GetLength(const DiffusionTensor3D< T > &)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:169
itk::NumericTraits::PrintType
T PrintType
Definition: itkNumericTraits.h:70
itk::NumericTraits< DiffusionTensor3D< T > >::ScalarRealType
ElementRealType ScalarRealType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:77
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::NumericTraits< DiffusionTensor3D< T > >::ElementRealType
typename NumericTraits< T >::RealType ElementRealType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:52
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:150
itk::NumericTraits< DiffusionTensor3D< T > >::min
static const Self min(const Self &)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:94
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::NumericTraits< DiffusionTensor3D< T > >::AssignToArray
static void AssignToArray(const Self &v, MeasurementVectorType &mv)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:182
itk::NumericTraits::IsComplex
static constexpr bool IsComplex
Definition: itkNumericTraits.h:145
itk::NumericTraits< DiffusionTensor3D< T > >::SetLength
static void SetLength(DiffusionTensor3D< T > &m, const unsigned int s)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:156
itk::NumericTraits< DiffusionTensor3D< T > >::ZeroValue
static const Self ZeroValue()
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:118
itkNumericTraits.h
itk::NumericTraits< DiffusionTensor3D< T > >::ElementAccumulateType
typename NumericTraits< T >::AccumulateType ElementAccumulateType
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:49
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
AddImageFilter
Definition: itkAddImageFilter.h:81
itk::NumericTraits< DiffusionTensor3D< T > >::AssignToArray
static void AssignToArray(const Self &v, TArray &mv)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:189
itk::NumericTraits::FloatType
float FloatType
Definition: itkNumericTraits.h:83
itk::NumericTraits< DiffusionTensor3D< T > >::OneValue
static const Self OneValue()
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:124
itk::NumericTraits< DiffusionTensor3D< T > >::max
static const Self max(const Self &)
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:88
itk::NumericTraits< DiffusionTensor3D< T > >::Zero
static const Self ITKCommon_EXPORT Zero
Definition: itkNumericTraitsDiffusionTensor3DPixel.h:200
itk::NumericTraits::AbsType
T AbsType
Definition: itkNumericTraits.h:73
itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >::Fill
void Fill(const ValueType &)