A base class for a dimension which represents a certain unit (e.g. RT or m/z). Derived classes implement virtual functions, which receive a well-defined data type, e.g. a Feature, and return the appropriate value for their dimension (the DimRT class would return the RT of the feature). This makes it possible to extract dimensions using a runtime configuration of DimBase instances. Very useful when mapping units (RT, m/z) to axis when plotting etc. More...
#include <OpenMS/KERNEL/DimMapper.h>
Public Types | |
using | ValueType = double |
using | ValueTypes = std::vector< ValueType > |
Public Member Functions | |
DimBase ()=delete | |
No default c'tor. More... | |
DimBase (DIM_UNIT unit) | |
Custom c'tor with unit. More... | |
DimBase & | operator= (const DimBase &rhs)=default |
Assignment operator. More... | |
virtual | ~DimBase () noexcept=default |
D'tor (needs to be virtual; we are holding pointers to base in DimMapper) More... | |
bool | operator== (const DimBase &rhs) const |
Equality. More... | |
virtual std::unique_ptr< DimBase > | clone () const =0 |
Copy derived objects to avoid slicing when dealing with pointers to DimBase. More... | |
virtual ValueType | map (const Peak1D &p) const =0 |
virtual ValueType | map (const Peak2D &p) const =0 |
virtual ValueType | map (const ChromatogramPeak &p) const =0 |
virtual ValueType | map (const MSExperiment::ConstAreaIterator &it) const =0 |
virtual ValueType | map (const MobilityPeak1D &p) const =0 |
virtual ValueType | map (const MobilityPeak2D &p) const =0 |
virtual ValueType | map (const MSSpectrum &spec, const Size index) const =0 |
obtain value from a certain point in a spectrum More... | |
virtual ValueType | map (const MSChromatogram &chrom, const Size index) const =0 |
obtain value from a certain point in a chromatogram More... | |
virtual ValueType | map (const Mobilogram &mb, const Size index) const =0 |
obtain value from a certain point in a mobilogram More... | |
virtual ValueTypes | map (const MSSpectrum &spec) const =0 |
virtual ValueTypes | map (const MSChromatogram &chrom) const =0 |
virtual ValueType | map (const BaseFeature &bf) const =0 |
virtual ValueType | map (const PeptideIdentification &pi) const =0 |
virtual RangeBase | map (const RangeAllType &rm) const =0 |
Return the min/max (range) for a certain dimension. More... | |
virtual RangeBase & | map (RangeAllType &rm) const =0 |
Return the min/max (range) for a certain dimension (i.e. a reference to the base class of rm ) More... | |
virtual void | setRange (const RangeBase &in, RangeAllType &out) const =0 |
Set the min/max (range) in out for a certain dimension. More... | |
virtual void | fromXY (const ValueType in, Peak1D &p) const =0 |
set the dimension of a Peak1D More... | |
virtual void | fromXY (const ValueType in, ChromatogramPeak &p) const =0 |
set the dimension of a ChromatogramPeak More... | |
virtual void | fromXY (const ValueType in, MobilityPeak1D &p) const =0 |
set the dimension of a MobilityPeak1D More... | |
virtual void | fromXY (const ValueType in, MobilityPeak2D &p) const =0 |
set the dimension of a MobilityPeak2D More... | |
std::string_view | getDimName () const |
Name of the dimension, e.g. 'RT [s]'. More... | |
std::string_view | getDimNameShort () const |
Name of the dimension, e.g. 'RT'. More... | |
DIM_UNIT | getUnit () const |
The unit of the dimension. More... | |
String | formattedValue (const ValueType value) const |
Creates a short string representation with "UNIT: value", where value has a predefined precision (see valuePrecision()) More... | |
String | formattedValue (ValueType value, const String &prefix) const |
like formattedValue() but with a custom unit prefix instead of the default one for the dim, e.g. "myText: 45.32" More... | |
int | valuePrecision () const |
return the recommended precision for the current unit (2 digits for RT, 8 for m/z, etc) More... | |
Protected Attributes | |
DIM_UNIT | unit_ |
the unit of this dimension More... | |
A base class for a dimension which represents a certain unit (e.g. RT or m/z). Derived classes implement virtual functions, which receive a well-defined data type, e.g. a Feature, and return the appropriate value for their dimension (the DimRT class would return the RT of the feature). This makes it possible to extract dimensions using a runtime configuration of DimBase instances. Very useful when mapping units (RT, m/z) to axis when plotting etc.
The reverse (X-Y coordinates to data type, e.g. Peak1D) is also possible using 'from...()' methods
using ValueType = double |
using ValueTypes = std::vector<ValueType> |
|
delete |
No default c'tor.
|
virtualdefaultnoexcept |
D'tor (needs to be virtual; we are holding pointers to base in DimMapper)
|
pure virtual |
Creates a short string representation with "UNIT: value", where value has a predefined precision (see valuePrecision())
value | The value of this Dim to format |
like formattedValue() but with a custom unit prefix instead of the default one for the dim, e.g. "myText: 45.32"
|
pure virtual |
set the dimension of a ChromatogramPeak
|
pure virtual |
set the dimension of a MobilityPeak1D
|
pure virtual |
set the dimension of a MobilityPeak2D
|
inline |
Name of the dimension, e.g. 'RT [s]'.
References OpenMS::DIM_NAMES.
|
inline |
Name of the dimension, e.g. 'RT'.
References OpenMS::DIM_NAMES_SHORT.
|
inline |
The unit of the dimension.
Referenced by Gravitator::setIntensityAsGravity(), and Plot2DWidget::setMapper().
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
obtain vector of same length as spec
; one element per peak
Exception::InvalidRange | if elements do not support the dimension |
|
pure virtual |
|
pure virtual |
|
pure virtual |
obtain vector of same length as spec
; one element per peak
Exception::InvalidRange | if elements do not support the dimension |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
inline |
Equality.
|
pure virtual |
int valuePrecision | ( | ) | const |
return the recommended precision for the current unit (2 digits for RT, 8 for m/z, etc)
|
protected |
the unit of this dimension