IMP.bff
Loading...
Searching...
No Matches
PathMapTile.h
Go to the documentation of this file.
1
9#ifndef IMPBFF_PATHMAPTILE_H
10#define IMPBFF_PATHMAPTILE_H
11
12#include <IMP/bff/bff_config.h>
13
14#include <cmath> /* std::sqrt */
15#include <vector>
16#include <utility> /* std::pair */
17#include <algorithm>
18
19#include <IMP/bff/PathMap.h>
20#include <IMP/bff/PathMapTileEdge.h>
21
22IMPBFF_BEGIN_NAMESPACE
23
24const bool TILE_VISITED_DEFAULT = false;
25const float TILE_PENALTY_DEFAULT = 100000.0f;
26const float TILE_COST_DEFAULT = 100000.0f;
27const float TILE_EDGE_COST_DEFAULT = 100000.0f;
28
29const float TILE_PENALTY_THRESHOLD = 100000.0f;
30const float TILE_OBSTACLE_THRESHOLD = 0.000001f;
31const float TILE_OBSTACLE_PENALTY = 100000.0f;
32
33
46
47
48class PathMap;
49
50class IMPBFFEXPORT PathMapTile{
51
52friend class PathMap;
53
54private:
55
57
72 void update_edges(
73 IMP::bff::PathMap* av,
74 std::vector<PathMapTile> &tiles,
75 double neighbor_radius,
76 float tile_penalty_threshold = TILE_PENALTY_THRESHOLD
77 );
78
88 void update_edges_2(
89 int nx, int ny, int nz,
90 std::vector<PathMapTile>& tiles,
91 std::vector<int> neighbor_idxs,
92 float tile_penalty_threshold =TILE_PENALTY_THRESHOLD
93 );
94
95
96protected:
97
98 long idx; // tile index: corresponds to voxel index
99
100 // Variable for path search
101 float penalty; // penalty for visiting tile in a path search
102 float cost; // total cost for visiting tile in a path search (integrated cost)
103 PathMapTile* previous; // tile previously visited in path search
104
105 // Additional tile feature (e.g. av density)
106 std::map<std::string, float> features;
107
108 // Edges leaving tile and going to neighboring tiles
109 std::vector<PathMapTileEdge> edges;
110
111public:
112
114 float density;
115
117
133 explicit PathMapTile(
134 long index=-1,
135 float visit_penalty = 0.0,
136 float tile_density = 1.0
137 ) :
138 idx(index),
139 penalty(visit_penalty),
140 cost(std::numeric_limits<float>::max()),
141 previous(nullptr),
142 density(tile_density)
143 {}
144
145
150 std::vector<long> backtrack_to_path();
151
171 int value_type,
172 std::pair<float, float> bounds = std::pair<float, float>(
173 {std::numeric_limits<float>::min(),
174 std::numeric_limits<float>::max()}),
175 const std::string &feature_name="",
176 float grid_spacing = 1.0
177 );
178
180
186 void set_value(int value_type, float value, const std::string &name="");
187
188};
189
190
191IMPBFF_END_NAMESPACE
192
193#endif //IMPBFF_PATHMAPTILE_H
const float TILE_COST_DEFAULT
Definition PathMapTile.h:26
const float TILE_EDGE_COST_DEFAULT
Definition PathMapTile.h:27
const float TILE_PENALTY_DEFAULT
Definition PathMapTile.h:25
const float TILE_OBSTACLE_PENALTY
Definition PathMapTile.h:31
PathMapTileOutputs
Value types that can be read from a PathMapTile.
Definition PathMapTile.h:35
@ PM_TILE_COST
Write path penalty.
Definition PathMapTile.h:37
@ PM_TILE_PENALTY
Definition PathMapTile.h:36
@ PM_TILE_PATH_LENGTH
Threshold path length and write tile weights.
Definition PathMapTile.h:40
@ PM_TILE_FEATURE
Threshold path length and write tile weights.
Definition PathMapTile.h:42
@ PM_TILE_ACCESSIBLE_FEATURE
Density that is accessible (Path length in bounds)
Definition PathMapTile.h:44
@ PM_TILE_PATH_LENGTH_DENSITY
Write path length.
Definition PathMapTile.h:41
@ PM_TILE_ACCESSIBLE_DENSITY
Threshold path length and write tile weights.
Definition PathMapTile.h:43
@ PM_TILE_DENSITY
Write cost.
Definition PathMapTile.h:38
@ PM_TILE_COST_DENSITY
Density of tile.
Definition PathMapTile.h:39
const float TILE_PENALTY_THRESHOLD
Definition PathMapTile.h:29
IMPBFF_BEGIN_NAMESPACE const bool TILE_VISITED_DEFAULT
Definition PathMapTile.h:24
const float TILE_OBSTACLE_THRESHOLD
Definition PathMapTile.h:30
Definition PathMap.h:44
Definition PathMapTile.h:50
float cost
Definition PathMapTile.h:102
PathMapTile(long index=-1, float visit_penalty=0.0, float tile_density=1.0)
Construct an accessible volume tile.
Definition PathMapTile.h:133
std::map< std::string, float > features
Definition PathMapTile.h:106
std::vector< long > backtrack_to_path()
Computes the path from a tile to the origin.
float penalty
Definition PathMapTile.h:101
long idx
Definition PathMapTile.h:98
void set_value(int value_type, float value, const std::string &name="")
Set the value of a tile.
float density
AV density.
Definition PathMapTile.h:114
float get_value(int value_type, std::pair< float, float > bounds=std::pair< float, float >({std::numeric_limits< float >::min(), std::numeric_limits< float >::max()}), const std::string &feature_name="", float grid_spacing=1.0)
Get the value of a tile.
std::vector< PathMapTileEdge > edges
Definition PathMapTile.h:109
PathMapTile * previous
Definition PathMapTile.h:103