IMP logo
IMP Reference Guide  develop.36b5e40f34,2024/10/14
The Integrative Modeling Platform
EnvelopeScore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/EnvelopeScore.h
3  * \brief class for envelope based scoring using MapDistanceTransform
4  *
5  * Copyright 2007-2022 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/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::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 IMP::algebra::Vector3Ds& points,
36  float penetration_thr) const;
37 
38  /** same as above
39  \param[in] points
40  \param[in] trans apply this transformation on points before
41  checking for penetrations
42  \param[in] penetration_thr
43  */
44  bool is_penetrating(const IMP::algebra::Vector3Ds& points,
45  const IMP::algebra::Transformation3D& trans,
46  float penetration_thr) const;
47 
48  /**
49  score points with respect to the distance transform
50  the score awards points that fall into the envelope
51  and penalizes for points outside the envelope
52  */
53  double score(const IMP::algebra::Vector3Ds& points) const;
54 
55  /** same as above
56  \param[in] points
57  \param[in] trans apply this transformation on points before scoring
58  */
59  double score(const IMP::algebra::Vector3Ds& points,
60  const IMP::algebra::Transformation3D& trans) const;
61 
62  // methods required by Object
64  return IMP::VersionInfo(get_module_name(), get_module_version());
65  }
66 
67  ~EnvelopeScore() {}
68 
69  private:
70  unsigned int find_range(float distance) const {
71  for (unsigned int i = 0; i < ranges_.size(); i++)
72  // Add a small delta to handle floating point 'equals'
73  if (distance <= ranges_[i] + 1e-5) return i;
74  return ranges_.size();
75  }
76 
77  private:
78  const MapDistanceTransform* mdt_;
79  std::vector<float> ranges_;
80  std::vector<int> weights_;
81  std::vector<long> inner_voxels_;
82  std::vector<long> neighbors_;
83 };
84 
85 IMPEM_END_NAMESPACE
86 
87 #endif /* IMPEM_ENVELOPE_SCORE_H */
Simple 3D transformation class.
Class for getting the distance from the map envelope.
class for envelope based scoring using MapDistanceTransform
Definition: EnvelopeScore.h:21
Common base class for heavy weight IMP objects.
Definition: Object.h:111
Version and module information for Objects.
Definition: VersionInfo.h:29
A shared base class to help in debugging and things.
IMP::VersionInfo get_version_info() const override
Get information about the module and version of the object.
Definition: EnvelopeScore.h:63
class for computing a distance transform of the density map
std::string get_module_version()
Return the version of this module, as a string.