DGtal  1.5.beta
DGtal::ParDirCollapse< CC > Class Template Reference

Aim: Implements thinning algorithms in cubical complexes. The implementation supports any model of cubical complex, for instance a DGtal::CubicalComplex< KhalimskySpaceND< 3, int > >. Three approaches are provided. The first—ParDirCollapse—bases on directional collapse of free pairs of faces. Second—CollapseSurface—is an extension of ParDirCollapse such that faces of dimension one lower than the dimension of the complex are kept. The last approach —CollapseIsthmus—is also an extension of ParDirCollapse such that faces of dimension one lower than the complex are preserved when they do not contain free faces of dimension two lower than the complex. Paper: Chaussard, J. and Couprie, M., Surface Thinning in 3D Cubical Complexes, Combinatorial Image Analysis, (2009) More...

#include <DGtal/topology/ParDirCollapse.h>

Public Types

typedef CC::KSpace KSpace
 Any model of concepts::CCellularGridSpaceND, i.e. a type that models a Khalimsky space. More...
 
typedef CC::Point Point
 Type of integer point. More...
 
typedef CC::Size Size
 Type of containers size. More...
 
typedef KSpace::Cell Cell
 Type of cells in Khalimsky space. More...
 
typedef KSpace::Cells Cells
 Type of collection of cells. More...
 
typedef CC::CellMapConstIterator CellMapConstIterator
 Type of const iterator over a map of cells. More...
 

Public Member Functions

bool isValid () const
 
 ParDirCollapse (const KSpace &k)
 
void attach (Alias< CC > pComplex)
 
unsigned int eval (unsigned int iterations)
 
void collapseSurface ()
 
void collapseIsthmus ()
 

Data Fields

bool verbose = true
 

Protected Member Functions

 ParDirCollapse ()
 

Private Member Functions

 BOOST_STATIC_ASSERT ((CC::KSpace::dimension >=2))
 
 BOOST_CONCEPT_ASSERT ((boost::Container< CC >))
 
int getOrientation (const Cell &F, const Cell &G) const
 
int getDirection (const Cell &F, const Cell &G) const
 
bool completeFreepair (CellMapConstIterator F, Cell &G, int orient, int dir)
 
bool isNotIncludedInUpperDim (CellMapConstIterator F)
 
bool isIsthmus (CellMapConstIterator F)
 
 ParDirCollapse (const ParDirCollapse &other)
 
ParDirCollapseoperator= (const ParDirCollapse &other)
 

Private Attributes

const KSpaceK
 Reference to Khalimsky space in which a given complex is embedded. More...
 
CCcomplex
 Pointer to complex. More...
 

Detailed Description

template<typename CC>
class DGtal::ParDirCollapse< CC >

Aim: Implements thinning algorithms in cubical complexes. The implementation supports any model of cubical complex, for instance a DGtal::CubicalComplex< KhalimskySpaceND< 3, int > >. Three approaches are provided. The first—ParDirCollapse—bases on directional collapse of free pairs of faces. Second—CollapseSurface—is an extension of ParDirCollapse such that faces of dimension one lower than the dimension of the complex are kept. The last approach —CollapseIsthmus—is also an extension of ParDirCollapse such that faces of dimension one lower than the complex are preserved when they do not contain free faces of dimension two lower than the complex. Paper: Chaussard, J. and Couprie, M., Surface Thinning in 3D Cubical Complexes, Combinatorial Image Analysis, (2009)

Description of class 'ParDirCollapse'

Template Parameters
CCcubical complex.

Definition at line 77 of file ParDirCollapse.h.

Member Typedef Documentation

◆ Cell

template<typename CC >
typedef KSpace::Cell DGtal::ParDirCollapse< CC >::Cell

Type of cells in Khalimsky space.

Definition at line 90 of file ParDirCollapse.h.

◆ CellMapConstIterator

Type of const iterator over a map of cells.

Definition at line 94 of file ParDirCollapse.h.

◆ Cells

template<typename CC >
typedef KSpace::Cells DGtal::ParDirCollapse< CC >::Cells

Type of collection of cells.

Definition at line 92 of file ParDirCollapse.h.

◆ KSpace

template<typename CC >
typedef CC::KSpace DGtal::ParDirCollapse< CC >::KSpace

Any model of concepts::CCellularGridSpaceND, i.e. a type that models a Khalimsky space.

Definition at line 84 of file ParDirCollapse.h.

◆ Point

template<typename CC >
typedef CC::Point DGtal::ParDirCollapse< CC >::Point

Type of integer point.

Definition at line 86 of file ParDirCollapse.h.

◆ Size

template<typename CC >
typedef CC::Size DGtal::ParDirCollapse< CC >::Size

Type of containers size.

Definition at line 88 of file ParDirCollapse.h.

Constructor & Destructor Documentation

◆ ParDirCollapse() [1/3]

