|
open_iA 2023.02
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
|
#include "iAbase_export.h"#include <algorithm>#include <cassert>#include <cmath>#include <cstddef>#include <limits>#include <numeric>#include <vector>#include <QVector>Typedefs | |
| typedef std::vector< double > | FuncType |
Functions | |
| template<typename T > | |
| T | clamp (T const minVal, T const maxVal, T const value) |
| Make sure the given value is inside the given range. | |
| template<typename T > | |
| void | computeMinMax (T *minVal, T *maxVal, T const *val1, T const *val2, T const *size, int numVal) |
| for numVal entries in two arrays, compute component-wise minimum and maximum | |
| iAbase_API double | covariance (FuncType const &func1, FuncType const &func2, double mean1=std::numeric_limits< double >::infinity(), double mean2=std::numeric_limits< double >::infinity(), bool correctDF=true) |
| Compute covariance between two functions. | |
| template<typename OutContainerT = QVector<double>, typename ValueT = double, typename InContainerT > | |
| OutContainerT | createHistogram (const InContainerT &inData, typename OutContainerT::size_type binCount, ValueT &minValue, ValueT &maxValue, bool discrete=false) |
| compute histogram from given values | |
| template<typename RealType > | |
| bool | dblApproxEqual (RealType a, RealType b, RealType tolerance=std::numeric_limits< RealType >::epsilon()) |
| Checks whether two real values are equal, given a certain tolerance. | |
| iAbase_API FuncType | derivative (FuncType const &func) |
| Calculate first derivative of a given function. | |
| template<typename T > | |
| T | frac (T val) |
| Compute the fractional part of a floating-point type. | |
| iAbase_API double | gaussian (double x, double sigma) |
| Compute Gaussian function for the given value x and parameter sigma (mean = 0). | |
| iAbase_API FuncType | gaussianKernel (double kernelSigma, size_t kernelSteps) |
| Compute a gaussian kernel with the given sigma (mean = 0). | |
| iAbase_API FuncType | gaussianSmoothing (FuncType const &data, double kernelSigma, int kernelSteps) |
| Convolutes the given function with a Gaussian kernel with the given sigma and steps. | |
| iAbase_API FuncType | getNormedRanks (FuncType const &func) |
| Compute ranks for a given list of values. | |
| template<typename T > | |
| bool | inRange (T const *range, T const value) |
| Check whether a value is in a given range. | |
| template<typename T > | |
| T | invertValue (T const *range, T const value) |
| Invert value in a given range. | |
| template<typename T1 , typename T2 > | |
| bool | isApproxEqual (T1 a, T2 b, T1 tolerance=std::numeric_limits< T1 >::epsilon()) |
| comparison of two real type values - merge with above! | |
| template<typename T > | |
| T | linterp (const T a, const T b, const T t) |
| Linear interpolation in a given range. | |
| template<typename DstType > | |
| DstType | mapNormTo (DstType minDstVal, DstType maxDstVal, double norm) |
| Map value from "norm" range [0..1] to the given range. | |
| template<typename T > | |
| T | mapToNorm (const T *range, const T value) |
| Map values from a given range to the "normalized" range [0..1]. | |
| template<typename SrcType > | |
| double | mapToNorm (SrcType const minSrcVal, SrcType const maxSrcVal, SrcType const value) |
| Map value from given interval to "norm" interval [0..1]. | |
| template<typename SrcType > | |
| double | mapToNormNoClamp (SrcType const minSrcVal, SrcType const maxSrcVal, SrcType const value) |
| Map value from given interval to "norm" interval [0..1]. | |
| template<typename SrcType , typename DstType > | |
| DstType | mapValue (SrcType const *rangeSrc, DstType const *rangeDst, SrcType const value) |
| Map value from one range to another. | |
| template<typename SrcType , typename DstType > | |
| DstType | mapValue (SrcType minSrcVal, SrcType maxSrcVal, DstType minDstVal, DstType maxDstVal, SrcType value) |
| Map value from one range to another. | |
| iAbase_API double | mean (FuncType const &func) |
| Compute the mean of a function. | |
| iAbase_API double | pearsonsCorrelationCoefficient (FuncType const &func1, FuncType const &func2) |
| Calculate the Pearson's correlation coefficient between two functions. | |
| template<typename T > | |
| std::vector< size_t > | sort_indexes (const std::vector< T > &v) |
| iAbase_API double | spearmansCorrelationCoefficient (FuncType const &func1, FuncType const &func2) |
| Calculate the Spearman's correlation coefficient between two functions. | |
| iAbase_API double | standardDeviation (FuncType const &func, double meanVal=std::numeric_limits< double >::infinity(), bool correctDF=true) |
| Compute the standard deviation of a function. mean can be given (to improve speed). | |
| iAbase_API double | variance (FuncType const &func, double meanVal=std::numeric_limits< double >::infinity(), bool correctDF=true) |
| Compute the variation of a function. If known, mean can be given (to improve speed). | |
| typedef std::vector<double> FuncType |
| T clamp | ( | T const | minVal, |
| T const | maxVal, | ||
| T const | value | ||
| ) |
Make sure the given value is inside the given range.
| minVal | the minimum value which should be returned |
| maxVal | the maximum value which should be returned |
| value | the value to check |
| void computeMinMax | ( | T * | minVal, |
| T * | maxVal, | ||
| T const * | val1, | ||
| T const * | val2, | ||
| T const * | size, | ||
| int | numVal | ||
| ) |
for numVal entries in two arrays, compute component-wise minimum and maximum
| minVal | array with numVal entries, will hold the minimum value for each component in given val1/val2 array |
| maxVal | array with numVal entries, will hold the maximum value for each component in given val1/val2 array |
| val1 | array with numVal entries |
| val2 | array with numVal entries |
| size | |
| numVal | number of values in minVal, maxVal, val1, val2, and size |
| iAbase_API double covariance | ( | FuncType const & | func1, |
| FuncType const & | func2, | ||
| double | mean1 = std::numeric_limits< double >::infinity(), |
||
| double | mean2 = std::numeric_limits< double >::infinity(), |
||
| bool | correctDF = true |
||
| ) |
Compute covariance between two functions.
| OutContainerT createHistogram | ( | const InContainerT & | inData, |
| typename OutContainerT::size_type | binCount, | ||
| ValueT & | minValue, | ||
| ValueT & | maxValue, | ||
| bool | discrete = false |
||
| ) |
compute histogram from given values
| bool dblApproxEqual | ( | RealType | a, |
| RealType | b, | ||
| RealType | tolerance = std::numeric_limits<RealType>::epsilon() |
||
| ) |
Checks whether two real values are equal, given a certain tolerance.
inspired by great points about floating point equals at https://stackoverflow.com/a/41405501
Calculate first derivative of a given function.
| T frac | ( | T | val | ) |
Compute the fractional part of a floating-point type.
| iAbase_API double gaussian | ( | double | x, |
| double | sigma | ||
| ) |
Compute Gaussian function for the given value x and parameter sigma (mean = 0).
| iAbase_API FuncType gaussianKernel | ( | double | kernelSigma, |
| size_t | kernelSteps | ||
| ) |
Compute a gaussian kernel with the given sigma (mean = 0).
| iAbase_API FuncType gaussianSmoothing | ( | FuncType const & | data, |
| double | kernelSigma, | ||
| int | kernelSteps | ||
| ) |
Convolutes the given function with a Gaussian kernel with the given sigma and steps.
TODO: number of steps could be calculated from sigma (cut off kernel when factor gets very small)
Compute ranks for a given list of values.
| bool inRange | ( | T const * | range, |
| T const | value | ||
| ) |
Check whether a value is in a given range.
| range | the range given as minimum (stored at index 0) and maximum (stored at index 1) |
| value | the value to be checked. return true if value in range (bounds included, i.e. returns true if equal to minimum or maximum), false otherwise |
| T invertValue | ( | T const * | range, |
| T const | value | ||
| ) |
Invert value in a given range.
Example: invertValue(range=[0, 1], value=0.2) = 0.8; invertValue(range=[1,2], value=1.3) = 1.7
| range | an array of size 2 with minimum and maximum value of the range |
| value | the value to be inverted. |
| bool isApproxEqual | ( | T1 | a, |
| T2 | b, | ||
| T1 | tolerance = std::numeric_limits<T1>::epsilon() |
||
| ) |
comparison of two real type values - merge with above!
| T linterp | ( | const T | a, |
| const T | b, | ||
| const T | t | ||
| ) |
Linear interpolation in a given range.
| a | minimum of the interpolation range |
| b | maximum of the interpolation range |
| t | a value from the range [0..1] specifying the interpolation position |
| DstType mapNormTo | ( | DstType | minDstVal, |
| DstType | maxDstVal, | ||
| double | norm | ||
| ) |
Map value from "norm" range [0..1] to the given range.
| minDstVal | minimum value of destination range |
| maxDstVal | maximum value of destination range |
| norm | a value in range [0..1] |
|
inline |
Map values from a given range to the "normalized" range [0..1].
if min is bigger than max, a reverse mapping is applied
| range | an array of size 2 with minimum and maximum value of the source range |
| value | the value to be mapped from the source range to the destination range |
| double mapToNorm | ( | SrcType const | minSrcVal, |
| SrcType const | maxSrcVal, | ||
| SrcType const | value | ||
| ) |
Map value from given interval to "norm" interval [0..1].
if min is bigger than max, a reverse mapping is applied
| minSrcVal | minimum value of source interval |
| maxSrcVal | maximum value of source interval |
| value | a value in source interval |
| double mapToNormNoClamp | ( | SrcType const | minSrcVal, |
| SrcType const | maxSrcVal, | ||
| SrcType const | value | ||
| ) |
Map value from given interval to "norm" interval [0..1].
if min is bigger than max, a reverse mapping is applied
| minSrcVal | minimum value of source interval |
| maxSrcVal | maximum value of source interval |
| value | a value in source interval |
|
inline |
Map value from one range to another.
| rangeSrc | an array of size 2 with minimum and maximum value of the source range |
| rangeDst | an array of size 2 with minimum and maximum value of the destination range |
| value | the value to be mapped from the source range to the destination range |
| DstType mapValue | ( | SrcType | minSrcVal, |
| SrcType | maxSrcVal, | ||
| DstType | minDstVal, | ||
| DstType | maxDstVal, | ||
| SrcType | value | ||
| ) |
Map value from one range to another.
| minSrcVal | minimum value of source range |
| maxSrcVal | maximum value of source range |
| minDstVal | minimum value of destination range |
| maxDstVal | maximum value of destination range |
| value | the value to be mapped from the source range to the destination range |
| iAbase_API double mean | ( | FuncType const & | func | ) |
Compute the mean of a function.
Calculate the Pearson's correlation coefficient between two functions.
| std::vector< size_t > sort_indexes | ( | const std::vector< T > & | v | ) |
| iAbase_API double spearmansCorrelationCoefficient | ( | FuncType const & | func1, |
| FuncType const & | func2 | ||
| ) |
Calculate the Spearman's correlation coefficient between two functions.
| iAbase_API double standardDeviation | ( | FuncType const & | func, |
| double | meanVal = std::numeric_limits< double >::infinity(), |
||
| bool | correctDF = true |
||
| ) |
Compute the standard deviation of a function. mean can be given (to improve speed).
| iAbase_API double variance | ( | FuncType const & | func, |
| double | meanVal = std::numeric_limits< double >::infinity(), |
||
| bool | correctDF = true |
||
| ) |
Compute the variation of a function. If known, mean can be given (to improve speed).