OpenMS
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SpectrumRangeManager Class Reference

Advanced range manager for MS spectra with separate ranges for each MS level. More...

#include <OpenMS/KERNEL/SpectrumRangeManager.h>

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

Public Types

using BaseType = RangeManager< RangeMZ, RangeIntensity, RangeMobility, RangeRT >
 Base type. More...
 
- Public Types inherited from RangeManager< RangeMZ, RangeIntensity, RangeMobility, RangeRT >
using ThisRangeType = RangeManager< RangeBases... >
 

Public Member Functions

 SpectrumRangeManager ()=default
 Default constructor. More...
 
 SpectrumRangeManager (const SpectrumRangeManager &source)=default
 Copy constructor. More...
 
 SpectrumRangeManager (SpectrumRangeManager &&source)=default
 Move constructor. More...
 
SpectrumRangeManageroperator= (const SpectrumRangeManager &source)=default
 Assignment operator. More...
 
SpectrumRangeManageroperator= (SpectrumRangeManager &&source)=default
 Move assignment operator. More...
 
 ~SpectrumRangeManager ()=default
 Destructor. More...
 
void clearRanges ()
 Clears all ranges (global and MS level-specific) More...
 
void extend (const BaseType &other, UInt ms_level=0)
 Extends the ranges with the ranges of another range manager. More...
 
const BaseTypebyMSLevel (UInt ms_level=0) const
 Gets the ranges for a specific MS level. More...
 
std::set< UIntgetMSLevels () const
 Gets all MS levels for which specific ranges exist. More...
 
void extendRT (double rt, UInt ms_level=0)
 Extends the RT range with an MS level parameter. More...
 
void extendMZ (double mz, UInt ms_level=0)
 Extends the m/z range with an MS level parameter. More...
 
void extendUnsafe (const MSSpectrum &spectrum, UInt ms_level=0)
 Extends the ranges with the ranges of a spectrum using an MS level parameter. More...
 
- Public Member Functions inherited from RangeManager< RangeMZ, RangeIntensity, RangeMobility, RangeRT >
bool operator== (const RangeManager &rhs) const
 
bool operator!= (const RangeManager &rhs) const
 
bool assignUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
auto & assign (const RangeManager< RangeBasesOther... > &rhs)
 
bool extendUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
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...
 
bool pushIntoUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void pushInto (const RangeManager< RangeBasesOther... > &sandbox)
 
bool clampToUnsafe (const RangeManager< RangeBasesOther... > &rhs)
 
void clampTo (const RangeManager< RangeBasesOther... > &rhs)
 
const RangeBasegetRangeForDim (MSDim dim) const
 obtain a range dimension at runtime using dim More...
 
RangeBasegetRangeForDim (MSDim dim)
 obtain a range dimension at runtime using dim More...
 
HasRangeType hasRange () const
 is any/some/all dimension in this range populated? More...
 
bool containsAll (const RangeManager< RangeBasesOther... > &rhs) const
 
void clearRanges ()
 Resets all ranges. More...
 
ThisRangeTypeclear (const DIM_UNIT range)
 
void printRange (std::ostream &out) const
 print each dimension (base classes) to a stream More...
 

Protected Attributes

std::map< UInt, BaseTypems_level_ranges_
 MS level-specific ranges. More...
 

Additional Inherited Members

- Protected Member Functions inherited from RangeManager< RangeMZ, RangeIntensity, RangeMobility, RangeRT >
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...
 
void for_each_base_ (Visitor &&visitor) const
 .. and a const version More...
 
- Static Protected Member Functions inherited from RangeManager< RangeMZ, RangeIntensity, RangeMobility, RangeRT >
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...
 

Detailed Description

Advanced range manager for MS spectra with separate ranges for each MS level.

This class extends the basic RangeManager to provide separate range tracking for different MS levels (MS1, MS2, etc.). It manages four types of ranges:

  • m/z (mass-to-charge ratio)
  • intensity
  • retention time (RT)
  • ion mobility

A global range is tracked for all MS levels, and additional ranges are maintained for each specific MS level. This allows for efficient querying of ranges for specific MS levels, which is useful for visualization, filtering, and processing operations that need to work with specific MS levels.

The class inherits from RangeManager and adds MS level-specific functionality. The base RangeManager functionality is used for the global ranges, while a map of MS levels to RangeManagers is used for the MS level-specific ranges.

See also
RangeManager
MSSpectrum
ChromatogramRangeManager
MSExperiment

Member Typedef Documentation

◆ BaseType

Constructor & Destructor Documentation

◆ SpectrumRangeManager() [1/3]

SpectrumRangeManager ( )
default

Default constructor.

◆ SpectrumRangeManager() [2/3]

SpectrumRangeManager ( const SpectrumRangeManager source)
default

Copy constructor.

◆ SpectrumRangeManager() [3/3]

Move constructor.

◆ ~SpectrumRangeManager()

~SpectrumRangeManager ( )
default

Destructor.

Member Function Documentation

◆ byMSLevel()

const BaseType& byMSLevel ( UInt  ms_level = 0) const
inline

Gets the ranges for a specific MS level.

Parameters
ms_levelThe MS level for which to retrieve the ranges
Returns
The ranges for the specified MS level
Exceptions
Exception::InvalidValueif no ranges exist for the specified MS level

◆ clearRanges()

void clearRanges ( )
inline

Clears all ranges (global and MS level-specific)

◆ extend()

void extend ( const BaseType other,
UInt  ms_level = 0 
)
inline

Extends the ranges with the ranges of another range manager.

Parameters
otherThe other range manager to extend from
ms_levelThe MS level for which to extend the ranges (0 for global ranges)

◆ extendMZ()

void extendMZ ( double  mz,
UInt  ms_level = 0 
)
inline

Extends the m/z range with an MS level parameter.

Parameters
mzThe m/z value to extend with
ms_levelThe MS level for which to extend the m/z range (0 for global range)

◆ extendRT()

void extendRT ( double  rt,
UInt  ms_level = 0 
)
inline

Extends the RT range with an MS level parameter.

Parameters
rtThe RT value to extend with
ms_levelThe MS level for which to extend the RT range (0 for global range)

◆ extendUnsafe()

void extendUnsafe ( const MSSpectrum spectrum,
UInt  ms_level = 0 
)
inline

Extends the ranges with the ranges of a spectrum using an MS level parameter.

Parameters
spectrumThe spectrum whose ranges to extend from
ms_levelThe MS level for which to extend the ranges (0 for global ranges)

References RangeManagerContainer< RangeBases >::getRange().

◆ getMSLevels()

std::set<UInt> getMSLevels ( ) const
inline

Gets all MS levels for which specific ranges exist.

Returns
The set of MS levels

◆ operator=() [1/2]

SpectrumRangeManager& operator= ( const SpectrumRangeManager source)
default

Assignment operator.

◆ operator=() [2/2]

SpectrumRangeManager& operator= ( SpectrumRangeManager &&  source)
default

Move assignment operator.

Member Data Documentation

◆ ms_level_ranges_

std::map<UInt, BaseType> ms_level_ranges_
protected

MS level-specific ranges.