template<typename CC >
DGtal::ParDirCollapse< CC >::ParDirCollapse ( const KSpace k)

Constructor.

Parameters
k– const reference to Khalimsky space

◆ ParDirCollapse() [2/3]

template<typename CC >
DGtal::ParDirCollapse< CC >::ParDirCollapse ( )
protected

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

◆ ParDirCollapse() [3/3]

template<typename CC >
DGtal::ParDirCollapse< CC >::ParDirCollapse ( const ParDirCollapse< CC > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ attach()

template<typename CC >
void DGtal::ParDirCollapse< CC >::attach ( Alias< CC pComplex)

This method should be use to point to a complex to which one wish to apply one of the thinning algorithms.

Parameters
pComplex– Cubical complex

Referenced by main(), and TEST_CASE().

◆ BOOST_CONCEPT_ASSERT()

template<typename CC >
DGtal::ParDirCollapse< CC >::BOOST_CONCEPT_ASSERT ( (boost::Container< CC >)  )
private

◆ BOOST_STATIC_ASSERT()

template<typename CC >
DGtal::ParDirCollapse< CC >::BOOST_STATIC_ASSERT ( (CC::KSpace::dimension >=2)  )
private

◆ collapseIsthmus()

template<typename CC >
void DGtal::ParDirCollapse< CC >::collapseIsthmus ( )

Extension of basic algorithm—ParDirCollapse—which preserve KSpace::dimension - 1 faces which are not included in any KSpace::dimension cells. Moreover, cells to be kept have not to be collapsible.

Referenced by main(), and TEST_CASE().

◆ collapseSurface()

template<typename CC >
void DGtal::ParDirCollapse< CC >::collapseSurface ( )

Extension of basic algorithm—ParDirCollapse—which preserve KSpace::dimension - 1 faces which are not included in any KSpace::dimension cells.

Referenced by main(), and TEST_CASE().

◆ completeFreepair()

template<typename CC >
bool DGtal::ParDirCollapse< CC >::completeFreepair ( CellMapConstIterator  F,
Cell G,
int  orient,
int  dir 
)
private

Calculate an orientation of a freepair.

Parameters
F– cell of a dimension one lower than G.
G– cell of a dimension one higher than F.
orient– freepair orientation
dir– freepair direction
Returns
– true if G was found as collapisble, false otherwise.

◆ eval()

template<typename CC >
unsigned int DGtal::ParDirCollapse< CC >::eval ( unsigned int  iterations)

This method applies a given number of iterations to a complex provided by the attach() method.

Parameters
iterations– number of iterations
Returns
total number of removed cells.

Referenced by main(), and TEST_CASE().

◆ getDirection()

template<typename CC >
int DGtal::ParDirCollapse< CC >::getDirection ( const Cell F,
const Cell G 
) const
private

Calculate an orientation of a freepair.

Parameters
F– cell of a dimension one lower than G.
G– cell of a dimension one higher than F.

◆ getOrientation()

template<typename CC >
int DGtal::ParDirCollapse< CC >::getOrientation ( const Cell F,
const Cell G 
) const
private

Calculate an orientation of a freepair.

Parameters
F– cell of a dimension one lower than G.
G– cell of a dimension one higher than F.

◆ isIsthmus()

template<typename CC >
bool DGtal::ParDirCollapse< CC >::isIsthmus ( CellMapConstIterator  F)
private

Check if a given face of dimension: KSpace::dimension - 1, does not constitute a freepair. Note that, a given face has to not be included in any face of dimension: KSpace::dimension.

Parameters
F– cell of dimension one lower than KSpace.
Returns
true if F does not constitute a freepair and false otherwise.

◆ isNotIncludedInUpperDim()

template<typename CC >
bool DGtal::ParDirCollapse< CC >::isNotIncludedInUpperDim ( CellMapConstIterator  F)
private

Check if a given face of dimension n is included in a face of dimmension n + 1.

Parameters
F– cell of dimension smaller than KSpace::dimension.
Returns
true if a face is not included in any other and false otherwise.

◆ isValid()

template<typename CC >
bool DGtal::ParDirCollapse< CC >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ operator=()

template<typename CC >
ParDirCollapse& DGtal::ParDirCollapse< CC >::operator= ( const ParDirCollapse< CC > &  other)
private

Assignment.

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

Field Documentation

◆ complex

template<typename CC >
CC* DGtal::ParDirCollapse< CC >::complex
private

Pointer to complex.

Definition at line 215 of file ParDirCollapse.h.

◆ K

template<typename CC >
const KSpace& DGtal::ParDirCollapse< CC >::K
private

Reference to Khalimsky space in which a given complex is embedded.

Definition at line 213 of file ParDirCollapse.h.

◆ verbose

template<typename CC >
bool DGtal::ParDirCollapse< CC >::verbose = true

Definition at line 218 of file ParDirCollapse.h.


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