Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_KERNEL_FEATURE_H
00036 #define OPENMS_KERNEL_FEATURE_H
00037
00038 #include <OpenMS/KERNEL/BaseFeature.h>
00039 #include <OpenMS/DATASTRUCTURES/ConvexHull2D.h>
00040 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/ModelDescription.h>
00041
00042 namespace OpenMS
00043 {
00044
00066 class OPENMS_DLLAPI Feature :
00067 public BaseFeature
00068 {
00069 public:
00073
00074 Feature();
00075
00077 Feature(const Feature & feature);
00078
00080 ~Feature();
00082
00084
00085
00086 QualityType getOverallQuality() const;
00087
00089 void setOverallQuality(QualityType q);
00090
00092 QualityType getQuality(Size index) const;
00094 void setQuality(Size index, QualityType q);
00095
00097 typedef QualityLess OverallQualityLess;
00098
00100 const ModelDescription<2> & getModelDescription() const;
00101
00103 ModelDescription<2> & getModelDescription();
00104
00106 void setModelDescription(const ModelDescription<2> & q);
00108
00110
00111
00112 const std::vector<ConvexHull2D> & getConvexHulls() const;
00114 std::vector<ConvexHull2D> & getConvexHulls();
00116 void setConvexHulls(const std::vector<ConvexHull2D> & hulls);
00117
00123 ConvexHull2D & getConvexHull() const;
00124
00126 bool encloses(DoubleReal rt, DoubleReal mz) const;
00128
00130 Feature & operator=(const Feature & rhs);
00131
00133 bool operator==(const Feature & rhs) const;
00134
00136 const std::vector<Feature> & getSubordinates() const;
00137
00139 std::vector<Feature> & getSubordinates();
00140
00142 void setSubordinates(const std::vector<Feature> & rhs);
00143
00156 template <typename Type>
00157 Size applyMemberFunction(Size (Type::* member_function)())
00158 {
00159 Size assignments = 0;
00160 assignments += ((*this).*member_function)();
00161 for (std::vector<Feature>::iterator iter = subordinates_.begin(); iter != subordinates_.end(); ++iter)
00162 {
00163 assignments += iter->applyMemberFunction(member_function);
00164 }
00165 return assignments;
00166 }
00167
00169 template <typename Type>
00170 Size applyMemberFunction(Size (Type::* member_function)() const) const
00171 {
00172 Size assignments = 0;
00173 assignments += ((*this).*member_function)();
00174 for (std::vector<Feature>::const_iterator iter = subordinates_.begin(); iter != subordinates_.end(); ++iter)
00175 {
00176 assignments += iter->applyMemberFunction(member_function);
00177 }
00178 return assignments;
00179 }
00180
00181 protected:
00182
00184 QualityType qualities_[2];
00185
00187 ModelDescription<2> model_desc_;
00188
00190 std::vector<ConvexHull2D> convex_hulls_;
00191
00193 mutable bool convex_hulls_modified_;
00194
00196 mutable ConvexHull2D convex_hull_;
00197
00199 std::vector<Feature> subordinates_;
00200 };
00201
00202 }
00203
00204 #endif // OPENMS_KERNEL_FEATURE_H