IMP.bff
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Related Symbols | List of all members
PathMap Class Reference

#include <PathMap.h>

Inheritance diagram for PathMap:
Inheritance graph
Collaboration diagram for PathMap:
Collaboration graph

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 PathMapHeaderget_path_map_header () const
 Returns a read-only pointer to the header of the map.
 
PathMapHeaderget_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< PathMapTiletiles
 
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.
 

Constructor & Destructor Documentation

◆ PathMap()

PathMap::PathMap ( PathMapHeader header,
std::string  name = "PathMap%1%",
IMP::em::KernelType  kt = IMP::em::BINARIZED_SPHERE,
float  resolution = -1.0 
)
explicit

Constructs a PathMap object.

Parameters
headerThe PathMapHeader object.
nameThe name of the PathMap.
ktThe kernel type.
resolutionThe resolution of the PathMap.

Member Function Documentation

◆ fill_sphere()

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

Parameters
r0location of the sphere
radiusradius of the sphere
valuevalue inside or outside of the sphere
inverseif set to true (default) the values outside of the sphere are modified. If false the values inside of the sphere are modified.

◆ find_path()

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.

Parameters
path_begin_idxThe index of the path begin point in the path map.
path_end_idxThe index of the path end point in the path map. Default value is -1, which means the last index in the path map.
heuristic_modeThe mode of the heuristic function to be used for path finding. Default value is 0.
Returns
void

◆ find_path_astar()

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.

Parameters
path_begin_idxThe index of the starting point of the path.
path_end_idxThe index of the ending point of the path. If not provided, the function will use the last index in the path map.

◆ find_path_dijkstra()

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.

Parameters
path_begin_idxThe index of the starting node.
path_end_idxThe index of the ending node (optional).

◆ get_dim_index_by_voxel()

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.

Parameters
indexvoxel index
dimdimension
Returns
index of voxel in axis of dimension

◆ get_edges()

std::vector< PathMapTileEdge > & PathMap::get_edges ( int  tile_idx)
protected

◆ get_neighbor_idx_offsets()

std::vector< int > PathMap::get_neighbor_idx_offsets ( double  neighbor_radius = -1)
inline

Returns a vector of neighbor index offsets within a given radius.

Parameters
neighbor_radiusThe radius within which to find neighbors. If negative, the radius is obtained from the path map header.
Returns
A vector of neighbor index offsets, where each offset consists of three integers (z, y, x) representing the relative position of the neighbor, and one integer representing the tile offset. The vector also includes the edge cost between the current tile and the neighbor.

◆ get_path_map_header()

const PathMapHeader * PathMap::get_path_map_header ( ) const
inline

Returns a read-only pointer to the header of the map.

Returns
const PathMapHeader* A read-only pointer to the header of the map.

◆ get_path_map_header_writable()

PathMapHeader * PathMap::get_path_map_header_writable ( )
inline

Returns a pointer to the header of the map in a writable version.

Returns
A pointer to the header of the map in a writable version.

◆ get_tile_values()

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.

Parameters
outputA pointer to a 2D array of floats where the tile values will be stored.
nxA pointer to an integer that will store the number of tiles in the x-direction.
nyA pointer to an integer that will store the number of tiles in the y-direction.
nzA pointer to an integer that will store the number of tiles in the z-direction.
value_typeThe type of value to retrieve for each tile. Defaults to PM_TILE_COST.
boundsA pair of floats representing the lower and upper bounds for the tile values. Defaults to the minimum and maximum float values.
feature_nameThe name of the feature for which to retrieve the tile values. Defaults to an empty string.

◆ get_tiles()

std::vector< PathMapTile > & PathMap::get_tiles ( )

Values of tiles

Returns
vector of all tiles in the accessible volume

◆ get_xyz_density() [1/2]

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.

Returns
std::vector The XYZ density of the path map.

◆ get_xyz_density() [2/2]

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.

Parameters
outputA pointer to a 2D array to store the XYZ density.
n_output1A pointer to an integer to store the number of rows in the output array.
n_output2A pointer to an integer to store the number of columns in the output array.

◆ resize()

void PathMap::resize ( unsigned int  nvox)

Resizes the PathMap object.

This function resizes the PathMap object to accommodate the specified number of voxels.

Parameters
nvoxThe number of voxels to resize the PathMap to.

◆ sample_obstacles()

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.

Parameters
extra_radiusThe extra radius to add to the obstacles (optional, default is 0.0).

◆ set_data()

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.

Parameters
inputPointer to the input data array.
n_inputNumber of elements in the input data array.
obstacle_thresholdThe threshold value for considering a cell as an obstacle. Default value is -1.
binarizeFlag indicating whether to binarize the input data. Default value is true.
obstacle_penaltyThe penalty value for obstacle cells. Default value is TILE_PENALTY_DEFAULT.
Note
The input data array should be of size n_input.
If binarize is set to true, the input data will be converted to binary values based on the obstacle_threshold.
The obstacle_penalty is used to assign penalty values to obstacle cells in the path map.

◆ set_path_map_header()

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.

Parameters
path_map_headerThe path map header to set.
resolutionThe resolution of the path map. Default value is -1.0.

◆ update_tiles()

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.

Parameters
obstacle_thresholdThe threshold value for considering a cell as an obstacle. Default value is -1.0.
binarizeA flag indicating whether to binarize the path map. Default value is true.
obstacle_penaltyThe penalty value for obstacle cells. Default value is TILE_PENALTY_DEFAULT.
reset_tile_edgesA flag indicating whether to reset the edges of the tiles. Default value is true.

Friends And Related Symbol Documentation

◆ get_tile_values()

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 = "" 
)
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.

Parameters
value_typeSpecifies 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.
boundsBound for cropping the output values.
feature_nameName of a feature when accessing additional information.
Returns
A vector of values for the specified parameters.

Member Data Documentation

◆ offsets_

std::vector<int> PathMap::offsets_
protected

◆ pathMapHeader_

PathMapHeader PathMap::pathMapHeader_
protected

◆ tiles

std::vector<PathMapTile> PathMap::tiles
protected

The documentation for this class was generated from the following file: