9 #ifndef IMPBFF_PATHMAP_H
10 #define IMPBFF_PATHMAP_H
12 #include <IMP/bff/bff_config.h>
19 #include <unordered_set>
23 #include <Eigen/Dense>
39 IMPBFF_BEGIN_NAMESPACE
53 std::vector<bool> visited;
54 std::vector<bool> edge_computed;
55 std::vector<float> cost;
59 std::vector<PathMapTile> tiles;
61 std::vector<int> offsets_;
62 std::vector<PathMapTileEdge>&
get_edges(
int tile_idx);
79 float obstacle_threshold=-1.0,
81 float obstacle_penalty=TILE_PENALTY_DEFAULT,
82 bool reset_tile_edges=
true
92 void resize(
unsigned int nvox);
110 void set_data(
double *input,
int n_input,
111 float obstacle_threshold=-1,
bool binarize=
true,
112 float obstacle_penalty=TILE_PENALTY_DEFAULT);
122 if(neighbor_radius < 0){
123 auto pmh = get_path_map_header();
124 neighbor_radius = pmh->get_neighbor_radius();
126 const int nn = ceil(neighbor_radius);
127 const double nr2 = neighbor_radius * neighbor_radius;
130 int nx = header->
get_nx();
131 int ny = header->
get_ny();
134 std::vector<int> offsets;
135 for(
int z = -nn; z < nn; z += 1) {
138 for(
int y = -nn; y < nn; y++) {
140 double dz2_dy2 = dz2 + y * y;
141 for(
int x = -nn; x < nn; x++) {
143 int dz2_dy2_dx2 = dz2_dy2 + x * x;
144 if(dz2_dy2_dx2 <= nr2){
146 float *p = (
float*) &d;
147 *p = sqrt((
float) dz2_dy2_dx2);
148 int tile_offset = oz + oy + ox;
149 offsets.emplace_back(z);
150 offsets.emplace_back(y);
151 offsets.emplace_back(x);
152 offsets.emplace_back(tile_offset);
153 offsets.emplace_back(d);
169 int get_dim_index_by_voxel(
long index,
int dim);
198 void set_path_map_header(
PathMapHeader &path_map_header,
float resolution = -1.0);
218 std::vector<float> get_tile_values(
220 std::pair<float, float> bounds = std::pair<float, float>(
221 {std::numeric_limits<float>::min(),
222 std::numeric_limits<float>::max()}),
223 const std::string &feature_name=
""
242 void get_tile_values(
243 float **output,
int *nx,
int *ny,
int *nz,
245 std::pair<float, float> bounds = std::pair<float, float>(
246 {std::numeric_limits<float>::min(),
247 std::numeric_limits<float>::max()}),
248 const std::string &feature_name=
""
255 std::vector<PathMapTile>& get_tiles();
284 void find_path(
long path_begin_idx,
long path_end_idx = -1,
int heuristic_mode = 0);
298 void find_path_dijkstra(
long path_begin_idx,
long path_end_idx = -1);
313 void find_path_astar(
long path_begin_idx,
long path_end_idx = -1);
322 std::vector<IMP::algebra::Vector4D> get_xyz_density();
332 void get_xyz_density(
double** output,
int* n_output1,
int* n_output2);
342 void sample_obstacles(
double extra_radius=0.0);
354 PathMapHeader &header,
355 std::string name =
"PathMap%1%",
356 IMP::em::KernelType kt = IMP::em::BINARIZED_SPHERE,
357 float resolution = -1.0
381 std::string filename,
383 const std::pair<float, float> bounds = std::pair<float, float>(
384 std::numeric_limits<float>::min(),
385 std::numeric_limits<float>::max()
387 const std::string &feature_name =
""
392 #endif //IMPBFF_PATHMAP_H
A decorator for a particle with accessible volume (AV).
const DensityHeader * get_header() const
Returns a read-only pointer to the header of the map.
DensityMap * binarize(DensityMap *orig_map, float threshold, bool reverse=false)
Return a map with 0 for all voxels below the threshold and 1 for those above.
IntPairs get_edges(const BoundingBoxD< 3 > &)
Return the edges of the box as indices into the vertices list.
Tile used in path search by PathMap.
Class to search path on grids.
Tile edges used in path search by PathMap.
Class for sampling a density map from particles.
const PathMapHeader * get_path_map_header() const
Returns a read-only pointer to the header of the map.
PathMapHeader * get_path_map_header_writable()
Returns a pointer to the header of the map in a writable version.
Classes to read or write MRC files.
Classes to read or write density files in XPLOR format.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
void write_path_map(PathMap *m, std::string filename, int value_type, const std::pair< float, float > bounds=std::pair< float, float >(std::numeric_limits< float >::min(), std::numeric_limits< float >::max()), const std::string &feature_name="")
Writes a path map to a file.
A shared base class to help in debugging and things.
std::vector< int > get_neighbor_idx_offsets(double neighbor_radius=-1)
Management of Spider Headers Electron Microscopy. Compatible with Spider and Xmipp formats Copyright ...
Decorator for a sphere-like particle.
Classes to read or write density files in EM format.