Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TraceFitter.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-2017.
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 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_TRACEFITTER_H
36 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_TRACEFITTER_H
37 
40 #include <OpenMS/KERNEL/Peak1D.h>
41 
42 #include <Eigen/Core>
43 
44 namespace OpenMS
45 {
46 
56  class OPENMS_DLLAPI TraceFitter :
57  public DefaultParamHandler
58  {
59 
60 public:
62  //TODO: This is copy and paste from LevMarqFitter1d.h. Make a generic wrapper for LM optimization
64  {
65 public:
66  int inputs() const;
67  int values() const;
68 
69  GenericFunctor(int dimensions, int num_data_points);
70 
71  virtual ~GenericFunctor();
72 
73  virtual int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) = 0;
74  // compute Jacobian matrix for the different parameters
75  virtual int df(const Eigen::VectorXd& x, Eigen::MatrixXd& J) = 0;
76 
77 protected:
78  const int m_inputs, m_values;
79  };
80 
82  TraceFitter();
83 
85  TraceFitter(const TraceFitter& source);
86 
88  virtual TraceFitter& operator=(const TraceFitter& source);
89 
91  virtual ~TraceFitter();
92 
96  virtual void fit(FeatureFinderAlgorithmPickedHelperStructs::MassTraces& traces) = 0;
97 
101  virtual double getLowerRTBound() const = 0;
102 
106  virtual double getUpperRTBound() const = 0;
107 
111  virtual double getHeight() const = 0;
112 
116  virtual double getCenter() const = 0;
117 
121  virtual double getFWHM() const = 0;
122 
126  virtual double getValue(double rt) const = 0;
127 
134  double computeTheoretical(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace& trace, Size k);
135 
142  virtual bool checkMinimalRTSpan(const std::pair<double, double>& rt_bounds, const double min_rt_span) = 0;
143 
149  virtual bool checkMaximalRTSpan(const double max_rt_span) = 0;
150 
154  virtual double getArea() = 0;
155 
165  virtual String getGnuplotFormula(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace& trace, const char function_name, const double baseline, const double rt_shift) = 0;
166 
167 protected:
168  struct ModelData
169  {
171  bool weighted;
172  };
173 
174  virtual void updateMembers_();
175 
181  virtual void getOptimizedParameters_(const Eigen::VectorXd&) = 0;
185  void optimize_(Eigen::VectorXd& x_init, GenericFunctor& functor);
186 
190  bool weighted_;
191 
192  };
193 
194 }
195 
196 #endif // #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_TRACEFITTER_H
Definition: TraceFitter.h:63
const double k
A more convenient string class.
Definition: String.h:57
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:110
Abstract fitter for RT profile fitting.
Definition: TraceFitter.h:56
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
FeatureFinderAlgorithmPickedHelperStructs::MassTraces * traces_ptr
Definition: TraceFitter.h:170
Definition: TraceFitter.h:168
const int m_values
Definition: TraceFitter.h:78
SignedSize max_iterations_
Maximum number of iterations.
Definition: TraceFitter.h:188
bool weighted_
Whether to weight mass traces by theoretical intensity during the optimization.
Definition: TraceFitter.h:190
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
bool weighted
Definition: TraceFitter.h:171
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:80

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13