DGtal  1.1.0
DGtal::Surfaces< TKSpace > Class Template Reference

Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells). More...

#include <DGtal/topology/helpers/Surfaces.h>

## Public Types

typedef TKSpace KSpace

typedef KSpace::Integer Integer

typedef KSpace::Point Point

typedef KSpace::Vector Vector

typedef KSpace::Cell Cell

typedef KSpace::SCell SCell

typedef KSpace::Surfel Surfel

typedef KSpace::DirIterator DirIterator

typedef std::vector< CellCellRange

## Public Member Functions

~Surfaces ()

void selfDisplay (std::ostream &out) const

bool isValid () const

## Static Public Member Functions

template<typename PointPredicate >
static SCell findABel (const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)

template<typename PointPredicate >
static SCell findABel (const KSpace &K, const PointPredicate &pp, Point x1, Point x2)

template<typename SCellSet , typename PointPredicate >
static void trackBoundary (SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)

template<typename SCellSet , typename PointPredicate >
static void trackClosedBoundary (SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)

template<typename SCellSet , typename SurfelPredicate >
static void trackSurface (SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &pp, const SCell &start_surfel)

template<typename SCellSet , typename SurfelPredicate >
static void trackClosedSurface (SCellSet &surface, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &pp, const SCell &start_surfel)

template<typename PointPredicate >
static void track2DBoundary (std::vector< SCell > &aSCellContour2D, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)

template<typename PointPredicate >
static void track2DSliceBoundary (std::vector< SCell > &aSCellContour2D, const KSpace &K, const Dimension &trackDir, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)

template<typename SurfelPredicate >
static void track2DSurface (std::vector< SCell > &aSCellContour, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &sp, const SCell &start_surfel)

template<typename SurfelPredicate >
static void track2DSliceSurface (std::vector< SCell > &aSCellContour, const KSpace &K, const Dimension &trackDir, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const SurfelPredicate &sp, const SCell &start_surfel)

template<typename PointPredicate >
static void track2DBoundaryPoints (std::vector< Point > &aVectorOfPoints, const KSpace &K, const SurfelAdjacency< KSpace::dimension > &surfel_adj, const PointPredicate &pp, const SCell &start_surfel)

template<typename PointPredicate >
static void extractAllPointContours4C (std::vector< std::vector< Point > > &aVectPointContour2D, const KSpace &aKSpace, const PointPredicate &pp, const SurfelAdjacency< 2 > &aSAdj)

template<typename PointPredicate >
static void extractAll2DSCellContours (std::vector< std::vector< SCell > > &aVectSCellContour2D, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp)

template<typename PointPredicate >
static void extractAllConnectedSCell (std::vector< std::vector< SCell > > &aVectConnectedSCell, const KSpace &aKSpace, const SurfelAdjacency< KSpace::dimension > &aSurfelAdj, const PointPredicate &pp, bool forceOrientCellExterior=false)

template<typename PointPredicate >
static void orientSCellExterior (std::vector< SCell > &aVectOfSCell, const KSpace &aKSpace, const PointPredicate &pp)

template<typename CellSet , typename PointPredicate >
static void uMakeBoundary (CellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)

template<typename SCellSet , typename PointPredicate >
static void sMakeBoundary (SCellSet &aBoundary, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)

template<typename OutputIterator , typename PointPredicate >
static void uWriteBoundary (OutputIterator &out_it, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)

template<typename OutputIterator , typename PointPredicate >
static void sWriteBoundary (OutputIterator &out_it, const KSpace &aKSpace, const PointPredicate &pp, const Point &aLowerBound, const Point &aUpperBound)

template<typename TSurfelPredicate , typename TImageContainer >
unsigned static int uFillInterior (const KSpace &aKSpace, const TSurfelPredicate &aSurfPred, TImageContainer &anImage, const typename TImageContainer::Value &aValue, bool empty_is_inside=false, bool incrementMode=true)

template<typename SurfelPredicate , typename TImageContainer >
unsigned static int uFillExterior (const KSpace &aKSpace, const SurfelPredicate &aSurfPred, TImageContainer &anImage, const typename TImageContainer::Value &aValue, bool empty_is_outside=true, bool incrementMode=true)

