Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

MorphologicalFilter Class Reference
[SignalProcessing]

This class implements baseline filtering operations using methods from mathematical morphology. More...

#include <OpenMS/FILTERING/BASELINE/MorphologicalFilter.h>

Inheritance diagram for MorphologicalFilter:
ProgressLogger DefaultParamHandler

List of all members.

Public Member Functions

 MorphologicalFilter ()
 Constructor.
virtual ~MorphologicalFilter ()
 Destructor.
template<typename InputIterator , typename OutputIterator >
void filterRange (InputIterator input_begin, InputIterator input_end, OutputIterator output_begin)
 Applies the morphological filtering operation to an iterator range.
template<typename PeakType >
void filter (MSSpectrum< PeakType > &spectrum)
 Applies the morphological filtering operation to an MSSpectrum.
template<typename PeakType >
void filterExperiment (MSExperiment< PeakType > &exp)
 Applies the morphological filtering operation to an MSExperiment.

Protected Member Functions

template<typename InputIterator , typename OutputIterator >
void applyErosion_ (Int struc_size, InputIterator input, InputIterator input_end, OutputIterator output)
 Applies erosion. This implementation uses van Herk's method. Only 3 min/max comparisons are required per data point, independent of struc_size.
template<typename InputIterator , typename OutputIterator >
void applyDilation_ (Int struc_size, InputIterator input, InputIterator input_end, OutputIterator output)
 Applies dilation. This implementation uses van Herk's method. Only 3 min/max comparisons are required per data point, independent of struc_size.
template<typename InputIterator , typename OutputIterator >
void applyErosionSimple_ (Int struc_size, InputIterator input_begin, InputIterator input_end, OutputIterator output_begin)
 Applies erosion. Simple implementation, possibly faster if struc_size is very small, and used in some special cases.
template<typename InputIterator , typename OutputIterator >
void applyDilationSimple_ (Int struc_size, InputIterator input_begin, InputIterator input_end, OutputIterator output_begin)
 Applies dilation. Simple implementation, possibly faster if struc_size is very small, and used in some special cases.

Protected Attributes

UInt struct_size_in_datapoints_
 Member for struct size in data points.

Private Member Functions

 MorphologicalFilter (const MorphologicalFilter &source)
 copy constructor not implemented

Detailed Description

This class implements baseline filtering operations using methods from mathematical morphology.

The fundamental operations are erosion and dilation. These are defined with respect to a structuring element. In our case, this is just a straight line and the definitions can be given as follows:

Assume that the input is $x_0, x_1, x_2, ...$. Then the erosion of $x$ contains the minima of a sliding window of size struc_size around $ i $, i.e.

\[ \mathrm{erosion}_i = \min\{x_{i-\mathrm{struc\_size}/2}, \ldots, x_{i+\mathrm{struc\_size}/2}\} \]

. The dilation of $x$ contains the maxima of a sliding window of size struc_size around $ i $, i.e.

\[ \mathrm{dilation}_i = \max\{x_{i-\mathrm{struc\_size}/2}, \ldots, x_{i+\mathrm{struc\_size}/2}\} \]

.

For morphological baseline filtering the tophat method is used. The tophat transform is defined as signal minus opening, where the opening is the dilation of the erosion of the signal.

MorphologicalFilter_tophat.png

Several other morphological operations are implemented as well. See the image below and the documentation for further explanation.

MorphologicalFilter_all.png
Note:
The class MorphologicalFilter is designed for uniformly spaced profile data.
The data must be sorted according to ascending m/z!
Parameters of this class are:

NameTypeDefaultRestrictionsDescription
struc_elem_length float3  Length of the structuring element. This should be wider than the expected peak width.
struc_elem_unit stringThomson Thomson, DataPointsThe unit of the 'struct_elem_length'.
method stringtophat identity, erosion, dilation, opening, closing, gradient, tophat, bothat, erosion_simple, dilation_simpleMethod to use, the default is 'tophat'. Do not change this unless you know what you are doing. The other methods may be useful for tuning the parameters, see the class documentation of MorpthologicalFilter.

Note:

Constructor & Destructor Documentation

MorphologicalFilter (  )  [inline]

Constructor.

References StringList::create().

virtual ~MorphologicalFilter (  )  [inline, virtual]

Destructor.

MorphologicalFilter ( const MorphologicalFilter source  )  [private]

copy constructor not implemented


Member Function Documentation

void applyDilation_ ( Int  struc_size,
InputIterator  input,
InputIterator  input_end,
OutputIterator  output 
) [inline, protected]

Applies dilation. This implementation uses van Herk's method. Only 3 min/max comparisons are required per data point, independent of struc_size.

void applyDilationSimple_ ( Int  struc_size,
InputIterator  input_begin,
InputIterator  input_end,
OutputIterator  output_begin 
) [inline, protected]

Applies dilation. Simple implementation, possibly faster if struc_size is very small, and used in some special cases.

void applyErosion_ ( Int  struc_size,
InputIterator  input,
InputIterator  input_end,
OutputIterator  output 
) [inline, protected]

Applies erosion. This implementation uses van Herk's method. Only 3 min/max comparisons are required per data point, independent of struc_size.

void applyErosionSimple_ ( Int  struc_size,
InputIterator  input_begin,
InputIterator  input_end,
OutputIterator  output_begin 
) [inline, protected]

Applies erosion. Simple implementation, possibly faster if struc_size is very small, and used in some special cases.

void filter ( MSSpectrum< PeakType > &  spectrum  )  [inline]

Applies the morphological filtering operation to an MSSpectrum.

If the size of the structuring element is given in 'Thomson', the number of data points for the structuring element is computed as follows:

  • The data points are assumed to be uniformly spaced. We compute the average spacing from the position of the first and the last peak and the total number of peaks in the input range.
  • The number of data points in the structuring element is computed from struc_size and the average spacing, and rounded up to an odd number.

References OpenMS::Internal::intensityIteratorWrapper(), OpenMS::Math::isOdd(), SpectrumSettings::RAWDATA, and SpectrumSettings::setType().

void filterExperiment ( MSExperiment< PeakType > &  exp  )  [inline]

Applies the morphological filtering operation to an MSExperiment.

The size of the structuring element is computed for each spectrum individually, if it is given in 'Thomson'. See the filtering method for MSSpectrum for details.

void filterRange ( InputIterator  input_begin,
InputIterator  input_end,
OutputIterator  output_begin 
) [inline]

Applies the morphological filtering operation to an iterator range.

Input and output range must be valid, i.e. allocated before. InputIterator must be a random access iterator type.

Parameters:
input_begin the begin of the input range
input_end the end of the input range
output_begin the begin of the output range
Exceptions:
Exception::IllegalArgument The given method is not one of the values defined in the method paramter.

Member Data Documentation

Member for struct size in data points.


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:53 using doxygen 1.7.1