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 Types | |
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 |
Public Member Functions | |
| BilinearInterpolation () | |
| Constructors and destructor. | |
| BilinearInterpolation (BilinearInterpolation const &arg) | |
| Copy constructor. | |
| BilinearInterpolation & | operator= (BilinearInterpolation const &arg) |
| Assignment operator. | |
| ~BilinearInterpolation () | |
| Destructor. | |
Interpolated data | |
| ValueType | value (KeyType arg_pos_0, KeyType arg_pos_1) const |
| Returns the interpolated value ("backward resampling"). | |
| 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"). | |
Discrete (non-interpolated) data | |
| ContainerType & | getData () |
| Returns the internal random access container storing the data. | |
| ContainerType const & | getData () const |
| Returns the internal random access container storing the data. | |
| template<typename SourceContainer > | |
| void | setData (SourceContainer const &data) |
| Assigns data to the internal random access container storing the data. | |
| bool | empty () const |
Returns true if getData() is empty. | |
Transformation | |
| KeyType | key2index_0 (KeyType pos) const |
| The transformation from "outside" to "inside" coordinates. | |
| KeyType | index2key_0 (KeyType pos) const |
| The transformation from "inside" to "outside" coordinates. | |
| KeyType | key2index_1 (KeyType pos) const |
| The transformation from "outside" to "inside" coordinates. | |
| KeyType | index2key_1 (KeyType pos) const |
| The transformation from "inside" to "outside" coordinates. | |
| KeyType const & | getScale_0 () const |
| Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". | |
| KeyType const & | getScale_1 () const |
| Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". | |
| void | setScale_0 (KeyType const &scale) |
| Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". | |
| void | setScale_1 (KeyType const &scale) |
| Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data". | |
| KeyType const & | getOffset_0 () const |
| Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". | |
| KeyType const & | getOffset_1 () const |
| Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". | |
| void | setOffset_0 (KeyType const &offset) |
| Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". | |
| void | setOffset_1 (KeyType const &offset) |
| Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)". | |
| 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:
| |
| 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:
| |
| 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:
| |
| 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:
| |
| KeyType const & | getInsideReferencePoint_0 () const |
| Accessor. See setMapping(). | |
| KeyType const & | getInsideReferencePoint_1 () const |
| Accessor. See setMapping(). | |
| KeyType const & | getOutsideReferencePoint_0 () const |
| Accessor. See setMapping(). | |
| KeyType const & | getOutsideReferencePoint_1 () const |
| Accessor. See setMapping(). | |
| KeyType | supportMin_0 () const |
| Lower boundary of the support, in "outside" coordinates. | |
| KeyType | supportMin_1 () const |
| Lower boundary of the support, in "outside" coordinates. | |
| KeyType | supportMax_0 () const |
| Upper boundary of the support, in "outside" coordinates. | |
| KeyType | supportMax_1 () const |
| Upper boundary of the support, in "outside" coordinates. | |
Protected Attributes | |
| KeyType | scale_0_ |
| Data members. | |
| KeyType | offset_0_ |
| KeyType | scale_1_ |
| KeyType | offset_1_ |
| KeyType | inside_0_ |
| KeyType | outside_0_ |
| KeyType | inside_1_ |
| KeyType | outside_1_ |
| ContainerType | data_ |
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 |
| BilinearInterpolation | ( | ) | [inline] |
Constructors and destructor.
Default constructor
| BilinearInterpolation | ( | BilinearInterpolation< Key, Value > const & | arg | ) | [inline] |
Copy constructor.
| ~BilinearInterpolation | ( | ) | [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().
| bool empty | ( | ) | const [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().
| ContainerType& getData | ( | ) | [inline] |
Returns the internal random access container storing the data.
References BilinearInterpolation< Key, Value >::data_.
| ContainerType const& getData | ( | ) | const [inline] |
Returns the internal random access container storing the data.
References BilinearInterpolation< Key, Value >::data_.
| KeyType const& getInsideReferencePoint_0 | ( | ) | const [inline] |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::inside_0_.
| KeyType const& getInsideReferencePoint_1 | ( | ) | const [inline] |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::inside_1_.
| KeyType const& getOffset_0 | ( | ) | const [inline] |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
References BilinearInterpolation< Key, Value >::offset_0_.
| KeyType const& getOffset_1 | ( | ) | const [inline] |
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,0)".
References BilinearInterpolation< Key, Value >::offset_1_.
| KeyType const& getOutsideReferencePoint_0 | ( | ) | const [inline] |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::outside_0_.
| KeyType const& getOutsideReferencePoint_1 | ( | ) | const [inline] |
Accessor. See setMapping().
References BilinearInterpolation< Key, Value >::outside_1_.
| KeyType const& getScale_0 | ( | ) | const [inline] |
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
References BilinearInterpolation< Key, Value >::scale_0_.
| KeyType const& getScale_1 | ( | ) | const [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().
| BilinearInterpolation& operator= | ( | BilinearInterpolation< Key, Value > const & | arg | ) | [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_.
| void setData | ( | SourceContainer const & | data | ) | [inline] |
Assigns data to the internal random access container storing the data.
SourceContainer must be assignable to ContainerType.
References BilinearInterpolation< Key, Value >::data_.
| void setMapping_0 | ( | KeyType const & | scale, | |
| KeyType const & | inside_low, | |||
| KeyType const & | outside_low | |||
| ) | [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().
| void setMapping_0 | ( | KeyType const & | inside_low, | |
| KeyType const & | outside_low, | |||
| KeyType const & | inside_high, | |||
| KeyType const & | outside_high | |||
| ) | [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().
| void setMapping_1 | ( | KeyType const & | scale, | |
| KeyType const & | inside_low, | |||
| KeyType const & | outside_low | |||
| ) | [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().
| void setMapping_1 | ( | KeyType const & | inside_low, | |
| KeyType const & | outside_low, | |||
| KeyType const & | inside_high, | |||
| KeyType const & | outside_high | |||
| ) | [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().
| void setOffset_0 | ( | KeyType const & | offset | ) | [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_.
| void setOffset_1 | ( | KeyType const & | offset | ) | [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_.
| void setScale_0 | ( | KeyType const & | scale | ) | [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_.
| void setScale_1 | ( | KeyType const & | scale | ) | [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_.
| KeyType supportMax_0 | ( | ) | const [inline] |
Upper boundary of the support, in "outside" coordinates.
References BilinearInterpolation< Key, Value >::data_, BilinearInterpolation< Key, Value >::index2key_0(), and Matrix< Value >::rows().
| KeyType supportMax_1 | ( | ) | const [inline] |
Upper boundary of the support, in "outside" coordinates.
References Matrix< Value >::cols(), BilinearInterpolation< Key, Value >::data_, and BilinearInterpolation< Key, Value >::index2key_1().
| KeyType supportMin_0 | ( | ) | const [inline] |
Lower boundary of the support, in "outside" coordinates.
References BilinearInterpolation< Key, Value >::empty(), and BilinearInterpolation< Key, Value >::index2key_0().
| KeyType supportMin_1 | ( | ) | const [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().
ContainerType data_ [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().
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().
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().
KeyType outside_0_ [protected] |
KeyType outside_1_ [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().
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().
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:43:00 using doxygen 1.7.1 |