static CellRange getPrimalVertices (const KSpace &K, const SCell &s)

static CellRange getPrimalVertices (const KSpace &K, const Surfel &s, bool ccw)

Surfaces ()

## Private Member Functions

Surfaces (const Surfaces &other)

Surfacesoperator= (const Surfaces &other)

## Detailed Description

### template<typename TKSpace> class DGtal::Surfaces< TKSpace >

Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).

Description of template class 'Surfaces'

Template Parameters
 TKSpace the type of cellular grid space (e.g. a KhalimskySpaceND).

Note that many methods requires a surfel adjacency so as to know how connected surfels are linked (first by the interior or first by the exterior). Secondly, many methods are parameterized by a PointPredicate which describes the shape as a characteristic function. This is to be more generic than a simple DigitalSet. With this approach, shapes can be defined implicitly.

Essentially a backport from ImaGene.

Examples
examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleGridCurve3d-2.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/volumes/distance/exampleFMM3D.cpp, graph/volDistanceTraversal.cpp, io/viewDualSurface.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/3dKSSurfaceExtraction.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, topology/ctopo-fillContours.cpp, topology/digitalSurfaceSlice.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/FMMErosion.cpp, and tutorial-examples/polyhedralizer.cpp.

Definition at line 78 of file Surfaces.h.

## ◆ Cell

template<typename TKSpace >
 typedef KSpace::Cell DGtal::Surfaces< TKSpace >::Cell

Definition at line 86 of file Surfaces.h.

## ◆ CellRange

template<typename TKSpace >
 typedef std::vector DGtal::Surfaces< TKSpace >::CellRange

Definition at line 90 of file Surfaces.h.

## ◆ DirIterator

template<typename TKSpace >
 typedef KSpace::DirIterator DGtal::Surfaces< TKSpace >::DirIterator

Definition at line 89 of file Surfaces.h.

## ◆ Integer

template<typename TKSpace >
 typedef KSpace::Integer DGtal::Surfaces< TKSpace >::Integer

Definition at line 83 of file Surfaces.h.

## ◆ KSpace

template<typename TKSpace >
 typedef TKSpace DGtal::Surfaces< TKSpace >::KSpace

Definition at line 82 of file Surfaces.h.

## ◆ Point

template<typename TKSpace >
 typedef KSpace::Point DGtal::Surfaces< TKSpace >::Point

Definition at line 84 of file Surfaces.h.

## ◆ SCell

template<typename TKSpace >
 typedef KSpace::SCell DGtal::Surfaces< TKSpace >::SCell

Definition at line 87 of file Surfaces.h.

## ◆ Surfel

template<typename TKSpace >
 typedef KSpace::Surfel DGtal::Surfaces< TKSpace >::Surfel

Definition at line 88 of file Surfaces.h.

## ◆ Vector

template<typename TKSpace >
 typedef KSpace::Vector DGtal::Surfaces< TKSpace >::Vector

Definition at line 85 of file Surfaces.h.

## ◆ ~Surfaces()

template<typename TKSpace >
 DGtal::Surfaces< TKSpace >::~Surfaces ( )

Destructor.

## ◆ Surfaces() [1/2]

template<typename TKSpace >
 DGtal::Surfaces< TKSpace >::Surfaces ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

## ◆ Surfaces() [2/2]

template<typename TKSpace >
 DGtal::Surfaces< TKSpace >::Surfaces ( const Surfaces< TKSpace > & other )
private

Copy constructor.

Parameters
 other the object to clone. Forbidden by default.

## ◆ extractAll2DSCellContours()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::extractAll2DSCellContours ( std::vector< std::vector< SCell > > & aVectSCellContour2D, const KSpace & aKSpace, const SurfelAdjacency< KSpace::dimension > & aSurfelAdj, const PointPredicate & pp )
static

Extract all contours as a vector containing the set of contours composed of SCell. Each contour is represented by a vector of signed surfels whose elements represents a boundary component of a digital shape defined by the predicate [pp]. The algorithms tracks surfels along the boundary of the shape.

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aVectSCellContour2D (modified) a vector of contour represented by a vector of cells (which are all surfels), containing the ordered list of the boundary component of [spelset]. aKSpace any space. aSurfelAdj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape.

