MeVisLabToolboxReference
|
The class maintains a graph for applying a shortest path algorithm on. More...
#include <CSOLiveWireGraph.h>
Public Member Functions | |
CSOLiveWireGraph () | |
Standard constructor. | |
CSOLiveWireGraph (float *imageData, unsigned int sizex, unsigned int sizey, const bool useCostsDirectly, float voxelSizeX=1.0f, float voxelSizeY=1.0f) | |
Constructor, takes an array with image values and the image's size as arguments. | |
~CSOLiveWireGraph () | |
Standard destructor. | |
void | setStartPosition (VoxelPos startVoxelPos) |
Sets the starting position. | |
void | setWeights (float w1, float w2, float w3) |
Sets the weights for individual costs. | |
void | setLengthPenalty (float weight) |
Sets the weight for length penalty. | |
void | setPathCostThreshold (bool useThreshold, float threshold) |
Sets whether the path cost threshold shall be used, and its value. | |
void | getShortestPathToStart (VoxelPos endPos, std::vector< VoxelPos > &intermediatePositions, int neighborhoodMode, bool reverse=true) |
Computes the shortest path from the given endPos to the graph's internal start position. | |
void | resetGraphAndHeap () |
Resets all costs and visited states. | |
void | setMaxPathLength (float maxLength) |
Sets the maximal allowed length of the path. | |
void | updateResultCosts () |
Computes the costs for all edges as a preprocessing step to speedup runtime computation. | |
Protected Member Functions | |
void | _computeCosts () |
compute the costs of all nodes | |
float | _getEdgeCosts (unsigned char direction, int posx, int posy) |
Returns the edge costs in the given direction of the node, given by its position. | |
void | _computeAdditionalCostsAndNormalizeValues () |
Computes additional costs and normalizes the nodes' values. | |
void | _normalizeValues () |
Normalizes node values (for using input costs directly) | |
Protected Attributes | |
std::vector< VoxelPos > | _lastPathPositions |
The last found path (used to determine intersections with the new path). | |
unsigned int | _imageSizeX |
The image size x. | |
unsigned int | _imageSizeY |
The image size y. | |
float | _voxelSizeX |
The size of the voxels in x direction. | |
float | _voxelSizeY |
The size of the voxels in y direction. | |
CSOLiveWireNode ** | _lwGraph |
The 2D array of nodes, representing the graph (edges exists from each voxel to its 8 neighborhood). | |
CSOObjectHeap< CSOLiveWireNode > * | _nodeHeap |
A heap for the shortest path algorithm. | |
VoxelPos | _startVoxelPos |
The starting voxel position. | |
int | _offsetX [8] |
Array of x-offsets depending on a direction. | |
int | _offsetY [8] |
Array of y-offsets depending on a direction. | |
float | _maxGlobalGradient |
the max gradient found in the whole graph | |
float | _w1 |
the weights for the individual costs | |
float | _w2 |
float | _w3 |
float | _lengthPenalty |
the higher this value the more direct path are preferred over longer paths | |
bool | _usePathCostThreshold |
Shall the path cost threshold be used? | |
float | _pathConstThreshold |
Threshold value for path costs: if the path costs are greater than this value, the according section is not added to the output list of positions. | |
bool | _useCostsDirectly |
Should we use the cost values from the image directly? | |
float | _maxPathLength |
The maximal allowed length of a path that are search by live-wire. | |
float | _directionLengths [8] |
The lengths of all possible 8 edges. |
The class maintains a graph for applying a shortest path algorithm on.
Definition at line 64 of file CSOLiveWireGraph.h.
ml::CSOLiveWireGraph::CSOLiveWireGraph | ( | ) |
Standard constructor.
ml::CSOLiveWireGraph::CSOLiveWireGraph | ( | float * | imageData, |
unsigned int | sizex, | ||
unsigned int | sizey, | ||
const bool | useCostsDirectly, | ||
float | voxelSizeX = 1.0f , |
||
float | voxelSizeY = 1.0f |
||
) |
Constructor, takes an array with image values and the image's size as arguments.
ml::CSOLiveWireGraph::~CSOLiveWireGraph | ( | ) |
Standard destructor.
void ml::CSOLiveWireGraph::_computeAdditionalCostsAndNormalizeValues | ( | ) | [protected] |
Computes additional costs and normalizes the nodes' values.
void ml::CSOLiveWireGraph::_computeCosts | ( | ) | [protected] |
compute the costs of all nodes
float ml::CSOLiveWireGraph::_getEdgeCosts | ( | unsigned char | direction, |
int | posx, | ||
int | posy | ||
) | [protected] |
Returns the edge costs in the given direction of the node, given by its position.
void ml::CSOLiveWireGraph::_normalizeValues | ( | ) | [protected] |
Normalizes node values (for using input costs directly)
void ml::CSOLiveWireGraph::getShortestPathToStart | ( | VoxelPos | endPos, |
std::vector< VoxelPos > & | intermediatePositions, | ||
int | neighborhoodMode, | ||
bool | reverse = true |
||
) |
Computes the shortest path from the given endPos to the graph's internal start position.
The voxel positions of the computed path are filled into the given vector 'intermediatePositions'. The given neighborhood mode sets if whether a 4- or a 8-neighborhood should be searched. reverse indicates that the path should go from end to start instead of start to end
void ml::CSOLiveWireGraph::resetGraphAndHeap | ( | ) |
Resets all costs and visited states.
void ml::CSOLiveWireGraph::setLengthPenalty | ( | float | weight | ) | [inline] |
Sets the weight for length penalty.
Definition at line 84 of file CSOLiveWireGraph.h.
void ml::CSOLiveWireGraph::setMaxPathLength | ( | float | maxLength | ) | [inline] |
Sets the maximal allowed length of the path.
Definition at line 101 of file CSOLiveWireGraph.h.
void ml::CSOLiveWireGraph::setPathCostThreshold | ( | bool | useThreshold, |
float | threshold | ||
) | [inline] |
Sets whether the path cost threshold shall be used, and its value.
Definition at line 89 of file CSOLiveWireGraph.h.
void ml::CSOLiveWireGraph::setStartPosition | ( | VoxelPos | startVoxelPos | ) |
Sets the starting position.
void ml::CSOLiveWireGraph::setWeights | ( | float | w1, |
float | w2, | ||
float | w3 | ||
) |
Sets the weights for individual costs.
void ml::CSOLiveWireGraph::updateResultCosts | ( | ) |
Computes the costs for all edges as a preprocessing step to speedup runtime computation.
float ml::CSOLiveWireGraph::_directionLengths[8] [protected] |
The lengths of all possible 8 edges.
Definition at line 158 of file CSOLiveWireGraph.h.
unsigned int ml::CSOLiveWireGraph::_imageSizeX [protected] |
The image size x.
Definition at line 117 of file CSOLiveWireGraph.h.
unsigned int ml::CSOLiveWireGraph::_imageSizeY [protected] |
The image size y.
Definition at line 119 of file CSOLiveWireGraph.h.
std::vector< VoxelPos > ml::CSOLiveWireGraph::_lastPathPositions [protected] |
The last found path (used to determine intersections with the new path).
Definition at line 114 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_lengthPenalty [protected] |
the higher this value the more direct path are preferred over longer paths
Definition at line 143 of file CSOLiveWireGraph.h.
CSOLiveWireNode** ml::CSOLiveWireGraph::_lwGraph [protected] |
The 2D array of nodes, representing the graph (edges exists from each voxel to its 8 neighborhood).
Definition at line 125 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_maxGlobalGradient [protected] |
the max gradient found in the whole graph
Definition at line 139 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_maxPathLength [protected] |
The maximal allowed length of a path that are search by live-wire.
Definition at line 155 of file CSOLiveWireGraph.h.
CSOObjectHeap<CSOLiveWireNode>* ml::CSOLiveWireGraph::_nodeHeap [protected] |
A heap for the shortest path algorithm.
Definition at line 128 of file CSOLiveWireGraph.h.
int ml::CSOLiveWireGraph::_offsetX[8] [protected] |
Array of x-offsets depending on a direction.
Definition at line 134 of file CSOLiveWireGraph.h.
int ml::CSOLiveWireGraph::_offsetY[8] [protected] |
Array of y-offsets depending on a direction.
Definition at line 136 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_pathConstThreshold [protected] |
Threshold value for path costs: if the path costs are greater than this value, the according section is not added to the output list of positions.
Definition at line 149 of file CSOLiveWireGraph.h.
VoxelPos ml::CSOLiveWireGraph::_startVoxelPos [protected] |
The starting voxel position.
Definition at line 131 of file CSOLiveWireGraph.h.
bool ml::CSOLiveWireGraph::_useCostsDirectly [protected] |
Should we use the cost values from the image directly?
Definition at line 152 of file CSOLiveWireGraph.h.
bool ml::CSOLiveWireGraph::_usePathCostThreshold [protected] |
Shall the path cost threshold be used?
Definition at line 146 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_voxelSizeX [protected] |
The size of the voxels in x direction.
Definition at line 121 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_voxelSizeY [protected] |
The size of the voxels in y direction.
Definition at line 123 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_w1 [protected] |
the weights for the individual costs
Definition at line 141 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_w2 [protected] |
Definition at line 141 of file CSOLiveWireGraph.h.
float ml::CSOLiveWireGraph::_w3 [protected] |
Definition at line 141 of file CSOLiveWireGraph.h.