Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Feature.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-2013.
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: Erhan Kenar $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_KERNEL_FEATURE_H
36 #define OPENMS_KERNEL_FEATURE_H
37 
41 
42 namespace OpenMS
43 {
44 
66  class OPENMS_DLLAPI Feature :
67  public BaseFeature
68  {
69 public:
73  Feature();
75 
77  Feature(const Feature & feature);
78 
80  ~Feature();
82 
84 
85  QualityType getOverallQuality() const;
87 
89  void setOverallQuality(QualityType q);
90 
92  QualityType getQuality(Size index) const;
94  void setQuality(Size index, QualityType q);
95 
98 
100  const ModelDescription<2> & getModelDescription() const;
101 
103  ModelDescription<2> & getModelDescription();
104 
106  void setModelDescription(const ModelDescription<2> & q);
108 
110 
111  const std::vector<ConvexHull2D> & getConvexHulls() const;
114  std::vector<ConvexHull2D> & getConvexHulls();
116  void setConvexHulls(const std::vector<ConvexHull2D> & hulls);
117 
123  ConvexHull2D & getConvexHull() const;
124 
126  bool encloses(DoubleReal rt, DoubleReal mz) const;
128 
130  Feature & operator=(const Feature & rhs);
131 
133  bool operator==(const Feature & rhs) const;
134 
136  const std::vector<Feature> & getSubordinates() const;
137 
139  std::vector<Feature> & getSubordinates();
140 
142  void setSubordinates(const std::vector<Feature> & rhs);
143 
156  template <typename Type>
157  Size applyMemberFunction(Size (Type::* member_function)())
158  {
159  Size assignments = 0;
160  assignments += ((*this).*member_function)();
161  for (std::vector<Feature>::iterator iter = subordinates_.begin(); iter != subordinates_.end(); ++iter)
162  {
163  assignments += iter->applyMemberFunction(member_function);
164  }
165  return assignments;
166  }
167 
169  template <typename Type>
170  Size applyMemberFunction(Size (Type::* member_function)() const) const
171  {
172  Size assignments = 0;
173  assignments += ((*this).*member_function)();
174  for (std::vector<Feature>::const_iterator iter = subordinates_.begin(); iter != subordinates_.end(); ++iter)
175  {
176  assignments += iter->applyMemberFunction(member_function);
177  }
178  return assignments;
179  }
180 
181 protected:
182 
184  QualityType qualities_[2];
185 
188 
190  std::vector<ConvexHull2D> convex_hulls_;
191 
194 
197 
199  std::vector<Feature> subordinates_;
200  };
201 
202 } // namespace OpenMS
203 
204 #endif // OPENMS_KERNEL_FEATURE_H
Size applyMemberFunction(Size(Type::*member_function)())
Applies a member function of Type to the feature (including subordinates). The returned values are ac...
Definition: Feature.h:157
Compare by quality.
Definition: BaseFeature.h:108
Size applyMemberFunction(Size(Type::*member_function)() const) const
The &quot;const&quot; variant.
Definition: Feature.h:170
QualityLess OverallQualityLess
Compare by quality.
Definition: Feature.h:97
A 2-dimensional hull representation in [counter]clockwise direction - depending on axis labelling...
Definition: ConvexHull2D.h:75
A basic LC-MS feature.
Definition: BaseFeature.h:55
ModelDescription< 2 > model_desc_
Description of the theoretical model the feature was constructed with.
Definition: Feature.h:187
ConvexHull2D convex_hull_
Overall convex hull of the feature.
Definition: Feature.h:196
std::vector< ConvexHull2D > convex_hulls_
Array of convex hulls (one for each mass trace)
Definition: Feature.h:190
std::vector< Feature > subordinates_
subordinate features (e.g. features that the ModelFitter discarded due to inferior quality) ...
Definition: Feature.h:199
An LC-MS feature.
Definition: Feature.h:66
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
bool convex_hulls_modified_
Flag that indicates if the overall convex hull needs to be recomputed (i.e. mass trace convex hulls w...
Definition: Feature.h:193

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:13 using doxygen 1.8.5