## ◆ extractAllConnectedSCell()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::extractAllConnectedSCell ( std::vector< std::vector< SCell > > & aVectConnectedSCell, const KSpace & aKSpace, const SurfelAdjacency< KSpace::dimension > & aSurfelAdj, const PointPredicate & pp, bool forceOrientCellExterior = false )
static

Extract all surfel elements associated to each connected components of the given DigitalSet. The connected surfel set are given as result in a vector containing all components. The orientation of the resulting SCell indicates the exterior orientation according the positive axis.

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aVectConnectedSCell (modified) a vector containing for each connected components a vector of the sequence of connected SCells. aKSpace any space. aSurfelAdj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape. forceOrientCellExterior if 'true', used to change the default cell orientation in order to get the direction of shape exterior (default =false). This is used only for displaying cells with Viewer3D. This mechanism should evolve shortly.

## ◆ extractAllPointContours4C()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::extractAllPointContours4C ( std::vector< std::vector< Point > > & aVectPointContour2D, const KSpace & aKSpace, const PointPredicate & pp, const SurfelAdjacency< 2 > & aSAdj )
static

Function that extracts all the boundaries of a 2D shape (specified by a predicate on point) in a 2D KSpace. The boundaries are returned as a vector of vector of points.

Extract all 4-connected contours as a vector containing the sequence of contour Points. Each contour is represented by a vector of points defined by the sequence of pointels extracted from the boundary surfels. Calls extractAll2DSCellContours.

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aVectPointContour2D (modified) a vector of contour represented by a vector of cells (which are all surfels), containing the ordered list of the boundary component of [pp]. aKSpace any space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape. aSAdj the surfel adjacency chosen for the tracking.
Examples
tutorial-examples/freemanChainFromImage.cpp.

Referenced by main().

## ◆ findABel() [1/2]

template<typename TKSpace >
template<typename PointPredicate >
 static SCell DGtal::Surfaces< TKSpace >::findABel ( const KSpace & K, const PointPredicate & pp, Point x1, Point x2 )
static

Find a bel in some digital set given two hints (one point inside, one point outside).

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Precondition
we must have pp( x1 ) != pp( x2 ), i.e. one point should satisfy the predicate while the other not.
Parameters
 K any cellular grid space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. x1 a point within the bounds of K and such that pp( x1 ) != pp( x2 ). x2 a point within the bounds of K and such that pp( x1 ) != pp( x2 ).
Returns
a signed surfel separating a digital point in [dset] from a face adjacent digital point outside [dset].

## ◆ findABel() [2/2]

template<typename TKSpace >
template<typename PointPredicate >
 static SCell DGtal::Surfaces< TKSpace >::findABel ( const KSpace & K, const PointPredicate & pp, unsigned int nbtries = 1000 )
static

Find a bel in some digital set by random tries then dichotomy.

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 K any cellular grid space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. nbtries the maximum number of random tries (default 1000).
Returns
a signed surfel separating a digital point in [dset] from a face adjacent digital point outside [dset] or throws an InputException if none was found after [nbtries] iterations.
Examples
dec/exampleDECSurface.cpp, and tutorial-examples/AreaSurfaceEstimation-final.cpp.

## ◆ getPrimalVertices() [1/2]

template<typename TKSpace >
 static CellRange DGtal::Surfaces< TKSpace >::getPrimalVertices ( const KSpace & K, const SCell & s )
static

Given a space K and an oriented cell s, returns its vertices.

Parameters
 K any cellular grid space. s any signed cell.
Returns
the vector of the vertices of s, as unsigned cells of dimension 0.

## ◆ getPrimalVertices() [2/2]

template<typename TKSpace >
 static CellRange DGtal::Surfaces< TKSpace >::getPrimalVertices ( const KSpace & K, const Surfel & s, bool ccw )
static

Given a space K and a surfel s, returns its vertices in ccw or cw order.

Parameters
 K any cellular grid space of dimension 3. s any surfel, a signed cell of dimension 2. ccw when 'true', the order corresponds to a ccw orientation seen from the exterior normal to the surfel, otherwise it is a cw order.
Returns
the vector of the vertices of s, as unsigned cells of dimension 0.
Note
useful when exporting faces to OBJ format.

## ◆ isValid()

template<typename TKSpace >
 bool DGtal::Surfaces< TKSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

## ◆ operator=()

template<typename TKSpace >
 Surfaces& DGtal::Surfaces< TKSpace >::operator= ( const Surfaces< TKSpace > & other )
private

Assignment.

Parameters
 other the object to copy.
Returns
a reference on 'this'. Forbidden by default.

## ◆ orientSCellExterior()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::orientSCellExterior ( std::vector< SCell > & aVectOfSCell, const KSpace & aKSpace, const PointPredicate & pp )
static

Orient the SCell positively in the direction of the exterior of the DigitalSet shape. It simply check if the direct incident Cell in the first upper dimension (obtain with KhalimskySpaceND::sDirectIncident) belongs to the DigitalSet or not.

This method is used to change the default cell orientation in order to get the direction of shape exterior (default =false). This is used only for displaying cells with Viewer3D. This mechanism should evolve shortly.

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aVectOfSCell (modified) a vector containing the SCell to be oriented positively in the direction of the exterior. aKSpace any space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape.

## ◆ selfDisplay()

template<typename TKSpace >
 void DGtal::Surfaces< TKSpace >::selfDisplay ( std::ostream & out ) const

Writes/Displays the object on an output stream.

Parameters
 out the output stream where the object is written.

## ◆ sMakeBoundary()

template<typename TKSpace >
template<typename SCellSet , typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::sMakeBoundary ( SCellSet & aBoundary, const KSpace & aKSpace, const PointPredicate & pp, const Point & aLowerBound, const Point & aUpperBound )
static

Creates a set of signed surfels whose elements represents all the boundary components of a digital shape described by the predicate [pp].

Template Parameters
 SCellSet a model of a set of SCell (e.g., std::set). PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aBoundary (modified) a set of cells (which are all surfels), the boundary component of [aSpelSet]. aKSpace any space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape. aLowerBound and aUpperBound points giving the bounds of the extracted boundary.
Examples
dec/exampleHeatLaplace.cpp.

## ◆ sWriteBoundary()

template<typename TKSpace >
template<typename OutputIterator , typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::sWriteBoundary ( OutputIterator & out_it, const KSpace & aKSpace, const PointPredicate & pp, const Point & aLowerBound, const Point & aUpperBound )
static

Writes on the output iterator out_it the signed surfels whose elements represents all the boundary elements of a digital shape described by the predicate [pp].

Template Parameters
 OutputIterator any output iterator (like std::back_insert_iterator< std::vector >). PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 out_it any output iterator for writing the signed cells. aKSpace any space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape. aLowerBound and aUpperBound points giving the bounds of the extracted boundary.

## ◆ track2DBoundary()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::track2DBoundary ( std::vector< SCell > & aSCellContour2D, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const PointPredicate & pp, const SCell & start_surfel )
static

Function that extracts the boundary of a 2D shape (specified by a predicate on point) in a 2D KSpace. The boundary is returned as a vector of surfels. The surfels are guaranteed to be in the direct orientation ordering.

Creates a vector of signed surfels whose elements represents a 2D boundary component of a digital shape described by a PointPredicate. The algorithm tracks surfels along the boundary of the shape by starting from the given [start_surfel]. It only tracks the boundary of a 2D shape.

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aSCellContour2D (modified) a vector of cells (which are all surfels), containing the ordered list of the boundary component of [spelset] which touches [start_surfel]. K any space of dimension 2. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. start_surfel a signed surfel which should be between an element of [shape] and an element not in [shape].

## ◆ track2DBoundaryPoints()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::track2DBoundaryPoints ( std::vector< Point > & aVectorOfPoints, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const PointPredicate & pp, const SCell & start_surfel )
static

Function that extracts the boundary of a 2D shape (specified by a predicate on point) in a 2D KSpace. The boundary is returned as a vector of points.

This method uses random tries to find a first linel separating an interior pixel from an exterior one. It then follows direct orientations to extract the 4-connected set of points.

Parameters
 aVectorOfPoints (returns) the sequence of points of the boundary component of the digitized shape containing [start_surfel]. K any space of dimension 2. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. start_surfel a signed surfel which should be between an element of [shape] and an element not in [shape].

