OpenMS
LinearResamplerAlign Class Reference

Linear Resampling of raw data with alignment. More...

#include <OpenMS/PROCESSING/RESAMPLING/LinearResamplerAlign.h>

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

Public Member Functions

 LinearResamplerAlign ()
 
template<class PeakContainerT >
void raster (PeakContainerT &container)
 Applies the resampling algorithm to a container (MSSpectrum or MSChromatogram). More...
 
template<typename PeakContainerT >
void raster_align (PeakContainerT &container, double start_pos, double end_pos)
 Applies the resampling algorithm to a container (MSSpectrum or MSChromatogram) with fixed coordinates. More...
 
template<typename PeakTypeIterator , typename ConstPeakTypeIterator >
void raster (ConstPeakTypeIterator raw_it, ConstPeakTypeIterator raw_end, PeakTypeIterator resampled_begin, PeakTypeIterator resampled_end)
 Resample points (e.g. Peak1D) from an input range onto a prepopulated output range with given m/z, modifying the output intensities. More...
 
template<typename PeakTypeIterator , typename ConstPeakTypeIterator >
void raster (ConstPeakTypeIterator mz_raw_it, ConstPeakTypeIterator mz_raw_end, ConstPeakTypeIterator int_raw_it, ConstPeakTypeIterator int_raw_end, ConstPeakTypeIterator mz_resample_it, ConstPeakTypeIterator mz_resample_end, PeakTypeIterator int_resample_it, PeakTypeIterator int_resample_end)
 Resample points (with m/z and intensity in separate containers, but of same length) from an input range onto a prepopulated output m/z & intensity range (each in separate containers, but of same length). More...
 
template<typename PeakTypeIterator >
void raster_interpolate (PeakTypeIterator raw_it, PeakTypeIterator raw_end, PeakTypeIterator resampled_start, PeakTypeIterator resampled_end)
 Applies the resampling algorithm using a linear interpolation. More...
 
- Public Member Functions inherited from LinearResampler
 LinearResampler ()
 Constructor. More...
 
 ~LinearResampler () override
 Destructor. More...
 
void raster (MSSpectrum &spectrum) const
 Applies the resampling algorithm to an MSSpectrum, without alignment between spectra. More...
 
void rasterExperiment (PeakMap &exp)
 Resamples the data in an MSExperiment, without alignment between spectra. More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
virtual ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void setLogger (ProgressLoggerImpl *logger)
 Sets the logger to be used for progress logging. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress (UInt64 bytes_processed=0) const
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 

Protected Member Functions

void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
template<typename PeakType >
void populate_raster_ (std::vector< PeakType > &resampled_peak_container, double start_pos, double end_pos, int number_resampled_points)
 Generate raster for resampled peak container. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Protected Attributes

bool ppm_
 Spacing of the resampled data. More...
 
- Protected Attributes inherited from LinearResampler
double spacing_
 Spacing of the resampled data. More...
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
 Writes all parameters to meta values. More...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Linear Resampling of raw data with alignment.

This class can be used to generate uniform data from non-uniform raw data (e.g. ESI-TOF or MALDI-TOF experiments). Therefore the intensity at every position x in the input raw data is spread to the two adjacent resampling points. This method preserves the area of the input signal and also the centroid position of a peak. Therefore it is recommended for quantitation as well as for ProteinIdentification experiments.

In addition to the LinearResampler, this class also allows to fix the points at which resampling will occur. This is useful if the resampling points are known in advance, e.g. if one needs to resample a chromatogram at the positions of another chromatogram.

Constructor & Destructor Documentation

◆ LinearResamplerAlign()

Member Function Documentation

◆ populate_raster_()

void populate_raster_ ( std::vector< PeakType > &  resampled_peak_container,
double  start_pos,
double  end_pos,
int  number_resampled_points 
)
inlineprotected

Generate raster for resampled peak container.

References Peak2D::setIntensity().

◆ raster() [1/3]

void raster ( ConstPeakTypeIterator  mz_raw_it,
ConstPeakTypeIterator  mz_raw_end,
ConstPeakTypeIterator  int_raw_it,
ConstPeakTypeIterator  int_raw_end,
ConstPeakTypeIterator  mz_resample_it,
ConstPeakTypeIterator  mz_resample_end,
PeakTypeIterator  int_resample_it,
PeakTypeIterator  int_resample_end 
)
inline

