Chemical Data Processing Library C++ API - Version 1.1.1
SpatialFeatureMapping.hpp
Go to the documentation of this file.
1 /*
2  * SpatialFeatureMappingExtractor.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_PHARM_SPATIALFEATUREMAPPING_HPP
30 #define CDPL_PHARM_SPATIALFEATUREMAPPING_HPP
31 
32 #include <utility>
33 #include <unordered_map>
34 #include <functional>
35 
36 #include <boost/functional/hash.hpp>
37 
38 #include "CDPL/Pharm/APIPrefix.hpp"
40 #include "CDPL/Math/Matrix.hpp"
41 
42 
43 namespace CDPL
44 {
45 
46  namespace Pharm
47  {
48 
49  class FeatureContainer;
50 
55  {
56 
57  public:
61  typedef std::function<bool(const Feature&, const Feature&)> TypeMatchFunction;
62 
66  typedef std::function<double(const Feature&, const Feature&, const Math::Matrix4D&)> PositionMatchFunction;
67 
71  typedef std::function<double(const Feature&, const Feature&, const Math::Matrix4D&)> GeometryMatchFunction;
72 
78  SpatialFeatureMapping(bool query_mode = false);
79 
85 
91 
97 
103 
109 
115 
116  double getPositionMatchScore(const Feature& ref_ftr, const Feature& aligned_ftr) const;
117 
118  double getGeometryMatchScore(const Feature& ref_ftr, const Feature& aligned_ftr) const;
119 
120  void perceive(const FeatureContainer& ref_ftrs, const FeatureContainer& aligned_ftrs, const Math::Matrix4D& xform);
121 
122  private:
123  typedef std::pair<const Feature*, const Feature*> FeaturePair;
124  typedef std::unordered_map<FeaturePair, double, boost::hash<FeaturePair> > FeaturePairToScoreMap;
125 
126  TypeMatchFunction typeMatchFunc;
127  PositionMatchFunction posMatchFunc;
128  GeometryMatchFunction geomMatchFunc;
129  FeaturePairToScoreMap posMatchScores;
130  FeaturePairToScoreMap geomMatchScores;
131  };
132  } // namespace Pharm
133 } // namespace CDPL
134 
135 #endif // CDPL_PHARM_SPATIALFEATUREMAPPING_HPP
CDPL::Pharm::SpatialFeatureMapping::getPositionMatchFunction
const PositionMatchFunction & getPositionMatchFunction() const
Returns the function that was registered for checking the proximity of mapped feature positions.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_PHARM_API.
FeatureMapping.hpp
Definition of the type CDPL::Pharm::FeatureMapping.
CDPL_PHARM_API
#define CDPL_PHARM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Pharm::FeatureMapping
A data type for the storage and lookup of arbitrary feature to feature mappings.
Definition: FeatureMapping.hpp:54
CMatrix< double, 4, 4 >
CDPL::Pharm::SpatialFeatureMapping::SpatialFeatureMapping
SpatialFeatureMapping(bool query_mode=false)
Constructs a SpatialFeatureMapping instance.
CDPL::Pharm::SpatialFeatureMapping::PositionMatchFunction
std::function< double(const Feature &, const Feature &, const Math::Matrix4D &)> PositionMatchFunction
A generic wrapper class used to store a user-defined feature position match function.
Definition: SpatialFeatureMapping.hpp:66
CDPL::Pharm::SpatialFeatureMapping
SpatialFeatureMapping.
Definition: SpatialFeatureMapping.hpp:55
CDPL::Pharm::SpatialFeatureMapping::getGeometryMatchScore
double getGeometryMatchScore(const Feature &ref_ftr, const Feature &aligned_ftr) const
CDPL::Pharm::SpatialFeatureMapping::getGeometryMatchFunction
const GeometryMatchFunction & getGeometryMatchFunction() const
Returns the function that was registered for checking the match of mapped feature geometries.
CDPL::Pharm::SpatialFeatureMapping::getPositionMatchScore
double getPositionMatchScore(const Feature &ref_ftr, const Feature &aligned_ftr) const
CDPL::Pharm::SpatialFeatureMapping::setPositionMatchFunction
void setPositionMatchFunction(const PositionMatchFunction &func)
Specifies a function for checking the proximity of mapped feature positions.
bool
CDPL::Pharm::FeatureContainer
FeatureContainer.
Definition: FeatureContainer.hpp:53
double
CDPL::Pharm::SpatialFeatureMapping::perceive
void perceive(const FeatureContainer &ref_ftrs, const FeatureContainer &aligned_ftrs, const Math::Matrix4D &xform)
CDPL::Pharm::SpatialFeatureMapping::setGeometryMatchFunction
void setGeometryMatchFunction(const GeometryMatchFunction &func)
Specifies a function for checking the match of mapped feature geometries.
CDPL::Pharm::SpatialFeatureMapping::TypeMatchFunction
std::function< bool(const Feature &, const Feature &)> TypeMatchFunction
A generic wrapper class used to store a user-defined feature type match function.
Definition: SpatialFeatureMapping.hpp:61
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Pharm::SpatialFeatureMapping::setTypeMatchFunction
void setTypeMatchFunction(const TypeMatchFunction &func)
Specifies a function for testing the type compatibility of features.
CDPL::Pharm::SpatialFeatureMapping::GeometryMatchFunction
std::function< double(const Feature &, const Feature &, const Math::Matrix4D &)> GeometryMatchFunction
A generic wrapper class used to store a user-defined feature geometry match function.
Definition: SpatialFeatureMapping.hpp:71
Matrix.hpp
Definition of matrix data types.
CDPL::Pharm::SpatialFeatureMapping::getTypeMatchFunction
const TypeMatchFunction & getTypeMatchFunction() const
Returns the function that was registered for testing the type compatibility of the features.
CDPL::Pharm::Feature
Feature.
Definition: Feature.hpp:48