OpenMS
FeatureOverlapFilter.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Julianus Pfeuffer $
6 // $Authors: Julianus Pfeuffer $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 
13 namespace OpenMS
14 {
15  class OPENMS_DLLAPI FeatureOverlapFilter
16  {
17  public:
18  /*
19  @brief Filter overlapping features using a spatial datastructure (quadtree).
20  Retains only the best feature in each cluster of overlapping features.
21 
22  @param FeatureComparator must implement the concept of a less comparator.
23  If several features overlap, the feature that evaluates as "smallest" is considered the best (according to the passed comparator) and is kept.
24  The other overlapping features are removed and FeatureOverlapCallback evaluated on them.
25  Default: overall feature quality.
26 
27  @param FeatureOverlapCallback(best_in_cluster, f) is called if a feature f overlaps with a feature best_in_cluster.
28  FeatureOverlapCallback provides a customization point to e.g.:
29  - transfer information from the soon-to-be-removed feature f over to the best_in_cluster feature
30  - gather overlap statistics
31  - help in debugging
32  - etc.
33  in form of a callable.
34  If the FeatureOverlapCallback returns false, the overlapping feature will be treated as not overlapping with best_in_cluster (and not removed).
35  Default: function that just returns true.
36 
37  @ingroup Datareduction
38  */
39  static void filter(FeatureMap& fmap,
40  std::function<bool(const Feature&, const Feature&)> FeatureComparator = [](const Feature& left, const Feature& right){ return left.getOverallQuality() > right.getOverallQuality(); },
41  std::function<bool(Feature&, Feature&)> FeatureOverlapCallback = [](Feature&, Feature&){ return true; },
42  bool check_overlap_at_trace_level = true);
43  };
44 
45 }
46 
47 
A container for features.
Definition: FeatureMap.h:80
Definition: FeatureOverlapFilter.h:16
static void filter(FeatureMap &fmap, std::function< bool(const Feature &, const Feature &)> FeatureComparator=[](const Feature &left, const Feature &right){ return left.getOverallQuality() > right.getOverallQuality();}, std::function< bool(Feature &, Feature &)> FeatureOverlapCallback=[](Feature &, Feature &){ return true;}, bool check_overlap_at_trace_level=true)
An LC-MS feature.
Definition: Feature.h:46
QualityType getOverallQuality() const
Non-mutable access to the overall quality.
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19