OpenMS
|
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra. More...
#include <OpenMS/KERNEL/RangeManager.h>
Public Types | |
using | ThisRangeType = RangeManager< RangeBases... > |
Public Member Functions | |
bool | operator== (const RangeManager &rhs) const |
bool | operator!= (const RangeManager &rhs) const |
template<typename... RangeBasesOther> | |
bool | assignUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
auto & | assign (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
bool | extendUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
void | extend (const RangeManager< RangeBasesOther... > &rhs) |
void | scaleBy (const double factor) |
calls RangeBase::scale() for each dimension More... | |
void | minSpanIfSingular (const double min_span) |
If any dimension is a single point, e.g. min==max, then extend this dimension by min_span / 2 on either side. More... | |
template<typename... RangeBasesOther> | |
bool | pushIntoUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
void | pushInto (const RangeManager< RangeBasesOther... > &sandbox) |
template<typename... RangeBasesOther> | |
bool | clampToUnsafe (const RangeManager< RangeBasesOther... > &rhs) |
template<typename... RangeBasesOther> | |
void | clampTo (const RangeManager< RangeBasesOther... > &rhs) |
const RangeBase & | getRangeForDim (MSDim dim) const |
obtain a range dimension at runtime using dim More... | |
RangeBase & | getRangeForDim (MSDim dim) |
obtain a range dimension at runtime using dim More... | |
HasRangeType | hasRange () const |
is any/some/all dimension in this range populated? More... | |
template<typename... RangeBasesOther> | |
bool | containsAll (const RangeManager< RangeBasesOther... > &rhs) const |
void | clearRanges () |
Resets all ranges. More... | |
ThisRangeType & | clear (const DIM_UNIT range) |
void | printRange (std::ostream &out) const |
print each dimension (base classes) to a stream More... | |
Protected Member Functions | |
template<typename Visitor > | |
void | for_each_base_ (Visitor &&visitor) |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one More... | |
template<typename Visitor > | |
void | for_each_base_ (Visitor &&visitor) const |
.. and a const version More... | |
Static Protected Member Functions | |
template<typename Visitor > | |
static void | static_for_each_base_ (Visitor &&visitor) |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one (for static members) More... | |
Handles the management of a multidimensional range, e.g. RangeMZ and RangeIntensity for spectra.
Instantiate it with the dimensions which are supported/required, e.g. RangeManager<RangeRT, RangeMZ> range_spec
for a spectrum and use the strongly typed features, such as range_spec.getMaxRT()/setMaxRT(500.0)
or range_spec.extend(RangeMZ{100, 1500})
.
Use RangeManagerContainer as a base class for all peak and feature containers like MSSpectrum, MSExperiment and FeatureMap.
The implementation uses non-virtual multiple inheritance using variadic templates. Each dimension, e.g. RangeRT, is inherited from, thus all members of the base class become accessible in the RangeManager, e.g. getMaxRT(). Operations (e.g. assignment, or extension of ranges) across RangeManagers with a different, yet overlapping set of base classes is enabled using fold expressions and constexpr evaluations, which are resolved at compile time (see for_each_base_ member function).
using ThisRangeType = RangeManager<RangeBases...> |
|
inline |
copy all overlapping dimensions from rhs
to this instance. Dimensions which are not contained in rhs
are left untouched.
rhs | Range to copy from |
Exception::InvalidRange | if no dimensions overlapped |
References RangeManager< RangeBases >::assignUnsafe().
Referenced by LayerDataChrom::getRange(), LayerDataConsensus::getRange(), LayerDataFeature::getRange(), LayerDataIonMobility::getRange(), LayerDataPeak::getRange(), LayerData1DChrom::getRange1D(), LayerData1DIonMobility::getRange1D(), LayerData1DPeak::getRange1D(), LayerData1DChrom::getRangeForArea(), LayerData1DIonMobility::getRangeForArea(), LayerData1DPeak::getRangeForArea(), and DimMapper< N_DIM >::mapRange().
|
inline |
copy all overlapping dimensions from rhs
to this instance. Dimensions which are not contained in rhs
are left untouched.
rhs | Range to copy from |
References RangeManager< RangeBases >::for_each_base_().
Referenced by RangeManager< RangeBases >::assign().
|
inline |
Clamp min/max of all overlapping dimensions to min/max of rhs
. This may tighten the range (even to a single point). Dimensions which are not contained in rhs
or where rhs is empty are left untouched.
rhs | Range to clamp to |
Exception::InvalidRange | if no dimensions overlapped |
References RangeManager< RangeBases >::clampToUnsafe().
Referenced by RangeManager< RangeBases >::clampToUnsafe().
|
inline |
Clamp min/max of all overlapping dimensions to min/max of rhs
Dimensions which are not contained in rhs
or where rhs is empty are left untouched.
rhs | Range to clamp to |
References RangeManager< RangeBases >::clampTo(), and RangeManager< RangeBases >::for_each_base_().
Referenced by RangeManager< RangeBases >::clampTo().
|
inline |
Resets the dimension of the given range
. Any type of ion mobility in range
will clear the RTMobility dimension. If the range
is not contained in this class, then nothing happens.
References RangeBase::clear(), OpenMS::FAIMS_CV, OpenMS::IM_MS, OpenMS::IM_VSSC, OpenMS::INT, OpenMS::MZ, and OpenMS::RT.
|
inline |
Resets all ranges.
References RangeManager< RangeBases >::for_each_base_().
Referenced by Plot1DCanvas::recalculateRanges_().
|
inline |
Are all dimensions of rhs
(which overlap with this Range) contained in this range? An empty dimension is considered contained in the other dimension (even if that one is empty as well). If only all overlapping dimensions are empty, true is returned.
Exception::InvalidRange | if no dimensions overlap |
References RangeManager< RangeBases >::for_each_base_().
|
inline |
extend all dimensions which overlap with rhs
to contain the range of rhs
Dimensions which are not contained in rhs
are left untouched.
rhs | Range to extend from |
Exception::InvalidRange | if no dimensions overlapped |
References RangeManager< RangeBases >::extendUnsafe().
Referenced by Plot1DCanvas::recalculateRanges_().
|
inline |
extend all dimensions which overlap with rhs
to contain the range of rhs
Dimensions which are not contained in rhs
are left untouched.
rhs | Range to extend from |
References RangeManager< RangeBases >::for_each_base_().
Referenced by RangeManager< RangeBases >::extend().
|
inlineprotected |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one
Referenced by RangeManager< RangeBases >::assignUnsafe(), RangeManager< RangeBases >::clampToUnsafe(), RangeManager< RangeBases >::clearRanges(), RangeManager< RangeBases >::containsAll(), RangeManager< RangeBases >::extendUnsafe(), RangeManager< RangeBases >::hasRange(), RangeManager< RangeBases >::minSpanIfSingular(), RangeManager< RangeBases >::operator==(), RangeManager< RangeBases >::printRange(), RangeManager< RangeBases >::pushIntoUnsafe(), and RangeManager< RangeBases >::scaleBy().
|
inlineprotected |
.. and a const version
obtain a range dimension at runtime using dim
References RangeManager< RangeBases >::static_for_each_base_().
obtain a range dimension at runtime using dim
References RangeManager< RangeBases >::static_for_each_base_().
Referenced by DimRT::map(), DimMZ::map(), DimINT::map(), and DimIM::map().
|
inline |
is any/some/all dimension in this range populated?
References OpenMS::ALL, RangeManager< RangeBases >::for_each_base_(), OpenMS::NONE, and OpenMS::SOME.
|
inline |
If any dimension is a single point, e.g. min==max, then extend this dimension by min_span
/ 2 on either side.
Empty dimensions remain unchanged.
References RangeManager< RangeBases >::for_each_base_().
Referenced by Plot1DCanvas::recalculateRanges_().
|
inline |
References RangeManager< RangeBases >::operator==().
|
inline |
References RangeManager< RangeBases >::for_each_base_().
Referenced by RangeManager< RangeBases >::operator!=().
|
inline |
print each dimension (base classes) to a stream
References RangeManager< RangeBases >::for_each_base_().
Referenced by OpenMS::operator<<().
|
inline |
Move range of *this to min/max of sandbox
, without changing the span, if possible. This does tighten the range unless sandbox's
ranges are smaller than *this. Dimensions which are not contained in sandbox
or are empty are left untouched.
sandbox | Range to translate/move the current range into |
Exception::InvalidRange | if no dimensions overlapped |
References RangeManager< RangeBases >::pushIntoUnsafe().
Referenced by Area< N_DIM >::pushInto(), and RangeManager< RangeBases >::pushIntoUnsafe().
|
inline |
Move range of *this to min/max of rhs
, without changing the span, if possible. This does tighten the range unless rhs's
ranges are smaller than *this. Dimensions which are not contained in rhs
or are empty are left untouched.
rhs | Range to translate/move the current range into |
References RangeManager< RangeBases >::for_each_base_(), and RangeManager< RangeBases >::pushInto().
Referenced by RangeManager< RangeBases >::pushInto().
|
inline |
calls RangeBase::scale() for each dimension
References RangeManager< RangeBases >::for_each_base_().
Referenced by Plot1DCanvas::recalculateRanges_().
|
inlinestaticprotected |
use fold expression to iterate over all RangeBases of RangeManager and apply a lambda (Visitor) for each one (for static members)
Referenced by RangeManager< RangeBases >::getRangeForDim().