ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::FastMarching Class Referenceabstract

Fast Marching algorithm (front propagation) More...

#include <FastMarching.h>

Inheritance diagram for cloudViewer::FastMarching:
[legend]
Collaboration diagram for cloudViewer::FastMarching:
[legend]

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...
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ FastMarching()

FastMarching::FastMarching ( )

◆ ~FastMarching()

FastMarching::~FastMarching ( )
virtual

Destructor.

References m_gridSize, and m_theGrid.

Member Function Documentation

◆ addActiveCell()

◆ addIgnoredCell()

void FastMarching::addIgnoredCell ( unsigned  index)
protectedvirtual

◆ addTrialCell()

◆ cleanLastPropagation()

void FastMarching::cleanLastPropagation ( )
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).

References m_activeCells, m_ignoredCells, m_trialCells, and resetCells().

Referenced by define_FastMarching(), FastMarchingForFacetExtraction::ExtractPlanarFacets(), cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation(), and ccFastMarchingForNormsDirection::OrientNormals().

◆ computeT()

◆ computeTCoefApprox()

virtual float cloudViewer::FastMarching::computeTCoefApprox ( Cell *  currentCell,
Cell *  neighbourCell 
) const
protectedpure virtual

Computes the front acceleration between two cells.

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

Implemented in FastMarchingForFacetExtraction, ccFastMarchingForNormsDirection, and cloudViewer::FastMarchingForPropagation.

Referenced by computeT(), and initTrialCells().

◆ getNearestTrialCell()

unsigned FastMarching::getNearestTrialCell ( )
protectedvirtual

Returns the TRIAL cell with the smallest front arrival time.

Returns
the index of the "earliest" TRIAL cell (or 0 in case of error)

References m_theGrid, m_trialCells, and cloudViewer::FastMarching::Cell::T.

Referenced by ccFastMarchingForNormsDirection::step(), cloudViewer::FastMarchingForPropagation::step(), and FastMarchingForFacetExtraction::step().

◆ getTime()

float FastMarching::getTime ( Tuple3i &  pos,
bool  absoluteCoordinates = false 
) const
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).

Parameters
posthe cell position (3 integer coordinates)
absoluteCoordinateswhether the cell coordinates are absolute or relative

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().

◆ initGrid()

int FastMarching::initGrid ( float  step,
unsigned  dim[3] 
)
protectedvirtual

Intializes the grid with a given step and dimensions.

Parameters
stepgrid step
dimgrid dimensions in 3D
Returns
a negative value if a problem occurred

References initOther(), m_cellSize, m_dx, m_dy, m_dz, m_gridLevel, m_minFillIndexes, m_octree, and step().

◆ initGridWithOctree()

int FastMarching::initGridWithOctree ( DgmOctree *  octree,
unsigned char  gridLevel 
)
protectedvirtual

◆ initOther()

int FastMarching::initOther ( )
protectedvirtual

◆ initTrialCells()

◆ instantiateGrid()

virtual bool cloudViewer::FastMarching::instantiateGrid ( unsigned  size)
protectedpure virtual

Instantiates grid in memory.

Grid is also filled with zeros.

Parameters
sizegrid size
Returns
success

Implemented in FastMarchingForFacetExtraction, cloudViewer::FastMarchingForPropagation, and ccFastMarchingForNormsDirection.

Referenced by initOther().

◆ instantiateGridTpl()

template<class T >
bool cloudViewer::FastMarching::instantiateGridTpl ( unsigned  size)
inlineprotected

Grid instantiation helper.

References size.

◆ pos2index()

◆ propagate()

virtual int cloudViewer::FastMarching::propagate ( )
pure virtual

Propagates the front.

The seeds should have already been initialized

Returns
propagation result (errors = negative values)

Implemented in cloudViewer::FastMarchingForPropagation, FastMarchingForFacetExtraction, and ccFastMarchingForNormsDirection.

◆ resetCells()

void FastMarching::resetCells ( std::vector< unsigned > &  list)
protected

◆ setExtendedConnectivity()

virtual void cloudViewer::FastMarching::setExtendedConnectivity ( bool  state)
inlinevirtual

Sets extended connectivity mode.

To use common edges instead of common faces (much slower)

Referenced by define_FastMarching().

◆ setSeedCell()

◆ step()

virtual int cloudViewer::FastMarching::step ( )
protectedpure virtual

Propagates the front (one step)

Returns
a negative value if a problem occurred

Implemented in FastMarchingForFacetExtraction, cloudViewer::FastMarchingForPropagation, and ccFastMarchingForNormsDirection.

Referenced by initGrid().

Member Data Documentation

◆ m_activeCells

◆ m_cellSize

float cloudViewer::FastMarching::m_cellSize
protected

Octree cell size at equivalent subdivision level.

Referenced by initGrid(), initGridWithOctree(), initOther(), and cloudViewer::FastMarchingForPropagation::step().

◆ m_dx

unsigned cloudViewer::FastMarching::m_dx
protected

◆ m_dy

unsigned cloudViewer::FastMarching::m_dy
protected

◆ m_dz

unsigned cloudViewer::FastMarching::m_dz
protected

◆ m_gridLevel

◆ m_gridSize

unsigned cloudViewer::FastMarching::m_gridSize
protected

Grid size.

Referenced by initOther(), setSeedCell(), and ~FastMarching().

◆ m_ignoredCells

std::vector<unsigned> cloudViewer::FastMarching::m_ignoredCells
protected

IGNORED cells lits.

Referenced by addIgnoredCell(), cleanLastPropagation(), and initOther().

◆ m_indexShift

unsigned cloudViewer::FastMarching::m_indexShift
protected

First index of innerbound grid.

Referenced by initOther().

◆ m_initialized

◆ m_minFillIndexes

Tuple3i cloudViewer::FastMarching::m_minFillIndexes
protected

Octree min fill indexes at 'm_gridLevel'.

Referenced by initGrid(), and initGridWithOctree().

◆ m_neighboursDistance

float cloudViewer::FastMarching::m_neighboursDistance[26]
protected

◆ m_neighboursIndexShift

◆ m_numberOfNeighbours

◆ m_octree

◆ m_rowSize

unsigned cloudViewer::FastMarching::m_rowSize
protected

Shift for cell access acceleration (Y dimension)

Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), getTime(), and initOther().

◆ m_sliceSize

unsigned cloudViewer::FastMarching::m_sliceSize
protected

Shift for cell access acceleration (Z dimension)

Referenced by cloudViewer::FastMarchingForPropagation::findPeaks(), getTime(), and initOther().

◆ m_theGrid

◆ m_trialCells

std::vector<unsigned> cloudViewer::FastMarching::m_trialCells
protected

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