ITK
4.9.0
Insight Segmentation and Registration Toolkit
|
Namespaces | |
Detail | |
Functions | |
template<typename T1 , typename T2 > | |
bool | AlmostEquals (T1 x1, T2 x2) |
template<typename TReturn , typename TInput > | |
TReturn | CastWithRangeCheck (TInput x) |
template<TReturn , typename TInput > | |
Ceil (TInput x) | |
template<typename TInput1 , typename TInput2 > | |
bool | ExactlyEquals (const TInput1 &x1, const TInput2 &x2) |
template<typename T > | |
bool | FloatAlmostEqual (T x1, T x2, typename Detail::FloatIEEE< T >::IntType maxUlps=4, typename Detail::FloatIEEE< T >::FloatType maxAbsoluteDifference=0.1 *itk::NumericTraits< T >::epsilon()) |
template<typename T > | |
Detail::FloatIEEE< T >::IntType | FloatDifferenceULP (T x1, T x2) |
template<TReturn , typename TInput > | |
Floor (TInput x) | |
template<typename T1 , typename T2 > | |
bool | NotAlmostEquals (T1 x1, T2 x2) |
template<typename TInput1 , typename TInput2 > | |
bool | NotExactlyEquals (const TInput1 &x1, const TInput2 &x2) |
template<typename TReturn , typename TInput > | |
TReturn | Round (TInput x) |
template<TReturn , typename TInput > | |
RoundHalfIntegerToEven (TInput x) | |
template<TReturn , typename TInput > | |
RoundHalfIntegerUp (TInput x) | |
ITKCommon_EXPORT bool | IsPrime (unsigned short n) |
ITKCommon_EXPORT bool | IsPrime (unsigned int n) |
ITKCommon_EXPORT bool | IsPrime (unsigned long n) |
ITKCommon_EXPORT bool | IsPrime (unsigned long long n) |
ITKCommon_EXPORT unsigned short | GreatestPrimeFactor (unsigned short n) |
ITKCommon_EXPORT unsigned int | GreatestPrimeFactor (unsigned int n) |
ITKCommon_EXPORT unsigned long | GreatestPrimeFactor (unsigned long n) |
ITKCommon_EXPORT unsigned long long | GreatestPrimeFactor (unsigned long long n) |
Variables | |
static const double | e = 2.7182818284590452354 |
static const double | ln10 = 2.30258509299404568402 |
static const double | ln2 = 0.69314718055994530942 |
static const double | log10e = 0.43429448190325182765 |
static const double | log2e = 1.4426950408889634074 |
static const double | one_over_pi = 0.31830988618379067154 |
static const double | one_over_sqrt2pi = 0.39894228040143267794 |
static const double | pi = 3.14159265358979323846 |
static const double | pi_over_2 = 1.57079632679489661923 |
static const double | pi_over_4 = 0.78539816339744830962 |
static const double | sqrt1_2 = 0.70710678118654752440 |
static const double | sqrt2 = 1.41421356237309504880 |
static const double | two_over_pi = 0.63661977236758134308 |
static const double | two_over_sqrtpi = 1.12837916709551257390 |
|
inline |
Provide consistent equality checks between values of potentially different scalar or complex types.
template< typename T1, typename T2 > AlmostEquals( T1 x1, T2 x2 )
template< typename T1, typename T2 > NotAlmostEquals( T1 x1, T2 x2 )
This function compares two scalar or complex values of potentially different types. For maximum extensibility the function is implemented through a series of templated structs which direct the AlmostEquals() call to the correct function by evaluating the parameter's types.
Overall algorithm: If both values are complex... separate values into real and imaginary components and compare them separately
If one of the values is complex.. see if the imaginary part of the complex value is approximately 0 ... compare real part of complex value with scalar value
If both values are scalars...
To compare two floating point types... use FloatAlmostEqual.
To compare a floating point and an integer type... Use static_cast<FloatingPointType>(integerValue) and call FloatAlmostEqual
To compare signed and unsigned integers... Check for negative value or overflow, then cast and use ==
To compare two signed or two unsigned integers ... Use ==
To compare anything else ... Use ==
x1 | first scalar value to compare |
x2 | second scalar value to compare |
Definition at line 627 of file itkMath.h.
Referenced by itk::AnchorErodeDilateLine< TInputPix, TCompare >::Compare(), itk::DivideImageFilter< TInputImage, Image< TConstant, TInputImage::ImageDimension >, TOutputImage >::GenerateData(), and NotAlmostEquals().
|
inline |
This class requires OnlyDefinedForIntegerTypes1 in the form of ( itk::Concept::IsInteger< TReturn > )
This class requires OnlyDefinedForIntegerTypes2 in the form of ( itk::Concept::IsInteger< TInput > )
Definition at line 182 of file itkMath.h.
References itk::NumericTraits< T >::IsPositive(), and itkConceptMacro.
itk::Math::Ceil | ( | TInput | x | ) |
Round towards plus infinity.
The behavior of overflow is undefined due to numerous implementations.
|
inline |
Return the result of an exact comparison between two scalar values of potetially different types.
template <typename TInput1, typename TInput2> inline bool ExactlyEquals( const TInput & x1, const TInput & x2 )
template <typename TInput1, typename TInput2> inline bool NotExactlyEquals( const TInput & x1, const TInput & x2 )
These functions complement the EqualsComparison functions and determine if two scalar values are exactly equal using the compilers casting rules when comparing two different types. While this is also easily accomplished by using the equality operators, use of this function demonstrates the intent of an exact equality check and thus improves readability and clarity of code. In addition, this function suppresses float-equal warnings produced when using Clang.
x1 | first floating point value to compare |
x2 | second floating point value to compare |
Definition at line 665 of file itkMath.h.
Referenced by itk::BSplineKernelFunction< VSplineOrder, TRealValueType >::Evaluate(), itk::BSplineDerivativeKernelFunction< VSplineOrder, TRealValueType >::Evaluate(), NotExactlyEquals(), itk::Point< SpacePrecisionType, VIndexDimension >::operator!=(), itk::Functor::Equal< TInput1, TInput2, TOutput >::operator()(), itk::Point< SpacePrecisionType, VIndexDimension >::operator==(), itk::KLMDynamicBorderArray< TBorder >::operator>(), itk::LaplacianSegmentationLevelSetFunction< TImageType, TFeatureImageType >::SetAdvectionWeight(), itk::SigmoidImageFilter< TInputImage, TOutputImage >::SetAlpha(), itk::SigmoidImageFilter< TInputImage, TOutputImage >::SetBeta(), itk::FastMarchingImageFilter< TLevelSet, TSpeedImage >::SetBinaryMask(), itk::SigmoidImageFilter< TInputImage, TOutputImage >::SetOutputMaximum(), itk::SigmoidImageFilter< TInputImage, TOutputImage >::SetOutputMinimum(), and itk::ShapeUniqueLabelMapFilter< TImage >::TemplatedGenerateData().
|
inline |
Compare two floats and return if they are effectively equal.
Determining when floats are almost equal is difficult because of their IEEE bit representation. This function uses the integer representation of the float to determine if they are almost equal.
The implementation is based off the explanation in the white papers:
This function is not a cure-all, and reading those articles is important to understand its appropriate use in the context of ULPs, zeros, subnormals, infinities, and NANs. For example, it is preferable to use this function on two floats directly instead of subtracting them and comparing them to zero.
The tolerance is specified in ULPs (units in the last place), i.e. how many floats there are in between the numbers. Therefore, the tolerance depends on the magnitude of the values that are being compared. A second tolerance is a maximum difference allowed, which is important when comparing numbers close to zero.
A NAN compares as not equal to a number, but two NAN's may compare as equal to each other.
x1 | first floating value to compare |
x2 | second floating values to compare |
maxUlps | maximum units in the last place to be considered equal |
maxAbsoluteDifference | maximum absolute difference to be considered equal |
Definition at line 261 of file itkMath.h.
References itk::Math::Detail::FloatIEEE< T >::AsULP(), and FloatDifferenceULP().
|
inline |
Return the signed distance in ULPs (units in the last place) between two floats.
This is the signed distance, i.e., if x1 > x2, then the result is positive.
Definition at line 222 of file itkMath.h.
References itk::Math::Detail::FloatIEEE< T >::AsULP().
Referenced by FloatAlmostEqual().
itk::Math::Floor | ( | TInput | x | ) |
Round towards minus infinity.
The behavior of overflow is undefined due to numerous implementations.
ITKCommon_EXPORT unsigned short itk::Math::GreatestPrimeFactor | ( | unsigned short | n | ) |
Return the greatest factor of the decomposition in prime numbers
ITKCommon_EXPORT unsigned int itk::Math::GreatestPrimeFactor | ( | unsigned int | n | ) |
Return the greatest factor of the decomposition in prime numbers
ITKCommon_EXPORT unsigned long itk::Math::GreatestPrimeFactor | ( | unsigned long | n | ) |
Return the greatest factor of the decomposition in prime numbers
ITKCommon_EXPORT unsigned long long itk::Math::GreatestPrimeFactor | ( | unsigned long long | n | ) |
Return the greatest factor of the decomposition in prime numbers
ITKCommon_EXPORT bool itk::Math::IsPrime | ( | unsigned short | n | ) |
Return whether the number in a prime number or not.
ITKCommon_EXPORT bool itk::Math::IsPrime | ( | unsigned int | n | ) |
Return whether the number in a prime number or not.
ITKCommon_EXPORT bool itk::Math::IsPrime | ( | unsigned long | n | ) |
Return whether the number in a prime number or not.
ITKCommon_EXPORT bool itk::Math::IsPrime | ( | unsigned long long | n | ) |
Return whether the number in a prime number or not.
|
inline |
Definition at line 635 of file itkMath.h.
References AlmostEquals().
Referenced by itk::Functor::Div< TInputImage1::PixelType, TInputImage2::PixelType, TOutputImage::PixelType >::operator()().
|
inline |
Definition at line 676 of file itkMath.h.
References ExactlyEquals().
Referenced by itk::Functor::VectorMagnitudeLinearTransform< TInputImage::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::ExpNegative< TInputImage::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::WeightedAdd2< TInputImage1::PixelType, TInputImage2::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::IntensityWindowingTransform< TInputImage::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::IntensityLinearTransform< TInputImage::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::Sigmoid< TInputImage::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::BinaryThreshold< TInputImage::PixelType, TOutputImage::PixelType >::operator!=(), itk::Functor::LabelOverlayFunctor< FeatureImagePixelType, LabelMapPixelType, OutputImagePixelType >::operator!=(), itk::Functor::NotEqual< TInput1, TInput2, TOutput >::operator()(), itk::VariableSizeMatrix< T >::operator==(), itk::Matrix< TParametersValueType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension)>::operator==(), itk::NarrowBandLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType, Image< TOutputPixelType, TInputImage::ImageDimension > >::SetAdvectionScaling(), itk::SegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType >::SetAdvectionScaling(), itk::GaussianInterpolateImageFunction< TInputImage, TCoordRep >::SetAlpha(), itk::ConstantPadImageFilter< TInputImage, TOutputImage >::SetConstant(), itk::DivideOrZeroOutImageFilter< TInputImage1, TInputImage2, TOutputImage >::SetConstant(), itk::NarrowBandLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType, Image< TOutputPixelType, TInputImage::ImageDimension > >::SetCurvatureScaling(), itk::SegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType >::SetCurvatureScaling(), itk::GeodesicActiveContourLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType >::SetDerivativeSigma(), itk::SegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType >::SetFeatureScaling(), itk::CannyEdgeDetectionImageFilter< ImageType, ImageType >::SetMaximumError(), itk::MaskImageFilter< TInputImage, TMaskImage, TOutputImage >::SetOutsideValue(), itk::NarrowBandLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType, Image< TOutputPixelType, TInputImage::ImageDimension > >::SetPropagationScaling(), itk::SegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType >::SetPropagationScaling(), itk::ShapePriorSegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType >::SetShapePriorScaling(), itk::DivideOrZeroOutImageFilter< TInputImage1, TInputImage2, TOutputImage >::SetThreshold(), and itk::CannyEdgeDetectionImageFilter< ImageType, ImageType >::SetVariance().
|
inline |
Round towards nearest integer (This is a synonym for RoundHalfIntegerUp)
TReturn | must be an integer type |
TInput | must be float or double |
itk::Math::RoundHalfIntegerToEven | ( | TInput | x | ) |
Round towards nearest integer.
TReturn | must be an integer type |
TInput | must be float or double halfway cases are rounded towards the nearest even integer, e.g. * RoundHalfIntegerToEven( 1.5) == 2
* RoundHalfIntegerToEven(-1.5) == -2
* RoundHalfIntegerToEven( 2.5) == 2
* RoundHalfIntegerToEven( 3.5) == 4
*
|
The behavior of overflow is undefined due to numerous implementations.
itk::Math::RoundHalfIntegerUp | ( | TInput | x | ) |
Round towards nearest integer.
TReturn | must be an integer type |
TInput | must be float or double halfway cases are rounded upward, e.g. |
The behavior of overflow is undefined due to numerous implementations.
|
static |
The base of the natural logarithm or Euler's number
Definition at line 47 of file itkMath.h.
Referenced by itk::TreeChangeEvent< TTreeType >::CheckEvent(), itk::TreeNodeChangeEvent< TTreeType >::CheckEvent(), itk::ProgressReporter::CompletedPixel(), ComputeHash(), itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter< TInputMesh, TOutputMesh >::ComputeMeanAndGaussianCurvatures(), itk::Concept::AdditiveOperators< T1, T2, T3 >::Constraints::const_constraints(), itk::Concept::MultiplyOperator< T1, T2, T3 >::Constraints::const_constraints(), itk::Concept::DivisionOperators< T1, T2, T3 >::Constraints::const_constraints(), itk::Concept::BitwiseOperators< T1, T2, T3 >::Constraints::const_constraints(), itk::Concept::BracketOperator< T1, T2, T3 >::Constraints::const_constraints(), itk::Functor::DivideOrZeroOut< TInputImage1::PixelType, TInputImage2::PixelType, TOutputImage::PixelType >::DivideOrZeroOut(), itk::Versor< TParametersValueType >::Epsilon(), itk::DiscreteMeanCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh >::EstimateCurvature(), itk::MatrixOrthogonalityTolerance< double >::GetTolerance(), itk::MatrixOrthogonalityTolerance< float >::GetTolerance(), HashTestImage(), itk::ConstNeighborhoodIterator< TSparseImageType >::IsAtEnd(), itk::Functor::Sigmoid< TInputImage::PixelType, TOutputImage::PixelType >::operator()(), itk::operator<<(), RegressionTestImage(), itk::fem::LoadLandmark::SetContainedElement(), itk::fem::ImageMetricLoad< TMoving, TFixed >::SetCurrentEnergy(), itk::fem::FEMRegistrationFilter< TMovingImage, TFixedImage, TFemObjectType >::SetElement(), itk::GPUPDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::SetEnergy(), itk::PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::SetEnergy(), itk::LevelSetFunction< TImageType >::SetEpsilonMagnitude(), itk::PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::SetGradientStep(), itk::GPUPDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::SetGradientStep(), itk::PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::SetNormalizeGradient(), and itk::GPUPDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField >::SetNormalizeGradient().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 57 of file itkMath.h.
Referenced by itk::DiscretePrincipalCurvaturesQuadEdgeMeshFilter< TInputMesh, TOutputMesh >::ComputeMeanAndGaussianCurvatures(), itk::DelaunayConformingQuadEdgeMeshFilter< TInputMesh, TOutputMesh >::Dyer07Criterion(), itk::DiscreteGaussianCurvatureQuadEdgeMeshFilter< TInputMesh, TOutputMesh >::EstimateCurvature(), itk::GaborKernelFunction< TRealValueType >::Evaluate(), itk::Statistics::MersenneTwisterRandomVariateGenerator::GetNormalVariate(), itk::PhasedArray3DSpecialCoordinatesImage< TPixel >::PhasedArray3DSpecialCoordinatesImage(), itk::WindowedSincInterpolateImageFunction< TInputImage, VRadius, TWindowFunction, TBoundaryCondition, TCoordRep >::Sinc(), and itk::STLMeshIO::WritePointsTyped().
|
static |
|
static |
|
static |
|
static |
|
static |