OpenMS
LinearResamplerAlign Class Reference

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

#include <OpenMS/FILTERING/TRANSFORMERS/LinearResamplerAlign.h>

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

Public Member Functions

 LinearResamplerAlign ()
 
template<class SpecT >
void raster (SpecT &container)
 Applies the resampling algorithm to a container (MSSpectrum or MSChromatogram). More...
 
template<typename SpecT >
void raster_align (SpecT &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 resample_it, PeakTypeIterator resample_end)
 Applies the resampling algorithm. More...
 
template<typename PeakTypeIterator , typename ConstPeakTypeIterator >
void raster (ConstPeakTypeIterator mz_raw_it, ConstPeakTypeIterator mz_raw_end, ConstPeakTypeIterator int_raw_it, ConstPeakTypeIterator, PeakTypeIterator mz_resample_it, PeakTypeIterator mz_resample_end, PeakTypeIterator int_resample_it, PeakTypeIterator)
 Applies the resampling algorithm. More...
 
template<typename PeakTypeIterator >
void raster_interpolate (PeakTypeIterator raw_it, PeakTypeIterator raw_end, PeakTypeIterator resample_it, 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. More...
 
void rasterExperiment (PeakMap &exp)
 Resamples the data in an MSExperiment. 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 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 () const
 Ends the progress display. More...
 
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 Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. 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(), and Peak2D::setMZ().

◆ raster() [1/3]

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

Applies the resampling algorithm.

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 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_itIterator 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_itIterator pointing to end of the output spectrum range (intensities)

References OPENMS_PRECONDITION.

◆ raster() [2/3]

void raster ( ConstPeakTypeIterator  raw_it,
ConstPeakTypeIterator  raw_end,
PeakTypeIterator  resample_it,
PeakTypeIterator  resample_end 
)
inline

Applies the resampling algorithm.

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 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)
resample_itIterator pointing to start of the output spectrum range (m/z need to be populated, intensities should be zero)
resample_itIterator 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 ( SpecT &  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 ( SpecT &  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  resample_it,
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
resample_itIterator pointing to start of the output spectrum range (m/z need to be populated, intensities should be zero)
resample_itIterator 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.