ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::FastMarchingForPropagation Class Reference

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

#include <FastMarchingForPropagation.h>

Inheritance diagram for cloudViewer::FastMarchingForPropagation:
Collaboration diagram for cloudViewer::FastMarchingForPropagation:

Classes

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

Public Member Functions

 FastMarchingForPropagation ()
 Default constructor. More...
 
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)
 
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 cloudViewer::FastMarching
 FastMarching ()
 Default constructor. More...
 
virtual ~FastMarching ()
 Destructor. More...
 
virtual bool setSeedCell (const Tuple3i &pos)
 Sets a given cell as "seed". 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 cloudViewer::FastMarching
unsigned pos2index (const Tuple3i &pos) const
 
virtual int initGridWithOctree (DgmOctree *octree, unsigned char gridLevel)
 
virtual int initGrid (float step, unsigned dim[3])
 Intializes the grid with a given step and dimensions. More...
 
virtual int initOther ()
 
virtual float computeT (unsigned index)
 Computes the front arrival time at a given cell. More...
 
virtual void initTrialCells ()
 Initializes the TRIAL cells list. More...
 
template<class T >
bool instantiateGridTpl (unsigned size)
 Grid instantiation helper. More...
 
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. More...
 
float m_detectionThreshold
 Threshold for propagation stop. More...
 
- Protected Attributes inherited from cloudViewer::FastMarching
std::vector< unsigned > m_activeCells
 ACTIVE cells list. More...
 
std::vector< unsigned > m_trialCells
 TRIAL cells list. More...
 
std::vector< unsigned > m_ignoredCells
 IGNORED cells lits. More...
 
bool m_initialized
 Specifiies whether structure is initialized or not. More...
 
unsigned m_dx
 Grid size along the X dimension. More...
 
unsigned m_dy
 Grid size along the Y dimension. More...
 
unsigned m_dz
 Grid size along the Z dimension. More...
 
unsigned m_rowSize
 Shift for cell access acceleration (Y dimension) More...
 
unsigned m_sliceSize
 Shift for cell access acceleration (Z dimension) More...
 
unsigned m_indexShift
 First index of innerbound grid. More...
 
unsigned m_gridSize
 Grid size. More...
 
Cell ** m_theGrid
 Grid used to process Fast Marching. More...
 
DgmOctreem_octree
 Associated octree. More...
 
unsigned char m_gridLevel
 Equivalent octree subdivision level. More...
 
float m_cellSize
 Octree cell size at equivalent subdivision level. More...
 
Tuple3i m_minFillIndexes
 Octree min fill indexes at 'm_gridLevel'. More...
 
unsigned m_numberOfNeighbours
 Current number of neighbours (6 or 26) More...
 
int m_neighboursIndexShift [26]
 Neighbours coordinates shifts in grid. More...
 
float m_neighboursDistance [26]
 Neighbours distance weight. More...
 

Detailed Description

Fast Marching algorithm for surface front propagation.

Extends the FastMarching class.

Definition at line 22 of file FastMarchingForPropagation.h.

Constructor & Destructor Documentation

◆ FastMarchingForPropagation()

FastMarchingForPropagation::FastMarchingForPropagation ( )

Default constructor.

Definition at line 17 of file FastMarchingForPropagation.cpp.

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 cloudViewer::FastMarching.

Definition at line 212 of file FastMarchingForPropagation.cpp.

References cloudViewer::FastMarchingForPropagation::PropagationCell::f, and m_jumpCoef.

◆ 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

Definition at line 141 of file FastMarchingForPropagation.cpp.

References cloudViewer::FastMarchingForPropagation::PropagationCell::cellCode, cloudViewer::DgmOctree::getPointsInCell(), cloudViewer::FastMarching::m_activeCells, cloudViewer::FastMarching::m_gridLevel, cloudViewer::FastMarching::m_initialized, cloudViewer::FastMarching::m_octree, cloudViewer::FastMarching::m_theGrid, cloudViewer::DgmOctree::MAX_OCTREE_LEVEL, NAN_VALUE, and points.

Referenced by cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().

◆ findPeaks()

◆ 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

Definition at line 27 of file FastMarchingForPropagation.cpp.

References cloudViewer::DgmOctree::associatedCloud(), cloudViewer::FastMarchingForPropagation::PropagationCell::cellCode, cloudViewer::ScalarFieldTools::computeMeanScalarValue(), cloudViewer::FastMarchingForPropagation::PropagationCell::f, cloudViewer::DgmOctree::getCellCodes(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getPointsInCell(), cloudViewer::FastMarching::initGridWithOctree(), cloudViewer::FastMarching::m_initialized, cloudViewer::FastMarching::m_theGrid, cloudViewer::FastMarching::pos2index(), and result.

Referenced by cloudViewer::DistanceComputationTools::computeGeodesicDistances(), and cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().

◆ instantiateGrid()

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

Instantiates grid in memory.

Grid is also filled with zeros.

Parameters
sizegrid size
Returns
success

Implements cloudViewer::FastMarching.

Definition at line 104 of file FastMarchingForPropagation.h.

References size.

◆ propagate()

int FastMarchingForPropagation::propagate ( )
overridevirtual

Propagates the front.

The seeds should have already been initialized

Returns
propagation result (errors = negative values)

Implements cloudViewer::FastMarching.

Definition at line 130 of file FastMarchingForPropagation.cpp.

References cloudViewer::FastMarching::initTrialCells(), result, and step().

Referenced by cloudViewer::DistanceComputationTools::computeGeodesicDistances(), and cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().

◆ setDetectionThreshold()

void cloudViewer::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

Definition at line 63 of file FastMarchingForPropagation.h.

References m_detectionThreshold.

Referenced by cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().

◆ setJumpCoef()

void cloudViewer::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

Definition at line 72 of file FastMarchingForPropagation.h.

References m_jumpCoef.

Referenced by cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().

◆ setPropagationTimingsAsDistances()

◆ step()

Member Data Documentation

◆ m_detectionThreshold

float cloudViewer::FastMarchingForPropagation::m_detectionThreshold
protected

Threshold for propagation stop.

Definition at line 111 of file FastMarchingForPropagation.h.

Referenced by setDetectionThreshold(), and step().

◆ m_jumpCoef

float cloudViewer::FastMarchingForPropagation::m_jumpCoef
protected

Accceleration exageration factor.

Definition at line 109 of file FastMarchingForPropagation.h.

Referenced by computeTCoefApprox(), and setJumpCoef().


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