OpenMS
2.8.0
|
This class implements baseline filtering operations using methods from mathematical morphology. More...
#include <OpenMS/FILTERING/BASELINE/MorphologicalFilter.h>
Public Member Functions | |
MorphologicalFilter () | |
Constructor. More... | |
~MorphologicalFilter () override | |
Destructor. More... | |
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. More... | |
void | filter (MSSpectrum &spectrum) |
Applies the morphological filtering operation to an MSSpectrum. More... | |
void | filterExperiment (PeakMap &exp) |
Applies the morphological filtering operation to an MSExperiment. More... | |
Public Member Functions inherited from ProgressLogger | |
ProgressLogger () | |
Constructor. More... | |
virtual | ~ProgressLogger () |
Destructor. More... | |
ProgressLogger (const ProgressLogger &other) | |
Copy constructor. More... | |
ProgressLogger & | operator= (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... | |
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... | |
virtual DefaultParamHandler & | operator= (const DefaultParamHandler &rhs) |
Assignment operator. More... | |
virtual bool | operator== (const DefaultParamHandler &rhs) const |
Equality operator. More... | |
void | setParameters (const Param ¶m) |
Sets the parameters. More... | |
const Param & | getParameters () const |
Non-mutable access to the parameters. More... | |
const Param & | getDefaults () const |
Non-mutable access to the default parameters. More... | |
const String & | getName () 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... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Protected Member Functions inherited from DefaultParamHandler | |
virtual void | updateMembers_ () |
This method is used to update extra member variables at the end of the setParameters() method. More... | |
void | defaultsToParam_ () |
Updates the parameters after the defaults have been set in the constructor. More... | |
Protected Attributes | |
UInt | struct_size_in_datapoints_ |
Member for struct size in data points. More... | |
Protected Attributes inherited from ProgressLogger | |
LogType | type_ |
time_t | last_invoke_ |
ProgressLoggerImpl * | current_logger_ |
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< String > | subsections_ |
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... | |
Private Member Functions | |
MorphologicalFilter (const MorphologicalFilter &source) | |
copy constructor not implemented More... | |
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_ |
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.0 | 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. |
|
inline |
Constructor.
|
inlineoverride |
Destructor.
|
private |
copy constructor not implemented
|
inlineprotected |
Applies dilation. This implementation uses van Herk's method. Only 3 min/max comparisons are required per data point, independent of struc_size.
|
inlineprotected |
Applies dilation. Simple implementation, possibly faster if struc_size is very small, and used in some special cases.
|
inlineprotected |
Applies erosion. This implementation uses van Herk's method. Only 3 min/max comparisons are required per data point, independent of struc_size.
|
inlineprotected |
Applies erosion. Simple implementation, possibly faster if struc_size is very small, and used in some special cases.
|
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::PROFILE, and SpectrumSettings::setType().
|
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.
References MSExperiment::size().
|
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 parameter. |
|
protected |
Member for struct size in data points.