OpenMS  3.0.0
TransformationDescription.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-2022.
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: Clemens Groepl, Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
40 #include <iosfwd>
41 #include <map>
42 
43 namespace OpenMS
44 {
62  class OPENMS_DLLAPI TransformationDescription
63  {
64  // friend class MapAlignmentAlgorithm;
65 
66 public:
67 
73  {
74  // default constructor
75  TransformationStatistics() = default;
76 
77  // copy constructor
79 
80  // copy assignment
81  TransformationStatistics& operator=(const TransformationStatistics& rhs) = default;
82 
83  std::vector<Size> percents = {100, 99, 95, 90, 75, 50, 25}; // TODO: use constexpr array
84  double xmin = 0;
85  double xmax = 0;
86  double ymin = 0;
87  double ymax = 0;
88 
89  std::map<Size, double> percentiles_before;
90  std::map<Size, double> percentiles_after;
91  };
92 
93 
98 
101 
103  explicit TransformationDescription(const DataPoints& data);
104 
107 
112 
114  void fitModel(const String& model_type, const Param& params = Param());
115 
122  double apply(double value) const;
123 
125  const String& getModelType() const;
126 
128  static void getModelTypes(StringList& result);
129 
135  void setDataPoints(const DataPoints& data);
136 
142  void setDataPoints(const std::vector<std::pair<double, double> >& data);
143 
145  const DataPoints& getDataPoints() const;
146 
148  const Param& getModelParameters() const;
149 
151  void invert();
152 
160  void getDeviations(std::vector<double>& diffs, bool do_apply = false,
161  bool do_sort = true) const;
162 
164  TransformationStatistics getStatistics() const;
165 
167  void printSummary(std::ostream& os) const;
168 
169 protected:
176  };
177 
178 } // end of namespace OpenMS
179 
OpenMS::TransformationDescription::data_
DataPoints data_
Data points.
Definition: TransformationDescription.h:171
TransformationModel.h
OpenMS::TransformationDescription::model_
TransformationModel * model_
Pointer to model.
Definition: TransformationDescription.h:175
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::TransformationDescription::TransformationStatistics::percentiles_after
std::map< Size, double > percentiles_after
percentiles of x/y deviations after transformation
Definition: TransformationDescription.h:90
ListUtils.h
OpenMS::TransformationDescription::TransformationStatistics
Summary statistics before/after applying the transformation. For deviations before/after transformati...
Definition: TransformationDescription.h:72
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::TransformationDescription::DataPoint
TransformationModel::DataPoint DataPoint
Coordinate pair.
Definition: TransformationDescription.h:95
OpenMS::TransformationModel
Base class for transformation models.
Definition: TransformationModel.h:54
Param.h
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::TransformationDescription::TransformationStatistics::percentiles_before
std::map< Size, double > percentiles_before
percentiles of x/y deviations before transformation
Definition: TransformationDescription.h:89
OpenMS::TransformationDescription::model_type_
String model_type_
Type of model.
Definition: TransformationDescription.h:173
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::TransformationModel::DataPoints
std::vector< DataPoint > DataPoints
Vector of coordinate pairs.
Definition: TransformationModel.h:91
OpenMS::TransformationModel::DataPoint
Coordinate pair (with optional annotation)
Definition: TransformationModel.h:58
OpenMS::TransformationDescription::DataPoints
TransformationModel::DataPoints DataPoints
Vector of coordinate pairs.
Definition: TransformationDescription.h:97
OpenMS::TransformationDescription
Generic description of a coordinate transformation.
Definition: TransformationDescription.h:62