OpenMS
Peak2D Class Reference

A 2-dimensional raw data point or peak. More...

#include <OpenMS/KERNEL/Peak2D.h>

Inheritance diagram for Peak2D:
[legend]
Collaboration diagram for Peak2D:
[legend]

Classes

struct  IntensityLess
 
struct  MZLess
 Comparator by m/z position. More...
 
struct  PositionLess
 Comparator by position. Lexicographical comparison (first RT then m/z) is done. More...
 
struct  RTLess
 Comparator by RT position. More...
 

Public Types

Type definitions
typedef float IntensityType
 Intensity type. More...
 
typedef double CoordinateType
 Coordinate type (of the position) More...
 
typedef DPosition< 2 > PositionType
 Position type. More...
 

Public Member Functions

bool operator== (const Peak2D &rhs) const
 Equality operator. More...
 
bool operator!= (const Peak2D &rhs) const
 Equality operator. More...
 
Constructors and Destructor

Default constructor

 Peak2D ()=default
 
 Peak2D (const PositionType &pos, const IntensityType in)
 Member constructor. More...
 
 Peak2D (const Peak2D &p)=default
 Copy constructor. More...
 
 Peak2D (Peak2D &&) noexcept=default
 Move constructor. More...
 
Peak2Doperator= (const Peak2D &rhs)=default
 Assignment operator. More...
 
Peak2Doperator= (Peak2D &&) noexcept=default
 Move assignment operator. More...
 
 ~Peak2D () noexcept=default
 Destructor. More...
 
Accessors

Non-mutable access to the data point intensity (height)

IntensityType getIntensity () const
 
void setIntensity (IntensityType intensity)
 Sets data point intensity (height) More...
 
PositionType const & getPosition () const
 Non-mutable access to the position. More...
 
PositionTypegetPosition ()
 Mutable access to the position. More...
 
void setPosition (const PositionType &position)
 Mutable access to the position. More...
 
CoordinateType getMZ () const
 Returns the m/z coordinate (index 1) More...
 
void setMZ (CoordinateType coordinate)
 Mutable access to the m/z coordinate (index 1) More...
 
CoordinateType getRT () const
 Returns the RT coordinate (index 0) More...
 
void setRT (CoordinateType coordinate)
 Mutable access to the RT coordinate (index 0) More...
 

Protected Attributes

PositionType position_ {}
 The data point position. More...
 
IntensityType intensity_ {}
 The data point intensity. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Peak2D &point)
 Print the contents to a stream. More...
 

Dimension descriptions

enum  DimensionDescription { RT = 0 , MZ = 1 , DIMENSION = 2 }
 This enum maps the symbolic names of the dimensions to numbers. More...
 
static char const *const dimension_name_short_ [DIMENSION]
 Short name of the dimension (abbreviated form) More...
 
static char const *const dimension_name_full_ [DIMENSION]
 Full name of the dimension (self-explanatory form) More...
 
static char const *const dimension_unit_short_ [DIMENSION]
 Unit of measurement (abbreviated form) More...
 
static char const *const dimension_unit_full_ [DIMENSION]
 Unit of measurement (self-explanatory form) More...
 
static char const * shortDimensionName (UInt const dim)
 Short name of the dimension (abbreviated form) More...
 
static char const * shortDimensionNameRT ()
 Short name of the dimension (abbreviated form) More...
 
static char const * shortDimensionNameMZ ()
 Short name of the dimension (abbreviated form) More...
 
static char const * fullDimensionName (UInt const dim)
 Full name of the dimension (self-explanatory form) More...
 
static char const * fullDimensionNameRT ()
 Full name of the dimension (self-explanatory form) More...
 
static char const * fullDimensionNameMZ ()
 Full name of the dimension (self-explanatory form) More...
 
static char const * shortDimensionUnit (UInt const dim)
 Unit of measurement (abbreviated form) More...
 
static char const * shortDimensionUnitRT ()
 Unit of measurement (abbreviated form) More...
 
static char const * shortDimensionUnitMZ ()
 Unit of measurement (abbreviated form) More...
 
static char const * fullDimensionUnit (UInt const dim)
 Unit of measurement (self-explanatory form) More...
 
static char const * fullDimensionUnitRT ()
 Unit of measurement (self-explanatory form) More...
 
static char const * fullDimensionUnitMZ ()
 Unit of measurement (self-explanatory form) More...
 

Detailed Description

A 2-dimensional raw data point or peak.

This data structure is intended for continuous data or peak data. If you want to annotated single peaks with meta data, use RichPeak2D instead.

Member Typedef Documentation

◆ CoordinateType

typedef double CoordinateType

Coordinate type (of the position)

◆ IntensityType

typedef float IntensityType

Intensity type.

◆ PositionType

typedef DPosition<2> PositionType

Position type.

Member Enumeration Documentation

◆ DimensionDescription

This enum maps the symbolic names of the dimensions to numbers.

Enumerator
RT 