## ◆ track2DSliceBoundary()

template<typename TKSpace >
template<typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::track2DSliceBoundary ( std::vector< SCell > & aSCellContour2D, const KSpace & K, const Dimension & trackDir, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const PointPredicate & pp, const SCell & start_surfel )
static

Function that extracts a 2D slice of the boundary of a nD shape (specified by a predicate on point) in a nD KSpace. The boundary is returned as a vector of surfels. The surfels are guaranteed to be in the direct orientation ordering.

Creates a vector of signed surfels whose elements represents a 2D boundary component of a digital shape described by a PointPredicate. The algorithms tracks surfels along the boundary of the shape by starting from the given [start_surfel], along the direction specified by [trackDir]. More precisely, it is the boundary of the slice of the shape along directions [trackDir] and the orthogonal direction of [start_surfel].

Template Parameters
 PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aSCellContour2D (modified) a vector of cells (which are all surfels), containing the ordered list of the boundary component of [spelset] which touches [start_surfel]. K any space (dimension is arbitrary). trackDir the initial track direction at [start_surfel], should be different from the orthogonal direction of [start_surfel]. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. start_surfel a signed surfel which should be between an element of [shape] and an element not in [shape].

## ◆ track2DSliceSurface()

template<typename TKSpace >
template<typename SurfelPredicate >
 static void DGtal::Surfaces< TKSpace >::track2DSliceSurface ( std::vector< SCell > & aSCellContour, const KSpace & K, const Dimension & trackDir, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const SurfelPredicate & sp, const SCell & start_surfel )
static

Function that extracts a 2D slice of a n-1 digital surface (specified by a predicate on surfel) in a nD KSpace. The boundary is returned as a vector of surfels. The surfels (of dimension n-1) are guaranteed to be in the direct orientation ordering.

Creates a vector of signed surfels whose elements represents a component of a slice of digital surface described by a SurfelPredicate. The algorithm tracks surfels along the surface by starting from the given start_surfel and by moving along the directions trackDir and the orthogonal direction to start_surfel. All surfels are returned so as to follow the direct orientation. If the surface is open, the first surfel is at one extremity (the indirect extremity) while the last surfel is at the other extremity. Otherwise, the first surfel is start_surfel.

Template Parameters
 SurfelPredicate a model of CSurfelPredicate, meaning a functor taking a Surfel (SCell) and returning 'true' whenever the surfel belongs to the digital surface. Models include FrontierPredicate and BoundaryPredicate.
Parameters
 aSCellContour (modified) a vector of cells (which are all surfels), containing the ordered list of surfels that forms the connected component of the digital surface slice containing surfel start_surfel and the direction trackDir. K any space (dimension is arbitrary). trackDir the initial track direction at [start_surfel], should be different from the orthogonal direction of [start_surfel]. surfel_adj the surfel adjacency chosen for the tracking. sp an instance of a model of CSurfelPredicate, for instance a FrontierPredicate or a BoundaryPredicate. start_surfel a signed surfel such that sp(start_surfel) is true.

## ◆ track2DSurface()

template<typename TKSpace >
template<typename SurfelPredicate >
 static void DGtal::Surfaces< TKSpace >::track2DSurface ( std::vector< SCell > & aSCellContour, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const SurfelPredicate & sp, const SCell & start_surfel )
static

Function that extracts a 1d-contour (specified by a predicate on surfel) in a 2D KSpace. The boundary is returned as a vector of surfels. The surfels are guaranteed to be in the direct orientation ordering.

Creates a vector of signed surfels whose elements represents a component of a digital surface described by a SurfelPredicate. The algorithm tracks surfels along the surface by starting from the given start_surfel. All surfels are returned so as to follow the direct orientation. If the surface is open, the first surfel is at one extremity (the indirect extremity) while the last surfel is at the other extremity. Otherwise, the first surfel is start_surfel.

Template Parameters
 SurfelPredicate a model of CSurfelPredicate, meaning a functor taking a Surfel (SCell) and returning 'true' whenever the surfel belongs to the digital surface. Models include FrontierPredicate and BoundaryPredicate.
