| OpenMS 2.5.0

GaussTraceFitter.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg$
32 // $Authors: Stephan Aiche, Marc Sturm$
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/TraceFitter.h>
38
39 namespace OpenMS
40 {
41
49 class OPENMS_DLLAPI GaussTraceFitter :
50 public TraceFitter
51 {
52 public:
53 GaussTraceFitter();
54
55 GaussTraceFitter(const GaussTraceFitter& other);
56
57 GaussTraceFitter& operator=(const GaussTraceFitter& source);
58
59 ~GaussTraceFitter() override;
60
61 // override important methods
62 void fit(FeatureFinderAlgorithmPickedHelperStructs::MassTraces& traces) override;
63
64 double getLowerRTBound() const override;
65
66 double getUpperRTBound() const override;
67
68 double getHeight() const override;
69
70 double getCenter() const override;
71
72 double getFWHM() const override;
73
77 double getSigma() const;
78
79 bool checkMaximalRTSpan(const double max_rt_span) override;
80
81 bool checkMinimalRTSpan(const std::pair<double, double>& rt_bounds, const double min_rt_span) override;
82
83 double getValue(double rt) const override;
84
85 double getArea() override;
86
87 String getGnuplotFormula(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace& trace, const char function_name, const double baseline, const double rt_shift) override;
88
89 protected:
90 double sigma_;
91 double x0_;
92 double height_;
93 double region_rt_span_;
94
95 static const Size NUM_PARAMS_;
96
97 void getOptimizedParameters_(const Eigen::VectorXd& x_init) override;
98
99 class GaussTraceFunctor :
100 public TraceFitter::GenericFunctor
101 {
102 public:
103 GaussTraceFunctor(int dimensions,
104 const TraceFitter::ModelData* data);
105
106 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) override;
107
108 // compute Jacobian matrix for the different parameters
109 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& J) override;
110 protected:
111 const TraceFitter::ModelData* m_data;
112 };
113
114 void setInitialParameters_(FeatureFinderAlgorithmPickedHelperStructs::MassTraces& traces);
115
116 void updateMembers_() override;
117
118 };
119
120 } // namespace OpenMS
121
OpenMS::FeatureFinderAlgorithmPickedHelperStructs::MassTraces
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:109
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::GaussTraceFitter::sigma_
double sigma_
Definition: GaussTraceFitter.h:90
OpenMS::GaussTraceFitter::height_
double height_
Definition: GaussTraceFitter.h:92
OpenMS::GaussTraceFitter::GaussTraceFunctor::m_data
const TraceFitter::ModelData * m_data
Definition: GaussTraceFitter.h:111
OpenMS::TraceFitter
Abstract fitter for RT profile fitting.
Definition: TraceFitter.h:55
OpenMS::FeatureFinderAlgorithmPickedHelperStructs::MassTrace
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:79
OpenMS::GaussTraceFitter::GaussTraceFunctor
Definition: GaussTraceFitter.h:99
OpenMS::GaussTraceFitter::NUM_PARAMS_
static const Size NUM_PARAMS_
Definition: GaussTraceFitter.h:95
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::TraceFitter::ModelData
Definition: TraceFitter.h:167
OpenMS::TraceFitter::GenericFunctor
Definition: TraceFitter.h:62
TraceFitter.h
OpenMS::GaussTraceFitter::x0_
double x0_
Definition: GaussTraceFitter.h:91
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::GaussTraceFitter
Fitter for RT profiles using a Gaussian background model.
Definition: GaussTraceFitter.h:49
OpenMS::GaussTraceFitter::region_rt_span_
double region_rt_span_
Definition: GaussTraceFitter.h:93