30 bool constantAcceleration ) {
31 assert(theCloud && theOctree);
42 while (!cellCodes.empty()) {
50 theOctree->
getCellPos(cellCodes.back(), level, cellPos,
true);
57 aCell->
f = (constantAcceleration
77 if (minTCellIndex == 0) {
83 assert(minTCell !=
nullptr);
100 assert(minTCell->
T >= lastT);
116 float t_old = nCell->
T;
119 if (t_new < t_old) nCell->
T = t_new;
159 points->placeIteratorAtBeginning();
160 for (
unsigned k = 0; k <
points->size(); ++k) {
162 points->forwardIterator();
186 for (
unsigned k = 0; k < Yk.
size(); ++k) {
201 template <
typename T>
204 return x + (x * x) / 2;
213 Cell* currentCell,
Cell* neighbourCell)
const {
223 for (
unsigned k = 0; k <
m_dz; ++k) {
224 int pos[3] = {0, 0,
static_cast<int>(k)};
226 for (
unsigned j = 0; j <
m_dy; ++j) {
227 pos[1] =
static_cast<int>(j);
229 for (
unsigned i = 0; i <
m_dx; ++i) {
230 pos[0] =
static_cast<int>(i);
233 static_cast<unsigned>(pos[0] + 1) +
234 static_cast<unsigned>(pos[1] + 1) *
m_rowSize +
253 if (nCell->
f > theCell->f)
255 else if (nCell->
f < theCell->f)
260 if (isMin != isMax) {
constexpr ScalarType NAN_VALUE
NaN as a ScalarType value.
#define CC_FM_MAX_NUMBER_OF_NEIGHBOURS
The octree structure used throughout the library.
GenericIndexedCloudPersist * associatedCloud() const
Returns the associated cloud.
void getCellPos(CellCode code, unsigned char level, Tuple3i &cellPos, bool isCodeTruncated) const
static const int MAX_OCTREE_LEVEL
Max octree subdivision level.
bool getPointsInCell(CellCode cellCode, unsigned char level, ReferenceCloud *subset, bool isCodeTruncated=false, bool clearOutputCloud=true) const
Returns the points lying in a specific cell.
std::vector< CellCode > cellCodesContainer
Octree cell codes container.
bool getCellCodes(unsigned char level, cellCodesContainer &vec, bool truncatedCodes=false) const
A Fast Marching grid cell for surfacical propagation.
float f
Local front acceleration.
DgmOctree::CellCode cellCode
Equivalent cell code in the octree.
float m_jumpCoef
Accceleration exageration factor.
float computeTCoefApprox(Cell *currentCell, Cell *neighbourCell) const override
Computes the front acceleration between two cells.
int propagate() override
Propagates the front.
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)
int step() override
Propagates the front (one step)
bool setPropagationTimingsAsDistances()
Sets the propagation timings as distances for each point.
void findPeaks()
Find peaks of local acceleration values.
bool extractPropagatedPoints(ReferenceCloud *Zk)
float m_detectionThreshold
Threshold for propagation stop.
A generic Fast Marching grid cell.
static float T_INF()
Returns infinite time value.
float T
Front arrival time.
Fast Marching algorithm (front propagation)
virtual void addActiveCell(unsigned index)
Add a cell to the ACTIVE cells list.
float m_cellSize
Octree cell size at equivalent subdivision level.
unsigned pos2index(const Tuple3i &pos) const
Cell ** m_theGrid
Grid used to process Fast Marching.
virtual float computeT(unsigned index)
Computes the front arrival time at a given cell.
unsigned m_dx
Grid size along the X dimension.
DgmOctree * m_octree
Associated octree.
std::vector< unsigned > m_activeCells
ACTIVE cells list.
unsigned char m_gridLevel
Equivalent octree subdivision level.
bool m_initialized
Specifiies whether structure is initialized or not.
virtual void addTrialCell(unsigned index)
Add a cell to the TRIAL cells list.
unsigned m_dz
Grid size along the Z dimension.
unsigned m_rowSize
Shift for cell access acceleration (Y dimension)
virtual int initGridWithOctree(DgmOctree *octree, unsigned char gridLevel)
virtual void initTrialCells()
Initializes the TRIAL cells list.
unsigned m_sliceSize
Shift for cell access acceleration (Z dimension)
unsigned m_numberOfNeighbours
Current number of neighbours (6 or 26)
virtual void addIgnoredCell(unsigned index)
Add a cell to the IGNORED cells list.
virtual unsigned getNearestTrialCell()
Returns the TRIAL cell with the smallest front arrival time.
int m_neighboursIndexShift[26]
Neighbours coordinates shifts in grid.
unsigned m_dy
Grid size along the Y dimension.
A very simple point cloud (no point duplication)
void placeIteratorAtBeginning() override
Sets the cloud iterator at the beginning.
unsigned size() const override
Returns the number of points.
virtual void setCurrentPointScalarValue(ScalarType value)
Sets the current point associated scalar value.
virtual void forwardIterator()
Forwards the local element iterator.
__host__ __device__ int2 abs(int2 v)
Generic file read and write utility for python interface.