CCCoreLib 31 May 2022
CloudCompare Core algorithms
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CCCoreLib::FastMarchingForPropagation Class Reference

Fast Marching algorithm for surface front propagation. More...

#include <FastMarchingForPropagation.h>

Inheritance diagram for CCCoreLib::FastMarchingForPropagation:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::FastMarchingForPropagation:
Collaboration graph
[legend]

Classes

class  PropagationCell
 A Fast Marching grid cell for surfacical propagation. More...
 

Public Member Functions

 FastMarchingForPropagation ()
 Default constructor.
 
int init (GenericCloud *theCloud, DgmOctree *theOctree, unsigned char gridLevel, bool constantAcceleration=false)
 Initializes the grid with a point cloud (and ist corresponding octree) More...
 
bool extractPropagatedPoints (ReferenceCloud *Zk)
 Returns a list of the points (references to) reached by the propagation process. More...
 
bool setPropagationTimingsAsDistances ()
 Sets the propagation timings as distances for each point. More...
 
void setDetectionThreshold (float value)
 Sets the threshold for propagation stop. More...
 
void setJumpCoef (float value)
 Sets the accceleration exageration factor. More...
 
void findPeaks ()
 Find peaks of local acceleration values. More...
 
int propagate () override
 Propagates the front. More...
 
- Public Member Functions inherited from CCCoreLib::FastMarching
 FastMarching ()
 Default constructor.
 
virtual ~FastMarching ()
 Destructor.
 
virtual bool setSeedCell (const Tuple3i &pos)
 Sets a given cell as "seed". More...
 
virtual int propagate ()=0
 Propagates the front. More...
 
virtual void cleanLastPropagation ()
 
virtual float getTime (Tuple3i &pos, bool absoluteCoordinates=false) const
 Returns the front arrival time at a given cell. More...
 
virtual void setExtendedConnectivity (bool state)
 Sets extended connectivity mode. More...
 

Protected Member Functions

float computeTCoefApprox (Cell *currentCell, Cell *neighbourCell) const override
 Computes the front acceleration between two cells. More...
 
int step () override
 Propagates the front (one step) More...
 
bool instantiateGrid (unsigned size) override
 Instantiates grid in memory. More...
 
- Protected Member Functions inherited from CCCoreLib::FastMarching
unsigned pos2index (const Tuple3i &pos) const
 
virtual int initGridWithOctree (DgmOctree *octree, unsigned char gridLevel)
 Intializes the grid as a snapshot of an octree structure at a given subdivision level. More...
 
virtual int initGrid (float step, unsigned dim[3])
 Intializes the grid with a given step and dimensions. More...
 
virtual int initOther ()
 Intializes other dimension-related variables and finishes the initialization job.
 
virtual float computeT (unsigned index)
 Computes the front arrival time at a given cell. More...
 
virtual float computeTCoefApprox (Cell *currentCell, Cell *neighbourCell) const =0
 Computes the front acceleration between two cells. More...
 
virtual int step ()=0
 Propagates the front (one step) More...
 
virtual void initTrialCells ()
 Initializes the TRIAL cells list. More...
 
virtual bool instantiateGrid (unsigned size)=0
 Instantiates grid in memory. More...
 
template<class T >
bool instantiateGridTpl (unsigned size)
 Grid instantiation helper.
 
virtual void addTrialCell (unsigned index)
 Add a cell to the TRIAL cells list. More...
 
virtual void addActiveCell (unsigned index)
 Add a cell to the ACTIVE cells list. More...
 
virtual void addIgnoredCell (unsigned index)
 Add a cell to the IGNORED cells list. More...
 
virtual unsigned getNearestTrialCell ()
 Returns the TRIAL cell with the smallest front arrival time. More...
 
void resetCells (std::vector< unsigned > &list)
 Resets the state of cells in a given list. More...
 

Protected Attributes

float m_jumpCoef
 Accceleration exageration factor.
 
float m_detectionThreshold
 Threshold for propagation stop.
 
- Protected Attributes inherited from CCCoreLib::FastMarching
std::vector< unsigned > m_activeCells
 ACTIVE cells list.
 
std::vector< unsigned > m_trialCells
 TRIAL cells list.
 
std::vector< unsigned > m_ignoredCells
 IGNORED cells lits.
 
bool m_initialized
 Specifiies whether structure is initialized or not.
 
unsigned m_dx
 Grid size along the X dimension.
 
unsigned m_dy
 Grid size along the Y dimension.
 
unsigned m_dz
 Grid size along the Z dimension.
 