Parameters
 aSCellContour (modified) a vector of cells (which are all surfels), containing the ordered list of surfels that forms the connected component containing surfel [start_surfel]. K any space of dimension 2. surfel_adj the surfel adjacency chosen for the tracking. sp an instance of a model of CSurfelPredicate, for instance a FrontierPredicate or a BoundaryPredicate. start_surfel a signed surfel such that sp(start_surfel) is true.

## ◆ trackBoundary()

template<typename TKSpace >
template<typename SCellSet , typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::trackBoundary ( SCellSet & surface, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const PointPredicate & pp, const SCell & start_surfel )
static

Function that extracts the boundary of a nD digital shape (specified by a predicate on point), closed or open, in a nD KSpace. The boundary is returned as a set of surfels.

Creates a set of signed surfels whose elements represents a boundary component of a digital shape described by a PointPredicate. The algorithms tracks surfels along the boundary of the shape.

Template Parameters
 SCellSet a model of a set of SCell (e.g., std::set). PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 surface (modified) a set of cells (which are all surfels), the boundary component of [spelset] which touches [start_surfel]. K any space. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. start_surfel a signed surfel which should be between an element of [shape] and an element not in [shape].

## ◆ trackClosedBoundary()

template<typename TKSpace >
template<typename SCellSet , typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::trackClosedBoundary ( SCellSet & surface, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const PointPredicate & pp, const SCell & start_surfel )
static

Function that extracts the closed boundary of a nD digital shape (specified by a predicate on point), in a nD KSpace. The boundary is returned as a set of surfels.

Creates a set of signed surfels whose elements represents a boundary component of a digital shape described by a PointPredicate. The algorithms tracks surfels along the boundary of the shape. It follows only direct orientations, so that it is faster than trackBoundary but requires the object to be fully inside the space. Follows the idea of Artzy, Frieder and Herman algorithm [Artzy:1981-cgip], but in nD.

Template Parameters
 SCellSet a model of a set of SCell (e.g., std::set). PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 surface (modified) a set of cells (which are all surfels), the boundary component of [spelset] which touches [start_surfel]. K any space. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape, which should be at least partially included in the bounds of space [K]. start_surfel a signed surfel which should be between an element of [shape] and an element not in [shape].

## ◆ trackClosedSurface()

template<typename TKSpace >
template<typename SCellSet , typename SurfelPredicate >
 static void DGtal::Surfaces< TKSpace >::trackClosedSurface ( SCellSet & surface, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const SurfelPredicate & pp, const SCell & start_surfel )
static

Function that extracts a closed n-1 digital surface (specified by a predicate on surfel) in a nD KSpace. The surface is returned as a set of surfels.

Creates a set of signed surfels whose elements represents a boundary component of a digital surface described by a SurfelPredicate. The algorithms tracks surfels along the surface. This is an optimized version of trackSurface, which is valid only when the tracked surface is closed.

Template Parameters
 SCellSet a model of a set of SCell (e.g., std::set). SurfelPredicate a model of CSurfelPredicate describing whether a surfel belongs or not to the surface.
Parameters
 surface (modified) a set of cells (which are all surfels), the boundary component of [spelset] which touches [start_surfel]. K any space. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of CSurfelPredicate. start_surfel a signed surfel which should be part of the surface, ie. 'sp(start_surfel)==true'.

## ◆ trackSurface()

template<typename TKSpace >
template<typename SCellSet , typename SurfelPredicate >
 static void DGtal::Surfaces< TKSpace >::trackSurface ( SCellSet & surface, const KSpace & K, const SurfelAdjacency< KSpace::dimension > & surfel_adj, const SurfelPredicate & pp, const SCell & start_surfel )
static

Function that extracts a n-1 digital surface (specified by a predicate on surfel), closed or open, in a nD KSpace. The surface is returned as a set of surfels.

Creates a set of signed surfels whose elements represents a boundary component of a digital surface described by a SurfelPredicate. The algorithms tracks surfels along the surface.

Template Parameters
 SCellSet a model of a set of SCell (e.g., std::set). SurfelPredicate a model of CSurfelPredicate describing whether a surfel belongs or not to the surface.
