![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Fast Marching algorithm (front propagation) More...
#include <FastMarching.h>


Classes | |
| class | Cell |
| A generic Fast Marching grid cell. More... | |
Public Member Functions | |
| FastMarching () | |
| Default constructor. More... | |
| virtual | ~FastMarching () |
| Destructor. More... | |
| 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 | |
| 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 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. 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 | |
| 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... | |
| DgmOctree * | m_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... | |
Fast Marching algorithm (front propagation)
Implementation of the Fast Marching algorithm [Sethian 1996]. Inspired from the "vtkFastMarching" class of the "Slicer" project (http://www.slicer.org).
Definition at line 41 of file FastMarching.h.
| FastMarching::FastMarching | ( | ) |
Default constructor.
Definition at line 15 of file FastMarching.cpp.
References CC_FM_MAX_NUMBER_OF_NEIGHBOURS, m_neighboursDistance, and m_neighboursIndexShift.
|
virtual |
|
protectedvirtual |
Add a cell to the ACTIVE cells list.
| index | index of the cell |
Definition at line 196 of file FastMarching.cpp.
References cloudViewer::FastMarching::Cell::ACTIVE_CELL, m_activeCells, m_theGrid, and cloudViewer::FastMarching::Cell::state.
Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), setSeedCell(), cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
protectedvirtual |
Add a cell to the IGNORED cells list.
| index | index of the cell |
Definition at line 201 of file FastMarching.cpp.
References cloudViewer::FastMarching::Cell::EMPTY_CELL, m_ignoredCells, m_theGrid, and cloudViewer::FastMarching::Cell::state.
Referenced by cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
protectedvirtual |
Add a cell to the TRIAL cells list.
| index | index of the cell |
Definition at line 191 of file FastMarching.cpp.
References m_theGrid, m_trialCells, cloudViewer::FastMarching::Cell::state, and cloudViewer::FastMarching::Cell::TRIAL_CELL.
Referenced by initTrialCells(), FastMarchingForFacetExtraction::initTrialCells(), cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
virtual |
Finalizes an iteration process Resets the different lists and the grid. This method should be called after each propagation (before starting a new one).
Definition at line 143 of file FastMarching.cpp.
References m_activeCells, m_ignoredCells, m_trialCells, and resetCells().
Referenced by define_FastMarching(), FastMarchingForFacetExtraction::ExtractPlanarFacets(), and cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().
|
protectedvirtual |
Computes the front arrival time at a given cell.
the cell is represented by its index in the cell list
| index | the cell index |
Definition at line 234 of file FastMarching.cpp.
References cloudViewer::FastMarching::Cell::ACTIVE_CELL, cloudViewer::c_FastMarchingNeighbourPosShift, CC_FM_MAX_NUMBER_OF_NEIGHBOURS, computeTCoefApprox(), m_neighboursDistance, m_neighboursIndexShift, m_numberOfNeighbours, m_theGrid, cloudViewer::FastMarching::Cell::state, cloudViewer::FastMarching::Cell::T, cloudViewer::FastMarching::Cell::T_INF(), and cloudViewer::FastMarching::Cell::TRIAL_CELL.
Referenced by cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
protectedpure virtual |
Computes the front acceleration between two cells.
| currentCell | the "central" cell |
| neighbourCell | the other cell |
Implemented in FastMarchingForFacetExtraction, ccFastMarchingForNormsDirection, and cloudViewer::FastMarchingForPropagation.
Referenced by computeT(), and initTrialCells().
|
protectedvirtual |
Returns the TRIAL cell with the smallest front arrival time.
Definition at line 206 of file FastMarching.cpp.
References m_theGrid, m_trialCells, and cloudViewer::FastMarching::Cell::T.
Referenced by cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
virtual |
Returns the front arrival time at a given cell.
This method should only be called after the propagation succeeded. The coordinates of the cell can be absolute (i.e. expressed relatively to the octree borders) or relative (i.e. expressed relatively to the Fast Marching grid).
| pos | the cell position (3 integer coordinates) |
| absoluteCoordinates | whether the cell coordinates are absolute or relative |
Definition at line 49 of file FastMarching.cpp.
References m_rowSize, m_sliceSize, m_theGrid, pos2index(), cloudViewer::FastMarching::Cell::T, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by define_FastMarching().
|
protectedvirtual |
Intializes the grid with a given step and dimensions.
| step | grid step |
| dim | grid dimensions in 3D |
Definition at line 65 of file FastMarching.cpp.
References initOther(), m_cellSize, m_dx, m_dy, m_dz, m_gridLevel, m_minFillIndexes, m_octree, and step().
|
protectedvirtual |
Intializes the grid as a snapshot of an octree structure at a given subdivision level
| octree | input octree |
| gridLevel | subdivision level |
Definition at line 78 of file FastMarching.cpp.
References cloudViewer::DgmOctree::getCellSize(), cloudViewer::DgmOctree::getMaxFillIndexes(), cloudViewer::DgmOctree::getMinFillIndexes(), initOther(), m_cellSize, m_dx, m_dy, m_dz, m_gridLevel, m_minFillIndexes, m_octree, cloudViewer::DgmOctree::MAX_OCTREE_LEVEL, octree, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by FastMarchingForFacetExtraction::init(), and cloudViewer::FastMarchingForPropagation::init().
|
protectedvirtual |
Intializes other dimension-related variables and finishes the initialization job
Definition at line 99 of file FastMarching.cpp.
References cloudViewer::c_FastMarchingNeighbourPosShift, CC_FM_MAX_NUMBER_OF_NEIGHBOURS, instantiateGrid(), m_activeCells, m_cellSize, m_dx, m_dy, m_dz, m_gridSize, m_ignoredCells, m_indexShift, m_neighboursDistance, m_neighboursIndexShift, m_rowSize, m_sliceSize, and m_trialCells.
Referenced by initGrid(), and initGridWithOctree().
|
protectedvirtual |
Initializes the TRIAL cells list.
See the Fast Marching algorithm theory for more information
Reimplemented in FastMarchingForFacetExtraction, and ccFastMarchingForNormsDirection.
Definition at line 168 of file FastMarching.cpp.
References addTrialCell(), computeTCoefApprox(), cloudViewer::FastMarching::Cell::FAR_CELL, m_activeCells, m_neighboursDistance, m_neighboursIndexShift, m_numberOfNeighbours, m_theGrid, cloudViewer::FastMarching::Cell::state, and cloudViewer::FastMarching::Cell::T.
Referenced by cloudViewer::FastMarchingForPropagation::propagate().
|
protectedpure virtual |
Instantiates grid in memory.
Grid is also filled with zeros.
| size | grid size |
Implemented in FastMarchingForFacetExtraction, ccFastMarchingForNormsDirection, and cloudViewer::FastMarchingForPropagation.
Referenced by initOther().
|
inlineprotected |
|
inlineprotected |
Definition at line 87 of file FastMarching.h.
References Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
Referenced by getTime(), FastMarchingForFacetExtraction::init(), cloudViewer::FastMarchingForPropagation::init(), setSeedCell(), and FastMarchingForFacetExtraction::setSeedCell().
|
pure virtual |
Propagates the front.
The seeds should have already been initialized
Implemented in FastMarchingForFacetExtraction, ccFastMarchingForNormsDirection, and cloudViewer::FastMarchingForPropagation.
|
protected |
Resets the state of cells in a given list.
Warning: the list will be cleared!
Definition at line 132 of file FastMarching.cpp.
References cloudViewer::FastMarching::Cell::FAR_CELL, m_theGrid, cloudViewer::FastMarching::Cell::state, cloudViewer::FastMarching::Cell::T, and cloudViewer::FastMarching::Cell::T_INF().
Referenced by cleanLastPropagation().
|
inlinevirtual |
Sets extended connectivity mode.
To use common edges instead of common faces (much slower)
Definition at line 81 of file FastMarching.h.
Referenced by define_FastMarching().
|
virtual |
Sets a given cell as "seed".
| pos | the cell position in the grid (3 integer coordinates) |
Reimplemented in FastMarchingForFacetExtraction.
Definition at line 150 of file FastMarching.cpp.
References cloudViewer::FastMarching::Cell::ACTIVE_CELL, addActiveCell(), m_gridSize, m_theGrid, pos2index(), cloudViewer::FastMarching::Cell::state, and cloudViewer::FastMarching::Cell::T.
Referenced by cloudViewer::DistanceComputationTools::computeGeodesicDistances(), define_FastMarching(), cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation(), and FastMarchingForFacetExtraction::setSeedCell().
|
protectedpure virtual |
Propagates the front (one step)
Implemented in FastMarchingForFacetExtraction, ccFastMarchingForNormsDirection, and cloudViewer::FastMarchingForPropagation.
Referenced by initGrid().
|
protected |
ACTIVE cells list.
Definition at line 212 of file FastMarching.h.
Referenced by addActiveCell(), cleanLastPropagation(), cloudViewer::FastMarchingForPropagation::extractPropagatedPoints(), initOther(), initTrialCells(), FastMarchingForFacetExtraction::initTrialCells(), cloudViewer::FastMarchingForPropagation::setPropagationTimingsAsDistances(), cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::updateFlagsTable().
|
protected |
Octree cell size at equivalent subdivision level.
Definition at line 242 of file FastMarching.h.
Referenced by initGrid(), initGridWithOctree(), initOther(), and cloudViewer::FastMarchingForPropagation::step().
|
protected |
Grid size along the X dimension.
Definition at line 221 of file FastMarching.h.
Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), initGrid(), initGridWithOctree(), and initOther().
|
protected |
Grid size along the Y dimension.
Definition at line 223 of file FastMarching.h.
Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), initGrid(), initGridWithOctree(), and initOther().
|
protected |
Grid size along the Z dimension.
Definition at line 225 of file FastMarching.h.
Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), initGrid(), initGridWithOctree(), and initOther().
|
protected |
Equivalent octree subdivision level.
Definition at line 240 of file FastMarching.h.
Referenced by FastMarchingForFacetExtraction::addCellToCurrentFacet(), FastMarchingForFacetExtraction::computeTCoefApprox(), cloudViewer::FastMarchingForPropagation::extractPropagatedPoints(), initGrid(), initGridWithOctree(), cloudViewer::FastMarchingForPropagation::setPropagationTimingsAsDistances(), and FastMarchingForFacetExtraction::updateFlagsTable().
|
protected |
Grid size.
Definition at line 233 of file FastMarching.h.
Referenced by initOther(), setSeedCell(), and ~FastMarching().
|
protected |
IGNORED cells lits.
Definition at line 216 of file FastMarching.h.
Referenced by addIgnoredCell(), cleanLastPropagation(), and initOther().
|
protected |
First index of innerbound grid.
Definition at line 231 of file FastMarching.h.
Referenced by initOther().
|
protected |
Specifiies whether structure is initialized or not.
Definition at line 219 of file FastMarching.h.
Referenced by FastMarchingForFacetExtraction::addCellToCurrentFacet(), cloudViewer::FastMarchingForPropagation::extractPropagatedPoints(), cloudViewer::FastMarchingForPropagation::findPeaks(), FastMarchingForFacetExtraction::init(), cloudViewer::FastMarchingForPropagation::init(), cloudViewer::FastMarchingForPropagation::setPropagationTimingsAsDistances(), cloudViewer::FastMarchingForPropagation::step(), FastMarchingForFacetExtraction::step(), and FastMarchingForFacetExtraction::updateFlagsTable().
|
protected |
Octree min fill indexes at 'm_gridLevel'.
Definition at line 244 of file FastMarching.h.
Referenced by initGrid(), and initGridWithOctree().
|
protected |
Neighbours distance weight.
Definition at line 251 of file FastMarching.h.
Referenced by computeT(), FastMarching(), initOther(), initTrialCells(), and FastMarchingForFacetExtraction::initTrialCells().
|
protected |
Neighbours coordinates shifts in grid.
Definition at line 249 of file FastMarching.h.
Referenced by computeT(), FastMarching(), cloudViewer::FastMarchingForPropagation::findPeaks(), initOther(), initTrialCells(), FastMarchingForFacetExtraction::initTrialCells(), cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
protected |
Current number of neighbours (6 or 26)
Definition at line 247 of file FastMarching.h.
Referenced by computeT(), initTrialCells(), FastMarchingForFacetExtraction::initTrialCells(), cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().
|
protected |
Associated octree.
Definition at line 238 of file FastMarching.h.
Referenced by FastMarchingForFacetExtraction::addCellToCurrentFacet(), FastMarchingForFacetExtraction::computeTCoefApprox(), cloudViewer::FastMarchingForPropagation::extractPropagatedPoints(), initGrid(), initGridWithOctree(), cloudViewer::FastMarchingForPropagation::setPropagationTimingsAsDistances(), FastMarchingForFacetExtraction::setSeedCell(), and FastMarchingForFacetExtraction::updateFlagsTable().
|
protected |
Shift for cell access acceleration (Y dimension)
Definition at line 227 of file FastMarching.h.
Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), getTime(), and initOther().
|
protected |
Shift for cell access acceleration (Z dimension)
Definition at line 229 of file FastMarching.h.
Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), getTime(), and initOther().
|
protected |
Grid used to process Fast Marching.
Definition at line 235 of file FastMarching.h.
Referenced by addActiveCell(), FastMarchingForFacetExtraction::addCellToCurrentFacet(), addIgnoredCell(), addTrialCell(), computeT(), cloudViewer::FastMarchingForPropagation::extractPropagatedPoints(), cloudViewer::FastMarchingForPropagation::findPeaks(), getNearestTrialCell(), getTime(), FastMarchingForFacetExtraction::init(), cloudViewer::FastMarchingForPropagation::init(), initTrialCells(), FastMarchingForFacetExtraction::initTrialCells(), resetCells(), cloudViewer::FastMarchingForPropagation::setPropagationTimingsAsDistances(), setSeedCell(), cloudViewer::FastMarchingForPropagation::step(), FastMarchingForFacetExtraction::step(), FastMarchingForFacetExtraction::updateFlagsTable(), and ~FastMarching().
|
protected |
TRIAL cells list.
Definition at line 214 of file FastMarching.h.
Referenced by addTrialCell(), cleanLastPropagation(), getNearestTrialCell(), and initOther().