unsigned m_rowSize
 Shift for cell access acceleration (Y dimension)
 
unsigned m_sliceSize
 Shift for cell access acceleration (Z dimension)
 
unsigned m_indexShift
 First index of innerbound grid.
 
unsigned m_gridSize
 Grid size.
 
Cell ** m_theGrid
 Grid used to process Fast Marching.
 
DgmOctreem_octree
 Associated octree.
 
unsigned char m_gridLevel
 Equivalent octree subdivision level.
 
float m_cellSize
 Octree cell size at equivalent subdivision level.
 
Tuple3i m_minFillIndexes
 Octree min fill indexes at 'm_gridLevel'.
 
unsigned m_numberOfNeighbours
 Current number of neighbours (6 or 26)
 
int m_neighboursIndexShift [CC_FM_MAX_NUMBER_OF_NEIGHBOURS]
 Neighbours coordinates shifts in grid.
 
float m_neighboursDistance [CC_FM_MAX_NUMBER_OF_NEIGHBOURS]
 Neighbours distance weight.
 

Detailed Description

Fast Marching algorithm for surface front propagation.

Extends the FastMarching class.

Member Function Documentation

◆ computeTCoefApprox()

float FastMarchingForPropagation::computeTCoefApprox ( Cell currentCell,
Cell neighbourCell 
) const
overrideprotectedvirtual

Computes the front acceleration between two cells.

Parameters
currentCellthe "central" cell
neighbourCellthe other cell
Returns
the front acceleration

Implements CCCoreLib::FastMarching.

◆ extractPropagatedPoints()

bool FastMarchingForPropagation::extractPropagatedPoints ( ReferenceCloud Zk)

Returns a list of the points (references to) reached by the propagation process.

Returns a cloud of points (references to) corresponding to the points that are lying in cells that have been visited by the last propagation process.

Parameters
[out]Zk(reference) point cloud

◆ findPeaks()

void FastMarchingForPropagation::findPeaks ( )

Find peaks of local acceleration values.

This method is useful when using this Fast Marching algorithm in a Watershed process. Peak cells are automatically set as "seeds".

◆ init()

int FastMarchingForPropagation::init ( GenericCloud theCloud,
DgmOctree theOctree,
unsigned char  gridLevel,
bool  constantAcceleration = false 
)

Initializes the grid with a point cloud (and ist corresponding octree)

The points should be associated to scalar values. Warning: be sure to activate an OUTPUT scalar field on the input cloud The Fast Marching grid will have the same characteristics as the octree considered at a given level of subdivision. The local front acceleration in each cell is deduced from the scalar values associated to the points lying in the octree cell (mean value).

Parameters
theCloudthe point cloud
theOctreethe associated octree
gridLevelthe level of subdivision
constantAccelerationspecifies if the acceleration is constant or shoul be computed from the cell points scalar values
Returns
a negative value if something went wrong

◆ instantiateGrid()

bool CCCoreLib::FastMarchingForPropagation::instantiateGrid ( unsigned  size)
inlineoverrideprotectedvirtual

Instantiates grid in memory.

Grid is also filled with zeros.

Parameters
sizegrid size
Returns
success

Implements CCCoreLib::FastMarching.

◆ propagate()

int FastMarchingForPropagation::propagate ( )
overridevirtual

Propagates the front.

The seeds should have already been initialized

Returns
propagation result (errors = negative values)

Implements CCCoreLib::FastMarching.

◆ setDetectionThreshold()

void CCCoreLib::FastMarchingForPropagation::setDetectionThreshold ( float  value)
inline

Sets the threshold for propagation stop.

This threshold corresponds to the maximum front arrival time increase allowed. If the delta between the fornt arrival time at two consecutive cells is higher, the propagation process is stoped.

Parameters
valuethe threshold

◆ setJumpCoef()

void CCCoreLib::FastMarchingForPropagation::setJumpCoef ( float  value)
inline

Sets the accceleration exageration factor.

In order to detect the front arrival time jumps (see FastMarchingForPropagation::setDetectionThreshold), it is possible to exaggerate the result of the acceleration computation with this factor.

Parameters
valuethe acceleration exageration factor

◆ setPropagationTimingsAsDistances()

bool FastMarchingForPropagation::setPropagationTimingsAsDistances ( )

Sets the propagation timings as distances for each point.

Returns
true if ok, false otherwise

◆ step()

int FastMarchingForPropagation::step ( )
overrideprotectedvirtual

Propagates the front (one step)

Returns
a negative value if a problem occurred

Implements CCCoreLib::FastMarching.


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