IMP  2.0.0
The Integrative Modeling Platform
EnvelopeScore.h
Go to the documentation of this file.
1 /**
2  * \file EnvelopeScore.h
3  * \brief class for envelope based scoring using MapDistanceTransform
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_ENVELOPE_SCORE_H
10 #define IMPEM_ENVELOPE_SCORE_H
11 
12 #include <IMP/em/em_config.h>
14 #include <IMP/base/Object.h>
15 
16 #include <vector>
17 
18 IMPEM_BEGIN_NAMESPACE
19 
20 //! class for envelope based scoring using MapDistanceTransform
21 class IMPEMEXPORT EnvelopeScore : public IMP::base::Object {
22 public:
23  // init with MapDistanceTransform
25 
26  /** check for penetration with respect to the envelope as defined
27  by the distance transform
28  \param [in] points - check this set of points for penetration
29  \param [in] penetration_thr - threshold that defines penetration
30  use penetration_thr=0 to require for all points inside the envelope
31  to allow some penetration set the threshold to the -distance of
32  the allowed penetration distance. Recommended value is map
33  resolution.
34  */
35  bool is_penetrating(const std::vector<IMP::algebra::Vector3D>& points,
36  float penetration_thr) const;
37 
38  /** same as above
39  \param [in] trans - apply this transformation on points before
40  checking for penetrations
41  */
42  bool is_penetrating(const std::vector<IMP::algebra::Vector3D>& points,
43  const IMP::algebra::Transformation3D& trans,
44  float penetration_thr) const;
45 
46  /**
47  score points with respect to the distance transform
48  the score awards points that fall into the envelope
49  and penalizes for points outside the envelope
50  */
51  double score(const std::vector<IMP::algebra::Vector3D>& points) const;
52 
53  /** same as above
54  \param [in] trans - apply this transformation on points before scoring
55  */
56  double score(const std::vector<IMP::algebra::Vector3D>& points,
57  const IMP::algebra::Transformation3D& trans) const;
58 
59  // methods required by Object
61  return IMP::base::VersionInfo(get_module_name(), get_module_version());
62  }
63 
64  ~EnvelopeScore() {}
65 
66  private:
67  unsigned int find_range(float distance) const {
68  for(unsigned int i=0; i< ranges_.size(); i++)
69  if(distance <= ranges_[i]) return i;
70  return ranges_.size();
71  }
72 
73  private:
74  const MapDistanceTransform* mdt_;
75  std::vector<float> ranges_;
76  std::vector<int> weights_;
77  std::vector<long> inner_voxels_;
78  std::vector<long> neighbors_;
79 };
80 
81 IMPEM_END_NAMESPACE
82 
83 #endif /* IMPEM_ENVELOPE_SCORE_H */