IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
PathMapHeader.h
Go to the documentation of this file.
1 /**
2  * \file IMP/bff/PathMapHeader.h
3  * \brief Header class for path search class PathMap
4  *
5  * \authors Thomas-Otavio Peulen
6  * Copyright 2007-2022 IMP Inventors. All rights reserved.
7  *
8  */
9 #ifndef IMPBFF_PATHMAPHEADER_H
10 #define IMPBFF_PATHMAPHEADER_H
11 
12 #include <IMP/bff/bff_config.h>
13 
14 #include <cmath> /* ceil */
15 
16 #include <IMP/Particle.h>
17 #include <IMP/algebra/Vector3D.h>
18 #include <IMP/atom/Atom.h>
19 #include <IMP/atom/Hierarchy.h>
20 #include <IMP/atom/Selection.h>
21 #include <IMP/em/DensityHeader.h>
22 
23 #include <IMP/bff/internal/json.h>
24 
25 #include <algorithm>
26 
27 IMPBFF_BEGIN_NAMESPACE
28 
29 
30 class PathMap;
31 
32 //!* Header class for path search class PathMap
33 class IMPBFFEXPORT PathMapHeader {
34 
35 friend class IMP::bff::PathMap;
36 
37 private:
38 
39  double grid_spacing_;
40  double max_path_length_;
41  double neighbor_radius_;
42  double obstacle_threshold_;
43 
44  IMP::em::DensityHeader density_header_;
45 
46 protected:
47 
48  IMP::algebra::Vector3D path_origin_;
49 
50 public:
51 
52  ~PathMapHeader() = default;
53 
54  /*!
55  *
56  * @param max_path_length maximum length of path (defines also size of grid)
57  * @param grid_spacing spacing between grid tiles
58  * @param neighbor_radius defines size of box around tile where other
59  * voxels are considered a neighbor
60  * @param obstacle_threshold voxels with density larger than this
61  * threshold value are considered an obstacle.
62  */
64  double max_path_length = 10.0,
65  double grid_spacing = 1.0,
66  double neighbor_radius = 2,
67  double obstacle_threshold = std::numeric_limits<double>::epsilon()
68  );
69 
70  //! Update the dimensions of the AV to be (nnx,nny,nnz)
71  //! The origin of the map does not change. If not values
72  //! are provided used linker length & radius to update.
73  /**
74  \param[in] nnx the new number of voxels on the X axis
75  \param[in] nny the new number of voxels on the Y axis
76  \param[in] nnz the new number of voxels on the Z axis
77  */
78  void update_map_dimensions(int nx=-1, int ny=-1, int nz=-1);
79 
80  /**
81  * @brief Sets the origin of the path.
82  * @param v The origin vector.
83  */
84  void set_path_origin(const IMP::algebra::Vector3D &v);
85 
86  //! Returns position of the labeling site
88  return path_origin_;
89  }
90 
91  /**
92  * @brief Get the maximum linker/path length from origin.
93  * @return The maximum linker/path length.
94  */
96  return max_path_length_;
97  }
98 
99  /**
100  * @brief Get the simulation grid resolution.
101  * @return The simulation grid resolution as a double.
102  */
103  double get_simulation_grid_resolution();
104 
105  /**
106  * @brief Set the obstacle threshold.
107  * @param obstacle_threshold The obstacle threshold value
108  */
109  void set_obstacle_threshold(double obstacle_threshold);
110 
111  /**
112  * @brief Get the obstacle threshold.
113  * @return The obstacle threshold value
114  */
115  double get_obstacle_threshold() const{
116  return obstacle_threshold_;
117  }
118 
119  /**
120  * @brief Set the neighbor radius.
121  * @param neighbor_radius The neighbor radius value
122  */
123  void set_neighbor_radius(double neighbor_radius);
124 
125  /**
126  * @brief Get the neighbor radius.
127  * @return The neighbor radius as a double.
128  */
129  double get_neighbor_radius() const{
130  return neighbor_radius_;
131  }
132 
133  /**
134  * @brief Get the size of the neighbor box.
135  * @return The size of the neighbor box
136  */
137  int get_neighbor_box_size() const;
138 
139  //! Returns a read-only pointer to the header of the map
141  return &density_header_; }
142 
143  //! Returns a pointer to the header of the map in a writable version
145  return &density_header_; }
146 
147  //! Get origin on the PathMap (the corner of the grid)
148  IMP::algebra::Vector3D get_origin() const ;
149 
150  /**
151  * @brief Get the edge length of the grid.
152  * @return The edge length of the grid as a double.
153  */
154  double get_grid_edge_length();
155 
156  //! Set origin on the PathMap (the corner of the grid)
157  void set_origin(float x, float y, float z);
158 
159  void show(std::ostream& out = std::cout) const;
160 };
161 
162 IMPBFF_END_NAMESPACE
163 
164 
165 #endif //IMPBFF_PATHMAPHEADER_H
const IMP::em::DensityHeader * get_density_header() const
Returns a read-only pointer to the header of the map.
double get_neighbor_radius() const
Get the neighbor radius.
Simple atom decorator.
Metadata for a density file.
Class to search path on grids.
Definition: PathMap.h:45
double get_max_path_length()
Get the maximum linker/path length from origin.
Definition: PathMapHeader.h:95
Decorator for helping deal with a hierarchy of molecules.
IMP::algebra::Vector3D get_path_origin() const
Returns position of the labeling site.
Definition: PathMapHeader.h:87
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
VectorD< 3 > Vector3D
Definition: VectorD.h:408
Simple 3D vector class.
void set_origin(float x, float y, float z)
Sets the origin of the header.
Select a subset of a hierarchy.
double get_obstacle_threshold() const
Get the obstacle threshold.
IMP::em::DensityHeader * get_density_header_writable()
Returns a pointer to the header of the map in a writable version.