89 return unit_ == rhs.unit_;
93 virtual std::unique_ptr<DimBase>
clone()
const = 0;
179 std::unique_ptr<DimBase>
clone()
const override
181 return std::make_unique<DimRT>();
212 res.reserve(chrom.size());
213 for (
const auto& p : chrom)
215 res.push_back(p.getRT());
250 out.RangeRT::operator=(in);
281 std::unique_ptr<DimBase>
clone()
const override
283 return std::make_unique<DimMZ>();
313 return spec[index].getMZ();
323 res.reserve(spec.size());
324 for (
const auto& p : spec)
326 res.push_back(p.getMZ());
352 out.RangeMZ::operator=(in);
384 std::unique_ptr<DimBase>
clone()
const override
386 return std::make_unique<DimINT>();
403 return it->getIntensity();
416 return spec[index].getIntensity();
420 return mb[index].getIntensity();
426 res.reserve(spec.size());
427 for (
const auto& p : spec)
429 res.push_back(p.getIntensity());
437 res.reserve(chrom.size());
438 for (
const auto& p : chrom)
440 res.push_back(p.getIntensity());
462 out.RangeIntensity::operator=(in);
493 std::unique_ptr<DimBase>
clone()
const override
495 return std::make_unique<DimIM>(*
this);
539 return mb[index].getMobility();
559 out.RangeMobility::operator=(in);
618 std::array<std::unique_ptr<const DimBase>, N_DIM> dims_tmp;
619 for (
int i = 0; i < N_DIM; ++i)
621 dims_tmp[i] =
create_(units[i]);
626 static_assert(N_DIM >= 1);
627 static_assert(N_DIM <= 3);
639 for (
int i = 0; i < N_DIM; ++i)
dims_[i] = rhs.
dims_[i]->clone();
647 for (
int i = 0; i < N_DIM; ++i)
661 template <
typename T>
665 for (
int i = 0; i < N_DIM; ++i) pr[i] =
dims_[i]->
map(data);
669 template<
typename Container>
673 for (
int i = 0; i < N_DIM; ++i)
679 template<
typename ...Ranges>
685 for (
int i = 0; i < N_DIM; ++i)
697 template<
typename... Ranges>
700 for (
int i = 0; i < N_DIM; ++i)
712 template<
typename... Ranges>
715 for (
int i = 0; i < N_DIM; ++i)
717 dims_[i]->setRange({in[i], in[i]}, output);
727 for (
int i = 0; i < N_DIM; ++i)
729 dims_[i]->fromXY(in[i], out);
739 for (
int i = 0; i < N_DIM; ++i)
741 dims_[i]->setRange({in[i], in[i]}, output);
749 assert((
int)d <= N_DIM);
750 return *
dims_[(int)d];
760 return std::make_unique<DimRT>();
762 return std::make_unique<DimMZ>();
764 return std::make_unique<DimINT>();
768 return std::make_unique<DimIM>(u);
774 std::array<std::unique_ptr<const DimBase>, N_DIM>
dims_;
805 throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Assignment of Areas using different mappers!");
Definition: DimMapper.h:782
bool operator!=(const Area &rhs) const
Definition: DimMapper.h:818
const Area & setArea(const RangeAllType &data)
Set the area using unit data (RT, m/z, ...)
Definition: DimMapper.h:828
Area()=delete
No default C'tor.
bool operator==(const Area &rhs) const
Definition: DimMapper.h:812
RangeAllType data_range_
range in units
Definition: DimMapper.h:896
const Area & setArea(const AreaXYType &data)
Set the area using axis data (X and Y)
Definition: DimMapper.h:841
void pushInto(const RangeAllType &sandbox)
Push the area into a sandbox (if its outside the sandbox). See UnitRange::pushInto()
Definition: DimMapper.h:887
AreaXYType visible_area_
Definition: DimMapper.h:897
Area cloneWith(const RangeAllType &data) const
Clone the current object, set the area of the clone using unit data (RT, m/z, ...) and return the clo...
Definition: DimMapper.h:876
const DimMapper< N_DIM > * mapper_
and a mapper (non-owning pointer) to translate between the two
Definition: DimMapper.h:899
Area & operator=(const Area &rhs)
Assignment operator - which checks for identical DimMappers and throws otherwise.
Definition: DimMapper.h:800
Area cloneWith(const AreaXYType &data) const
Clone the current object, set the area of the clone using axis data (X and Y) and return the clone.
Definition: DimMapper.h:864
Area(const DimMapper< N_DIM > *const dims)
Custom C'tor with a mapper (non owning pointer)
Definition: DimMapper.h:791
const RangeAllType & getAreaUnit() const
Definition: DimMapper.h:854
Area(const Area &range)=default
Copy C'tor.
const AreaXYType & getAreaXY() const
Definition: DimMapper.h:849
A basic LC-MS feature.
Definition: BaseFeature.h:59
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:54
IntensityType getIntensity() const
Non-mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:110
void setRT(CoordinateType rt)
Mutable access to RT.
Definition: ChromatogramPeak.h:121
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:112
CoordinateType getRT() const
Non-mutable access to RT.
Definition: ChromatogramPeak.h:115
Representation of a coordinate in D-dimensional space.
Definition: DPosition.h:54
A base class for a dimension which represents a certain unit (e.g. RT or m/z). Derived classes implem...
Definition: DimMapper.h:67
virtual ValueType map(const Peak1D &p) const =0
virtual ~DimBase() noexcept=default
D'tor (needs to be virtual; we are holding pointers to base in DimMapper)
virtual void fromXY(const ValueType in, Peak1D &p) const =0
set the dimension of a Peak1D
virtual ValueType map(const PeptideIdentification &pi) const =0
double ValueType
Definition: DimMapper.h:69
std::string_view getDimNameShort() const
Name of the dimension, e.g. 'RT'.
Definition: DimMapper.h:144
virtual ValueType map(const MobilityPeak2D &p) const =0
virtual ValueType map(const MSExperiment::ConstAreaIterator &it) const =0
virtual ValueType map(const ChromatogramPeak &p) const =0
int valuePrecision() const
return the recommended precision for the current unit (2 digits for RT, 8 for m/z,...
DimBase(DIM_UNIT unit)
Custom c'tor with unit.
Definition: DimMapper.h:76
virtual ValueType map(const Mobilogram &mb, const Size index) const =0
obtain value from a certain point in a mobilogram
virtual void fromXY(const ValueType in, ChromatogramPeak &p) const =0
set the dimension of a ChromatogramPeak
DIM_UNIT unit_
the unit of this dimension
Definition: DimMapper.h:169
String formattedValue(const ValueType value) const
Creates a short string representation with "UNIT: value", where value has a predefined precision (see...
DimBase & operator=(const DimBase &rhs)=default
Assignment operator.
virtual ValueTypes map(const MSChromatogram &chrom) const =0
virtual ValueType map(const BaseFeature &bf) const =0
virtual void setRange(const RangeBase &in, RangeAllType &out) const =0
Set the min/max (range) in out for a certain dimension.
virtual ValueType map(const MSSpectrum &spec, const Size index) const =0
obtain value from a certain point in a spectrum
std::vector< ValueType > ValueTypes
Definition: DimMapper.h:70
String formattedValue(ValueType value, const String &prefix) const
like formattedValue() but with a custom unit prefix instead of the default one for the dim,...
std::string_view getDimName() const
Name of the dimension, e.g. 'RT [s]'.
Definition: DimMapper.h:138
virtual void fromXY(const ValueType in, MobilityPeak2D &p) const =0
set the dimension of a MobilityPeak2D
virtual RangeBase map(const RangeAllType &rm) const =0
Return the min/max (range) for a certain dimension.
virtual ValueType map(const MobilityPeak1D &p) const =0
virtual ValueTypes map(const MSSpectrum &spec) const =0
virtual void fromXY(const ValueType in, MobilityPeak1D &p) const =0
set the dimension of a MobilityPeak1D
virtual ValueType map(const Peak2D &p) const =0
DIM_UNIT getUnit() const
The unit of the dimension.
Definition: DimMapper.h:150
DimBase()=delete
No default c'tor.
virtual std::unique_ptr< DimBase > clone() const =0
Copy derived objects to avoid slicing when dealing with pointers to DimBase.
Definition: DimMapper.h:489
ValueType map(const Peak2D &) const override
Definition: DimMapper.h:502
ValueType map(const BaseFeature &) const override
Definition: DimMapper.h:542
ValueType map(const PeptideIdentification &) const override
Definition: DimMapper.h:547
ValueType map(const Mobilogram &mb, const Size index) const
obtain value from a certain point in a mobilogram
Definition: DimMapper.h:537
void fromXY(const ValueType, Peak1D &) const override
set the IM of a Peak1D (throws)
Definition: DimMapper.h:563
std::unique_ptr< DimBase > clone() const override
Copy derived objects to avoid slicing when dealing with pointers to DimBase.
Definition: DimMapper.h:493
ValueType map(const MSSpectrum &spec, const Size) const
obtain value from a certain point in a spectrum
Definition: DimMapper.h:533
ValueTypes map(const MSSpectrum &) const override
Definition: DimMapper.h:510
void setRange(const RangeBase &in, RangeAllType &out) const
Set the min/max (range) in out for a certain dimension.
Definition: DimMapper.h:557
ValueType map(const MSExperiment::ConstAreaIterator &it) const override
Definition: DimMapper.h:519
ValueType map(const ChromatogramPeak &) const override
Definition: DimMapper.h:506
void fromXY(const ValueType, ChromatogramPeak &) const override
set the IM of a ChromatogramPeak (throws)
Definition: DimMapper.h:569
RangeBase map(const RangeAllType &rm) const override
Return the min/max (range) for a certain dimension.
Definition: DimMapper.h:552
void fromXY(const ValueType in, MobilityPeak2D &p) const override
set the IM of a MobilityPeak2D
Definition: DimMapper.h:580
ValueType map(const MobilityPeak2D &p) const override
Definition: DimMapper.h:528
ValueType map(const MobilityPeak1D &p) const override
Definition: DimMapper.h:524
DimIM(const DIM_UNIT im_unit)
Definition: DimMapper.h:491
ValueTypes map(const MSChromatogram &) const override
Definition: DimMapper.h:514
ValueType map(const Peak1D &) const override
Definition: DimMapper.h:498
void fromXY(const ValueType in, MobilityPeak1D &p) const override
set the IM of a MobilityPeak1D
Definition: DimMapper.h:575
Definition: DimMapper.h:380
ValueType map(const Peak1D &p) const override
Definition: DimMapper.h:389
ValueType map(const Peak2D &p) const override
Definition: DimMapper.h:393
ValueType map(const PeptideIdentification &) const override
Definition: DimMapper.h:450
ValueType map(const Mobilogram &mb, const Size index) const
obtain value from a certain point in a mobilogram
Definition: DimMapper.h:418
std::unique_ptr< DimBase > clone() const override
Copy derived objects to avoid slicing when dealing with pointers to DimBase.
Definition: DimMapper.h:384
ValueTypes map(const MSChromatogram &chrom) const override
Definition: DimMapper.h:434
void setRange(const RangeBase &in, RangeAllType &out) const
Set the min/max (range) in out for a certain dimension.
Definition: DimMapper.h:460
ValueType map(const MSExperiment::ConstAreaIterator &it) const override
Definition: DimMapper.h:401
ValueType map(const ChromatogramPeak &p) const override
Definition: DimMapper.h:397
DimINT()
Definition: DimMapper.h:382
ValueTypes map(const MSSpectrum &spec) const override
Definition: DimMapper.h:423
ValueType map(const MSSpectrum &spec, const Size index) const
obtain value from a certain point in a spectrum
Definition: DimMapper.h:414
ValueType map(const BaseFeature &bf) const override
Definition: DimMapper.h:445
RangeBase map(const RangeAllType &rm) const override
Return the min/max (range) for a certain dimension.
Definition: DimMapper.h:455
void fromXY(const ValueType in, MobilityPeak2D &p) const override
set the intensity of a MobilityPeak2D
Definition: DimMapper.h:482
ValueType map(const MobilityPeak2D &p) const override
Definition: DimMapper.h:409
ValueType map(const MobilityPeak1D &p) const override
Definition: DimMapper.h:405
void fromXY(const ValueType in, Peak1D &p) const override
set the intensity of a Peak1D
Definition: DimMapper.h:466
void fromXY(const ValueType in, ChromatogramPeak &p) const override
set the intensity of a ChromatogramPeak
Definition: DimMapper.h:472
void fromXY(const ValueType in, MobilityPeak1D &p) const override
set the intensity of a MobilityPeak1D
Definition: DimMapper.h:477
Definition: DimMapper.h:277
ValueType map(const Peak1D &p) const override
Definition: DimMapper.h:286
DimMZ()
Definition: DimMapper.h:279
ValueType map(const Peak2D &p) const override
Definition: DimMapper.h:290
std::unique_ptr< DimBase > clone() const override
Copy derived objects to avoid slicing when dealing with pointers to DimBase.
Definition: DimMapper.h:281
void setRange(const RangeBase &in, RangeAllType &out) const
Set the min/max (range) in out for a certain dimension.
Definition: DimMapper.h:350
ValueType map(const MSExperiment::ConstAreaIterator &it) const override
Definition: DimMapper.h:298
ValueTypes map(const MSSpectrum &spec) const override
Definition: DimMapper.h:320
ValueType map(const ChromatogramPeak &) const override
Definition: DimMapper.h:294
void fromXY(const ValueType, ChromatogramPeak &) const override
set the MZ of a ChromatogramPeak (throws)
Definition: DimMapper.h:362
ValueType map(const MSSpectrum &spec, const Size index) const
obtain value from a certain point in a spectrum
Definition: DimMapper.h:311
ValueType map(const BaseFeature &bf) const override
Definition: DimMapper.h:335
ValueType map(const PeptideIdentification &pi) const override
Definition: DimMapper.h:340
void fromXY(const ValueType, MobilityPeak1D &) const override
set the MZ of a MobilityPeak1D (throws)
Definition: DimMapper.h:368
RangeBase map(const RangeAllType &rm) const override
Return the min/max (range) for a certain dimension.
Definition: DimMapper.h:345
ValueType map(const Mobilogram &, const Size) const
obtain value from a certain point in a mobilogram
Definition: DimMapper.h:315
void fromXY(const ValueType in, MobilityPeak2D &p) const override
set the MZ of a MobilityPeak2D (throws)
Definition: DimMapper.h:373
ValueType map(const MobilityPeak2D &p) const override
Definition: DimMapper.h:306
ValueTypes map(const MSChromatogram &) const override
Definition: DimMapper.h:330
void fromXY(const ValueType in, Peak1D &p) const override
set the MZ of a Peak1D
Definition: DimMapper.h:356
ValueType map(const MobilityPeak1D &) const override
Definition: DimMapper.h:302
Allows dynamical switching (at runtime) between a dimension (RT, m/z, int, IM, etc) and X,...
Definition: DimMapper.h:608
static std::unique_ptr< const DimBase > create_(DIM_UNIT u)
a minimal factory
Definition: DimMapper.h:755
bool operator!=(const DimMapper &rhs) const
Inequality.
Definition: DimMapper.h:655
std::array< std::unique_ptr< const DimBase >, N_DIM > dims_
mappers for the X,Y,Z... dimension
Definition: DimMapper.h:774
bool operator==(const DimMapper &rhs) const
Equality.
Definition: DimMapper.h:644
void fromXY(const DRange< N_DIM > &in, RangeManager< Ranges... > &output) const
Definition: DimMapper.h:698
DimMapper & operator=(const DimMapper &rhs)
Assignment operator.
Definition: DimMapper.h:637
void fromXY(const Point &in, RangeManager< Ranges... > &output) const
Definition: DimMapper.h:713
DimMapper(const DimMapper &rhs)
Copy C'tor.
Definition: DimMapper.h:631
DRange< N_DIM > mapRange(const RangeManager< Ranges... > &ranges) const
Convert Range to an N_DIM-dimensional area (min and max for each dimension)
Definition: DimMapper.h:680
Point map(const T &data) const
convert an OpenMS datatype (such as Feature) to an N_DIM-dimensional point
Definition: DimMapper.h:662
const DimBase & getDim(DIM d) const
obtain unit/name for X/Y/Z dimension.
Definition: DimMapper.h:747
RangeAllType fromXY(const Point &in) const
Definition: DimMapper.h:736
DimMapper(const DIM_UNIT(&units)[N_DIM])
Custom C'tor with given dimensions to map to (the order is assumed to be X, Y, Z, ....
Definition: DimMapper.h:616
DimMapper()=delete
No default c'tor (we need dimensions)
Point map(const Container &data, const Size index) const
convert an OpenMS datapoint in a container (such as MSSpectrum) to an N_DIM-dimensional point
Definition: DimMapper.h:670
void fromXY(const Point &in, T &out) const
Definition: DimMapper.h:725
Definition: DimMapper.h:175
ValueType map(const MobilityPeak2D &) const override
Definition: DimMapper.h:228
ValueType map(const Peak2D &p) const override
Definition: DimMapper.h:188
void fromXY(const ValueType, MobilityPeak2D &) const override
set the RT of a MobilityPeak2D (throws)
Definition: DimMapper.h:270
void fromXY(const ValueType, Peak1D &) const override
set the RT of a Peak1D (throws)
Definition: DimMapper.h:254
std::unique_ptr< DimBase > clone() const override
Copy derived objects to avoid slicing when dealing with pointers to DimBase.
Definition: DimMapper.h:179
ValueTypes map(const MSChromatogram &chrom) const override
Definition: DimMapper.h:209
ValueType map(const MSSpectrum &spec, const Size) const
obtain value from a certain point in a spectrum
Definition: DimMapper.h:196
ValueTypes map(const MSSpectrum &) const override
Definition: DimMapper.h:205
void setRange(const RangeBase &in, RangeAllType &out) const
Set the min/max (range) in out for a certain dimension.
Definition: DimMapper.h:248
ValueType map(const MSExperiment::ConstAreaIterator &it) const override
Definition: DimMapper.h:220
ValueType map(const ChromatogramPeak &p) const override
Definition: DimMapper.h:192
ValueType map(const BaseFeature &bf) const override
Definition: DimMapper.h:233
ValueType map(const PeptideIdentification &pi) const override
Definition: DimMapper.h:238
ValueType map(const Mobilogram &mb, const Size) const
obtain value from a certain point in a mobilogram
Definition: DimMapper.h:200
void fromXY(const ValueType, MobilityPeak1D &) const override
set the RT of a MobilityPeak1D (throws)
Definition: DimMapper.h:265
RangeBase map(const RangeAllType &rm) const override
Return the min/max (range) for a certain dimension.
Definition: DimMapper.h:243
DimRT()
Definition: DimMapper.h:177
ValueType map(const Peak1D &) const override
Definition: DimMapper.h:184
void fromXY(const ValueType in, ChromatogramPeak &p) const override
set the RT of a ChromatogramPeak
Definition: DimMapper.h:260
ValueType map(const MobilityPeak1D &) const override
Definition: DimMapper.h:224
Invalid range exception.
Definition: Exception.h:278
Not implemented exception.
Definition: Exception.h:430
Precondition failed exception.
Definition: Exception.h:159
Forward iterator for an area of peaks in an experiment.
Definition: AreaIterator.h:63
CoordinateType getDriftTime() const
returns the ion mobility time of the current scan
Definition: AreaIterator.h:252
CoordinateType getRT() const
returns the retention time of the current scan
Definition: AreaIterator.h:246
void setDimMinMax(UInt dim, const DIntervalBase< 1 > &min_max)
only set interval for a single dimension
Definition: DIntervalBase.h:254
PositionType const & maxPosition() const
Accessor to maximum position.
Definition: DIntervalBase.h:130
bool isEmpty() const
Definition: DIntervalBase.h:242
static DIntervalBase const empty
empty instance
Definition: DIntervalBase.h:284
PositionType const & minPosition() const
Accessor to minimum position.
Definition: DIntervalBase.h:124
The representation of a chromatogram.
Definition: MSChromatogram.h:57
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
double getDriftTime() const
Returns the ion mobility drift time (MSSpectrum::DRIFTTIME_NOT_SET means it is not set)
A 1-dimensional raw data mobility point or peak. The unit (ms, 1/K_0, etc) is implicit.
Definition: MobilityPeak1D.h:51
IntensityType getIntensity() const
Definition: MobilityPeak1D.h:105
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: MobilityPeak1D.h:110
void setMobility(CoordinateType mobility)
Mutable access to mobility.
Definition: MobilityPeak1D.h:122
CoordinateType getMobility() const
Non-mutable access to m/z.
Definition: MobilityPeak1D.h:116
A 2-dimensional raw data point or peak.
Definition: MobilityPeak2D.h:55
CoordinateType getMZ() const
Returns the m/z coordinate (index 1)
Definition: MobilityPeak2D.h:194
void setMZ(CoordinateType coordinate)
Mutable access to the m/z coordinate (index 1)
Definition: MobilityPeak2D.h:200
void setMobility(CoordinateType coordinate)
Mutable access to the IM coordinate (index 0)
Definition: MobilityPeak2D.h:212
IntensityType getIntensity() const
Definition: MobilityPeak2D.h:164
void setIntensity(IntensityType intensity)
Sets data point intensity (height)
Definition: MobilityPeak2D.h:170
CoordinateType getMobility() const
Returns the IM coordinate (index 0)
Definition: MobilityPeak2D.h:206
The representation of a 1D ion mobilogram.
Definition: Mobilogram.h:55
double getRT() const noexcept
Definition: Mobilogram.h:262
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:54
CoordinateType getMZ() const
Non-mutable access to m/z.
Definition: Peak1D.h:113
IntensityType getIntensity() const
Definition: Peak1D.h:108
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: Peak1D.h:110
void setMZ(CoordinateType mz)
Mutable access to m/z.
Definition: Peak1D.h:119
A 2-dimensional raw data point or peak.
Definition: Peak2D.h:55
CoordinateType getMZ() const
Returns the m/z coordinate (index 1)
Definition: Peak2D.h:198
IntensityType getIntensity() const
Definition: Peak2D.h:168
CoordinateType getRT() const
Returns the RT coordinate (index 0)
Definition: Peak2D.h:210
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:65
double getRT() const
returns the RT of the MS2 spectrum where the identification occurred
double getMZ() const
returns the MZ of the MS2 spectrum
void pushInto(const RangeManager< RangeBasesOther... > &sandbox)
Definition: RangeManager.h:727
const RangeBase & getRangeForDim(MSDim dim) const
obtain a range dimension at runtime using dim
Definition: RangeManager.h:771
auto & assign(const RangeManager< RangeBasesOther... > &rhs)
Definition: RangeManager.h:635
A more convenient string class.
Definition: String.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
static String prefix(const String &this_s, size_t length)
Definition: StringUtilsSimple.h:147
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: FeatureDeconvolution.h:48
DIM
Definition: DimMapper.h:590
DIM_UNIT
Definition: CommonEnums.h:46
@ IM_VSSC
volt-second per square centimeter (i.e. 1/K_0)
@ FAIMS_CV
FAIMS compensation voltage.
@ IM_MS
ion mobility milliseconds
std::string_view DIM_NAMES[(int) DIM_UNIT::SIZE_OF_DIM_UNITS]
Definition: CommonEnums.h:55
std::string_view DIM_NAMES_SHORT[(int) DIM_UNIT::SIZE_OF_DIM_UNITS]
Definition: CommonEnums.h:56
Base class for a simple range with minimum and maximum.
Definition: RangeManager.h:59
double getMin() const
only useful if isEmpty() returns false
Definition: RangeManager.h:134
bool isEmpty() const
is the range empty (i.e. min > max)?
Definition: RangeManager.h:94
double getMax() const
only useful if isEmpty() returns false
Definition: RangeManager.h:140