OpenMS
Loading...
Searching...
No Matches
LinearResampling Class Reference

Shared linear resampling implementation without parameter or progress handling. More...

#include <OpenMS/MATH/MISC/LinearResampling.h>

Public Member Functions

 LinearResampling (double spacing, bool ppm=false)
 Construct a resampler with explicit spacing and units.
 
template<class PeakContainerT >
void raster (PeakContainerT &container)
 Resample a peak container onto a grid spanning its first and last points.
 
template<typename PeakTypeIterator , typename ConstPeakTypeIterator >
void raster (ConstPeakTypeIterator raw_it, ConstPeakTypeIterator raw_end, PeakTypeIterator resampled_begin, PeakTypeIterator resampled_end)
 Distribute input intensities onto an existing output grid.
 
template<typename PeakType >
void populateRaster (std::vector< PeakType > &resampled_peak_container, double start_pos, double end_pos, int number_resampled_points)
 Populate an absolute or ppm grid using the existing endpoint convention.
 
template<typename PeakTypeIterator >
void verifySpacing (PeakTypeIterator it, PeakTypeIterator end, auto access)
 Emit the existing spacing warning for absolute grids when enabled.
 

Private Attributes

double spacing_
 
bool ppm_
 

Detailed Description

Shared linear resampling implementation without parameter or progress handling.

Used by MSExperiment::calculateTIC() and LinearResamplerAlign. The latter retains the parameter interface and experiment-wide processing API.

Constructor & Destructor Documentation

◆ LinearResampling()

LinearResampling ( double  spacing,
bool  ppm = false 
)
inlineexplicit

Construct a resampler with explicit spacing and units.

Parameters
[in]spacingSpacing of output points.
[in]ppmWhether spacing is relative (ppm) instead of absolute.

Member Function Documentation

◆ populateRaster()

template<typename PeakType >
void populateRaster ( std::vector< PeakType > &  resampled_peak_container,
double  start_pos,
double  end_pos,
int  number_resampled_points 
)
inline

Populate an absolute or ppm grid using the existing endpoint convention.

Parameters
[in,out]resampled_peak_containerOutput grid.
[in]start_posFirst grid position.
[in]end_posEnd position for ppm grids.
[in]number_resampled_pointsNumber of points for absolute grids.

References Peak2D::setIntensity().

Referenced by LinearResamplerAlign::populate_raster_().

◆ raster() [1/2]

template<typename PeakTypeIterator , typename ConstPeakTypeIterator >
void raster ( ConstPeakTypeIterator  raw_it,
ConstPeakTypeIterator  raw_end,
PeakTypeIterator  resampled_begin,
PeakTypeIterator  resampled_end 
)
inline

Distribute input intensities onto an existing output grid.

Intensities outside the grid accumulate at its endpoints. Existing output intensities are retained and incremented.

Parameters
[in]raw_itStart of the input range.
[in]raw_endEnd of the input range.
[in,out]resampled_beginStart of the nonempty output grid.
[in,out]resampled_endEnd of the output grid.

References OPENMS_PRECONDITION.

◆ raster() [2/2]

template<class PeakContainerT >
void raster ( PeakContainerT &  container)
inline

Resample a peak container onto a grid spanning its first and last points.

Parameters
[in,out]containerContainer to resample, with the same requirements as LinearResamplerAlign::raster().

References first.

Referenced by LinearResamplerAlign::raster(), and LinearResamplerAlign::raster().

◆ verifySpacing()

template<typename PeakTypeIterator >
void verifySpacing ( PeakTypeIterator  it,
PeakTypeIterator  end,
auto  access 
)
inline

Emit the existing spacing warning for absolute grids when enabled.

Parameters
[in]itStart of the input range.
[in]endEnd of the input range.
[in]accessFunction returning the position at an iterator.

References OPENMS_LOG_WARN, and OpenMS::suppress_resampling_spacing_warning.

Referenced by LinearResamplerAlign::verifySpacing_().

Member Data Documentation

◆ ppm_

bool ppm_
private

◆ spacing_

double spacing_
private