Profile

Description

Profile is a discrete approximation of a continuous real function, or may represent output of a measurement. FabImage Library contains a rich set of ready to use profile manipulating functions, therefore it should be preferred to use instead of plain old real numbers' arrays or std::vector.

Each profile has an offset and a scale. These values determine what actual X coordinate is represented by each index of the profiles value array. It is worth mentioning that the scale of a profile has to be a positive number as a scale less then or equal to zero is not supported (An attempt to set the scale to an incorrect value will result in an error). Additionally, infinite/NaN values in the offset and scale (and also in one of the Y values) can cause filters to compute incorrect results and thus such values should be used with caution.

class Profile : public XTransform, public Array< float >
{
public:
    Profile();
    Profile(float xOffset_, float xScale_);
    Profile(float xOffset_, float xScale_, const Array<float>& values_);
    Profile(float xOffset_, float xScale_, void* data_, int count, bool own);
    Profile(float xOffset_, float xScale_, void* data_, int count);
    Profile(float xOffset_, float xScale_, int count, float value);
    Profile(int count, float value);

    void Reset(float xOffset_, float xScale_, int newSize = 0, float value = 0.0f);
    void Reset(int newSize = 0, float value = 0.0f);
    void Reset(float xOffset_, float xScale_, const void* data_, int count);
    void Reset(float xOffset_, float xScale_, void* data_, int count, bool own);

    float		XOffset() const;
    float		XScale() const;
    float		X(const int index) const;
    float		X(const float index) const;
    float&		Y(const int index);
    const float&	Y(const int index) const;

    int			Size() const;
    void		Reserve(int newCapacity);
    void		Resize(int newSize);
    void		Resize(int newSize, float value); 
    float*		Begin();
    float*		End();
    const float*	Begin();
    const float*	End()	const;

    void SetXOffset(float xOffset_);
    void SetXScale(float xScale_);
    void SetXTransform(float xOffset_, float xScale_);
    void SetXTransform(const XTransform& xTransform);
    void ResetDomain(const Profile& rhs);
};