45 template <
typename Key =
double,
typename Value = Key>
155 return data_(0, 0) * (1. + pos_0) * (1. + pos_1);
160 if (lower_1 >= size_1 - 1)
162 if (lower_1 != size_1 - 1)
168 return data_(0, lower_1) * (1. + pos_0) * (size_1 - pos_1);
176 data_(0, lower_1 + 1) * factor_1 +
177 data_(0, lower_1) * factor_1_complement
183 if (lower_0 >= size_0 - 1)
185 if (lower_0 != size_0 - 1)
199 return data_(lower_0, 0) * (size_0 - pos_0) * (1. + pos_1);
204 if (lower_1 >= size_1 - 1)
206 if (lower_1 != size_1 - 1)
212 return data_(lower_0, lower_1) * (size_0 - pos_0) * (size_1 - pos_1);
220 data_(lower_0, lower_1 + 1) * factor_1 +
221 data_(lower_0, lower_1) * factor_1_complement
242 data_(lower_0 + 1, 0) * factor_0
244 data_(lower_0, 0) * factor_0_complement
251 if (lower_1 >= size_1 - 1)
253 if (lower_1 != size_1 - 1)
260 data_(lower_0 + 1, lower_1) * factor_0
262 data_(lower_0, lower_1) * factor_0_complement
272 data_(lower_0 + 1, lower_1 + 1) * factor_0
274 data_(lower_0, lower_1 + 1) * factor_0_complement
279 data_(lower_0 + 1, lower_1) * factor_0
281 data_(lower_0, lower_1) * factor_0_complement
283 * factor_1_complement;
293 typedef typename std::ptrdiff_t DiffType;
298 KeyType const frac_0 = std::modf(pos_0, &lower_0_key);
299 DiffType
const lower_0 = DiffType(lower_0_key);
312 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
313 DiffType
const lower_1 = DiffType(lower_1_key);
324 data_(0, 0) += arg_value * (1 + frac_0) * (1 + frac_1);
330 DiffType
const back_1 =
data_.cols() - 1;
332 if (lower_1 >= back_1)
334 if (lower_1 != back_1)
340 data_(0, lower_1) += arg_value * (1 + frac_0) * (1 - frac_1);
348 data_(0, lower_1 + 1) += tmp_prod * frac_1;
349 data_(0, lower_1) += tmp_prod * (1. - frac_1);
357 DiffType
const back_0 =
data_.rows() - 1;
358 if (lower_0 >= back_0)
360 if (lower_0 != back_0)
372 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
373 DiffType
const lower_1 = DiffType(lower_1_key);
384 data_(lower_0, 0) += tmp_prod * (1 + frac_1);
390 DiffType
const back_1 =
data_.cols() - 1;
392 if (lower_1 >= back_1)
394 if (lower_1 != back_1)
400 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
407 data_(lower_0, lower_1 + 1) += tmp_prod * frac_1;
408 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
422 KeyType const frac_1 = std::modf(pos_1, &lower_1_key);
423 DiffType
const lower_1 = DiffType(lower_1_key);
435 data_(lower_0 + 1, 0) += tmp_prod * frac_0;
436 data_(lower_0, 0) += tmp_prod * (1 - frac_0);
442 DiffType
const back_1 =
data_.cols() - 1;
444 if (lower_1 >= back_1)
446 if (lower_1 != back_1)
453 data_(lower_0 + 1, lower_1) += tmp_prod * frac_0;
454 data_(lower_0, lower_1) += tmp_prod * (1 - frac_0);
464 data_(lower_0 + 1, lower_1 + 1) += tmp_prod * frac_1;
465 data_(lower_0 + 1, lower_1) += tmp_prod * (1 - frac_1);
466 tmp_prod =
KeyType(arg_value * (1 - frac_0));
467 data_(lower_0, lower_1 + 1) += tmp_prod * frac_1;
468 data_(lower_0, lower_1) += tmp_prod * (1 - frac_1);
500 template <
typename SourceContainer>
649 offset_0_ = outside_low - scale * inside_low;
662 if (inside_high != inside_low)
664 setMapping_0((outside_high - outside_low) / (inside_high - inside_low),
665 inside_low, outside_low);
692 offset_1_ = outside_low - scale * inside_low;
705 if (inside_high != inside_low)
707 setMapping_1((outside_high - outside_low) / (inside_high - inside_low),
708 inside_low, outside_low);
Provides access to bilinearly interpolated values (and derivatives) from discrete data points....
Definition: BilinearInterpolation.h:47
KeyType const & getOffset_1() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition: BilinearInterpolation.h:604
ContainerType const & getData() const
Returns the internal random access container storing the data.
Definition: BilinearInterpolation.h:490
Value value_type
Definition: BilinearInterpolation.h:53
KeyType supportMin_1() const
Lower boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:748
ValueType value(KeyType arg_pos_0, KeyType arg_pos_1) const
Returns the interpolated value ("backward resampling")
Definition: BilinearInterpolation.h:125
KeyType const & getOffset_0() const
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition: BilinearInterpolation.h:598
Key key_type
Definition: BilinearInterpolation.h:55
Matrix< value_type > container_type
Definition: BilinearInterpolation.h:56
ContainerType data_
Definition: BilinearInterpolation.h:779
container_type ContainerType
Definition: BilinearInterpolation.h:60
void setData(SourceContainer const &data)
Assigns data to the internal random access container storing the data.
Definition: BilinearInterpolation.h:501
KeyType outside_0_
Definition: BilinearInterpolation.h:776
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:
Definition: BilinearInterpolation.h:702
KeyType supportMax_1() const
Upper boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:760
BilinearInterpolation & operator=(BilinearInterpolation const &arg)
Assignment operator.
Definition: BilinearInterpolation.h:96
KeyType inside_1_
Definition: BilinearInterpolation.h:777
BilinearInterpolation(BilinearInterpolation const &arg)
Copy constructor.
Definition: BilinearInterpolation.h:83
KeyType const & getScale_1() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition: BilinearInterpolation.h:572
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:
Definition: BilinearInterpolation.h:687
bool empty() const
Returns true if getData() is empty.
Definition: BilinearInterpolation.h:507
KeyType supportMax_0() const
Upper boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:754
KeyType const & getOutsideReferencePoint_1() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:736
void setOffset_1(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition: BilinearInterpolation.h:626
KeyType const & getOutsideReferencePoint_0() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:730
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:
Definition: BilinearInterpolation.h:644
KeyType const & getInsideReferencePoint_1() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:724
value_type ValueType
Definition: BilinearInterpolation.h:58
KeyType scale_1_
Definition: BilinearInterpolation.h:773
BilinearInterpolation()
Constructors and destructor.
Definition: BilinearInterpolation.h:70
KeyType const & getInsideReferencePoint_0() const
Accessor. See setMapping().
Definition: BilinearInterpolation.h:718
KeyType index2key_0(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition: BilinearInterpolation.h:535
KeyType offset_0_
Definition: BilinearInterpolation.h:772
KeyType scale_0_
Data members.
Definition: BilinearInterpolation.h:771
KeyType inside_0_
Definition: BilinearInterpolation.h:775
ContainerType & getData()
Returns the internal random access container storing the data.
Definition: BilinearInterpolation.h:484
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:
Definition: BilinearInterpolation.h:659
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....
Definition: BilinearInterpolation.h:290
key_type KeyType
Definition: BilinearInterpolation.h:59
KeyType offset_1_
Definition: BilinearInterpolation.h:774
~BilinearInterpolation()
Destructor.
Definition: BilinearInterpolation.h:114
KeyType outside_1_
Definition: BilinearInterpolation.h:778
void setScale_1(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition: BilinearInterpolation.h:592
KeyType key2index_1(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition: BilinearInterpolation.h:543
void setOffset_0(KeyType const &offset)
Accessor. "Offset" is the point (in "outside" units) which corresponds to "Data(0,...
Definition: BilinearInterpolation.h:615
KeyType index2key_1(KeyType pos) const
The transformation from "inside" to "outside" coordinates.
Definition: BilinearInterpolation.h:558
KeyType const & getScale_0() const
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition: BilinearInterpolation.h:566
KeyType supportMin_0() const
Lower boundary of the support, in "outside" coordinates.
Definition: BilinearInterpolation.h:742
KeyType key2index_0(KeyType pos) const
The transformation from "outside" to "inside" coordinates.
Definition: BilinearInterpolation.h:520
void setScale_0(KeyType const &scale)
Accessor. "Scale" is the difference (in "outside" units) between consecutive entries in "Data".
Definition: BilinearInterpolation.h:582
A class representing a thin wrapper around an Eigen matrix.
Definition: Matrix.h:32
const EigenMatrixType & getEigenMatrix() const
Get a const reference to the underlying Eigen matrix.
Definition: Matrix.h:180
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:104
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19