ITK  6.0.0
Insight Toolkit
itkNumericTraits.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 itkNumericTraits_h
19 #define itkNumericTraits_h
20 
21 #include "itkMacro.h"
22 
23 #undef min
24 #undef max
25 
26 #define itkNUMERIC_TRAITS_MIN_MAX_MACRO() \
27  static constexpr ValueType min(ValueType) { return std::numeric_limits<ValueType>::min(); } \
28  static constexpr ValueType max(ValueType) { return std::numeric_limits<ValueType>::max(); } \
29  static constexpr ValueType min() { return std::numeric_limits<ValueType>::min(); } \
30  static constexpr ValueType max() { return std::numeric_limits<ValueType>::max(); } \
31  ITK_MACROEND_NOOP_STATEMENT
32 
33 #include <limits> // for std::numeric_limits
34 #include <complex>
35 #include <type_traits> // for std::is_floating_point
36 
37 namespace itk
38 {
39 
40 // forward declare to avoid circular dependencies
41 template <typename TValue, unsigned int VLength>
42 class FixedArray;
43 
59 template <typename T>
60 class NumericTraits : public std::numeric_limits<T>
61 {
62 public:
64  using TraitsType = std::numeric_limits<T>;
65 
67  using ValueType = T;
68 
70  using PrintType = T;
71 
73  using AbsType = T;
74 
76  using AccumulateType = double;
77 
80 
83  using FloatType = float;
84 
86  using RealType = double;
87 
90 
92  static const T ITKCommon_EXPORT Zero;
93 
95  static const T ITKCommon_EXPORT One;
96 
98  static constexpr T
100  {
101  return TraitsType::lowest();
102  }
103 
105  static bool
106  IsPositive(T val)
107  {
108  return val > Zero;
109  }
110 
112  static bool
114  {
115  return val <= Zero;
116  }
117 
119  static bool
120  IsNegative(T val)
121  {
122  return val < Zero;
123  }
124 
126  static bool
128  {
129  return val >= Zero;
130  }
131 
135  static constexpr bool IsSigned = false;
136 
140  static constexpr bool IsInteger = false;
141 
145  static constexpr bool IsComplex = false;
146 
149  static T
151  {
152  return Zero;
153  }
154 
157  static T
159  {
160  return One;
161  }
162 
163  /* Provide a default implementation of the max() method with
164  * argument. This API is needed for VariableLengthVector because
165  * its length is only known at run-time. Specializations of the
166  * VariableLengthVector will provide a different implementation
167  * where a vector of the correct size is built. */
168  static constexpr T
169  max(const T &)
170  {
171  return TraitsType::max();
172  }
173  static constexpr T
174  min(const T &)
175  {
176  return TraitsType::min();
177  }
178 
186  static void
187  SetLength(T & m, const unsigned int s)
188  {
189  if (s != 1)
190  {
191  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
192  }
193  m = ValueType{};
194  }
195 
202  static unsigned int
203  GetLength(const T &)
204  {
205  return GetLength();
206  }
207 
209  static unsigned int
211  {
212  return 1;
213  }
214 
218  static T
219  NonpositiveMin(const T &)
220  {
221  return NonpositiveMin();
222  }
223 
227  static T
228  ZeroValue(const T &)
229  {
230  return ZeroValue();
231  }
232 
236  static T
237  OneValue(const T &)
238  {
239  return OneValue();
240  }
241 
243  template <typename TArray>
244  static void
245  AssignToArray(const T & v, TArray & mv)
246  {
247  mv[0] = v;
248  }
249 };
250 
252 
260 template <>
261 class NumericTraits<bool> : public std::numeric_limits<bool>
262 {
263 public:
264  using ValueType = bool;
265  using PrintType = bool;
266  using AbsType = unsigned char;
267  using AccumulateType = unsigned char;
268  using RealType = double;
269  using ScalarRealType = RealType;
270  using FloatType = float;
271  using MeasurementVectorType = FixedArray<ValueType, 1>;
272 
273  static constexpr bool ITKCommon_EXPORT Zero = false;
274  static constexpr bool ITKCommon_EXPORT One = true;
275 
276  static constexpr bool
277  min()
278  {
279  return false;
280  }
281  static constexpr bool
282  max()
283  {
284  return true;
285  }
286  static constexpr bool
287  min(bool)
288  {
289  return min();
290  }
291  static constexpr bool
292  max(bool)
293  {
294  return max();
295  }
296  static constexpr bool
298  {
299  return false;
300  }
301  static constexpr bool
302  IsPositive(bool val)
303  {
304  return val;
305  }
306  static constexpr bool
307  IsNonpositive(bool val)
308  {
309  return !val;
310  }
311  static constexpr bool
312  IsNegative(bool val)
313  {
314  return val ? false : false;
315  }
316  static constexpr bool
317  IsNonnegative(bool val)
318  {
319  return val ? true : true;
320  }
321  static constexpr bool IsSigned = false;
322  static constexpr bool IsInteger = true;
323  static constexpr bool IsComplex = false;
324  static constexpr bool
325  ZeroValue()
326  {
327  return Zero;
328  }
329  static constexpr bool
330  OneValue()
331  {
332  return One;
333  }
334  static constexpr unsigned int
335  GetLength(const ValueType &)
336  {
337  return 1;
338  }
339  static constexpr unsigned int
340  GetLength()
341  {
342  return 1;
343  }
344  static constexpr ValueType
345  NonpositiveMin(const ValueType &)
346  {
347  return NonpositiveMin();
348  }
349  static constexpr ValueType
350  ZeroValue(const ValueType &)
351  {
352  return ZeroValue();
353  }
354  static constexpr ValueType
355  OneValue(const ValueType &)
356  {
357  return OneValue();
358  }
359 
360  template <typename TArray>
361  static void
362  AssignToArray(const ValueType & v, TArray & mv)
363  {
364  mv[0] = v;
365  }
366  static void
367  SetLength(ValueType & m, const unsigned int s)
368  {
369  if (s != 1)
370  {
371  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
372  }
373  m = ValueType{};
374  }
375 };
376 
382 template <>
383 class NumericTraits<char> : public std::numeric_limits<char>
384 {
385 public:
386  using ValueType = char;
387  using PrintType = int;
388  using AbsType = unsigned char;
389  using AccumulateType = short;
390  using RealType = double;
391  using ScalarRealType = RealType;
392  using FloatType = float;
393  using MeasurementVectorType = FixedArray<ValueType, 1>;
394 
395  static constexpr char ITKCommon_EXPORT Zero = 0;
396  static constexpr char ITKCommon_EXPORT One = 1;
397 
399 
400  static constexpr char
402  {
403  return lowest();
404  }
405  static constexpr bool
406  IsPositive(char val)
407  {
408  return val > Zero;
409  }
410  static constexpr bool
411  IsNonpositive(char val)
412  {
413  return val <= Zero;
414  }
415 
416  static constexpr bool
417  IsNegative(char)
418  {
419  return false;
420  }
421  static constexpr bool
422  IsNonnegative(char)
423  {
424  return true;
425  }
426  static constexpr bool IsSigned = std::numeric_limits<char>::is_signed;
427 
428  static constexpr bool IsInteger = std::numeric_limits<char>::is_integer;
429  static constexpr bool IsComplex = false;
430  static constexpr char
431  ZeroValue()
432  {
433  return Zero;
434  }
435  static constexpr char
436  OneValue()
437  {
438  return One;
439  }
440  static constexpr unsigned int
441  GetLength(const ValueType &)
442  {
443  return 1;
444  }
445  static constexpr unsigned int
446  GetLength()
447  {
448  return 1;
449  }
450  static constexpr ValueType
451  NonpositiveMin(const ValueType &)
452  {
453  return NonpositiveMin();
454  }
455  static constexpr ValueType
456  ZeroValue(const ValueType &)
457  {
458  return ZeroValue();
459  }
460  static constexpr ValueType
461  OneValue(const ValueType &)
462  {
463  return OneValue();
464  }
465 
466  template <typename TArray>
467  static void
468  AssignToArray(const ValueType & v, TArray & mv)
469  {
470  mv[0] = v;
471  }
472  static void
473  SetLength(ValueType & m, const unsigned int s)
474  {
475  if (s != 1)
476  {
477  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
478  }
479  m = ValueType{};
480  }
481 };
482 
488 template <>
489 class NumericTraits<signed char> : public std::numeric_limits<signed char>
490 {
491 public:
492  using ValueType = signed char;
493  using PrintType = int;
494  using AbsType = unsigned char;
495  using AccumulateType = short;
496  using RealType = double;
497  using ScalarRealType = RealType;
498  using FloatType = float;
499  using MeasurementVectorType = FixedArray<ValueType, 1>;
500 
501  static constexpr signed char ITKCommon_EXPORT Zero = 0;
502  static constexpr signed char ITKCommon_EXPORT One = 1;
503 
504  static constexpr signed char
505  min()
506  {
507  return -128;
508  }
509  static constexpr signed char
510  max()
511  {
512  return 127;
513  }
514  static constexpr signed char
515  min(signed char)
516  {
517  return min();
518  }
519  static constexpr signed char
520  max(signed char)
521  {
522  return max();
523  }
524  static constexpr signed char
526  {
527  return lowest();
528  }
529  static constexpr bool
530  IsPositive(signed char val)
531  {
532  return val > Zero;
533  }
534  static constexpr bool
535  IsNonpositive(signed char val)
536  {
537  return val <= Zero;
538  }
539  static constexpr bool
540  IsNegative(signed char val)
541  {
542  return val < Zero;
543  }
544  static constexpr bool
545  IsNonnegative(signed char val)
546  {
547  return val >= Zero;
548  }
549  static constexpr bool IsSigned = true;
550  static constexpr bool IsInteger = true;
551  static constexpr bool IsComplex = false;
552  static constexpr signed char
553  ZeroValue()
554  {
555  return Zero;
556  }
557  static constexpr signed char
558  OneValue()
559  {
560  return One;
561  }
562  static constexpr unsigned int
563  GetLength(const ValueType &)
564  {
565  return 1;
566  }
567  static constexpr unsigned int
568  GetLength()
569  {
570  return 1;
571  }
572  static constexpr ValueType
573  NonpositiveMin(const ValueType &)
574  {
575  return NonpositiveMin();
576  }
577  static constexpr ValueType
578  ZeroValue(const ValueType &)
579  {
580  return ZeroValue();
581  }
582  static constexpr ValueType
583  OneValue(const ValueType &)
584  {
585  return OneValue();
586  }
587 
588  template <typename TArray>
589  static void
590  AssignToArray(const ValueType & v, TArray & mv)
591  {
592  mv[0] = v;
593  }
594  static void
595  SetLength(ValueType & m, const unsigned int s)
596  {
597  if (s != 1)
598  {
599  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
600  }
601  m = ValueType{};
602  }
603 };
604 
610 template <>
611 class NumericTraits<unsigned char> : public std::numeric_limits<unsigned char>
612 {
613 public:
614  using ValueType = unsigned char;
615  using PrintType = int;
616  using AbsType = unsigned char;
617  using AccumulateType = unsigned short;
618  using RealType = double;
619  using ScalarRealType = RealType;
620  using FloatType = float;
621  using MeasurementVectorType = FixedArray<ValueType, 1>;
622 
623  static constexpr unsigned char ITKCommon_EXPORT Zero = 0;
624  static constexpr unsigned char ITKCommon_EXPORT One = 1;
625 
627 
628  static constexpr unsigned char
630  {
631  return std::numeric_limits<ValueType>::lowest();
632  }
633  static constexpr bool
634  IsPositive(unsigned char val)
635  {
636  return val != Zero;
637  }
638  static constexpr bool
639  IsNonpositive(unsigned char val)
640  {
641  return val == Zero;
642  }
643  static constexpr bool
644  IsNegative(unsigned char val)
645  {
646  return val ? false : false;
647  }
648  static constexpr bool
649  IsNonnegative(unsigned char val)
650  {
651  return val ? true : true;
652  }
653  static constexpr bool IsSigned = false;
654  static constexpr bool IsInteger = true;
655  static constexpr bool IsComplex = false;
656  static constexpr unsigned char
657  ZeroValue()
658  {
659  return Zero;
660  }
661  static constexpr unsigned char
662  OneValue()
663  {
664  return One;
665  }
666  static constexpr unsigned int
667  GetLength(const ValueType &)
668  {
669  return 1;
670  }
671  static constexpr unsigned int
672  GetLength()
673  {
674  return 1;
675  }
676  static constexpr ValueType
677  NonpositiveMin(const ValueType &)
678  {
679  return NonpositiveMin();
680  }
681  static constexpr ValueType
682  ZeroValue(const ValueType &)
683  {
684  return ZeroValue();
685  }
686  static constexpr ValueType
687  OneValue(const ValueType &)
688  {
689  return OneValue();
690  }
691 
692  template <typename TArray>
693  static void
694  AssignToArray(const ValueType & v, TArray & mv)
695  {
696  mv[0] = v;
697  }
698  static void
699  SetLength(ValueType & m, const unsigned int s)
700  {
701  if (s != 1)
702  {
703  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
704  }
705  m = ValueType{};
706  }
707 };
708 
713 template <>
714 class NumericTraits<short> : public std::numeric_limits<short>
715 {
716 public:
717  using ValueType = short;
718  using PrintType = short;
719  using AbsType = unsigned short;
720  using AccumulateType = int;
721  using RealType = double;
722  using ScalarRealType = RealType;
723  using FloatType = float;
724  using MeasurementVectorType = FixedArray<ValueType, 1>;
725 
726  static constexpr short ITKCommon_EXPORT Zero = 0;
727  static constexpr short ITKCommon_EXPORT One = 1;
728 
730  static constexpr short
732  {
733  return std::numeric_limits<ValueType>::lowest();
734  }
735  static constexpr bool
736  IsPositive(short val)
737  {
738  return val > Zero;
739  }
740  static constexpr bool
741  IsNonpositive(short val)
742  {
743  return val <= Zero;
744  }
745  static constexpr bool
746  IsNegative(short val)
747  {
748  return val < Zero;
749  }
750  static constexpr bool
751  IsNonnegative(short val)
752  {
753  return val >= Zero;
754  }
755  static constexpr bool IsSigned = true;
756  static constexpr bool IsInteger = true;
757  static constexpr bool IsComplex = false;
758  static constexpr short
759  ZeroValue()
760  {
761  return Zero;
762  }
763  static constexpr short
764  OneValue()
765  {
766  return One;
767  }
768  static constexpr unsigned int
769  GetLength(const ValueType &)
770  {
771  return 1;
772  }
773  static constexpr unsigned int
774  GetLength()
775  {
776  return 1;
777  }
778  static constexpr ValueType
779  NonpositiveMin(const ValueType &)
780  {
781  return NonpositiveMin();
782  }
783  static constexpr ValueType
784  ZeroValue(const ValueType &)
785  {
786  return ZeroValue();
787  }
788  static constexpr ValueType
789  OneValue(const ValueType &)
790  {
791  return OneValue();
792  }
793 
794  template <typename TArray>
795  static void
796  AssignToArray(const ValueType & v, TArray & mv)
797  {
798  mv[0] = v;
799  }
800  static void
801  SetLength(ValueType & m, const unsigned int s)
802  {
803  if (s != 1)
804  {
805  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
806  }
807  m = ValueType{};
808  }
809 };
810 
816 template <>
817 class NumericTraits<unsigned short> : public std::numeric_limits<unsigned short>
818 {
819 public:
820  using ValueType = unsigned short;
821  using PrintType = unsigned short;
822  using AbsType = unsigned short;
823  using AccumulateType = unsigned int;
824  using RealType = double;
825  using ScalarRealType = RealType;
826  using FloatType = float;
827  using MeasurementVectorType = FixedArray<ValueType, 1>;
828 
829  static constexpr unsigned short ITKCommon_EXPORT Zero = 0;
830  static constexpr unsigned short ITKCommon_EXPORT One = 1;
831 
833  static constexpr unsigned short
835  {
836  return std::numeric_limits<ValueType>::lowest();
837  }
838  static constexpr bool
839  IsPositive(unsigned short val)
840  {
841  return val != Zero;
842  }
843  static constexpr bool
844  IsNonpositive(unsigned short val)
845  {
846  return val == Zero;
847  }
848  static constexpr bool
849  IsNegative(unsigned short val)
850  {
851  return val ? false : false;
852  }
853  static constexpr bool
854  IsNonnegative(unsigned short val)
855  {
856  return val ? true : true;
857  }
858  static constexpr bool IsSigned = false;
859  static constexpr bool IsInteger = true;
860  static constexpr bool IsComplex = false;
861  static constexpr unsigned short
862  ZeroValue()
863  {
864  return Zero;
865  }
866  static constexpr unsigned short
867  OneValue()
868  {
869  return One;
870  }
871  static constexpr unsigned int
872  GetLength(const ValueType &)
873  {
874  return 1;
875  }
876  static constexpr unsigned int
877  GetLength()
878  {
879  return 1;
880  }
881  static constexpr ValueType
882  NonpositiveMin(const ValueType &)
883  {
884  return NonpositiveMin();
885  }
886  static constexpr ValueType
887  ZeroValue(const ValueType &)
888  {
889  return ZeroValue();
890  }
891  static constexpr ValueType
892  OneValue(const ValueType &)
893  {
894  return OneValue();
895  }
896 
897  template <typename TArray>
898  static void
899  AssignToArray(const ValueType & v, TArray & mv)
900  {
901  mv[0] = v;
902  }
903  static void
904  SetLength(ValueType & m, const unsigned int s)
905  {
906  if (s != 1)
907  {
908  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
909  }
910  m = ValueType{};
911  }
912 };
913 
918 template <>
919 class NumericTraits<int> : public std::numeric_limits<int>
920 {
921 public:
922  using ValueType = int;
923  using PrintType = int;
924  using AbsType = unsigned int;
925  using AccumulateType = long;
926  using RealType = double;
927  using ScalarRealType = RealType;
928  using FloatType = float;
929  using MeasurementVectorType = FixedArray<ValueType, 1>;
930 
931  static constexpr int ITKCommon_EXPORT Zero = 0;
932  static constexpr int ITKCommon_EXPORT One = 1;
933 
935  static constexpr int
937  {
938  return std::numeric_limits<ValueType>::lowest();
939  }
940  static constexpr bool
941  IsPositive(int val)
942  {
943  return val > Zero;
944  }
945  static constexpr bool
946  IsNonpositive(int val)
947  {
948  return val <= Zero;
949  }
950  static constexpr bool
951  IsNegative(int val)
952  {
953  return val < Zero;
954  }
955  static constexpr bool
956  IsNonnegative(int val)
957  {
958  return val >= Zero;
959  }
960  static constexpr bool IsSigned = true;
961  static constexpr bool IsInteger = true;
962  static constexpr bool IsComplex = false;
963  static constexpr int
964  ZeroValue()
965  {
966  return Zero;
967  }
968  static constexpr int
969  OneValue()
970  {
971  return One;
972  }
973  static constexpr unsigned int
974  GetLength(const ValueType &)
975  {
976  return 1;
977  }
978  static constexpr unsigned int
979  GetLength()
980  {
981  return 1;
982  }
983  static constexpr ValueType
984  NonpositiveMin(const ValueType &)
985  {
986  return NonpositiveMin();
987  }
988  static constexpr ValueType
989  ZeroValue(const ValueType &)
990  {
991  return ZeroValue();
992  }
993  static constexpr ValueType
994  OneValue(const ValueType &)
995  {
996  return OneValue();
997  }
998 
999  template <typename TArray>
1000  static void
1001  AssignToArray(const ValueType & v, TArray & mv)
1002  {
1003  mv[0] = v;
1004  }
1005  static void
1006  SetLength(ValueType & m, const unsigned int s)
1007  {
1008  if (s != 1)
1009  {
1010  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1011  }
1012  m = ValueType{};
1013  }
1014 };
1015 
1021 template <>
1022 class NumericTraits<unsigned int> : public std::numeric_limits<unsigned int>
1023 {
1024 public:
1025  using ValueType = unsigned int;
1026  using PrintType = unsigned int;
1027  using AbsType = unsigned int;
1028  using AccumulateType = unsigned int;
1029  using RealType = double;
1030  using ScalarRealType = RealType;
1031  using FloatType = float;
1032  using MeasurementVectorType = FixedArray<ValueType, 1>;
1033 
1034  static constexpr unsigned int ITKCommon_EXPORT Zero = 0;
1035  static constexpr unsigned int ITKCommon_EXPORT One = 1;
1036 
1037  static constexpr unsigned int
1038  min()
1039  {
1040  return 0;
1041  }
1042  static constexpr unsigned int
1043  max()
1044  {
1045  return static_cast<unsigned int>(-1);
1046  }
1047  static constexpr unsigned int
1048  min(unsigned int)
1049  {
1050  return std::numeric_limits<ValueType>::min();
1051  }
1052  static constexpr unsigned int
1053  max(unsigned int)
1054  {
1055  return std::numeric_limits<ValueType>::max();
1056  }
1057  static constexpr unsigned int
1058  NonpositiveMin()
1059  {
1060  return 0;
1061  }
1062  static constexpr bool
1063  IsPositive(unsigned int val)
1064  {
1065  return val != Zero;
1066  }
1067  static constexpr bool
1068  IsNonpositive(unsigned int val)
1069  {
1070  return val == Zero;
1071  }
1072  static constexpr bool
1073  IsNegative(unsigned int val)
1074  {
1075  return val ? false : false;
1076  }
1077  static constexpr bool
1078  IsNonnegative(unsigned int val)
1079  {
1080  return val ? true : true;
1081  }
1082  static constexpr bool IsSigned = false;
1083  static constexpr bool IsInteger = true;
1084  static constexpr bool IsComplex = false;
1085  static constexpr unsigned int
1086  ZeroValue()
1087  {
1088  return Zero;
1089  }
1090  static constexpr unsigned int
1091  OneValue()
1092  {
1093  return One;
1094  }
1095  static constexpr unsigned int
1096  GetLength(const ValueType &)
1097  {
1098  return 1;
1099  }
1100  static constexpr unsigned int
1101  GetLength()
1102  {
1103  return 1;
1104  }
1105  static constexpr ValueType
1106  NonpositiveMin(const ValueType &)
1107  {
1108  return NonpositiveMin();
1109  }
1110  static constexpr ValueType
1111  ZeroValue(const ValueType &)
1112  {
1113  return ZeroValue();
1114  }
1115  static constexpr ValueType
1116  OneValue(const ValueType &)
1117  {
1118  return OneValue();
1119  }
1120 
1121  template <typename TArray>
1122  static void
1123  AssignToArray(const ValueType & v, TArray & mv)
1124  {
1125  mv[0] = v;
1126  }
1127  static void
1128  SetLength(ValueType & m, const unsigned int s)
1129  {
1130  if (s != 1)
1131  {
1132  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1133  }
1134  m = ValueType{};
1135  }
1136 };
1137 
1143 template <>
1144 class NumericTraits<long> : public std::numeric_limits<long>
1145 {
1146 public:
1147  using ValueType = long;
1148  using PrintType = long;
1149  using AbsType = unsigned long;
1150  using AccumulateType = long;
1151  using RealType = double;
1152  using ScalarRealType = RealType;
1153  using FloatType = float;
1154  using MeasurementVectorType = FixedArray<ValueType, 1>;
1155 
1156  static constexpr long ITKCommon_EXPORT Zero = 0L;
1157  static constexpr long ITKCommon_EXPORT One = 1L;
1158 
1160  static constexpr long
1161  NonpositiveMin()
1162  {
1163  return std::numeric_limits<ValueType>::lowest();
1164  }
1165  static constexpr bool
1166  IsPositive(long val)
1167  {
1168  return val > Zero;
1169  }
1170  static constexpr bool
1171  IsNonpositive(long val)
1172  {
1173  return val <= Zero;
1174  }
1175  static constexpr bool
1176  IsNegative(long val)
1177  {
1178  return val < Zero;
1179  }
1180  static constexpr bool
1181  IsNonnegative(long val)
1182  {
1183  return val >= Zero;
1184  }
1185  static constexpr bool IsSigned = true;
1186  static constexpr bool IsInteger = true;
1187  static constexpr bool IsComplex = false;
1188  static constexpr long
1189  ZeroValue()
1190  {
1191  return Zero;
1192  }
1193  static constexpr long
1194  OneValue()
1195  {
1196  return One;
1197  }
1198  static constexpr unsigned int
1199  GetLength(const ValueType &)
1200  {
1201  return 1;
1202  }
1203  static constexpr unsigned int
1204  GetLength()
1205  {
1206  return 1;
1207  }
1208  static constexpr ValueType
1209  NonpositiveMin(const ValueType &)
1210  {
1211  return NonpositiveMin();
1212  }
1213  static constexpr ValueType
1214  ZeroValue(const ValueType &)
1215  {
1216  return ZeroValue();
1217  }
1218  static constexpr ValueType
1219  OneValue(const ValueType &)
1220  {
1221  return OneValue();
1222  }
1223 
1224  template <typename TArray>
1225  static void
1226  AssignToArray(const ValueType & v, TArray & mv)
1227  {
1228  mv[0] = v;
1229  }
1230  static void
1231  SetLength(ValueType & m, const unsigned int s)
1232  {
1233  if (s != 1)
1234  {
1235  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1236  }
1237  m = ValueType{};
1238  }
1239 };
1240 
1246 template <>
1247 class NumericTraits<unsigned long> : public std::numeric_limits<unsigned long>
1248 {
1249 public:
1250  using ValueType = unsigned long;
1251  using PrintType = unsigned long;
1252  using AbsType = unsigned long;
1253  using AccumulateType = unsigned long;
1254  using RealType = double;
1255  using ScalarRealType = RealType;
1256  using FloatType = float;
1257  using MeasurementVectorType = FixedArray<ValueType, 1>;
1258 
1259  static constexpr unsigned long ITKCommon_EXPORT Zero = 0UL;
1260  static constexpr unsigned long ITKCommon_EXPORT One = 1UL;
1261 
1263  static constexpr unsigned long
1264  NonpositiveMin()
1265  {
1266  return std::numeric_limits<ValueType>::lowest();
1267  }
1268  static constexpr bool
1269  IsPositive(unsigned long val)
1270  {
1271  return val != Zero;
1272  }
1273  static constexpr bool
1274  IsNonpositive(unsigned long val)
1275  {
1276  return val == Zero;
1277  }
1278  static constexpr bool
1279  IsNegative(unsigned long)
1280  {
1281  return false;
1282  }
1283  static constexpr bool
1284  IsNonnegative(unsigned long)
1285  {
1286  return true;
1287  }
1288  static constexpr bool IsSigned = false;
1289  static constexpr bool IsInteger = true;
1290  static constexpr bool IsComplex = false;
1291  static constexpr unsigned long
1292  ZeroValue()
1293  {
1294  return Zero;
1295  }
1296  static constexpr unsigned long
1297  OneValue()
1298  {
1299  return One;
1300  }
1301  static constexpr unsigned int
1302  GetLength(const ValueType &)
1303  {
1304  return 1;
1305  }
1306  static constexpr unsigned int
1307  GetLength()
1308  {
1309  return 1;
1310  }
1311  static constexpr ValueType
1312  NonpositiveMin(const ValueType &)
1313  {
1314  return NonpositiveMin();
1315  }
1316  static constexpr ValueType
1317  ZeroValue(const ValueType &)
1318  {
1319  return ZeroValue();
1320  }
1321  static constexpr ValueType
1322  OneValue(const ValueType &)
1323  {
1324  return OneValue();
1325  }
1326 
1327  template <typename TArray>
1328  static void
1329  AssignToArray(const ValueType & v, TArray & mv)
1330  {
1331  mv[0] = v;
1332  }
1333  static void
1334  SetLength(ValueType & m, const unsigned int s)
1335  {
1336  if (s != 1)
1337  {
1338  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1339  }
1340  m = ValueType{};
1341  }
1342 };
1343 
1349 template <>
1350 class NumericTraits<float> : public std::numeric_limits<float>
1351 {
1352 public:
1353  using ValueType = float;
1354  using PrintType = float;
1355  using AbsType = float;
1356  using AccumulateType = double;
1357  using RealType = double;
1358  using ScalarRealType = RealType;
1359  using FloatType = float;
1360  using MeasurementVectorType = FixedArray<ValueType, 1>;
1361 
1362 
1363  static constexpr float ITKCommon_EXPORT Zero = 0.0f;
1364  static constexpr float ITKCommon_EXPORT One = 1.0f;
1365 
1367  static constexpr float
1368  NonpositiveMin()
1369  {
1370  return std::numeric_limits<ValueType>::lowest();
1371  }
1372  static constexpr bool
1373  IsPositive(float val)
1374  {
1375  return val > Zero;
1376  }
1377  static constexpr bool
1378  IsNonpositive(float val)
1379  {
1380  return val <= Zero;
1381  }
1382  static constexpr bool
1383  IsNegative(float val)
1384  {
1385  return val < Zero;
1386  }
1387  static constexpr bool
1388  IsNonnegative(float val)
1389  {
1390  return val >= Zero;
1391  }
1392  static constexpr bool IsSigned = true;
1393  static constexpr bool IsInteger = false;
1394  static constexpr bool IsComplex = false;
1395  static constexpr float
1396  ZeroValue()
1397  {
1398  return Zero;
1399  }
1400  static constexpr float
1401  OneValue()
1402  {
1403  return One;
1404  }
1405  static constexpr unsigned int
1406  GetLength(const ValueType &)
1407  {
1408  return 1;
1409  }
1410  static constexpr unsigned int
1411  GetLength()
1412  {
1413  return 1;
1414  }
1415  static constexpr ValueType
1416  NonpositiveMin(const ValueType &)
1417  {
1418  return NonpositiveMin();
1419  }
1420  static constexpr ValueType
1421  ZeroValue(const ValueType &)
1422  {
1423  return ZeroValue();
1424  }
1425  static constexpr ValueType
1426  OneValue(const ValueType &)
1427  {
1428  return OneValue();
1429  }
1430 
1431  template <typename TArray>
1432  static void
1433  AssignToArray(const ValueType & v, TArray & mv)
1434  {
1435  mv[0] = v;
1436  }
1437  static void
1438  SetLength(ValueType & m, const unsigned int s)
1439  {
1440  if (s != 1)
1441  {
1442  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1443  }
1444  m = ValueType{};
1445  }
1446 };
1447 
1453 template <>
1454 class NumericTraits<double> : public std::numeric_limits<double>
1455 {
1456 public:
1457  using ValueType = double;
1458  using PrintType = double;
1459  using AbsType = double;
1460  using AccumulateType = double;
1461  using RealType = double;
1462  using ScalarRealType = RealType;
1463  using FloatType = float;
1464  using MeasurementVectorType = FixedArray<ValueType, 1>;
1465 
1466  static constexpr double ITKCommon_EXPORT Zero = 0.0;
1467  static constexpr double ITKCommon_EXPORT One = 1.0;
1468 
1470  static constexpr double
1471  NonpositiveMin()
1472  {
1473  return std::numeric_limits<ValueType>::lowest();
1474  }
1475  static constexpr bool
1476  IsPositive(double val)
1477  {
1478  return val > Zero;
1479  }
1480  static constexpr bool
1481  IsNonpositive(double val)
1482  {
1483  return val <= Zero;
1484  }
1485  static constexpr bool
1486  IsNegative(double val)
1487  {
1488  return val < Zero;
1489  }
1490  static constexpr bool
1491  IsNonnegative(double val)
1492  {
1493  return val >= Zero;
1494  }
1495  static constexpr bool IsSigned = true;
1496  static constexpr bool IsInteger = false;
1497  static constexpr bool IsComplex = false;
1498  static constexpr double
1499  ZeroValue()
1500  {
1501  return Zero;
1502  }
1503  static constexpr double
1504  OneValue()
1505  {
1506  return One;
1507  }
1508  static constexpr unsigned int
1509  GetLength(const ValueType &)
1510  {
1511  return 1;
1512  }
1513  static constexpr unsigned int
1514  GetLength()
1515  {
1516  return 1;
1517  }
1518  static constexpr ValueType
1519  NonpositiveMin(const ValueType &)
1520  {
1521  return NonpositiveMin();
1522  }
1523  static constexpr ValueType
1524  ZeroValue(const ValueType &)
1525  {
1526  return ZeroValue();
1527  }
1528  static constexpr ValueType
1529  OneValue(const ValueType &)
1530  {
1531  return OneValue();
1532  }
1533 
1534  template <typename TArray>
1535  static void
1536  AssignToArray(const ValueType & v, TArray & mv)
1537  {
1538  mv[0] = v;
1539  }
1540  static void
1541  SetLength(ValueType & m, const unsigned int s)
1542  {
1543  if (s != 1)
1544  {
1545  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1546  }
1547  m = ValueType{};
1548  }
1549 };
1550 
1556 template <>
1557 class NumericTraits<long double> : public std::numeric_limits<long double>
1558 {
1559 public:
1560  using ValueType = long double;
1561 #if defined(__SUNPRO_CC) && defined(_ILP32)
1562  // sun studio in 32 bit mode is unable to print long double values: it
1563  // segfaults.
1564  // conversion to double will give usable results if the value is in the double
1565  // range - better than nothing.
1566  using PrintType = double;
1567 #else
1568  using PrintType = long double;
1569 #endif
1570  using AbsType = long double;
1571  using AccumulateType = long double;
1572  using RealType = long double;
1573  using ScalarRealType = RealType;
1574  using FloatType = float;
1575  using MeasurementVectorType = FixedArray<ValueType, 1>;
1576 
1577  static constexpr long double ITKCommon_EXPORT Zero = 0.0;
1578  static constexpr long double ITKCommon_EXPORT One = 1.0;
1579 
1581  static constexpr long double
1582  NonpositiveMin()
1583  {
1584  return std::numeric_limits<ValueType>::lowest();
1585  }
1586  static constexpr bool
1587  IsPositive(long double val)
1588  {
1589  return val > Zero;
1590  }
1591  static constexpr bool
1592  IsNonpositive(long double val)
1593  {
1594  return val <= Zero;
1595  }
1596  static constexpr bool
1597  IsNegative(long double val)
1598  {
1599  return val < Zero;
1600  }
1601  static constexpr bool
1602  IsNonnegative(long double val)
1603  {
1604  return val >= Zero;
1605  }
1606  static constexpr bool IsSigned = true;
1607  static constexpr bool IsInteger = false;
1608  static constexpr bool IsComplex = false;
1609  static constexpr long double
1610  ZeroValue()
1611  {
1612  return Zero;
1613  }
1614  static constexpr long double
1615  OneValue()
1616  {
1617  return One;
1618  }
1619  static constexpr unsigned int
1620  GetLength(const ValueType &)
1621  {
1622  return 1;
1623  }
1624  static constexpr unsigned int
1625  GetLength()
1626  {
1627  return 1;
1628  }
1629  static constexpr ValueType
1630  NonpositiveMin(const ValueType &)
1631  {
1632  return NonpositiveMin();
1633  }
1634  static constexpr ValueType
1635  ZeroValue(const ValueType &)
1636  {
1637  return ZeroValue();
1638  }
1639  static constexpr ValueType
1640  OneValue(const ValueType &)
1641  {
1642  return OneValue();
1643  }
1644 
1645  template <typename TArray>
1646  static void
1647  AssignToArray(const ValueType & v, TArray & mv)
1648  {
1649  mv[0] = v;
1650  }
1651  static void
1652  SetLength(ValueType & m, const unsigned int s)
1653  {
1654  if (s != 1)
1655  {
1656  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1657  }
1658  m = ValueType{};
1659  }
1660 };
1661 
1662 
1668 template <>
1669 class NumericTraits<long long> : public std::numeric_limits<long long>
1670 {
1671 public:
1672  using ValueType = long long;
1673  using PrintType = long long;
1674  using AbsType = long long;
1675  using AccumulateType = long long;
1676  using RealType = double;
1677  using ScalarRealType = RealType;
1678  using FloatType = float;
1679  using MeasurementVectorType = FixedArray<ValueType, 1>;
1680 
1681  static constexpr ValueType ITKCommon_EXPORT Zero = 0LL;
1682  static constexpr ValueType ITKCommon_EXPORT One = 1LL;
1683 
1685  static constexpr ValueType
1686  NonpositiveMin()
1687  {
1688  return std::numeric_limits<ValueType>::lowest();
1689  }
1690  static constexpr bool
1691  IsPositive(ValueType val)
1692  {
1693  return val > Zero;
1694  }
1695  static constexpr bool
1697  {
1698  return val <= Zero;
1699  }
1700  static constexpr bool
1701  IsNegative(ValueType val)
1702  {
1703  return val < Zero;
1704  }
1705  static constexpr bool
1707  {
1708  return val >= Zero;
1709  }
1710  static constexpr bool IsSigned = true;
1711  static constexpr bool IsInteger = true;
1712  static constexpr bool IsComplex = false;
1713  static constexpr ValueType
1714  ZeroValue()
1715  {
1716  return Zero;
1717  }
1718  static constexpr ValueType
1719  OneValue()
1720  {
1721  return One;
1722  }
1723  static constexpr unsigned int
1724  GetLength(const ValueType &)
1725  {
1726  return 1;
1727  }
1728  static constexpr unsigned int
1729  GetLength()
1730  {
1731  return 1;
1732  }
1733  static constexpr ValueType
1734  NonpositiveMin(const ValueType &)
1735  {
1736  return NonpositiveMin();
1737  }
1738  static constexpr ValueType
1739  ZeroValue(const ValueType &)
1740  {
1741  return ZeroValue();
1742  }
1743  static constexpr ValueType
1744  OneValue(const ValueType &)
1745  {
1746  return OneValue();
1747  }
1748 
1749  template <typename TArray>
1750  static void
1751  AssignToArray(const ValueType & v, TArray & mv)
1752  {
1753  mv[0] = v;
1754  }
1755  static void
1756  SetLength(ValueType & m, const unsigned int s)
1757  {
1758  if (s != 1)
1759  {
1760  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1761  }
1762  m = ValueType{};
1763  }
1764 };
1765 
1771 template <>
1772 class NumericTraits<unsigned long long> : public std::numeric_limits<unsigned long long>
1773 {
1774 public:
1775  using ValueType = unsigned long long;
1776  using PrintType = unsigned long long;
1777  using AbsType = unsigned long long;
1778  using AccumulateType = unsigned long long;
1779  using RealType = double;
1780  using ScalarRealType = RealType;
1781  using FloatType = float;
1782  using MeasurementVectorType = FixedArray<ValueType, 1>;
1783 
1784  static constexpr ValueType ITKCommon_EXPORT Zero = 0ULL;
1785  static constexpr ValueType ITKCommon_EXPORT One = 1ULL;
1786 
1788  static constexpr ValueType
1789  NonpositiveMin()
1790  {
1791  return std::numeric_limits<ValueType>::lowest();
1792  }
1793  static constexpr bool
1794  IsPositive(ValueType val)
1795  {
1796  return val != Zero;
1797  }
1798  static constexpr bool
1800  {
1801  return val == Zero;
1802  }
1803  static constexpr bool IsNegative(ValueType) { return false; }
1804  static constexpr bool IsNonnegative(ValueType) { return true; }
1805  static constexpr bool IsSigned = false;
1806  static constexpr bool IsInteger = true;
1807  static constexpr bool IsComplex = false;
1808  static constexpr ValueType
1809  ZeroValue()
1810  {
1811  return Zero;
1812  }
1813  static constexpr ValueType
1814  OneValue()
1815  {
1816  return One;
1817  }
1818  static constexpr unsigned int
1819  GetLength(const ValueType &)
1820  {
1821  return 1;
1822  }
1823  static constexpr unsigned int
1824  GetLength()
1825  {
1826  return 1;
1827  }
1828  static constexpr ValueType
1829  NonpositiveMin(const ValueType &)
1830  {
1831  return NonpositiveMin();
1832  }
1833  static constexpr ValueType
1834  ZeroValue(const ValueType &)
1835  {
1836  return ZeroValue();
1837  }
1838  static constexpr ValueType
1839  OneValue(const ValueType &)
1840  {
1841  return OneValue();
1842  }
1843 
1844  template <typename TArray>
1845  static void
1846  AssignToArray(const ValueType & v, TArray & mv)
1847  {
1848  mv[0] = v;
1849  }
1850  static void
1851  SetLength(ValueType & m, const unsigned int s)
1852  {
1853  if (s != 1)
1854  {
1855  itkGenericExceptionMacro("Cannot set the size of a scalar to " << s);
1856  }
1857  m = ValueType{};
1858  }
1859 };
1860 
1861 
1867 template <typename TComponent>
1868 class NumericTraits<std::complex<TComponent>>
1869 {
1870 public:
1871  using Self = std::complex<TComponent>;
1872  // for backward compatibility
1873  using TheType = Self;
1874  using ValueType = TComponent;
1875  using PrintType = Self;
1876  using AbsType = double;
1877  using AccumulateType = Self;
1878  using RealType = std::complex<double>;
1879  using ScalarRealType = double;
1880  using FloatType = std::complex<float>;
1881  using MeasurementVectorType = FixedArray<ValueType, 2>;
1882 
1883  static const Self ITKCommon_EXPORT Zero;
1884  static const Self ITKCommon_EXPORT One;
1885 
1886  static constexpr Self
1887  min()
1888  {
1889  return std::numeric_limits<ValueType>::min();
1890  }
1891  static constexpr Self
1892  max()
1893  {
1894  return std::numeric_limits<ValueType>::max();
1895  }
1896  static constexpr Self min(Self) { return min(); }
1897  static constexpr Self max(Self) { return max(); }
1898  static constexpr ValueType
1899  epsilon()
1900  {
1901  return std::numeric_limits<ValueType>::epsilon();
1902  }
1903  static constexpr Self
1904  NonpositiveMin()
1905  {
1907  }
1908 
1909  static constexpr bool
1910  IsPositive(Self val)
1911  {
1912  return val.real() > 0;
1913  }
1914  static constexpr bool
1915  IsNonpositive(Self val)
1916  {
1917  return val.real() <= 0;
1918  }
1919  static constexpr bool
1920  IsNegative(Self val)
1921  {
1922  return val.real() < 0;
1923  }
1924  static constexpr bool
1925  IsNonnegative(Self val)
1926  {
1927  return val.real() >= 0;
1928  }
1929 
1930  static constexpr bool IsSigned = std::is_signed_v<ValueType>;
1931  static constexpr bool IsInteger = false;
1932  static constexpr bool IsComplex = true;
1933  static Self
1934  ZeroValue()
1935  {
1936  return Self(0, 0);
1937  }
1938  static Self
1939  OneValue()
1940  {
1941  return Self(1, 0);
1942  }
1943  static constexpr unsigned int
1944  GetLength(const Self &)
1945  {
1946  return 2;
1947  }
1948  static constexpr unsigned int
1949  GetLength()
1950  {
1951  return 2;
1952  }
1953  static constexpr Self
1954  NonpositiveMin(const Self &)
1955  {
1956  return NonpositiveMin();
1957  }
1958  static Self
1959  ZeroValue(const Self &)
1960  {
1961  return ZeroValue();
1962  }
1963  static Self
1964  OneValue(const Self &)
1965  {
1966  return OneValue();
1967  }
1968 
1969  template <typename TArray>
1970  static void
1971  AssignToArray(const Self & v, TArray & mv)
1972  {
1973  mv[0] = v.real();
1974  mv[1] = v.imag();
1975  }
1976  static void
1977  SetLength(Self & m, const unsigned int s)
1978  {
1979  if (s != 2)
1980  {
1981  itkGenericExceptionMacro("Cannot set the size of a complex to " << s);
1982  }
1983  m = ValueType{};
1984  }
1985 
1986 #if defined(ITK_LEGACY_REMOVE)
1987  static_assert(std::is_floating_point_v<TComponent>,
1988  "As per https://en.cppreference.com/w/cpp/numeric/complex the behavior is unspecified and may fail to "
1989  "compile if TComponent is not float, double, or long double and undefined if T is not NumericType.");
1990 #endif // defined(ITK_LEGACY_REMOVE)
1991 };
1993 } // end namespace itk
1994 
1995 #include "itkFixedArray.h"
1996 
1997 #endif // itkNumericTraits_h
itk::NumericTraits::NonpositiveMin
static T NonpositiveMin(const T &)
Definition: itkNumericTraits.h:219
itk::NumericTraits::IsPositive
static bool IsPositive(T val)
Definition: itkNumericTraits.h:106
itk::NumericTraits::One
static const T ITKCommon_EXPORT One
Definition: itkNumericTraits.h:95
itk::NumericTraits< InputImagePixelType >::ValueType
InputImagePixelType ValueType
Definition: itkNumericTraits.h:67
Self
AddImageFilter Self
Definition: itkAddImageFilter.h:89
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:99
itk::NumericTraits::SetLength
static void SetLength(T &m, const unsigned int s)
Definition: itkNumericTraits.h:187
itk::NumericTraits::min
static constexpr T min(const T &)
Definition: itkNumericTraits.h:174
itk::NumericTraits< InputImagePixelType >::AccumulateType
double AccumulateType
Definition: itkNumericTraits.h:76
itk::NumericTraits::IsSigned
static constexpr bool IsSigned
Definition: itkNumericTraits.h:135
itk::NumericTraits::MeasurementVectorType
FixedArray< ValueType, 1 > MeasurementVectorType
Definition: itkNumericTraits.h:79
itk::NumericTraits::Zero
static const T ITKCommon_EXPORT Zero
Definition: itkNumericTraits.h:92
itkMacro.h
itk::NumericTraits::IsInteger
static constexpr bool IsInteger
Definition: itkNumericTraits.h:140
itkNUMERIC_TRAITS_MIN_MAX_MACRO
#define itkNUMERIC_TRAITS_MIN_MAX_MACRO()
Definition: itkNumericTraits.h:26
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:158
itk::NumericTraits::AssignToArray
static void AssignToArray(const T &v, TArray &mv)
Definition: itkNumericTraits.h:245
itk::NumericTraits< InputImagePixelType >::PrintType
InputImagePixelType PrintType
Definition: itkNumericTraits.h:70
itkFixedArray.h
itk::NumericTraits::OneValue
static T OneValue(const T &)
Definition: itkNumericTraits.h:237
itk::FixedArray
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:53
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::NumericTraits::max
static constexpr T max(const T &)
Definition: itkNumericTraits.h:169
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:150
itk::NumericTraits::GetLength
static unsigned int GetLength(const T &)
Definition: itkNumericTraits.h:203
itk::NumericTraits::IsNonnegative
static bool IsNonnegative(T val)
Definition: itkNumericTraits.h:127
itk::NumericTraits< InputImagePixelType >::ScalarRealType
RealType ScalarRealType
Definition: itkNumericTraits.h:89
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::NumericTraits< InputImagePixelType >::TraitsType
std::numeric_limits< InputImagePixelType > TraitsType
Definition: itkNumericTraits.h:64
itk::NumericTraits::GetLength
static unsigned int GetLength()
Definition: itkNumericTraits.h:210
itk::NumericTraits::IsComplex
static constexpr bool IsComplex
Definition: itkNumericTraits.h:145
itk::NumericTraits::IsNonpositive
static bool IsNonpositive(T val)
Definition: itkNumericTraits.h:113
itk::NumericTraits< InputImagePixelType >::RealType
double RealType
Definition: itkNumericTraits.h:86
AddImageFilter
Definition: itkAddImageFilter.h:81
itk::NumericTraits::ZeroValue
static T ZeroValue(const T &)
Definition: itkNumericTraits.h:228
itk::NumericTraits< InputImagePixelType >::FloatType
float FloatType
Definition: itkNumericTraits.h:83
itk::NumericTraits< InputImagePixelType >::AbsType
InputImagePixelType AbsType
Definition: itkNumericTraits.h:73
itk::NumericTraits::IsNegative
static bool IsNegative(T val)
Definition: itkNumericTraits.h:120