STIRA  0.1
Public Member Functions | List of all members
stira::common::FitCurve Class Reference

class to fit a parametric function to a set of data points For the moment, only linear, quadratic, exponential and polynomial fit are available The polynomial fit uses OpenCV's matrix operations More...

#include <FitCurve.h>

Public Member Functions

 FitCurve (std::vector< Point< int > > inputPoints)
 constructor More...
 
 FitCurve (std::vector< Point< double > > inputPoints)
 constructor More...
 
void SetPoints (std::vector< Point< double > > inputPoints)
 sets the input data points (coordinates in double precision float format ) More...
 
void SetPoints (std::vector< Point< int > > inputPoints)
 sets the input data points (coordinates in integer format ) More...
 
std::vector< double > FitLinear ()
 fits a straight line to a set of 2D points (x, y = a * x + b) Source: http://mathworld.wolfram.com/LeastSquaresFitting.html More...
 
std::vector< double > FitQuadratic ()
 fits a straight line to a set of 2D points (x, y = a * x^2 + b * x + c) Source: http://mathforum.org/library/drmath/view/72047.html More...
 
std::vector< double > FitExponential ()
 fits an exponential to a set of 2D points ( x, y = a * exp( b * x ) ) Source http://mathworld.wolfram.com/LeastSquaresFittingExponential.html More...
 
std::vector< double > GetAllAbsoluteErrors ()
 Gets a vector with all errors (in absolute value between the data points and the modeled points.
 
double GetMeanAbsoluteError ()
 Gets a vector with the average absolute error.
 
std::vector< double > PolynomialFit (int polynomialDegree)
 Fitting of a general polynomial of a given degree n to a set of 2D points (x, y = a * x^n + b * x^(n-1) + ... ) Math of the least square fitting: http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html Documentation of the used cv::Mat object: see http://opencv.willowgarage.com/documentation/cpp/basic_structures.html. More...
 
std::vector< double > GaussianFitLeastSquares ()
 Fitting of a guassian profile to a set of 2D points (x, y = G(x) ) Reference: http://terpconnect.umd.edu/~toh/spectrum/CurveFitting.html. More...
 
bool WriteToDisk (std::string fileName)
 writes source data points and points from the fitted model to disk More...
 

Detailed Description

class to fit a parametric function to a set of data points For the moment, only linear, quadratic, exponential and polynomial fit are available The polynomial fit uses OpenCV's matrix operations

Constructor & Destructor Documentation

stira::common::FitCurve::FitCurve ( std::vector< Point< int > >  inputPoints)

constructor

Parameters
inputPointsthe points to which the data model has to be fitted
stira::common::FitCurve::FitCurve ( std::vector< Point< double > >  inputPoints)

constructor

Parameters
inputPointsthe points to which the data model has to be fitted

Member Function Documentation

vector< double > stira::common::FitCurve::FitExponential ( )

fits an exponential to a set of 2D points ( x, y = a * exp( b * x ) ) Source http://mathworld.wolfram.com/LeastSquaresFittingExponential.html

Returns
vector with output parameters ( a, b )
vector< double > stira::common::FitCurve::FitLinear ( )

fits a straight line to a set of 2D points (x, y = a * x + b) Source: http://mathworld.wolfram.com/LeastSquaresFitting.html

Returns
vector with output parameters ( a, b )

Referenced by stira::common::QuantileNormalDistribution::AnalyseNormalizedHistogram().

vector< double > stira::common::FitCurve::FitQuadratic ( )

fits a straight line to a set of 2D points (x, y = a * x^2 + b * x + c) Source: http://mathforum.org/library/drmath/view/72047.html

Returns
vector with output parameters ( a, b, c )
vector< double > stira::common::FitCurve::GaussianFitLeastSquares ( )

Fitting of a guassian profile to a set of 2D points (x, y = G(x) ) Reference: http://terpconnect.umd.edu/~toh/spectrum/CurveFitting.html.

Returns
vector with in the following order ( peakHeight, peakPosition, sigma)
vector< double > stira::common::FitCurve::PolynomialFit ( int  polynomialDegree)

Fitting of a general polynomial of a given degree n to a set of 2D points (x, y = a * x^n + b * x^(n-1) + ... ) Math of the least square fitting: http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html Documentation of the used cv::Mat object: see http://opencv.willowgarage.com/documentation/cpp/basic_structures.html.

Parameters
polynomialDegreethe degree of the polynomial
Returns
vector with output parameters ( a, b, ... )
void stira::common::FitCurve::SetPoints ( std::vector< Point< double > >  inputPoints)

sets the input data points (coordinates in double precision float format )

Parameters
inputPointsthe input data points
void stira::common::FitCurve::SetPoints ( std::vector< Point< int > >  inputPoints)

sets the input data points (coordinates in integer format )

Parameters
inputPointsthe input data points
bool stira::common::FitCurve::WriteToDisk ( std::string  fileName)

writes source data points and points from the fitted model to disk

Parameters
fileNamename of file to write to

The documentation for this class was generated from the following files: