OpenMS
ThresholdMower.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Mathias Walzer $
6 // $Authors: Timo Sachsenberg $
7 // --------------------------------------------------------------------------
8 //
9 #pragma once
10 
15 
16 namespace OpenMS
17 {
25  class OPENMS_DLLAPI ThresholdMower :
26  public DefaultParamHandler
27  {
28 public:
29 
30  // @name Constructors and Destructors
31  // @{
35  ~ThresholdMower() override;
36 
38  ThresholdMower(const ThresholdMower & source);
41  // @}
42 
43  // @name Accessors
44  // @{
46 
48  template <typename SpectrumType>
49  void filterSpectrum(SpectrumType & spectrum)
50  {
51  threshold_ = ((double)param_.getValue("threshold"));
52  std::vector<Size> indices;
53  for (Size i = 0; i != spectrum.size(); ++i)
54  {
55  if (spectrum[i].getIntensity() >= threshold_)
56  {
57  indices.push_back(i);
58  }
59  }
60  spectrum.select(indices);
61  }
62 
63  void filterPeakSpectrum(PeakSpectrum & spectrum);
64 
65  void filterPeakMap(PeakMap & exp);
66 
67  //TODO reimplement DefaultParamHandler::updateMembers_()
68 
69 private:
70  double threshold_;
71 
72  // @}
73  };
74 
75 }
76 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
MSSpectrum & select(const std::vector< Size > &indices)
Removes all peaks below an intensity threshold.
Definition: ThresholdMower.h:27
~ThresholdMower() override
destructor
ThresholdMower(const ThresholdMower &source)
copy constructor
void filterPeakSpectrum(PeakSpectrum &spectrum)
ThresholdMower & operator=(const ThresholdMower &source)
assignment operator
void filterPeakMap(PeakMap &exp)
ThresholdMower()
default constructor
void filterSpectrum(SpectrumType &spectrum)
Definition: ThresholdMower.h:49
double threshold_
Definition: ThresholdMower.h:70
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19