Retention time dimension id (0 if used as a const int)

MZ 

Mass-to-charge dimension id (1 if used as a const int)

DIMENSION 

Number of dimensions.

Constructor & Destructor Documentation

◆ Peak2D() [1/4]

Peak2D ( )
default

◆ Peak2D() [2/4]

Peak2D ( const PositionType pos,
const IntensityType  in 
)
inlineexplicit

Member constructor.

◆ Peak2D() [3/4]

Peak2D ( const Peak2D p)
default

Copy constructor.

◆ Peak2D() [4/4]

Peak2D ( Peak2D &&  )
defaultnoexcept

Move constructor.

◆ ~Peak2D()

~Peak2D ( )
defaultnoexcept

Destructor.

Note
The destructor is non-virtual although many classes are derived from Peak2D. This is intentional, since otherwise we would "waste" space for a vtable pointer in each instance. Normally you should not derive other classes from Peak2D (unless you know what you are doing, of course).

Member Function Documentation

◆ fullDimensionName()

static char const* fullDimensionName ( UInt const  dim)
static

Full name of the dimension (self-explanatory form)

◆ fullDimensionNameMZ()

static char const* fullDimensionNameMZ ( )
static

Full name of the dimension (self-explanatory form)

◆ fullDimensionNameRT()

static char const* fullDimensionNameRT ( )
static

Full name of the dimension (self-explanatory form)

◆ fullDimensionUnit()

static char const* fullDimensionUnit ( UInt const  dim)
static

Unit of measurement (self-explanatory form)

◆ fullDimensionUnitMZ()

static char const* fullDimensionUnitMZ ( )
static

Unit of measurement (self-explanatory form)

◆ fullDimensionUnitRT()

static char const* fullDimensionUnitRT ( )
static

Unit of measurement (self-explanatory form)

◆ getIntensity()

◆ getMZ()

CoordinateType getMZ ( ) const
inline

Returns the m/z coordinate (index 1)

References OpenMS::MZ.

Referenced by DimMZ::map(), SpectraMerger::SpectraDistance_::operator()(), and Peak2D::MZLess::operator()().

◆ getPosition() [1/2]

PositionType& getPosition ( )
inline

Mutable access to the position.

◆ getPosition() [2/2]

PositionType const& getPosition ( ) const
inline

Non-mutable access to the position.

Referenced by Peak2D::PositionLess::operator()(), and InMzRange< PeakType >::operator()().

◆ getRT()

◆ operator!=()

bool operator!= ( const Peak2D rhs) const
inline

Equality operator.

References OpenMS::Internal::operator==().

◆ operator=() [1/2]

Peak2D& operator= ( const Peak2D rhs)
default

Assignment operator.

Referenced by RichPeak2D::operator=().

◆ operator=() [2/2]

Peak2D& operator= ( Peak2D &&  )
defaultnoexcept

Move assignment operator.

◆ operator==()

bool operator== ( const Peak2D rhs) const
inline

Equality operator.

References Peak2D::intensity_, and Peak2D::position_.

Referenced by RichPeak2D::operator==().

◆ setIntensity()

◆ setMZ()

◆ setPosition()

void setPosition ( const PositionType position)
inline

Mutable access to the position.

◆ setRT()

◆ shortDimensionName()

static char const* shortDimensionName ( UInt const  dim)
static

Short name of the dimension (abbreviated form)

◆ shortDimensionNameMZ()

static char const* shortDimensionNameMZ ( )
static

Short name of the dimension (abbreviated form)

◆ shortDimensionNameRT()

static char const* shortDimensionNameRT ( )
static

Short name of the dimension (abbreviated form)

◆ shortDimensionUnit()

static char const* shortDimensionUnit ( UInt const  dim)
static

Unit of measurement (abbreviated form)

◆ shortDimensionUnitMZ()

static char const* shortDimensionUnitMZ ( )
static

Unit of measurement (abbreviated form)

◆ shortDimensionUnitRT()

static char const* shortDimensionUnitRT ( )
static

Unit of measurement (abbreviated form)

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Peak2D point 
)
friend

Print the contents to a stream.

Member Data Documentation

◆ dimension_name_full_

char const* const dimension_name_full_[DIMENSION]
staticprotected

Full name of the dimension (self-explanatory form)

◆ dimension_name_short_

char const* const dimension_name_short_[DIMENSION]
staticprotected

Short name of the dimension (abbreviated form)

◆ dimension_unit_full_

char const* const dimension_unit_full_[DIMENSION]
staticprotected

Unit of measurement (self-explanatory form)

◆ dimension_unit_short_

char const* const dimension_unit_short_[DIMENSION]
staticprotected

Unit of measurement (abbreviated form)

◆ intensity_

IntensityType intensity_ {}
protected

The data point intensity.

Referenced by Peak2D::operator==().

◆ position_

PositionType position_ {}
protected

The data point position.

Referenced by Peak2D::operator==().