libpappsomspp
Library for mass spectrometry
filterpass.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/filers/filterpass.h
3  * \date 26/04/2019
4  * \author Olivier Langella
5  * \brief collection of filters concerned by Y selection
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of the PAPPSOms++ library.
12  *
13  * PAPPSOms++ is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms++ is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25  *
26  ******************************************************************************/
27 
28 #pragma once
29 
30 #include "filterinterface.h"
31 #include <cstddef>
32 #include "../../exportinmportconfig.h"
33 
34 
35 namespace pappso
36 {
37 
38 /** @brief remove datapoints higher than a given Y value (intensity)
39  */
40 class PMSPP_LIB_DECL FilterLowPass : public FilterInterface
41 {
42  private:
43  double m_passY = 0;
44 
45  public:
46  FilterLowPass(double pass_y);
47  FilterLowPass(const FilterLowPass &other);
48  virtual ~FilterLowPass(){};
49 
50  FilterLowPass &operator=(const FilterLowPass &other);
51 
52  Trace &filter(Trace &data_points) const override;
53 };
54 
55 /** @brief remove datapoints below a given Y value (intensity)
56  */
57 class PMSPP_LIB_DECL FilterHighPass : public FilterInterface
58 {
59  private:
60  double m_passY = 0;
61 
62  public:
63  FilterHighPass(double pass_y);
64  FilterHighPass(const FilterHighPass &other);
65  virtual ~FilterHighPass(){};
66 
67  FilterHighPass &operator=(const FilterHighPass &other);
68 
69  Trace &filter(Trace &data_points) const override;
70 };
71 
72 /** @brief remove datapoints below a given intensity percentage (ratio) of the
73  * maximum intensity
74  */
76 {
77 
78  public:
79  FilterHighPassPercentage(double y_ratio);
81  virtual ~FilterHighPassPercentage(){};
82 
84 
85  Trace &filter(Trace &data_points) const override;
86 
87 
88  private:
89  double m_ratioPassY = 0;
90 };
91 
92 
93 /** @brief keep N datapoints form the greatest intensities to the lowest
94  */
96 {
97  public:
98  /** @brief constructor with the number of datapoints to keep
99  */
100  FilterGreatestY(std::size_t number_of_points = 0);
101  FilterGreatestY(const FilterGreatestY &other);
102  virtual ~FilterGreatestY(){};
103 
104  FilterGreatestY &operator=(const FilterGreatestY &other);
105  Trace &filter(Trace &data_points) const override;
106 
107  std::size_t getNumberOfPoints() const;
108 
109 
110  private:
111  std::size_t m_numberOfPoints = 0;
112 };
113 
116 {
117  private:
118  FilterGreatestY m_filterGreatestY;
119 
120  public:
121  MassSpectrumFilterGreatestItensities(std::size_t number_of_points = 0);
125 
127  operator=(const MassSpectrumFilterGreatestItensities &other);
128  MassSpectrum &filter(MassSpectrum &spectrum) const override;
129 };
130 
131 /** @brief apply std::floor (round to lowest integer) to all Y values
132  */
134 {
135 
136  public:
137  FilterFloorY();
138  FilterFloorY(const FilterFloorY &other);
139  virtual ~FilterFloorY(){};
140 
141  FilterFloorY &operator=(const FilterFloorY &other);
142  Trace &filter(Trace &data_points) const override;
143 };
144 
145 
146 /** @brief apply std::round (round to nearest integer) to all Y values
147  */
149 {
150 
151  public:
152  FilterRoundY();
153  FilterRoundY(const FilterRoundY &other);
154  virtual ~FilterRoundY(){};
155 
156  FilterRoundY &operator=(const FilterRoundY &other);
157  Trace &filter(Trace &data_points) const override;
158 };
159 
160 /** @brief rescales Y values into a dynamic range
161  * if the dynamic range is set to 0, this filter is ignored
162  */
164 {
165  private:
166  double m_dynamic = 0;
167 
168  public:
169  FilterRescaleY(double dynamic);
170  FilterRescaleY(const FilterRescaleY &other);
171  virtual ~FilterRescaleY(){};
172 
173  FilterRescaleY &operator=(const FilterRescaleY &other);
174  double getDynamicRange() const;
175 
176  Trace &filter(Trace &data_points) const override;
177 };
178 
179 
180 /** @brief rescales Y values given a tranformation factor
181  */
183 {
184  private:
185  double m_factor = 0;
186 
187  public:
188  FilterScaleFactorY(double m_factor);
190  virtual ~FilterScaleFactorY(){};
191 
192  FilterScaleFactorY &operator=(const FilterScaleFactorY &other);
193 
194  Trace &filter(Trace &data_points) const override;
195 
196  double getScaleFactorY() const;
197 };
198 
199 } // namespace pappso
pappso::FilterGreatestY
keep N datapoints form the greatest intensities to the lowest
Definition: filterpass.h:113
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
pappso
Definition: aa.cpp:38
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition: massspectrum.h:91
pappso::FilterHighPassPercentage
remove datapoints below a given intensity percentage (ratio) of the maximum intensity
Definition: filterpass.h:93
pappso::MassSpectrumFilterGreatestItensities
Definition: filterpass.h:132
pappso::FilterHighPass
remove datapoints below a given Y value (intensity)
Definition: filterpass.h:75
pappso::FilterInterface
generic interface to apply a filter on a trace
Definition: filterinterface.h:57
pappso::FilterRoundY
apply std::round (round to nearest integer) to all Y values
Definition: filterpass.h:166
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:126
filterinterface.h
pappso::MassSpectrumFilterInterface
generic interface to apply a filter on a MassSpectrum This is the same as FilterInterface,...
Definition: filterinterface.h:72
pappso::FilterRescaleY
rescales Y values into a dynamic range if the dynamic range is set to 0, this filter is ignored
Definition: filterpass.h:181
pappso::FilterScaleFactorY
rescales Y values given a tranformation factor
Definition: filterpass.h:200
pappso::FilterFloorY
apply std::floor (round to lowest integer) to all Y values
Definition: filterpass.h:151