This class implements baseline filtering operations using methods from mathematical morphology. More...
#include <OpenMS/FILTERING/BASELINE/MorphologicalFilter.h>
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 | |
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
. Then the erosion of
contains the minima of a sliding window of size struc_size around
, i.e.
. The dilation of
contains the maxima of a sliding window of size struc_size around
, i.e.
.
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.
Several other morphological operations are implemented as well. See the image below and the documentation for further explanation.
| Name | Type | Default | Restrictions | Description |
|---|---|---|---|---|
| struc_elem_length | float | 3 | Length of the structuring element. This should be wider than the expected peak width. | |
| struc_elem_unit | string | Thomson | Thomson, DataPoints | The unit of the 'struct_elem_length'. |
| method | string | tophat | identity, erosion, dilation, opening, closing, gradient, tophat, bothat, erosion_simple, dilation_simple | Method 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. |
| MorphologicalFilter | ( | ) | [inline] |
Constructor.
References StringList::create().
| virtual ~MorphologicalFilter | ( | ) | [inline, virtual] |
Destructor.
| MorphologicalFilter | ( | const MorphologicalFilter & | source | ) | [private] |
copy constructor not implemented
| 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:
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.
| input_begin | the begin of the input range | |
| input_end | the end of the input range | |
| output_begin | the begin of the output range |
| Exception::IllegalArgument | The given method is not one of the values defined in the method paramter. |
UInt struct_size_in_datapoints_ [protected] |
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 |