IMP.bff
|
#include <PathMap.h>
Public Member Functions | |
void | update_tiles (float obstacle_threshold=-1.0, bool binarize=true, float obstacle_penalty=TILE_PENALTY_DEFAULT, bool reset_tile_edges=true) |
Updates the tiles in the path map. | |
void | resize (unsigned int nvox) |
Resizes the PathMap object. | |
void | set_data (double *input, int n_input, float obstacle_threshold=-1, bool binarize=true, float obstacle_penalty=TILE_PENALTY_DEFAULT) |
Sets the data for the path map. | |
std::vector< int > | get_neighbor_idx_offsets (double neighbor_radius=-1) |
int | get_dim_index_by_voxel (long index, int dim) |
Get index of voxel in an axis. | |
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. | |
void | set_path_map_header (PathMapHeader &path_map_header, float resolution=-1.0) |
Set the path map header. | |
void | get_tile_values (float **output, int *nx, int *ny, int *nz, int value_type=PM_TILE_COST, std::pair< float, float > bounds=std::pair< float, float >({std::numeric_limits< float >::min(), std::numeric_limits< float >::max()}), const std::string &feature_name="") |
Retrieves the values of the tiles in the path map. | |
std::vector< PathMapTile > & | get_tiles () |
void | fill_sphere (IMP::algebra::Vector3D r0, double radius, double value, bool inverse=true) |
Change the value of a density inside or outside of a sphere. | |
void | find_path (long path_begin_idx, long path_end_idx=-1, int heuristic_mode=0) |
Finds a path between two indices in the path map. | |
void | find_path_dijkstra (long path_begin_idx, long path_end_idx=-1) |
Finds the shortest path between two nodes using Dijkstra's algorithm. | |
void | find_path_astar (long path_begin_idx, long path_end_idx=-1) |
Finds the shortest path between two indices using the A* algorithm. | |
std::vector< IMP::algebra::Vector4D > | get_xyz_density () |
Get the XYZ density of the path map. This function returns a vector of IMP::algebra::Vector4D objects representing the XYZ density of the path map. | |
void | get_xyz_density (double **output, int *n_output1, int *n_output2) |
Get the XYZ density of the path map. This function returns the XYZ density of the path map as a 2D array. | |
void | sample_obstacles (double extra_radius=0.0) |
Resamples the obstacles in the path map. | |
PathMap (PathMapHeader &header, std::string name="PathMap%1%", IMP::em::KernelType kt=IMP::em::BINARIZED_SPHERE, float resolution=-1.0) | |
Constructs a PathMap object. | |
Protected Member Functions | |
std::vector< PathMapTileEdge > & | get_edges (int tile_idx) |
Protected Attributes | |
std::vector< PathMapTile > | tiles |
PathMapHeader | pathMapHeader_ |
std::vector< int > | offsets_ |
Related Symbols | |
(Note that these are not member symbols.) | |
std::vector< float > | get_tile_values (int value_type=PM_TILE_COST, std::pair< float, float > bounds=std::pair< float, float >({std::numeric_limits< float >::min(), std::numeric_limits< float >::max()}), const std::string &feature_name="") |
Get the values of all tiles. | |
|
explicit |
Constructs a PathMap object.
header | The PathMapHeader object. |
name | The name of the PathMap. |
kt | The kernel type. |
resolution | The resolution of the PathMap. |
void PathMap::fill_sphere | ( | IMP::algebra::Vector3D | r0, |
double | radius, | ||
double | value, | ||
bool | inverse = true |
||
) |
Change the value of a density inside or outside of a sphere.
Changes the value of the density inside or outside of a sphere. The density is used in the path-search (i.e., the accessible volume calculation
r0 | location of the sphere |
radius | radius of the sphere |
value | value inside or outside of the sphere |
inverse | if set to true (default) the values outside of the sphere are modified. If false the values inside of the sphere are modified. |
void PathMap::find_path | ( | long | path_begin_idx, |
long | path_end_idx = -1 , |
||
int | heuristic_mode = 0 |
||
) |
Finds a path between two indices in the path map.
This function finds a path between the specified path begin index and path end index in the path map. If the path end index is not specified, the function will find a path from the path begin index to the last index in the path map. The heuristic mode parameter determines the heuristic function to be used for path finding.
path_begin_idx | The index of the path begin point in the path map. |
path_end_idx | The index of the path end point in the path map. Default value is -1, which means the last index in the path map. |
heuristic_mode | The mode of the heuristic function to be used for path finding. Default value is 0. |
void PathMap::find_path_astar | ( | long | path_begin_idx, |
long | path_end_idx = -1 |
||
) |
Finds the shortest path between two indices using the A* algorithm.
This function uses the A* algorithm to find the shortest path between two indices in the path map. The path is stored in the path member variable.
path_begin_idx | The index of the starting point of the path. |
path_end_idx | The index of the ending point of the path. If not provided, the function will use the last index in the path map. |
void PathMap::find_path_dijkstra | ( | long | path_begin_idx, |
long | path_end_idx = -1 |
||
) |
Finds the shortest path between two nodes using Dijkstra's algorithm.
This function finds the shortest path between two nodes in the path map using Dijkstra's algorithm. The path is calculated from the node at index path_begin_idx to the node at index path_end_idx. If path_end_idx is not provided, the function will calculate the path to the last node in the map.
path_begin_idx | The index of the starting node. |
path_end_idx | The index of the ending node (optional). |
int PathMap::get_dim_index_by_voxel | ( | long | index, |
int | dim | ||
) |
Get index of voxel in an axis.
Returns the index of a voxel on a grid in a certain dimension.
index | voxel index |
dim | dimension |
|
protected |
|
inline |
Returns a vector of neighbor index offsets within a given radius.
neighbor_radius | The radius within which to find neighbors. If negative, the radius is obtained from the path map header. |
|
inline |
Returns a read-only pointer to the header of the map.
|
inline |
Returns a pointer to the header of the map in a writable version.
void PathMap::get_tile_values | ( | float ** | output, |
int * | nx, | ||
int * | ny, | ||
int * | nz, | ||
int | value_type = PM_TILE_COST , |
||
std::pair< float, float > | bounds = std::pair< float, float >({std::numeric_limits< float >::min(), std::numeric_limits< float >::max()}) , |
||
const std::string & | feature_name = "" |
||
) |
Retrieves the values of the tiles in the path map.
This function retrieves the values of the tiles in the path map and stores them in the output array.
output | A pointer to a 2D array of floats where the tile values will be stored. |
nx | A pointer to an integer that will store the number of tiles in the x-direction. |
ny | A pointer to an integer that will store the number of tiles in the y-direction. |
nz | A pointer to an integer that will store the number of tiles in the z-direction. |
value_type | The type of value to retrieve for each tile. Defaults to PM_TILE_COST. |
bounds | A pair of floats representing the lower and upper bounds for the tile values. Defaults to the minimum and maximum float values. |
feature_name | The name of the feature for which to retrieve the tile values. Defaults to an empty string. |
std::vector< PathMapTile > & PathMap::get_tiles | ( | ) |
Values of tiles
std::vector< IMP::algebra::Vector4D > PathMap::get_xyz_density | ( | ) |
Get the XYZ density of the path map. This function returns a vector of IMP::algebra::Vector4D objects representing the XYZ density of the path map.
void PathMap::get_xyz_density | ( | double ** | output, |
int * | n_output1, | ||
int * | n_output2 | ||
) |
Get the XYZ density of the path map. This function returns the XYZ density of the path map as a 2D array.
output | A pointer to a 2D array to store the XYZ density. |
n_output1 | A pointer to an integer to store the number of rows in the output array. |
n_output2 | A pointer to an integer to store the number of columns in the output array. |
void PathMap::resize | ( | unsigned int | nvox | ) |
void PathMap::sample_obstacles | ( | double | extra_radius = 0.0 | ) |
Resamples the obstacles in the path map.
This function resamples the obstacles in the path map, updating their positions and sizes.
extra_radius | The extra radius to add to the obstacles (optional, default is 0.0). |
void PathMap::set_data | ( | double * | input, |
int | n_input, | ||
float | obstacle_threshold = -1 , |
||
bool | binarize = true , |
||
float | obstacle_penalty = TILE_PENALTY_DEFAULT |
||
) |
Sets the data for the path map.
This function sets the input data for the path map. The input data is a 1D array of doubles representing the map.
input | Pointer to the input data array. |
n_input | Number of elements in the input data array. |
obstacle_threshold | The threshold value for considering a cell as an obstacle. Default value is -1. |
binarize | Flag indicating whether to binarize the input data. Default value is true. |
obstacle_penalty | The penalty value for obstacle cells. Default value is TILE_PENALTY_DEFAULT. |
void PathMap::set_path_map_header | ( | PathMapHeader & | path_map_header, |
float | resolution = -1.0 |
||
) |
Set the path map header.
This function sets the path map header for the path map.
path_map_header | The path map header to set. |
resolution | The resolution of the path map. Default value is -1.0. |
void PathMap::update_tiles | ( | float | obstacle_threshold = -1.0 , |
bool | binarize = true , |
||
float | obstacle_penalty = TILE_PENALTY_DEFAULT , |
||
bool | reset_tile_edges = true |
||
) |
Updates the tiles in the path map.
This function updates the tiles in the path map based on the given parameters.
obstacle_threshold | The threshold value for considering a cell as an obstacle. Default value is -1.0. |
binarize | A flag indicating whether to binarize the path map. Default value is true. |
obstacle_penalty | The penalty value for obstacle cells. Default value is TILE_PENALTY_DEFAULT. |
reset_tile_edges | A flag indicating whether to reset the edges of the tiles. Default value is true. |
|
related |
Get the values of all tiles.
A tile in a path map contains information on the penalty for visiting a tile, the cost of a path from the origin of a path search to the tile, the density of the tile, and other user-defined information.
When getting information from a tile, the returned values can be cropped to a specified range.
value_type | Specifies the type of the returned information (see: PathMapTileOutputs). Depending on the value type, the output can be the penalty for visiting the tile, the total cost of a path to the tile, or the density of the tile. Additional user-defined content can also be accessed. |
bounds | Bound for cropping the output values. |
feature_name | Name of a feature when accessing additional information. |
|
protected |
|
protected |
|
protected |