OpenMS
2.7.0
|
Provides access to bilinearly interpolated values (and derivatives) from discrete data points. Values beyond the given range of data points are implicitly taken as zero. More...
#include <OpenMS/MATH/MISC/BilinearInterpolation.h>
Public Member Functions | |
Interpolated data | |
ValueType | value (KeyType arg_pos_0, KeyType arg_pos_1) const |
Returns the interpolated value ("backward resampling") More... | |
void | addValue (KeyType arg_pos_0, KeyType arg_pos_1, ValueType arg_value) |
Performs bilinear resampling. The arg_value is split up and added to the data points around arg_pos. ("forward resampling") More... | |
Discrete (non-interpolated) data | |
ContainerType & | getData () |
Returns the internal random access container storing the data. More... | |
ContainerType const & | getData () const |
Returns the internal random access container storing the data. More... | |
template<typename SourceContainer > | |
void | setData (SourceContainer const &data) |
Assigns data to the internal random access container storing the data. More... | |
bool | empty () const |
Returns true if getData() is empty. More... | |
Typedefs | |
typedef Value | value_type |
typedef Key | key_type |
typedef Matrix< value_type > | container_type |
typedef value_type | ValueType |
typedef key_type | KeyType |
typedef container_type | ContainerType |
BilinearInterpolation () | |
Constructors and destructor. More... | |
BilinearInterpolation (BilinearInterpolation const &arg) | |
Copy constructor. More... | |
BilinearInterpolation & | operator= (BilinearInterpolation const &arg) |
Assignment operator. More... | |
~BilinearInterpolation () | |
Destructor. More... | |
Transformation | |
KeyType | scale_0_ |
Data members. More... | |
KeyType | offset_0_ |
KeyType | scale_1_ |
KeyType | offset_1_ |
KeyType | inside_0_ |
KeyType | outside_0_ |
KeyType | inside_1_ |
KeyType | outside_1_ |
ContainerType | data_ |
KeyType | key2index_0 (KeyType pos) const |
The transformation from "outside" to "inside" coordinates. More... | |
KeyType | index2key_0 (KeyType pos) const |
The transformation from "inside" to "outside" coordinates. More... | |
KeyType | key2index_1 (KeyType pos) const |
The transformation from "outside" to "inside" coordinates. More... | |
KeyType | index2key_1 (KeyType pos) const |
The transformation from "inside" to "outside" coordinates. More... | |
KeyType const & | getScale_0 () const |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". More... | |
KeyType const & | getScale_1 () const |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". More... | |
void | setScale_0 (KeyType const &scale) |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". More... | |
void | setScale_1 (KeyType const &scale) |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". More... | |
KeyType const & | getOffset_0 () const |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". More... | |
KeyType const & | getOffset_1 () const |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". More... | |
void | setOffset_0 (KeyType const &offset) |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". More... | |
void | setOffset_1 (KeyType const &offset) |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". More... | |
void | setMapping_0 (KeyType const &scale, KeyType const &inside_low, KeyType const &outside_low) |
Specifies the mapping from "outside" to "inside" coordinates by the following data: More... | |
void | setMapping_0 (KeyType const &inside_low, KeyType const &outside_low, KeyType const &inside_high, KeyType const &outside_high) |
Specifies the mapping from "outside" to "inside" coordinates by the following data: More... | |
void | setMapping_1 (KeyType const &scale, KeyType const &inside_low, KeyType const &outside_low) |
Specifies the mapping from "outside" to "inside" coordinates by the following data: More... | |
void | setMapping_1 (KeyType const &inside_low, KeyType const &outside_low, KeyType const &inside_high, KeyType const &outside_high) |
Specifies the mapping from "outside" to "inside" coordinates by the following data: More... | |
KeyType const & | getInsideReferencePoint_0 () const |
Accessor. See setMapping(). More... | |
KeyType const & | getInsideReferencePoint_1 () const |
Accessor. See setMapping(). More... | |
KeyType const & | getOutsideReferencePoint_0 () const |
Accessor. See setMapping(). More... | |
KeyType const & | getOutsideReferencePoint_1 () const |
Accessor. See setMapping(). More... | |
KeyType | supportMin_0 () const |
Lower boundary of the support, in "outside" coordinates. More... | |
KeyType | supportMin_1 () const |
Lower boundary of the support, in "outside" coordinates. More... | |
KeyType | supportMax_0 () const |
Upper boundary of the support, in "outside" coordinates. More... | |
KeyType | supportMax_1 () const |
Upper boundary of the support, in "outside" coordinates. More... | |
Provides access to bilinearly interpolated values (and derivatives) from discrete data points. Values beyond the given range of data points are implicitly taken as zero.
The input is just a vector of values ("Data"). These are interpreted as the y-coordinates at the x-coordinate positions 0,...,data_.size-1.
The interpolated data can also be scaled and shifted in the x-dimension by an affine mapping. That is, we have "inside" and "outside" x-coordinates. The affine mapping can be specified in two ways:
By default the identity mapping (scale=1, offset=0) is used.
Using the value() and derivative() methods you can sample bilinearly interpolated values for a given x-coordinate position of the data and the derivative of the data.
typedef Matrix<value_type> container_type |
typedef container_type ContainerType |
typedef Key key_type |
typedef Value value_type |
typedef value_type ValueType |
|
inline |
Constructors and destructor.
Default constructor
|
inline |
Copy constructor.
|
inline |
Destructor.
Performs bilinear resampling. The arg_value is split up and added to the data points around arg_pos. ("forward resampling")
References Matrix< Value >::cols(), BilinearInterpolation< Key, Value >::data_, BilinearInterpolation< Key, Value >::key2index_0(), BilinearInterpolation< Key, Value >::key2index_1(), and Matrix< Value >::rows().
|
inline |
Returns true
if getData() is empty.
References BilinearInterpolation< Key, Value >::data_.
Referenced by BilinearInterpolation< Key, Value >::supportMin_0(), and BilinearInterpolation< Key, Value >::supportMin_1().
|
inline |
Returns the internal random access container storing the data.
References BilinearInterpolation< Key, Value >::data_.
|
inline |
Returns the internal random access container storing the data.
References BilinearInterpolation< Key, Value >::data_.
|
inline |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::inside_0_.
|
inline |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::inside_1_.
|
inline |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
References BilinearInterpolation< Key, Value >::offset_0_.
|
inline |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
References BilinearInterpolation< Key, Value >::offset_1_.
|
inline |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::outside_0_.
|
inline |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::outside_1_.
|
inline |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
References BilinearInterpolation< Key, Value >::scale_0_.
|
inline |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
References BilinearInterpolation< Key, Value >::scale_1_.
The transformation from "inside" to "outside" coordinates.
References BilinearInterpolation< Key, Value >::offset_0_, and BilinearInterpolation< Key, Value >::scale_0_.
Referenced by BilinearInterpolation< Key, Value >::supportMax_0(), and BilinearInterpolation< Key, Value >::supportMin_0().
The transformation from "inside" to "outside" coordinates.
References BilinearInterpolation< Key, Value >::offset_1_, and BilinearInterpolation< Key, Value >::scale_1_.
Referenced by BilinearInterpolation< Key, Value >::supportMax_1(), and BilinearInterpolation< Key, Value >::supportMin_1().
The transformation from "outside" to "inside" coordinates.
References BilinearInterpolation< Key, Value >::offset_0_, and BilinearInterpolation< Key, Value >::scale_0_.
Referenced by BilinearInterpolation< Key, Value >::addValue(), and BilinearInterpolation< Key, Value >::value().
The transformation from "outside" to "inside" coordinates.
References BilinearInterpolation< Key, Value >::offset_1_, and BilinearInterpolation< Key, Value >::scale_1_.
Referenced by BilinearInterpolation< Key, Value >::addValue(), and BilinearInterpolation< Key, Value >::value().
|
inline |
Assignment operator.
References BilinearInterpolation< Key, Value >::data_, BilinearInterpolation< Key, Value >::inside_0_, BilinearInterpolation< Key, Value >::inside_1_, BilinearInterpolation< Key, Value >::offset_0_, BilinearInterpolation< Key, Value >::offset_1_, BilinearInterpolation< Key, Value >::outside_0_, BilinearInterpolation< Key, Value >::outside_1_, BilinearInterpolation< Key, Value >::scale_0_, and BilinearInterpolation< Key, Value >::scale_1_.
|
inline |
Assigns data to the internal random access container storing the data.
SourceContainer must be assignable to ContainerType.
References BilinearInterpolation< Key, Value >::data_.
|
inline |
Specifies the mapping from "outside" to "inside" coordinates by the following data:
inside_low
and outside_low
: these axis positions are mapped onto each other.inside_high
and outside_high
: these axis positions are mapped onto each other.This four argument version is just a convenience overload for the three argument version, which see.
References BilinearInterpolation< Key, Value >::setMapping_0().
|
inline |
Specifies the mapping from "outside" to "inside" coordinates by the following data:
scale
: the difference in outside coordinates between consecutive values in the data vector.inside
and outside
: these axis positions are mapped onto each other.For example, when you have a complicated probability distribution which is in fact centered around zero (but you cannot have negative indices in the data vector), then you can arrange things such that inside is the mean of the pre-computed, shifted density values of that distribution and outside is the centroid position of, say, a peak in the real world which you want to model by a scaled and shifted version of the probability distribution.
References BilinearInterpolation< Key, Value >::inside_0_, BilinearInterpolation< Key, Value >::offset_0_, BilinearInterpolation< Key, Value >::outside_0_, and BilinearInterpolation< Key, Value >::scale_0_.
Referenced by BilinearInterpolation< Key, Value >::setMapping_0().
|
inline |
Specifies the mapping from "outside" to "inside" coordinates by the following data:
inside_low
and outside_low
: these axis positions are mapped onto each other.inside_high
and outside_high
: these axis positions are mapped onto each other.This four argument version is just a convenience overload for the three argument version, which see.
References BilinearInterpolation< Key, Value >::setMapping_1().
|
inline |
Specifies the mapping from "outside" to "inside" coordinates by the following data:
scale
: the difference in outside coordinates between consecutive values in the data vector.inside
and outside
: these axis positions are mapped onto each other.For example, when you have a complicated probability distribution which is in fact centered around zero (but you cannot have negative indices in the data vector), then you can arrange things such that inside is the mean of the pre-computed, shifted density values of that distribution and outside is the centroid position of, say, a peak in the real world which you want to model by a scaled and shifted version of the probability distribution.
References BilinearInterpolation< Key, Value >::inside_1_, BilinearInterpolation< Key, Value >::offset_1_, BilinearInterpolation< Key, Value >::outside_1_, and BilinearInterpolation< Key, Value >::scale_1_.
Referenced by BilinearInterpolation< Key, Value >::setMapping_1().
|
inline |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
Note: Using this invalidates the inside and outside reference points.
References BilinearInterpolation< Key, Value >::offset_0_.
|
inline |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
Note: Using this invalidates the inside and outside reference points.
References BilinearInterpolation< Key, Value >::offset_1_.
|
inline |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Note: Using this invalidates the inside and outside reference points.
References BilinearInterpolation< Key, Value >::scale_0_.
|
inline |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Note: Using this invalidates the inside and outside reference points.
References BilinearInterpolation< Key, Value >::scale_1_.
|
inline |
Upper boundary of the support, in "outside" coordinates.
References BilinearInterpolation< Key, Value >::data_, BilinearInterpolation< Key, Value >::index2key_0(), and Matrix< Value >::rows().
|
inline |
Upper boundary of the support, in "outside" coordinates.
References Matrix< Value >::cols(), BilinearInterpolation< Key, Value >::data_, and BilinearInterpolation< Key, Value >::index2key_1().
|
inline |
Lower boundary of the support, in "outside" coordinates.
References BilinearInterpolation< Key, Value >::empty(), and BilinearInterpolation< Key, Value >::index2key_0().
|
inline |
Lower boundary of the support, in "outside" coordinates.
References BilinearInterpolation< Key, Value >::empty(), and BilinearInterpolation< Key, Value >::index2key_1().
Returns the interpolated value ("backward resampling")
References Matrix< Value >::cols(), BilinearInterpolation< Key, Value >::data_, BilinearInterpolation< Key, Value >::key2index_0(), BilinearInterpolation< Key, Value >::key2index_1(), and Matrix< Value >::rows().
|
protected |
Referenced by BilinearInterpolation< Key, Value >::addValue(), BilinearInterpolation< Key, Value >::empty(), BilinearInterpolation< Key, Value >::getData(), BilinearInterpolation< Key, Value >::operator=(), BilinearInterpolation< Key, Value >::setData(), BilinearInterpolation< Key, Value >::supportMax_0(), BilinearInterpolation< Key, Value >::supportMax_1(), and BilinearInterpolation< Key, Value >::value().
|
protected |
|
protected |
|
protected |
Referenced by BilinearInterpolation< Key, Value >::getOffset_0(), BilinearInterpolation< Key, Value >::index2key_0(), BilinearInterpolation< Key, Value >::key2index_0(), BilinearInterpolation< Key, Value >::operator=(), BilinearInterpolation< Key, Value >::setMapping_0(), and BilinearInterpolation< Key, Value >::setOffset_0().
|
protected |
Referenced by BilinearInterpolation< Key, Value >::getOffset_1(), BilinearInterpolation< Key, Value >::index2key_1(), BilinearInterpolation< Key, Value >::key2index_1(), BilinearInterpolation< Key, Value >::operator=(), BilinearInterpolation< Key, Value >::setMapping_1(), and BilinearInterpolation< Key, Value >::setOffset_1().
|
protected |
|
protected |
|
protected |
Data members.
Referenced by BilinearInterpolation< Key, Value >::getScale_0(), BilinearInterpolation< Key, Value >::index2key_0(), BilinearInterpolation< Key, Value >::key2index_0(), BilinearInterpolation< Key, Value >::operator=(), BilinearInterpolation< Key, Value >::setMapping_0(), and BilinearInterpolation< Key, Value >::setScale_0().
|
protected |
Referenced by BilinearInterpolation< Key, Value >::getScale_1(), BilinearInterpolation< Key, Value >::index2key_1(), BilinearInterpolation< Key, Value >::key2index_1(), BilinearInterpolation< Key, Value >::operator=(), BilinearInterpolation< Key, Value >::setMapping_1(), and BilinearInterpolation< Key, Value >::setScale_1().