Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

Feature.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Erhan Kenar $
00032 // $Authors: $
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 } // namespace OpenMS
00203 
00204 #endif // OPENMS_KERNEL_FEATURE_H

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:39 using doxygen 1.7.1