![]() |
ITK
5.4.0
Insight Toolkit
|
#include <itkNumericTraits.h>
Define additional traits for native types such as int or float.
Define numeric traits for std::vector.
NumericTraits is used to extend the traits associated with native types such as float, char, int, and so on. These traits are extensions of the standard numeric_limits defined by the C++ compilers. Some of the added traits include minimum and maximum value; accumulation type; etc.
T | Component type of std::vector |
We provide here a generic implementation based on creating types of std::vector whose components are the types of the NumericTraits from the original std::vector components. This implementation require support for partial specializations, since it is based on the concept that: NumericTraits<std::vector< T > > is defined piecewise by std::vector< NumericTraits< T > >
Definition at line 59 of file itkNumericTraits.h.
Public Types | |
using | AbsType = T |
using | AccumulateType = double |
using | FloatType = float |
using | MeasurementVectorType = FixedArray< ValueType, 1 > |
using | PrintType = T |
using | RealType = double |
using | ScalarRealType = RealType |
using | TraitsType = std::numeric_limits< T > |
using | ValueType = T |
Static Public Member Functions | |
template<typename TArray > | |
static void | AssignToArray (const T &v, TArray &mv) |
static unsigned int | GetLength () |
static unsigned int | GetLength (const T &) |
static bool | IsNegative (T val) |
static bool | IsNonnegative (T val) |
static bool | IsNonpositive (T val) |
static bool | IsPositive (T val) |
static constexpr T | max (const T &) |
static constexpr T | min (const T &) |
static constexpr T | NonpositiveMin () |
static T | NonpositiveMin (const T &) |
static T | OneValue () |
static T | OneValue (const T &) |
static void | SetLength (T &m, const unsigned int s) |
static T | ZeroValue () |
static T | ZeroValue (const T &) |
Static Public Attributes | |
static constexpr bool | IsComplex = false |
static constexpr bool | IsInteger = false |
static constexpr bool | IsSigned = false |
static const T ITKCommon_EXPORT | One |
static const T ITKCommon_EXPORT | Zero |
using itk::NumericTraits< T >::AbsType = T |
Return value of itk::Math::abs().
Definition at line 72 of file itkNumericTraits.h.
using itk::NumericTraits< T >::AccumulateType = double |
Accumulation of addition and multiplication.
Definition at line 75 of file itkNumericTraits.h.
using itk::NumericTraits< T >::FloatType = float |
Typedef for operations that use floating point instead of real precision to save memory
Definition at line 82 of file itkNumericTraits.h.
using itk::NumericTraits< T >::MeasurementVectorType = FixedArray<ValueType, 1> |
Measurement vector type
Definition at line 78 of file itkNumericTraits.h.
using itk::NumericTraits< T >::PrintType = T |
Return the type that can be printed.
Definition at line 69 of file itkNumericTraits.h.
using itk::NumericTraits< T >::RealType = double |
Type for real-valued scalar operations.
Definition at line 85 of file itkNumericTraits.h.
using itk::NumericTraits< T >::ScalarRealType = RealType |
Type for real-valued scalar operations.
Definition at line 88 of file itkNumericTraits.h.
using itk::NumericTraits< T >::TraitsType = std::numeric_limits<T> |
The type of this limits trait object.
Definition at line 63 of file itkNumericTraits.h.
using itk::NumericTraits< T >::ValueType = T |
Return the type of this native type.
Definition at line 66 of file itkNumericTraits.h.
|
inlinestatic |
assign the value to an array
Definition at line 244 of file itkNumericTraits.h.
|
inlinestatic |
Return the length of the scalar: 1. Array types can return a different value
Definition at line 209 of file itkNumericTraits.h.
Referenced by itk::NumericTraits< Array< T > >::AssignToArray(), itk::NumericTraits< std::vector< T > >::AssignToArray(), itk::NumericTraits< SymmetricSecondRankTensor< T, D > >::AssignToArray(), itk::NumericTraits< VariableLengthVector< T > >::AssignToArray(), itk::NumericTraits< SymmetricSecondRankTensor< T, D > >::GetLength(), itk::NumericTraits< T >::GetLength(), itk::NumericTraits< VariableLengthVector< T > >::IsNegative(), itk::NumericTraits< Vector< T, D > >::IsNegative(), itk::NumericTraits< VariableLengthVector< T > >::IsNonnegative(), itk::NumericTraits< Vector< T, D > >::IsNonnegative(), itk::NumericTraits< VariableLengthVector< T > >::IsNonpositive(), itk::NumericTraits< Vector< T, D > >::IsNonpositive(), itk::NumericTraits< VariableLengthVector< T > >::IsPositive(), itk::NumericTraits< Vector< T, D > >::IsPositive(), itk::Statistics::MeasurementVectorTraits::IsResizable(), itk::Statistics::MembershipFunctionBase< TVector >::MembershipFunctionBase(), itk::Statistics::Sample< TMeasurementVector >::Sample(), itk::Statistics::KdTreeBasedKmeansEstimator< TKdTree >::CandidateVector::SetCentroids(), itk::Statistics::DistanceMetric< TVector >::SetMeasurementVectorSize(), itk::Statistics::MembershipFunctionBase< TVector >::SetMeasurementVectorSize(), itk::Statistics::Sample< TMeasurementVector >::SetMeasurementVectorSize(), itk::GradientRecursiveGaussianImageFilter< TInputImage, TOutputImage >::TransformOutputPixel(), and itk::GTest::Predicate::VectorDoubleRMSPredFormat().
|
inlinestatic |
Return the length of the scalar. This API is needed for VariableLengthVector because its length is only known at run-time. Specializations of the VariableLengthVector will provide a different implementation where a vector of the correct size is built.
Definition at line 202 of file itkNumericTraits.h.
References itk::NumericTraits< T >::GetLength().
|
inlinestatic |
Is a given value negative?
Definition at line 119 of file itkNumericTraits.h.
References itk::NumericTraits< T >::Zero.
Referenced by itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::NumericTraits< RGBAPixel< T > >::IsNegative(), and itk::NumericTraits< RGBPixel< T > >::IsNegative().
|
inlinestatic |
Is a given value nonnegative?
Definition at line 126 of file itkNumericTraits.h.
References itk::NumericTraits< T >::Zero.
Referenced by itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::NumericTraits< RGBAPixel< T > >::IsNonnegative(), and itk::NumericTraits< RGBPixel< T > >::IsNonnegative().
|
inlinestatic |
Is a given value nonpositive?
Definition at line 112 of file itkNumericTraits.h.
References itk::NumericTraits< T >::Zero.
Referenced by itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::NumericTraits< RGBAPixel< T > >::IsNonpositive(), and itk::NumericTraits< RGBPixel< T > >::IsNonpositive().
|
inlinestatic |
Is a given value positive?
Definition at line 105 of file itkNumericTraits.h.
References itk::NumericTraits< T >::Zero.
Referenced by itk::Math::CastWithRangeCheck(), itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::NumericTraits< RGBAPixel< T > >::IsPositive(), and itk::NumericTraits< RGBPixel< T > >::IsPositive().
|
inlinestaticconstexpr |
Definition at line 168 of file itkNumericTraits.h.
Referenced by itk::AdaptiveHistogramEqualizationImageFilter< TImageType, TKernel >::AdaptiveHistogramEqualizationImageFilter(), itk::Functor::LabelToRGBFunctor< TLabel, TRGBPixel >::AddColor(), itk::AnchorCloseImageFilter< TImage, TKernel >::AnchorCloseImageFilter(), itk::AnchorErodeImageFilter< TImage, TKernel >::AnchorErodeImageFilter(), itk::AnchorOpenImageFilter< TImage, TKernel >::AnchorOpenImageFilter(), itk::BinaryNotImageFilter< TImage >::BinaryNotImageFilter(), itk::BinaryProjectionImageFilter< TInputImage, TOutputImage >::BinaryProjectionImageFilter(), itk::Functor::BinaryThreshold< TInput, TOutput >::BinaryThreshold(), itk::BinaryThresholdProjectionImageFilter< TInputImage, TOutputImage >::BinaryThresholdProjectionImageFilter(), itk::Function::ColormapFunction< TScalar, TRGBPixel >::ColormapFunction(), itk::Function::RankHistogram< TInputPixel >::GetValueBruteForce(), itk::Function::VectorRankHistogram< TInputPixel >::GetValueBruteForce(), itk::Functor::GPUBinaryThreshold< TInput, TOutput >::GPUBinaryThreshold(), itk::Functor::MinimumAccumulator< TInputPixel >::Initialize(), itk::Functor::IntensityLinearTransform< TInput, TOutput >::IntensityLinearTransform(), itk::Functor::InvertIntensityTransform< TInput, TOutput >::InvertIntensityTransform(), itk::LabelGeometryImageFilter< TLabelImage, TIntensityImage >::LabelGeometry::LabelGeometry(), itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelStatistics::LabelStatistics(), itk::MovingHistogramErodeImageFilter< TInputImage, TOutputImage, TKernel >::MovingHistogramErodeImageFilter(), itk::MultiphaseFiniteDifferenceImageFilter< TInputImage, TFeatureImage, TOutputImage, TFiniteDifferenceFunction, TIdCell >::MultiphaseFiniteDifferenceImageFilter(), itk::UnsharpMaskImageFilter< TInputImage, TOutputImage, TInternalPrecision >::UnsharpMaskingFunctor< InPixelType, FunctorRealType, OutPixelType >::operator()(), itk::Functor::Div< TInput1, TInput2, TOutput >::operator()(), itk::Functor::Modulus< TInput1, TInput2, TOutput >::operator()(), itk::Functor::DivFloor< TInput1, TInput2, TOutput >::operator()(), itk::Functor::ConstrainedValueAddition< TInput1, TInput2, TOutput >::operator()(), itk::Function::RankHistogram< TInputPixel >::RankHistogram(), itk::ReconstructionByErosionImageFilter< TInputImage, TOutputImage >::ReconstructionByErosionImageFilter(), itk::Function::VectorMorphologicalGradientHistogram< TInputPixel >::RemovePixel(), itk::Functor::Sigmoid< TInput, TOutput >::Sigmoid(), itk::SimplexMeshAdaptTopologyFilter< TInputMesh, TOutputMesh >::SimplexCellVisitor::SimplexCellVisitor(), itk::STAPLEImageFilter< TInputImage, TOutputImage >::STAPLEImageFilter(), itk::ThresholdSegmentationLevelSetFunction< TImageType, TFeatureImageType >::ThresholdSegmentationLevelSetFunction(), itk::VanHerkGilWermanErodeImageFilter< TImage, TKernel >::VanHerkGilWermanErodeImageFilter(), itk::Function::VectorMorphologicalGradientHistogram< TInputPixel >::VectorMorphologicalGradientHistogram(), itk::Function::VectorMorphologyHistogram< TInputPixel, TCompare >::VectorMorphologyHistogram(), and itk::Function::VectorRankHistogram< TInputPixel >::VectorRankHistogram().
|
inlinestaticconstexpr |
Definition at line 173 of file itkNumericTraits.h.
Referenced by itk::AdaptiveHistogramEqualizationImageFilter< TImageType, TKernel >::AdaptiveHistogramEqualizationImageFilter(), itk::Function::ColormapFunction< TScalar, TRGBPixel >::ColormapFunction(), itk::Statistics::KdTree< TSample >::NearestNeighbors::ReplaceFarthestNeighbor(), and itk::Functor::Sigmoid< TInput, TOutput >::Sigmoid().
|
inlinestaticconstexpr |
Smallest (most nonpositive) value
Definition at line 98 of file itkNumericTraits.h.
Referenced by itk::Function::VectorMorphologyHistogram< TInputPixel, TCompare >::AddPixel(), itk::Function::VectorMorphologicalGradientHistogram< TInputPixel >::AddPixel(), itk::AnchorCloseImageFilter< TImage, TKernel >::AnchorCloseImageFilter(), itk::AnchorDilateImageFilter< TImage, TKernel >::AnchorDilateImageFilter(), itk::AnchorOpenImageFilter< TImage, TKernel >::AnchorOpenImageFilter(), itk::BinaryNotImageFilter< TImage >::BinaryNotImageFilter(), itk::BinaryProjectionImageFilter< TInputImage, TOutputImage >::BinaryProjectionImageFilter(), itk::Functor::BinaryThreshold< TInput, TOutput >::BinaryThreshold(), itk::BinaryThresholdProjectionImageFilter< TInputImage, TOutputImage >::BinaryThresholdProjectionImageFilter(), itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::LevelSetMotionRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::GetGlobalDataPointer(), itk::Function::VectorRankHistogram< TInputPixel >::GetValueBruteForce(), itk::Functor::GPUBinaryThreshold< TInput, TOutput >::GPUBinaryThreshold(), itk::Functor::MaximumAccumulator< TInputPixel >::Initialize(), itk::Functor::IntensityLinearTransform< TInput, TOutput >::IntensityLinearTransform(), itk::LabelGeometryImageFilter< TLabelImage, TIntensityImage >::LabelGeometry::LabelGeometry(), itk::LabelStatisticsImageFilter< TInputImage, TLabelImage >::LabelStatistics::LabelStatistics(), itk::MovingHistogramDilateImageFilter< TInputImage, TOutputImage, TKernel >::MovingHistogramDilateImageFilter(), itk::NumericTraits< CovariantVector< T, D > >::NonpositiveMin(), itk::NumericTraits< DiffusionTensor3D< T > >::NonpositiveMin(), itk::NumericTraits< FixedArray< T, D > >::NonpositiveMin(), itk::NumericTraits< Point< T, D > >::NonpositiveMin(), itk::NumericTraits< RGBAPixel< T > >::NonpositiveMin(), itk::NumericTraits< RGBPixel< T > >::NonpositiveMin(), itk::NumericTraits< SymmetricSecondRankTensor< T, D > >::NonpositiveMin(), itk::NumericTraits< Vector< T, D > >::NonpositiveMin(), itk::NumericTraits< T >::NonpositiveMin(), itk::UnsharpMaskImageFilter< TInputImage, TOutputImage, TInternalPrecision >::UnsharpMaskingFunctor< InPixelType, FunctorRealType, OutPixelType >::operator()(), itk::Functor::Maximum1< TInput, TOutput >::operator()(), itk::Functor::DivFloor< TInput1, TInput2, TOutput >::operator()(), itk::Functor::ConstrainedValueAddition< TInput1, TInput2, TOutput >::operator()(), itk::Functor::ConstrainedValueDifference< TInput1, TInput2, TOutput >::operator()(), itk::Function::RankHistogram< TInputPixel >::RankHistogram(), itk::ReconstructionByDilationImageFilter< TInputImage, TOutputImage >::ReconstructionByDilationImageFilter(), itk::Function::VectorMorphologyHistogram< TInputPixel, TCompare >::RemovePixel(), itk::Function::VectorMorphologicalGradientHistogram< TInputPixel >::RemovePixel(), itk::ThresholdSegmentationLevelSetFunction< TImageType, TFeatureImageType >::ThresholdSegmentationLevelSetFunction(), itk::VanHerkGilWermanDilateImageFilter< TImage, TKernel >::VanHerkGilWermanDilateImageFilter(), itk::Function::VectorMorphologicalGradientHistogram< TInputPixel >::VectorMorphologicalGradientHistogram(), itk::Function::VectorMorphologyHistogram< TInputPixel, TCompare >::VectorMorphologyHistogram(), and itk::Function::VectorRankHistogram< TInputPixel >::VectorRankHistogram().
|
inlinestatic |
Smallest (most nonpositive) value. This API is needed for VariableLengthVector because its length is only known at run-time.
Definition at line 218 of file itkNumericTraits.h.
References itk::NumericTraits< T >::NonpositiveMin().
|
inlinestatic |
Return one value. This function should be used to support RGBPixel type and standard types (not vectors)
Definition at line 157 of file itkNumericTraits.h.
References itk::NumericTraits< T >::One.
Referenced by itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::RegionBasedLevelSetFunction< TInput, TFeature, TSharedData >::CurvatureSpeed(), itk::LevelSetFunction< TImageType >::CurvatureSpeed(), itk::Functor::DivideOrZeroOut< TNumerator, TDenominator, TOutput >::DivideOrZeroOut(), itk::Path< TInput, TOutput, VDimension >::EndOfInput(), itk::NormalVectorDiffusionFunction< TSparseImageType >::FluxStopFunction(), itk::RegionBasedLevelSetFunction< TInput, TFeature, TSharedData >::LaplacianSmoothingSpeed(), itk::LevelSetFunction< TImageType >::LaplacianSmoothingSpeed(), itk::Functor::LogicOpBase< TInput1, TInput2, TOutput >::LogicOpBase(), itk::NumericTraits< CovariantVector< T, D > >::OneValue(), itk::NumericTraits< DiffusionTensor3D< T > >::OneValue(), itk::NumericTraits< FixedArray< T, D > >::OneValue(), itk::NumericTraits< Point< T, D > >::OneValue(), itk::NumericTraits< RGBAPixel< T > >::OneValue(), itk::NumericTraits< RGBPixel< T > >::OneValue(), itk::NumericTraits< SymmetricSecondRankTensor< T, D > >::OneValue(), itk::NumericTraits< Vector< T, D > >::OneValue(), itk::NumericTraits< T >::OneValue(), itk::Functor::LandweberMethod< TInput1, TInput2, TInput3, TOutput >::operator()(), itk::Functor::InvertIntensityFunctor< InputPixelType >::operator()(), itk::Functor::WeightedAdd2< TInput1, TInput2, TOutput >::SetAlpha(), itk::STAPLEImageFilter< TInputImage, TOutputImage >::STAPLEImageFilter(), and itk::Functor::ThresholdLabeler< TInput, TOutput >::ThresholdLabeler().
|
inlinestatic |
One value. This API is needed for VariableLengthVector because its length is only known at run-time.
Definition at line 236 of file itkNumericTraits.h.
References itk::NumericTraits< T >::OneValue().
|
inlinestatic |
Scalars cannot be resized, so an exception will be thrown if the input size is not 1. If the size is valid the will be zeros. This API is needed for VariableLengthVector because its length is only known at run-time. Specializations of the VariableLengthVector will provide a different implementation where a vector of the correct size is built.
Definition at line 186 of file itkNumericTraits.h.
Referenced by itk::Functor::LabelToRGBFunctor< TLabel, TRGBPixel >::AddColor(), itk::Functor::LabelToRGBFunctor< TLabel, TRGBPixel >::LabelToRGBFunctor(), itk::Functor::LabelOverlayFunctor< TInputPixel, TLabel, TRGBPixel >::operator()(), and itk::Statistics::KdTreeBasedKmeansEstimator< TKdTree >::CandidateVector::SetCentroids().
|
inlinestatic |
Return zero value. This function should be used to support RGBPixel type and standard types (not vectors)
Definition at line 149 of file itkNumericTraits.h.
References itk::NumericTraits< T >::Zero.
Referenced by itk::Concept::HasNumericTraits< T >::Constraints::constraints(), itk::NumericTraits< CovariantVector< T, D > >::ZeroValue(), itk::NumericTraits< DiffusionTensor3D< T > >::ZeroValue(), itk::NumericTraits< FixedArray< T, D > >::ZeroValue(), itk::NumericTraits< Point< T, D > >::ZeroValue(), itk::NumericTraits< RGBAPixel< T > >::ZeroValue(), itk::NumericTraits< RGBPixel< T > >::ZeroValue(), itk::NumericTraits< SymmetricSecondRankTensor< T, D > >::ZeroValue(), itk::NumericTraits< Vector< T, D > >::ZeroValue(), and itk::NumericTraits< T >::ZeroValue().
|
inlinestatic |
Zero value. This API is needed for VariableLengthVector because its length is only known at run-time.
Definition at line 227 of file itkNumericTraits.h.
References itk::NumericTraits< T >::ZeroValue().
|
staticconstexpr |
Is a given type complex? – default is no. For uniform array data types in ITK, the value of IsComplex is determined by the component elements of the array.
Definition at line 144 of file itkNumericTraits.h.
|
staticconstexpr |
Is a given type an integer? – default is no. For uniform array data types in ITK, the value of IsInteger is determined by the component elements of the array.
Definition at line 139 of file itkNumericTraits.h.
|
staticconstexpr |
Is a given type signed? – default is no. For uniform array data types in ITK, the value of IsSigned is determined by the component elements of the array.
Definition at line 134 of file itkNumericTraits.h.
|
static |
Multiplicative identity.
Definition at line 94 of file itkNumericTraits.h.
Referenced by itk::NumericTraits< T >::OneValue().
|
static |
Additive identity.
Definition at line 91 of file itkNumericTraits.h.
Referenced by itk::NumericTraits< T >::IsNegative(), itk::NumericTraits< T >::IsNonnegative(), itk::NumericTraits< T >::IsNonpositive(), itk::NumericTraits< T >::IsPositive(), and itk::NumericTraits< T >::ZeroValue().