Parameters
 surface (modified) a set of cells (which are all surfels), the boundary component of [spelset] which touches [start_surfel]. K any space. surfel_adj the surfel adjacency chosen for the tracking. pp an instance of a model of CSurfelPredicate. start_surfel a signed surfel which should be part of the surface, ie. 'sp(start_surfel)==true'.

## ◆ uFillExterior()

template<typename TKSpace >
template<typename SurfelPredicate , typename TImageContainer >
 unsigned static int DGtal::Surfaces< TKSpace >::uFillExterior ( const KSpace & aKSpace, const SurfelPredicate & aSurfPred, TImageContainer & anImage, const typename TImageContainer::Value & aValue, bool empty_is_outside = true, bool incrementMode = true )
static

Given a boundary surface [aSurfPred] in [aKSpace] (given as SurfelPredicate), fills its exterior in a given image [anImage] by a specific value [aValue] (considered as increment if [incrementMode] is set to true). The technique is to fill line by line and tests the intersection with the surface. Note that the set of the surfel of the boundary has to be a closed surface.

Parameters
 aKSpace the digital space. aSurfPred the digital Jordan surface. anImage the image to be filled. aValue the value to fill the image. empty_is_outside when 'true', an empty line is considered exterior, otherwise interior. incrementMode if set to 'true' the image value is incremented by [aValue] instead to be set to [aValue] (default).
Returns
the number of cells filled in the image.

Referenced by test3dSurfaceHelper().

## ◆ uFillInterior()

template<typename TKSpace >
template<typename TSurfelPredicate , typename TImageContainer >
 unsigned static int DGtal::Surfaces< TKSpace >::uFillInterior ( const KSpace & aKSpace, const TSurfelPredicate & aSurfPred, TImageContainer & anImage, const typename TImageContainer::Value & aValue, bool empty_is_inside = false, bool incrementMode = true )
static

Given a boundary surface [aSurfPred] in [aKSpace] (given as SurfelPredicate), fills its interior in a given image [anImage] by a specific value [aValue] (considered as increment if [incrementMode] is set to true). The technique is to fill line by line and tests the intersection with the surface. Note that the set of the surfel of the boundary has to be a closed surface.

Parameters
 aKSpace the digital space. aSurfPred the digital Jordan surface. anImage the image to be filled. aValue the value to fill the image. empty_is_inside when 'true', an empty line is considered interior, otherwise exterior (set by default to false). incrementMode if set to 'true' the image value is incremented by [aValue] instead to be set to [aValue] (default).
Returns
the number of cells filled in the image.

Referenced by test3dSurfaceHelper().

## ◆ uMakeBoundary()

template<typename TKSpace >
template<typename CellSet , typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::uMakeBoundary ( CellSet & aBoundary, const KSpace & aKSpace, const PointPredicate & pp, const Point & aLowerBound, const Point & aUpperBound )
static

Creates a set of unsigned surfels whose elements represents all the boundary components of a digital shape described by the predicate [pp].

Template Parameters
 CellSet a model of a set of Cell (e.g., std::set). PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 aBoundary (modified) a set of cells (which are all surfels), the boundary component of [aSpelSet]. aKSpace any space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape. aLowerBound and aUpperBound points giving the bounds of the extracted boundary.

## ◆ uWriteBoundary()

template<typename TKSpace >
template<typename OutputIterator , typename PointPredicate >
 static void DGtal::Surfaces< TKSpace >::uWriteBoundary ( OutputIterator & out_it, const KSpace & aKSpace, const PointPredicate & pp, const Point & aLowerBound, const Point & aUpperBound )
static

Writes on the output iterator out_it the unsigned surfels whose elements represents all the boundary elements of a digital shape described by the predicate [pp].

Template Parameters
 OutputIterator any output iterator (like std::back_insert_iterator< std::vector >). PointPredicate a model of concepts::CPointPredicate describing the inside of a digital shape, meaning a functor taking a Point and returning 'true' whenever the point belongs to the shape.
Parameters
 out_it any output iterator for writing the cells. aKSpace any space. pp an instance of a model of concepts::CPointPredicate, for instance a SetPredicate for a digital set representing a shape. aLowerBound and aUpperBound points giving the bounds of the extracted boundary.

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