Resample points (with m/z and intensity in separate containers, but of same length) from an input range onto a prepopulated output m/z & intensity range (each in separate containers, but of same length).

This will use the raster provided by the output container, i.e. with alignment, to resample the data provided in the input container. The intensities will be added to the intensities in the output container (which in most cases will be zero).

The intensities will be distributed between the two closest resampling points, thus conserving the sum of intensity over the whole container.

Note that all intensity in the input data container that is in peaks outside the range of the output container will simply be added to the first or last data point.

Parameters
mz_raw_itStart of the input container to be resampled (containing the m/z data)
mz_raw_endEnd of the input container to be resampled (containing the m/z data)
int_raw_itStart of the input container to be resampled (containing the intensity data)
int_raw_endEnd of the input container to be resampled (containing the intensity data)
mz_resample_itIterator pointing to start of the output spectrum range (m/z which need to be populated)
mz_resample_endIterator pointing to end of the output spectrum range (m/z which need to be populated)
int_resample_itIterator pointing to start of the output spectrum range (intensities)
int_resample_endIterator pointing to end of the output spectrum range (intensities)

References OPENMS_PRECONDITION.

◆ raster() [2/3]

void raster ( ConstPeakTypeIterator  raw_it,
ConstPeakTypeIterator  raw_end,
PeakTypeIterator  resampled_begin,
PeakTypeIterator  resampled_end 
)
inline

Resample points (e.g. Peak1D) from an input range onto a prepopulated output range with given m/z, modifying the output intensities.

This will use the raster provided by the output container, i.e. with alignment, to resample the data provided in the input container. The intensities will be added to the intensities in the output container (which in most cases will be zero).

The intensities will be distributed between the two closest resampling points, thus conserving the sum of intensity over the whole container.

Note that all intensity in the input data container that is in peaks outside the range of the output container will simply be added to the first or last data point.

Parameters
raw_itStart of the input container to be resampled (containing the data)
raw_endEnd of the input container to be resampled (containing the data)
resampled_beginIterator pointing to start of the output spectrum range (m/z need to be populated, intensities should be zero)
resampled_endIterator pointing to end of the output spectrum range (m/z need to be populated, intensities should be zero)

References OPENMS_PRECONDITION.

◆ raster() [3/3]

void raster ( PeakContainerT &  container)
inline

Applies the resampling algorithm to a container (MSSpectrum or MSChromatogram).

The container will be resampled at equally spaced points between the start and end of the container. The resampling frequency can be controlled by the "spacing" parameter.

Parameters
containerThe container to be resampled

Referenced by MRMTransitionGroupPicker::resampleChromatogram_().

◆ raster_align()

void raster_align ( PeakContainerT &  container,
double  start_pos,
double  end_pos 
)
inline

Applies the resampling algorithm to a container (MSSpectrum or MSChromatogram) with fixed coordinates.

The container will be resampled at equally spaced points between the supplied start and end positions. The resampling frequency can be controlled by the "spacing" parameter.

This allows the user to specify the grid for alignment explicitly. This is especially useful if multiple spectra or chromatograms need to be resampled according to the same raster.

Parameters
containerThe container to be resampled
start_posThe start position to be used for resampling
end_posThe end position to be used for resampling

◆ raster_interpolate()

void raster_interpolate ( PeakTypeIterator  raw_it,
PeakTypeIterator  raw_end,
PeakTypeIterator  resampled_start,
PeakTypeIterator  resampled_end 
)
inline

Applies the resampling algorithm using a linear interpolation.

This will use the raster provided by the output container to resample the data provided in the input container. The intensities will be added to the intensities in the output container (which in most cases will be zero).

The intensities at the resampling point is computed by a linear interpolation between the two closest resampling points.

Parameters
raw_itStart of the input (raw) spectrum to be resampled
raw_endEnd of the input (raw) spectrum to be resampled
resampled_startIterator pointing to start of the output spectrum range (m/z need to be populated, intensities should be zero)
resampled_endIterator pointing to end of the output spectrum range (m/z need to be populated, intensities should be zero)

References OPENMS_PRECONDITION.

◆ updateMembers_()

void updateMembers_ ( )
inlineoverrideprotectedvirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented from LinearResampler.

Member Data Documentation

◆ ppm_

bool ppm_
protected

Spacing of the resampled data.