DGtal  1.4.2
DGtal::functions Namespace Reference

functions namespace gathers all DGtal functionsxs. More...

Namespaces

 dec
 
 Hull2D
 Hull2D namespace gathers useful functions to compute and return the convex hull or the alpha-shape of a range of 2D points.
 
 setops
 

Functions

template<typename T >
constexpr T const_pow (T b, unsigned int e)
 
template<typename T >
constexpr T const_middle (T K, unsigned int e)
 
template<typename Container , bool ordered>
bool isEqual (const Container &S1, const Container &S2)
 
template<typename Container >
bool isEqual (const Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
bool isSubset (const Container &S1, const Container &S2)
 
template<typename Container >
bool isSubset (const Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container & assignDifference (Container &S1, const Container &S2)
 
template<typename Container >
Container & assignDifference (Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container makeDifference (const Container &S1, const Container &S2)
 
template<typename Container >
Container makeDifference (const Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container & assignUnion (Container &S1, const Container &S2)
 
template<typename Container >
Container & assignUnion (Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container makeUnion (const Container &S1, const Container &S2)
 
template<typename Container >
Container makeUnion (const Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container & assignIntersection (Container &S1, const Container &S2)
 
template<typename Container >
Container & assignIntersection (Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container makeIntersection (const Container &S1, const Container &S2)
 
template<typename Container >
Container makeIntersection (const Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container & assignSymmetricDifference (Container &S1, const Container &S2)
 
template<typename Container >
Container & assignSymmetricDifference (Container &S1, const Container &S2)
 
template<typename Container , bool ordered>
Container makeSymmetricDifference (const Container &S1, const Container &S2)
 
template<typename Container >
Container makeSymmetricDifference (const Container &S1, const Container &S2)
 
template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool checkOnePoint (const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &aDSS)
 
template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool checkPointsPosition (const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &aDSS)
 
template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool checkPointsRemainder (const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &aDSS)
 
template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool checkAll (const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &aDSS)
 
template<typename Position , typename Coordinate , typename PointVector , typename OutputIterator , typename PositionFunctor , typename TruncationFunctor1 , typename TruncationFunctor2 >
bool smartCHNextVertex (const Position &positionBound, const Coordinate &remainderBound, PointVector &X, Coordinate &rX, const PointVector &Y, const Coordinate &rY, PointVector &V, Coordinate &rV, OutputIterator ito, const PositionFunctor &pos, const TruncationFunctor1 &f1, const TruncationFunctor2 &f2)
 Procedure that computes the next (lower or upper) vertex of the left hull of a DSS. More...
 
template<typename PointVector , typename Coordinate , typename Position , typename PositionFunctor , typename OutputIterator >
PointVector smartCH (const PointVector &aFirstPoint, const Coordinate &aRemainderBound, const Position &aPositionBound, const PointVector &aStep, const Coordinate &aRStep, const PointVector &aShift, const Coordinate &aRShift, const PositionFunctor &aPositionFunctor, OutputIterator uIto, OutputIterator lIto)
 Procedure that computes the lower and upper left hull of a DSS of first point aFirstPoint, length aPositionBound, contained in a digital straight line described by aRStep, aRShift and aRemainderBound. More...
 
template<typename DSL , typename OutputIterator >
DSL::Vector smartCH (const DSL &aDSL, const typename DSL::Point &aFirstPoint, const typename DSL::Position &aLength, OutputIterator uIto, OutputIterator lIto)
 Procedure that computes the lower and upper left hull of a DSS of first point aFirstPoint, length aLength, contained in a DSL aDSL [Roussillon 2014 : [108]]. More...
 
template<typename PointVector , typename Position , typename OutputIterator , typename TruncationFunctor1 , typename TruncationFunctor2 , typename PositionFunctor >
bool smartCHPreviousVertex (PointVector &X, const PointVector &Y, PointVector &V, const Position &aFirstPosition, const Position &aLastPosition, OutputIterator ito, const PositionFunctor &pos, const TruncationFunctor1 &f1, const TruncationFunctor2 &f2)
 Procedure that computes the previous vertex of the left hull of a DSS of main direction vector V , first upper leaning point U and first positive Bezout point L. The computation stops as soon as a computed vertex is located before aLastPosition.
More...
 
template<typename PointVector , typename Position , typename PositionFunctor , typename OutputIterator >
PointVector reversedSmartCH (PointVector U, PointVector L, PointVector V, const Position &aFirstPosition, const Position &aLastPosition, const PositionFunctor &aPositionFunctor, OutputIterator uIto, OutputIterator lIto)
 Procedure that computes the lower and upper left hull of the left subsegment of a greater DSS characterized by the first upper leaning point U, the first positive Bezout point L and its direction vector V. Note that the so-called left subsegment is bounded on the one hand by the first point of the DSS located at aFirstPosition and on the other hand by the point located at position aLastPosition. More...
 
template<typename DSS , typename OutputIterator >
DSS::Vector reversedSmartCH (const DSS &aDSS, const typename DSS::Position &aPositionBound, OutputIterator uIto, OutputIterator lIto)
 Procedure that computes the lower and upper left hull of the left subsegment of a greater DSS aDSS. Note that the so-called left subsegment is bounded on the one hand by the first point of aDSS and on the other hand by the point located at position aPositionBound [Roussillon 2014 : [108]]. More...
 
template<typename T >
power (const T &aVal, const unsigned int exponent)
 
template<typename T >
roundToUpperPowerOfTwo (const T &n)
 
template<typename T >
abs (const T &a)
 
template<typename T >
square (T x)
 
template<typename T >
cube (T x)
 
template<typename TKSpace , typename TCellContainer , typename CellConstIterator , typename CellMapIteratorPriority >
uint64_t collapse (CubicalComplex< TKSpace, TCellContainer > &K, CellConstIterator S_itB, CellConstIterator S_itE, const CellMapIteratorPriority &priority, bool hintIsSClosed=false, bool hintIsKClosed=false, bool verbose=false)
 
template<typename TKSpace , typename TCellContainer , typename BdryCellOutputIterator , typename InnerCellOutputIterator >
void filterCellsWithinBounds (const CubicalComplex< TKSpace, TCellContainer > &K, const typename TKSpace::Point &kLow, const typename TKSpace::Point &kUp, BdryCellOutputIterator itBdry, InnerCellOutputIterator itInner)
 
template<typename TObject , typename TKSpace , typename TCellContainer >
std::unique_ptr< TObject > objectFromSpels (const CubicalComplex< TKSpace, TCellContainer > &C)
 
template<typename TComplex >
NeighborhoodConfiguration getSpelNeighborhoodConfigurationOccupancy (const TComplex &input_complex, const typename TComplex::Point &center, const std::unordered_map< typename TComplex::Point, NeighborhoodConfiguration > &mapPointToMask)
 
DGtal::CountedPtr< boost::dynamic_bitset<> > loadTable (const std::string &input_filename, const unsigned int known_size, const bool compressed=true)
 
template<unsigned int dimension = 3>
DGtal::CountedPtr< boost::dynamic_bitset<> > loadTable (const std::string &input_filename, const bool compressed=true)
 
template<typename TPoint >
DGtal::CountedPtr< std::unordered_map< TPoint, NeighborhoodConfiguration > > mapZeroPointNeighborhoodToConfigurationMask ()
 
template<typename TObject , typename TMap >
void generateSimplicityTable (const typename TObject::DigitalTopology &dt, TMap &map)
 
template<typename TVoxelComplex , typename TMap >
void generateVoxelComplexTable (TMap &map, std::function< bool(const TVoxelComplex &, const typename TVoxelComplex::Cell &) > skelFunction)
 
template<typename TComplex >
TComplex asymetricThinningScheme (TComplex &vc, std::function< std::pair< typename TComplex::Cell, typename TComplex::Data >(const typename TComplex::Clique &) > Select, std::function< bool(const TComplex &, const typename TComplex::Cell &) > Skel, bool verbose=false)
 
template<typename TComplex >
TComplex persistenceAsymetricThinningScheme (TComplex &vc, std::function< std::pair< typename TComplex::Cell, typename TComplex::Data >(const typename TComplex::Clique &) > Select, std::function< bool(const TComplex &, const typename TComplex::Cell &) > Skel, uint32_t persistence, bool verbose=false)
 
template<typename TComplex >
std::pair< typename TComplex::Cell, typename TComplex::Data > selectFirst (const typename TComplex::Clique &clique)
 
template<typename TComplex >
std::pair< typename TComplex::Cell, typename TComplex::Data > selectRandom (const typename TComplex::Clique &clique)
 
template<typename TComplex , typename TRandomGenerator >
std::pair< typename TComplex::Cell, typename TComplex::Data > selectRandom (const typename TComplex::Clique &clique, TRandomGenerator &gen)
 
template<typename TDistanceTransform , typename TComplex >
std::pair< typename TComplex::Cell, typename TComplex::Data > selectMaxValue (const TDistanceTransform &dist_map, const typename TComplex::Clique &clique)
 
template<typename TComplex >
bool skelUltimate (const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TComplex >
bool skelEnd (const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TComplex >
bool skelSimple (const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TComplex >
bool skelIsthmus (const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TComplex >
bool oneIsthmus (const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TComplex >
bool twoIsthmus (const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TComplex >
bool skelWithTable (const boost::dynamic_bitset<> &table, const std::unordered_map< typename TComplex::Point, unsigned int > &pointToMaskMap, const TComplex &vc, const typename TComplex::Cell &cell)
 
template<typename TObject >
bool isZeroSurface (const TObject &small_obj)
 
template<typename TObject >
bool isOneSurface (const TObject &small_obj)
 
template<typename TObject >
std::vector< TObject > connectedComponents (const TObject &input_obj, bool verbose)
 
template<typename TComplex , typename TDistanceTransform = DistanceTransformation<Z3i::Space, Z3i::DigitalSet, ExactPredicateLpSeparableMetric<Z3i::Space, 3>>>
TComplex thinningVoxelComplex (TComplex &vc, const std::string &skel_type_str, const std::string &skel_select_type_str, const std::string &tables_folder, const int &persistence=0, const TDistanceTransform *distance_transform=nullptr, const bool profile=false, const bool verbose=false)
 

Detailed Description

functions namespace gathers all DGtal functionsxs.

Function Documentation

◆ abs()

template<typename T >
T DGtal::functions::abs ( const T &  a)

Return the absolute value of an instance of type T.

Template Parameters
Tthe type of elements to compare (model of boost::LessThanComparable).
Parameters
afirst value
Returns
the absolute value |a|.

Definition at line 116 of file BasicMathFunctions.h.

117  {
118  BOOST_CONCEPT_ASSERT((boost::LessThanComparable<T>));
119  if (a<0)
120  return -a;
121  else
122  return a;
123  }
Go to http://www.sgi.com/tech/stl/LessThanComparable.html.
Definition: Boost.dox:48

◆ assignDifference() [1/2]

template<typename Container , bool ordered>
Container& DGtal::functions::assignDifference ( Container &  S1,
const Container &  S2 
)

Set difference operation. Updates the set S1 as S1 - S2.

Parameters
[in,out]S1an input set, S1 - S2 as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 896 of file SetFunctions.h.

897  {
898  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
899  BOOST_STATIC_CONSTANT
900  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
901  BOOST_STATIC_CONSTANT
902  ( bool, isOrdered = ordered
903  || ( isAssociative && IsOrderedAssociativeContainer< Container >::value ) );
904 
906  ::assignDifference( S1, S2 );
907  }
static Container & assignDifference(Container &S1, const Container &S2)
Definition: SetFunctions.h:292

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignDifference().

Referenced by makeDifference(), and DGtal::functions::setops::operator-=().

◆ assignDifference() [2/2]

template<typename Container >
Container& DGtal::functions::assignDifference ( Container &  S1,
const Container &  S2 
)

Set difference operation. Updates the set S1 as S1 - S2.

Parameters
[in,out]S1an input set, S1 - S2 as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 918 of file SetFunctions.h.

919  {
920  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
921  BOOST_STATIC_CONSTANT
922  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
923  BOOST_STATIC_CONSTANT
924  ( bool, isOrdered = isAssociative && IsOrderedAssociativeContainer< Container >::value );
925 
927  ::assignDifference( S1, S2 );
928  }

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignDifference().

◆ assignIntersection() [1/2]

template<typename Container , bool ordered>
Container& DGtal::functions::assignIntersection ( Container &  S1,
const Container &  S2 
)

Set intersection operation. Updates the set S1 as \( S1 \cap S2 \).

Parameters
[in,out]S1an input set, \( S1 \cap S2 \) as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 1082 of file SetFunctions.h.

1083  {
1084  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1085  BOOST_STATIC_CONSTANT
1086  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
1087  BOOST_STATIC_CONSTANT
1088  ( bool, isOrdered = ordered
1089  || ( isAssociative && IsOrderedAssociativeContainer< Container >::value ) );
1090 
1092  ::assignIntersection( S1, S2 );
1093  }
static Container & assignIntersection(Container &S1, const Container &S2)
Definition: SetFunctions.h:340

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignIntersection().

Referenced by makeIntersection(), and DGtal::functions::setops::operator&=().

◆ assignIntersection() [2/2]

template<typename Container >
Container& DGtal::functions::assignIntersection ( Container &  S1,
const Container &  S2 
)

Set intersection operation. Updates the set S1 as \( S1 \cap S2 \).

Parameters
[in,out]S1an input set, \( S1 \cap S2 \) as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 1104 of file SetFunctions.h.

1105  {
1106  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1107  BOOST_STATIC_CONSTANT
1108  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
1109  BOOST_STATIC_CONSTANT
1110  ( bool, isOrdered = isAssociative && IsOrderedAssociativeContainer< Container >::value );
1111 
1113  ::assignIntersection( S1, S2 );
1114  }

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignIntersection().

◆ assignSymmetricDifference() [1/2]

template<typename Container , bool ordered>
Container& DGtal::functions::assignSymmetricDifference ( Container &  S1,
const Container &  S2 
)

Set symmetric difference operation. Updates the set S1 as \( S1 \Delta S2 \).

Parameters
[in,out]S1an input set, \( S1 \Delta S2 \) as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 1176 of file SetFunctions.h.

1177  {
1178  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1179  BOOST_STATIC_CONSTANT
1180  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
1181  BOOST_STATIC_CONSTANT
1182  ( bool, isOrdered = ordered
1183  || ( isAssociative && IsOrderedAssociativeContainer< Container >::value ) );
1184 
1187  }
static Container & assignSymmetricDifference(Container &S1, const Container &S2)
Definition: SetFunctions.h:365

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignSymmetricDifference().

Referenced by makeSymmetricDifference(), and DGtal::functions::setops::operator^=().

◆ assignSymmetricDifference() [2/2]

template<typename Container >
Container& DGtal::functions::assignSymmetricDifference ( Container &  S1,
const Container &  S2 
)

Set symmetric difference operation. Updates the set S1 as \( S1 \Delta S2 \).

Parameters
[in,out]S1an input set, \( S1 \Delta S2 \) as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 1198 of file SetFunctions.h.

1199  {
1200  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1201  BOOST_STATIC_CONSTANT
1202  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
1203  BOOST_STATIC_CONSTANT
1204  ( bool, isOrdered = isAssociative && IsOrderedAssociativeContainer< Container >::value );
1205 
1208  }

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignSymmetricDifference().

◆ assignUnion() [1/2]

template<typename Container , bool ordered>
Container& DGtal::functions::assignUnion ( Container &  S1,
const Container &  S2 
)

Set union operation. Updates the set S1 as \( S1 \cup S2 \).

Parameters
[in,out]S1an input set, \( S1 \cup S2 \) as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 990 of file SetFunctions.h.

991  {
992  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
993  BOOST_STATIC_CONSTANT
994  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
995  BOOST_STATIC_CONSTANT
996  ( bool, isOrdered = ordered
997  || ( isAssociative && IsOrderedAssociativeContainer< Container >::value ) );
998 
1000  ::assignUnion( S1, S2 );
1001  }
static Container & assignUnion(Container &S1, const Container &S2)
Definition: SetFunctions.h:316

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignUnion().

Referenced by makeUnion(), and DGtal::functions::setops::operator|=().

◆ assignUnion() [2/2]

template<typename Container >
Container& DGtal::functions::assignUnion ( Container &  S1,
const Container &  S2 
)

Set union operation. Updates the set S1 as \( S1 \cup S2 \).

Parameters
[in,out]S1an input set, \( S1 \cup S2 \) as output.
[in]S2another input set.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 1012 of file SetFunctions.h.

1013  {
1014  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1015  BOOST_STATIC_CONSTANT
1016  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
1017  BOOST_STATIC_CONSTANT
1018  ( bool, isOrdered = isAssociative && IsOrderedAssociativeContainer< Container >::value );
1019 
1021  ::assignUnion( S1, S2 );
1022  }

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::assignUnion().

◆ asymetricThinningScheme()

template<typename TComplex >
TComplex DGtal::functions::asymetricThinningScheme ( TComplex &  vc,
std::function< std::pair< typename TComplex::Cell, typename TComplex::Data >(const typename TComplex::Clique &) >  Select,
std::function< bool(const TComplex &, const typename TComplex::Cell &) >  Skel,
bool  verbose = false 
)

◆ checkAll()

template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool DGtal::functions::checkAll ( const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &  aDSS)

Checks whether a DSS is valid or not. NB: in logarithmic time (in order to check that a and b are relatively prime)

Parameters
aDSSany DSS
Returns
'true' if valid, 'false' otherwise.

◆ checkOnePoint()

template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool DGtal::functions::checkOnePoint ( const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &  aDSS)

Checks the validity of the DSS when it contains only one point.

Parameters
aDSSany DSS
Precondition
the DSS contains only one point
Returns
'true' if the DSS is valid, 'false' otherwise.

◆ checkPointsPosition()

template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool DGtal::functions::checkPointsPosition ( const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &  aDSS)

Checks that the difference between two extremal upper (resp. lower) leaning points is equal to the direction vector (a,b) scaled by an integer. Checks that there is no pattern between end points and extremal leaning points.

Parameters
aDSSany DSS
Precondition
the DSS contains more than one point, ie a and b are not both null.
Returns
'true' if ok, 'false' otherwise.

◆ checkPointsRemainder()

template<typename TCoordinate , typename TInteger , unsigned short adjacency>
bool DGtal::functions::checkPointsRemainder ( const ArithmeticalDSS< TCoordinate, TInteger, adjacency > &  aDSS)

Checks the consistency between the parameters and the leaning points: first and last upper leaning points should have a remainder equal to mu while firsta and last lower leaning points should have a remainder equal to mu + omega - 1. Moreover, front and back points should have a remainder lying within the range [mu, mu+omega[.

Parameters
aDSSany DSS
Precondition
the DSS contains more than one point, ie a and b are not both null.
Returns
'true' if this property is fulfilled, 'false' otherwise.

◆ collapse()

template<typename TKSpace , typename TCellContainer , typename CellConstIterator , typename CellMapIteratorPriority >
uint64_t DGtal::functions::collapse ( CubicalComplex< TKSpace, TCellContainer > &  K,
CellConstIterator  S_itB,
CellConstIterator  S_itE,
const CellMapIteratorPriority &  priority,
bool  hintIsSClosed = false,
bool  hintIsKClosed = false,
bool  verbose = false 
)

Collapse a user-specified part of complex K, collapsing cells following priority [priority], in a decreasing sequence until no more collapse is feasible. The range [S_itb,S_itE) provides the starting cells, generally (but not compulsory) maximal cells. The resulting complex is guaranteed to keep the same homotopy type (a kind of topology equivalence).

Note
Cells whose data has been marked as FIXED are not removed.
Only cells that are in the closure of [S_itb,S_itE) may be removed, and only if they are not marked as FIXED.
Advanced:
If you use a DefaultCellMapIteratorPriority object as priority, then the VALUE part of each cell data defines the priority (the highest value the soonest are these cells collapsed). You may thus fill these cell values before calling this method.
Template Parameters
TKSpacethe digital space in which lives the cubical complex.
TCellContainerthe associative container used to store cells within the cubical complex.
CellConstIteratorany forward const iterator on Cell.
CellMapIteratorPriorityany type defining a method 'bool operator()( const Cell&, const Cell&) const'. Defines the order in which cells are collapsed.
See also
DefaultCellMapIteratorPriority
Parameters
[in,out]Kthe complex that is collapsed.
S_itBthe start of a range of cells which is included in [K].
S_itEthe end of a range of cells which is included in [K].
prioritythe object that assign a priority to each cell.
hintIsSClosedindicates if [S_itb,S_ite) is a closed set (faster in this case).
hintIsKClosedindicates that complex K is closed.
verboseoutputs some information during processing when 'true'.
Returns
the number of cells removed from complex K.
See also
topology/cubical-complex-collapse.cpp

◆ connectedComponents()

template<typename TObject >
std::vector< TObject > DGtal::functions::connectedComponents ( const TObject &  input_obj,
bool  verbose 
)

Get all connected components of the input object.

Template Parameters
TObjectObject Type
Parameters
input_objinput object
verboseflag to be verbose at execution
Returns
vector of TObject containing the different connected components of the object.
See also
ObjectBoostGraphInterface.h

◆ const_middle()

template<typename T >
constexpr T DGtal::functions::const_middle ( K,
unsigned int  e 
)
constexpr
Template Parameters
Tany model of bounded number.
Parameters
Ka non negative number
ea non negative integer
Returns
the index of the middle element in the e-dimensional array of width \( 2K+1 \), computed at compile time.
auto m1 = functions::const_middle( 1, 2 ); // 4, dans le tableau 3x3
auto m2 = functions::const_middle( 2, 2 ); // 12, dans le tableau 5x5
auto m3 = functions::const_middle( 1, 3 ); // 13, dans le tableau 3x3x3

Definition at line 75 of file ConstExpressions.h.

75  {
76  return e <= 1
77  ? T( K )
78  : K * const_pow( 2 * K + 1, e - 1 ) + const_middle( K, e - 1 );
79  }
constexpr T const_pow(T b, unsigned int e)
constexpr T const_middle(T K, unsigned int e)
KSpace K

References const_pow(), and K.

◆ const_pow()

template<typename T >
constexpr T DGtal::functions::const_pow ( b,
unsigned int  e 
)
constexpr
Template Parameters
Tany model of bounded number.
Parameters
ba number
ea non negative integer
Returns
the constant expression \( b^e \), computed at compile time.
auto v = functions::const_pow( 5, 3 ); // 5^3

Definition at line 60 of file ConstExpressions.h.

60  {
61  return e == 0 ? T(1) : b * const_pow( b, e - 1 );
62  }

Referenced by const_middle().

◆ cube()

template<typename T >
T DGtal::functions::cube ( x)
inline

Returns the value x * x * x

Template Parameters
Ta type with the multiply operator.
Parameters
xany value
Returns
the value x * x * x

Definition at line 144 of file BasicMathFunctions.h.

145  { return x * x * x; }

◆ filterCellsWithinBounds()

template<typename TKSpace , typename TCellContainer , typename BdryCellOutputIterator , typename InnerCellOutputIterator >
void DGtal::functions::filterCellsWithinBounds ( const CubicalComplex< TKSpace, TCellContainer > &  K,
const typename TKSpace::Point kLow,
const typename TKSpace::Point kUp,
BdryCellOutputIterator  itBdry,
InnerCellOutputIterator  itInner 
)

Computes the cells of the given complex K that lies on the boundary or inside the parallelepiped specified by bounds kLow and kUp.

Template Parameters
TKSpacethe digital space in which lives the cubical complex.
TCellContainerthe associative container used to store cells within the cubical complex.
BdryCellOutputIteratorany output iterator on TCubicalComplex::Cell.
InnerCellOutputIteratorany output iterator on TCubicalComplex::Cell.
Parameters
[in]Kany cubical complex.
[in]kLowany Khalimsky coordinate representing the lowest possible cell.
[in]kUpany Khalimsky coordinate representing the uppermost possible cell.
[in,out]itBdryAn output iterator on Cell that outputs all the cells of K that lie on the boundary of the parallelepiped specified by bounds kLow and kUp.
[in,out]itInnerAn output iterator on Cell that outputs all the cells of K that lie in the interior of the parallelepiped specified by bounds kLow and kUp.
Note
Complexity is linear in the number of cells of K (but the constant is also linear in the dimension of K).

◆ generateSimplicityTable()

template<typename TObject , typename TMap >
void DGtal::functions::generateSimplicityTable ( const typename TObject::DigitalTopology &  dt,
TMap &  map 
)

Given a digital topology dt, generates tables that tells if the central point is simple for the specified configuration. The configuration is determined by a sequence of bits, the first bit for the point in the neighborhood, the second bit for the second point, etc. When set to one, the point is in the neighborhood.

Template Parameters
TObjectthe type of object whose simpleness we wish to precompute. Includes the topology.
TMapthe type used to store the mapping configuration -> bool.
Parameters
dtan instance of the digital topology.
map(modified) the mapping configuration -> bool.

Definition at line 71 of file NeighborhoodTablesGenerators.h.

74  {
75  typedef typename TObject::DigitalSet DigitalSet;
76  typedef typename TObject::Point Point;
77  typedef typename DigitalSet::Domain Domain;
78  typedef typename Domain::ConstIterator DomainConstIterator;
79 
80  Point p1 = Point::diagonal( -1 );
81  Point p2 = Point::diagonal( 1 );
82  Point c = Point::diagonal( 0 );
83  Domain domain( p1, p2 );
84  DigitalSet shapeSet( domain );
85  TObject shape( dt, shapeSet );
86  unsigned int k = 0;
87  for ( DomainConstIterator it = domain.begin(); it != domain.end(); ++it )
88  if ( *it != c ) ++k;
89  ASSERT( ( k < 32 )
90  && "[generateSimplicityTable] number of configurations is too high." );
91  unsigned int nbCfg = 1 << k;
92  for ( NeighborhoodConfiguration cfg = 0; cfg < nbCfg; ++cfg )
93  {
94  if ( ( cfg % 1000 ) == 0 )
95  {
96  trace.progressBar( (double) cfg, (double) nbCfg );
97  }
98  shape.pointSet().clear();
99  shape.pointSet().insert( c );
100  NeighborhoodConfiguration mask = 1;
101  for ( DomainConstIterator it = domain.begin(); it != domain.end(); ++it )
102  {
103  if ( *it != c )
104  {
105  if ( cfg & mask ) shape.pointSet().insert( *it );
106  mask <<= 1;
107  }
108  }
109  bool simple = shape.isSimple( c );
110  map[ cfg ] = simple;
111  }
112  }
void progressBar(const double currentValue, const double maximalValue)
MyDigitalSurface::ConstIterator ConstIterator
uint32_t NeighborhoodConfiguration
Trace trace
Definition: Common.h:153
MyPointD Point
Definition: testClone2.cpp:383
Domain domain
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet

References domain, dt, DGtal::Trace::progressBar(), and DGtal::trace.

◆ generateVoxelComplexTable()

template<typename TVoxelComplex , typename TMap >
void DGtal::functions::generateVoxelComplexTable ( TMap &  map,
std::function< bool(const TVoxelComplex &, const typename TVoxelComplex::Cell &) >  skelFunction 
)

Generates a table mapping the number of configuration of a 26 topology voxel neighborhood, and the boolean result of a predicate function applied to the central point for each configuration. The configuration is determined by a sequence of bits, the first bit for the point in the neighborhood, the second bit for the second point, etc. When set to one, the point is in the neighborhood.

Template Parameters
TVoxelComplexthe type of the VoxelComplex whose property we wish to precompute.
TMapthe type used to store the mapping configuration -> bool.
Parameters
map(modified) the mapping configuration -> bool.
skelFunctiona predicate function related to the property we want to check.

Definition at line 132 of file NeighborhoodTablesGenerators.h.

139  {
140  using Domain = DGtal::Z3i::Domain;
141  using Point = typename Domain::Point ;
142  using DigitalSet = DigitalSetByAssociativeContainer<
143  Domain, std::unordered_set< Point > >;
144  using DomainConstIterator = typename Domain::ConstIterator ;
145  using KSpace = typename TVoxelComplex::KSpace;
146 
147  Point p1 = Point::diagonal( -1 );
148  Point p2 = Point::diagonal( 1 );
149  Point c = Point::diagonal( 0 );
150  Domain domain( p1, p2 );
151  DigitalSet shapeSet( domain );
152  unsigned int k = 0;
153  for ( DomainConstIterator it = domain.begin(); it != domain.end(); ++it )
154  if ( *it != c ) ++k;
155  ASSERT( ( k < 32 )
156  && "[generateVoxelComplexTable] number of configurations is too high." );
157  unsigned int nbCfg = 1 << k;
158 
159  KSpace ks;
160  // Pad KSpace domain.
161  ks.init(domain.lowerBound() + Point::diagonal( -1 ) ,
162  domain.upperBound() + Point::diagonal( 1 ),
163  true);
164  TVoxelComplex vc(ks);
165  vc.construct(shapeSet);
166  for ( unsigned int cfg = 0; cfg < nbCfg; ++cfg ){
167  if ( ( cfg % 1000 ) == 0 )
168  trace.progressBar( (double) cfg, (double) nbCfg );
169  vc.clear();
170  vc.insertVoxelPoint(c);
171  unsigned int mask = 1;
172  for ( DomainConstIterator it = domain.begin(); it != domain.end(); ++it ){
173  if ( *it != c ) {
174  if ( cfg & mask ) vc.insertVoxelPoint( *it );
175  mask <<= 1;
176  }
177  }
178  const auto &kcell = vc.space().uSpel(c);
179  bool predicate_output = skelFunction(vc, kcell);
180  map[ cfg ] = predicate_output;
181  }
182  }
HyperRectDomain< Space > Domain
Definition: StdDefs.h:172

References domain, DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::Trace::progressBar(), and DGtal::trace.

◆ getSpelNeighborhoodConfigurationOccupancy()

template<typename TComplex >
NeighborhoodConfiguration DGtal::functions::getSpelNeighborhoodConfigurationOccupancy ( const TComplex &  input_complex,
const typename TComplex::Point center,
const std::unordered_map< typename TComplex::Point, NeighborhoodConfiguration > &  mapPointToMask 
)

Get the occupancy configuration of the neighborhood of a point in a cubical complex. The neighborhood size is considered 3^D for dimension D of the point (ie 3x3x3 cube for 3D point).

Template Parameters
TComplexComplex type.
Parameters
input_complexinput complex. Used to check what points are occupied.
centerof the neighborhood. It doesn't matter if center belongs or not to input_complex.
mapPointToMaskmap[Point]->configuration, where Point is inside a DxD cube centered in {0,0,..} in ND.
Note
This doesn't work with KSpace coordinates, these must be converted to digital coordinates before:
See also
KhalimskySpaceND::uCoords(3,cell)
mapPointToBitMask
Returns
bit configuration

◆ isEqual() [1/2]

template<typename Container , bool ordered>
bool DGtal::functions::isEqual ( const Container &  S1,
const Container &  S2 
)

Equality test.

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
true iff S1 is equal to S2 (i.e. S1 is a subset of S2 and S2 is a subset of S1).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 789 of file SetFunctions.h.

790  {
791  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
792  BOOST_STATIC_CONSTANT
793  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
794  BOOST_STATIC_CONSTANT
795  ( bool, isOrdered = ordered
796  || ( isAssociative && IsOrderedAssociativeContainer< Container >::value ) );
797 
799  ::isEqual( S1, S2 );
800  }
static bool isEqual(const Container &S1, const Container &S2)
Definition: SetFunctions.h:243

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::isEqual().

Referenced by DGtal::operator!=(), and DGtal::operator==().

◆ isEqual() [2/2]

template<typename Container >
bool DGtal::functions::isEqual ( const Container &  S1,
const Container &  S2 
)

Equality test.

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
true iff S1 is equal to S2 (i.e. S1 is a subset of S2 and S2 is a subset of S1).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 815 of file SetFunctions.h.

816  {
817  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
818  BOOST_STATIC_CONSTANT
819  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
820  BOOST_STATIC_CONSTANT
821  ( bool, isOrdered = isAssociative && IsOrderedAssociativeContainer< Container >::value );
822 
824  ::isEqual( S1, S2 );
825  }

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::isEqual().

◆ isOneSurface()

template<typename TObject >
bool DGtal::functions::isOneSurface ( const TObject &  small_obj)

Check if input object is a simple closed curve. Object must be:

See also
isZeroSurface
Template Parameters
TObjectObject Type
Parameters
small_objinput object
Returns
bool

Referenced by TEST_CASE_METHOD().

◆ isSubset() [1/2]

template<typename Container , bool ordered>
bool DGtal::functions::isSubset ( const Container &  S1,
const Container &  S2 
)

Inclusion test.

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
true iff S1 is a subset of S2.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 845 of file SetFunctions.h.

846  {
847  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
848  BOOST_STATIC_CONSTANT
849  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
850  BOOST_STATIC_CONSTANT
851  ( bool, isOrdered = ordered
852  || ( isAssociative && IsOrderedAssociativeContainer< Container >::value ) );
853 
855  ::isSubset( S1, S2 );
856  }
static bool isSubset(const Container &S1, const Container &S2)
Definition: SetFunctions.h:268

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::isSubset().

Referenced by DGtal::operator<=(), and DGtal::operator>=().

◆ isSubset() [2/2]

template<typename Container >
bool DGtal::functions::isSubset ( const Container &  S1,
const Container &  S2 
)

Inclusion test.

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
true iff S1 is a subset of S2.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 869 of file SetFunctions.h.

870  {
871  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
872  BOOST_STATIC_CONSTANT
873  ( bool, isAssociative = IsAssociativeContainer< Container >::value );
874  BOOST_STATIC_CONSTANT
875  ( bool, isOrdered = isAssociative && IsOrderedAssociativeContainer< Container >::value );
876 
878  ::isSubset( S1, S2 );
879  }

References DGtal::detail::SetFunctionsImpl< Container, associative, ordered >::isSubset().

◆ isZeroSurface()

template<typename TObject >
bool DGtal::functions::isZeroSurface ( const TObject &  small_obj)

Check if the object contains, exclusively, two disconnected voxels.

See also
Object::computeConnectedness
Template Parameters
TObjectObject Type
Parameters
small_objinput object
Returns
bool

Referenced by TEST_CASE_METHOD().

◆ loadTable() [1/2]

template<unsigned int dimension = 3>
DGtal::CountedPtr< boost::dynamic_bitset<> > DGtal::functions::loadTable ( const std::string &  input_filename,
const bool  compressed = true 
)
inline

Load existing look up table existing in file_name, precalculated tables can be accessed including the header: "DGtal/topology/tables/NeighborhoodTables.h"

Template Parameters
dimensionof the space input_filename table refers. 2 or 3
Parameters
input_filenameplain text containing the bool table.
compressedtrue if table to read has been compressed with zlib.
Returns
smart ptr of map[neighbor_configuration] -> bool
See also
NeighborhoodConfigurations::loadTable

◆ loadTable() [2/2]

DGtal::CountedPtr< boost::dynamic_bitset<> > DGtal::functions::loadTable ( const std::string &  input_filename,
const unsigned int  known_size,
const bool  compressed = true 
)
inline

Load existing look up table existing in file_name, precalculated tables can be accessed including the header: "DGtal/topology/tables/NeighborhoodTables.h"

Parameters
input_filenameplain text containing the bool table.
known_sizeof the bitset, for 2D = 256 (2^8), 3D = 67108864 (2^26)
compressedtrue if table to read has been compressed with zlib.
Returns
smart ptr of map[neighbor_configuration] -> bool
Note
The tables were calculated using the generateTableXXX examples. Compressed files of the tables are distributed in the source code. At build or install time, the header "DGtal/topology/tables/NeighborhoodTables.h" is generated. It has const strings variables with the file names of the tables.

Referenced by SCENARIO(), TEST_CASE_METHOD(), and thinningVoxelComplex().

◆ makeDifference() [1/2]

template<typename Container , bool ordered>
Container DGtal::functions::makeDifference ( const Container &  S1,
const Container &  S2 
)

Set difference operation. Returns the difference of S1 - S2.

Parameters
[in]S1an input set
[in]S2another input set.
Returns
the set S1 - S2.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 946 of file SetFunctions.h.

947  {
948  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
949  Container S( S1 );
950  assignDifference<Container, ordered>( S, S2 );
951  return S;
952  }

Referenced by DGtal::functions::setops::operator-().

◆ makeDifference() [2/2]

template<typename Container >
Container DGtal::functions::makeDifference ( const Container &  S1,
const Container &  S2 
)

Set difference operation. Returns the difference of S1 - S2.

Parameters
[in]S1an input set
[in]S2another input set.
Returns
the set S1 - S2.
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 965 of file SetFunctions.h.

966  {
967  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
968  Container S( S1 );
969  assignDifference( S, S2 );
970  return S;
971  }
Container & assignDifference(Container &S1, const Container &S2)
Definition: SetFunctions.h:896

References assignDifference().

◆ makeIntersection() [1/2]

template<typename Container , bool ordered>
Container DGtal::functions::makeIntersection ( const Container &  S1,
const Container &  S2 
)

Set intersection operation. Returns the set \( S1 \cap S2 \).

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
the set \( S1 \cap S2 \).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 1131 of file SetFunctions.h.

1132  {
1133  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1134  Container S( S1 );
1135  assignIntersection<Container, ordered>( S, S2 );
1136  return S;
1137  }

Referenced by DGtal::functions::setops::operator&().

◆ makeIntersection() [2/2]

template<typename Container >
Container DGtal::functions::makeIntersection ( const Container &  S1,
const Container &  S2 
)

Set intersection operation. Returns the set \( S1 \cap S2 \).

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
the set \( S1 \cap S2 \).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 1149 of file SetFunctions.h.

1150  {
1151  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1152  Container S( S1 );
1153  assignIntersection( S, S2 );
1154  return S;
1155  }
Container & assignIntersection(Container &S1, const Container &S2)

References assignIntersection().

◆ makeSymmetricDifference() [1/2]

template<typename Container , bool ordered>
Container DGtal::functions::makeSymmetricDifference ( const Container &  S1,
const Container &  S2 
)

Set symmetric difference operation. Returns the set \( S1 \Delta S2 \).

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
the set \( S1 \Delta S2 \).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 1225 of file SetFunctions.h.

1226  {
1227  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1228  Container S( S1 );
1229  assignSymmetricDifference<Container, ordered>( S, S2 );
1230  return S;
1231  }

Referenced by DGtal::functions::setops::operator^().

◆ makeSymmetricDifference() [2/2]

template<typename Container >
Container DGtal::functions::makeSymmetricDifference ( const Container &  S1,
const Container &  S2 
)

Set symmetric difference operation. Returns the set \( S1 \Delta S2 \).

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
the set \( S1 \Delta S2 \).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 1243 of file SetFunctions.h.

1244  {
1245  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1246  Container S( S1 );
1247  assignSymmetricDifference( S, S2 );
1248  return S;
1249  }
Container & assignSymmetricDifference(Container &S1, const Container &S2)

References assignSymmetricDifference().

◆ makeUnion() [1/2]

template<typename Container , bool ordered>
Container DGtal::functions::makeUnion ( const Container &  S1,
const Container &  S2 
)

Set union operation. Returns the set \( S1 \cup S2 \).

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
the set \( S1 \cup S2 \).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).
orderedwhen 'true', the user indicates that values are ordered (e.g. a sorted vector), otherwise, depending on the container type, the compiler may still determine that values are ordered.

Definition at line 1039 of file SetFunctions.h.

1040  {
1041  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1042  Container S( S1 );
1043  assignUnion<Container, ordered>( S, S2 );
1044  return S;
1045  }

Referenced by DGtal::functions::setops::operator|().

◆ makeUnion() [2/2]

template<typename Container >
Container DGtal::functions::makeUnion ( const Container &  S1,
const Container &  S2 
)

Set union operation. Returns the set \( S1 \cup S2 \).

Parameters
[in]S1an input set.
[in]S2another input set.
Returns
the set \( S1 \cup S2 \).
Template Parameters
Containerany type of container (even a sequence, a set, an unordered_set, a map, etc).

Definition at line 1057 of file SetFunctions.h.

1058  {
1059  BOOST_STATIC_ASSERT( IsContainer< Container >::value );
1060  Container S( S1 );
1061  assignUnion( S, S2 );
1062  return S;
1063  }
Container & assignUnion(Container &S1, const Container &S2)
Definition: SetFunctions.h:990

References assignUnion().

◆ mapZeroPointNeighborhoodToConfigurationMask()

template<typename TPoint >
DGtal::CountedPtr< std::unordered_map<TPoint, NeighborhoodConfiguration > > DGtal::functions::mapZeroPointNeighborhoodToConfigurationMask ( )
inline

Maps any point in the neighborhood of point Zero (0,..,0) to its corresponding configuration bit mask. This is a helper to use with tables. The order of the configuration is lexicographic, starting in {-1, -1, ...}.

Note
the neighborhood is considered to be all points p which ||p-zero|| <= 1

Example: Point{ -1, -1, -1 } = 1; // corresponding to mask x x 0000 0001 Point{ 0, -1, -1 } = 2; // corresponding to mask x x 0000 0010 Point{ 1, 1, 1 } = 2^26; // x 0010 x x x x x x

Note
NeighborhoodConfiguration is type uint 32 bits, so the max dimension supported is 3.
See also
HyperRectDomain_Iterator::nextLexicographicOrder
testNeighborhoodConfigurations.cpp shows the complete mapping.
Template Parameters
TPointtype of point to create map and input the desired dimension.
Returns
map[Point]->configuration smart pointer.

◆ objectFromSpels()

template<typename TObject , typename TKSpace , typename TCellContainer >
std::unique_ptr<TObject> DGtal::functions::objectFromSpels ( const CubicalComplex< TKSpace, TCellContainer > &  C)

Create object from the spels in the complex.

User has to provide a 3D TObject type with its associated DigitalSet and DigitalTopology.

Given a dimension n, spels are the n-cells, equivalently, spels are the grid-points in Z^n.

Template Parameters
TObjectwith its associdated DigitalSet and DigitalTopology
TKSpacekspace type of the input CubicalComplex.
TCellContainercell container type of the input CubicalComplex
Parameters
Cinput CubicalComplex
Returns
unique_ptr of created object with the pointset containing the spels of the complex.

◆ oneIsthmus()

template<typename TComplex >
bool DGtal::functions::oneIsthmus ( const TComplex &  vc,
const typename TComplex::Cell cell 
)

Check if input cell is a 1-isthmus. A voxel is a 1-isthmus if, after a thinning, its proper neighborhood is made only by two voxels, ie, it is a 0-Surface isZeroSurface.

See also
isZeroSurface
Object::properNeighborhood
Template Parameters
TComplexVoxelComplex.
Parameters
vcinput complex.
cellapply function on input cell.
Returns
bool

Referenced by TEST_CASE_METHOD().

◆ persistenceAsymetricThinningScheme()

template<typename TComplex >
TComplex DGtal::functions::persistenceAsymetricThinningScheme ( TComplex &  vc,
std::function< std::pair< typename TComplex::Cell, typename TComplex::Data >(const typename TComplex::Clique &) >  Select,
std::function< bool(const TComplex &, const typename TComplex::Cell &) >  Skel,
uint32_t  persistence,
bool  verbose = false 
)

◆ power()

template<typename T >
T DGtal::functions::power ( const T &  aVal,
const unsigned int  exponent 
)

Compute exponentiation by squaring of a scalar aVal of type T by the exponent exponent (unsigned int). The computation is done in \( O(\log(exponent))\) multiplications.

Note
This function is better than std::pow on unsigned int exponents and integer value type since it performs exact computations (no cast to float or doubles).
Parameters
aValthe value
exponentthe exponent
Template Parameters
Tscalar value type (must have '*' operator).
Returns
aVal^exponent
See also
square, cube

Definition at line 73 of file BasicMathFunctions.h.

74  {
75  unsigned int q=exponent;
76  T p(aVal);
77 
78  if (exponent == 0) { return 1; }
79 
80  T result = NumberTraits<T>::ONE;
81  while (q != 0)
82  {
83  if (q % 2 == 1) { // q is odd
84  result *= p;
85  q--;
86  }
87  p *= p;
88  q /= 2;
89  }
90  return result;
91  }

◆ reversedSmartCH() [1/2]

template<typename DSS , typename OutputIterator >
DSS::Vector DGtal::functions::reversedSmartCH ( const DSS &  aDSS,
const typename DSS::Position &  aPositionBound,
OutputIterator  uIto,
OutputIterator  lIto 
)
inline

Procedure that computes the lower and upper left hull of the left subsegment of a greater DSS aDSS. Note that the so-called left subsegment is bounded on the one hand by the first point of aDSS and on the other hand by the point located at position aPositionBound [Roussillon 2014 : [108]].

Parameters
aDSSbounding DSS
aPositionBoundposition of the last point of the subsegment (should be located after the first point of aDSS).
uItooutput iterator used to store the vertices of the upper convex hull
lItooutput iterator used to store the vertices of the lower convex hull
Template Parameters
DSSa model of arithmetical DSS
OutputIteratora model of output iterator
Returns
last direction vector, ie. the rational slope of minimal denominator

◆ reversedSmartCH() [2/2]

template<typename PointVector , typename Position , typename PositionFunctor , typename OutputIterator >
PointVector DGtal::functions::reversedSmartCH ( PointVector  U,
PointVector  L,
PointVector  V,
const Position &  aFirstPosition,
const Position &  aLastPosition,
const PositionFunctor &  aPositionFunctor,
OutputIterator  uIto,
OutputIterator  lIto 
)
inline

Procedure that computes the lower and upper left hull of the left subsegment of a greater DSS characterized by the first upper leaning point U, the first positive Bezout point L and its direction vector V. Note that the so-called left subsegment is bounded on the one hand by the first point of the DSS located at aFirstPosition and on the other hand by the point located at position aLastPosition.

Parameters
Ulast upper convex hull vertex
Llast lower convex hull vertex
Vlast valid Bezout vector (main direction vector)
aFirstPositionposition of the first point of the subsegment
aLastPositionposition of the last point of the subsegment
aPositionFunctorposition functor, which returns the position of any given point/vector
uItooutput iterator used to store the vertices of the upper convex hull
lItooutput iterator used to store the vertices of the lower convex hull
Template Parameters
PointVectora model of 2d point/vector
Positiona model of integer for the position of the point in the bounding DSS
PositionFunctora model of unary functor that returns the position of a point/vector
OutputIteratora model of output iterator
Returns
last direction vector, ie. the rational slope of minimal denominator

Referenced by basicTest2(), and reversedSmartCHSubsegment().

◆ roundToUpperPowerOfTwo()

template<typename T >
T DGtal::functions::roundToUpperPowerOfTwo ( const T &  n)

Compute the next higher power of two of the given argument n of type T.

Template Parameters
Tthe type of the element T
Parameters
nan element of type T (casted to unsigned integer).
Returns
the next higher power of two.

Definition at line 102 of file BasicMathFunctions.h.

102  {
103  return (T) 1 << (1+DGtal::Bits::mostSignificantBit( (unsigned int) n-1 ) );
104  }
static unsigned int mostSignificantBit(DGtal::uint8_t n)
Definition: Bits.h:343

References DGtal::Bits::mostSignificantBit().

Referenced by DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::GLTextureImage().

◆ selectFirst()

template<typename TComplex >
std::pair<typename TComplex::Cell, typename TComplex::Data> DGtal::functions::selectFirst ( const typename TComplex::Clique &  clique)

Select first voxel of input clique.

Template Parameters
TComplexinput CubicalComplex
Parameters
cliquefrom where cell is chosen.
Returns
first voxel of clique.

◆ selectMaxValue()

template<typename TDistanceTransform , typename TComplex >
std::pair<typename TComplex::Cell, typename TComplex::Data> DGtal::functions::selectMaxValue ( const TDistanceTransform &  dist_map,
const typename TComplex::Clique &  clique 
)

Select cell from clique that has max value looking at the input dist_map. The points in the dist_map and in the clique must refer to the same position.

If you need to have a std::function<bool(const Clique &)> signature (for using it in thinning algorithms), use a lambda: subsitute skelRandom (for example) for:

auto selectDistMax =
[&dist_map](const Clique & clique){
return selectMaxDistance<TDistMap, TComplex>(dist_map, clique);
}
Template Parameters
TDistanceTransformContainer type for the distance map.
TComplexinput CubicalComplex
Parameters
dist_mapcontainer holding the values.
cliquefrom where cell is chosen.
Returns
cell from input clique with highest value.
See also
DistanceTransformation.h

◆ selectRandom() [1/2]

template<typename TComplex >
std::pair<typename TComplex::Cell, typename TComplex::Data> DGtal::functions::selectRandom ( const typename TComplex::Clique &  clique)

Select random voxel from input clique.

Template Parameters
TComplexinput CubicalComplex
Parameters
cliquefrom where cell is chosen.
Returns
random voxel from input clique.

◆ selectRandom() [2/2]

template<typename TComplex , typename TRandomGenerator >
std::pair<typename TComplex::Cell, typename TComplex::Data> DGtal::functions::selectRandom ( const typename TComplex::Clique &  clique,
TRandomGenerator &  gen 
)

Select random voxel from input clique.

Template Parameters
TComplexCubicalComplex
TRandomGeneratorRandomGenerator
Parameters
cliquefrom where cell is chosen
genrandom generator
Returns
random voxel from input clique.

◆ skelEnd()

template<typename TComplex >
bool DGtal::functions::skelEnd ( const TComplex &  vc,
const typename TComplex::Cell cell 
)

Check if input cell only has one neighbor, using Object::topology.

Template Parameters
TComplexVoxelComplex
Parameters
vcinput voxel complex.
cellc apply function on this voxel cell.
Returns
true if voxel cell only has neighbor.

◆ skelIsthmus()

template<typename TComplex >
bool DGtal::functions::skelIsthmus ( const TComplex &  vc,
const typename TComplex::Cell cell 
)

Check if input cell is a 1 or 2 Isthmus.

Template Parameters
TComplexVoxelComplex.
Parameters
vcinput complex.
cellapply function on input cell.
Returns
oneIsthmus || twoIsthmus
See also
oneIsthmus
twoIsthmus

Referenced by TEST_CASE_METHOD().

◆ skelSimple()

template<typename TComplex >
bool DGtal::functions::skelSimple ( const TComplex &  vc,
const typename TComplex::Cell cell 
)

Check if input cell is simple using VoxelComplex::isSimple interface to Object::isSimple.

See also
VoxelComplex::isSimple
Object::isSimple
Template Parameters
TComplexVoxelComplex.
Parameters
vcinput complex.
cellapply function on input cell.
Returns
true if voxel is simple.

◆ skelUltimate()

template<typename TComplex >
bool DGtal::functions::skelUltimate ( const TComplex &  vc,
const typename TComplex::Cell cell 
)

Always returns false. Used in thinning schemes to calculate an ultimate skeleton. An ultimate skeleton only keeps voxels that don't change the topology.

Note
The number of cells of a thinning using this function is the same as the number of connected components of an object.
See also
asymetricThinningScheme
Template Parameters
TComplexVoxelComplex
Parameters
vcinput voxel complex.
cellc apply function on this voxel cell.
Returns
always false.

◆ skelWithTable()

template<typename TComplex >
bool DGtal::functions::skelWithTable ( const boost::dynamic_bitset<> &  table,
const std::unordered_map< typename TComplex::Point, unsigned int > &  pointToMaskMap,
const TComplex &  vc,
const typename TComplex::Cell cell 
)

Generic predicate to use external tables[configuration]->bool with skel functions. Can be adapted to any table using lambdas.

See also
LookUpTableFunctions.h
tests/topology/testVoxelComplex.h

If you need to have a std::function<bool(const Complex & vc, const Cell & c )> signature (for using it in thinning algorithms), use a lambda to capture values: subsitute skelIsthmus (for example) for:

auto skelWithTableIsthmus =
[&table, &pointToMaskMap](const Complex & vc, const Cell & cell){
return skelWithTable<TComplex>(table, pointToMaskMap, vc, cell);
}
Template Parameters
TComplexinput CubicalComplex type.
Parameters
table[configuration]->bool
See also
VoxelComplex::loadTable
LookUpTableFunctions.h::loadTable
Parameters
pointToMaskMapmap[neighborhood points] to a bit mask. Used to get the neighborhood configuration.
See also
VoxelComplex::pointToMask
LookUpTableFunctions.h::mapPointToBitMask
Parameters
vcinput complex.
cellinput cell, center from where the neighborhood [configuration] will be checked. Note that only neighborhood are checked to belong to the complex, not the input cell.
Returns
bool from selected table[configuration].

Referenced by TEST_CASE_METHOD(), and thinningVoxelComplex().

◆ smartCH() [1/2]

template<typename DSL , typename OutputIterator >
DSL::Vector DGtal::functions::smartCH ( const DSL &  aDSL,
const typename DSL::Point aFirstPoint,
const typename DSL::Position &  aLength,
OutputIterator  uIto,
OutputIterator  lIto 
)
inline

Procedure that computes the lower and upper left hull of a DSS of first point aFirstPoint, length aLength, contained in a DSL aDSL [Roussillon 2014 : [108]].

Parameters
aDSLbounding DSL
aFirstPointfirst point of the DSS
aLength(strictly positive) length of the DSS
uItooutput iterator used to store the vertices of the upper convex hull
lItooutput iterator used to store the vertices of the lower convex hull
Returns
last direction vector, ie. the rational slope of minimal denominator
Template Parameters
DSLa model of arithmetical DSL
OutputIteratora model of output iterator

◆ smartCH() [2/2]

template<typename PointVector , typename Coordinate , typename Position , typename PositionFunctor , typename OutputIterator >
PointVector DGtal::functions::smartCH ( const PointVector aFirstPoint,
const Coordinate &  aRemainderBound,
const Position &  aPositionBound,
const PointVector aStep,
const Coordinate &  aRStep,
const PointVector aShift,
const Coordinate &  aRShift,
const PositionFunctor &  aPositionFunctor,
OutputIterator  uIto,
OutputIterator  lIto 
)
inline

Procedure that computes the lower and upper left hull of a DSS of first point aFirstPoint, length aPositionBound, contained in a digital straight line described by aRStep, aRShift and aRemainderBound.

Parameters
aFirstPointfirst point of the DSS
aRemainderBounddifference between the intercept mu of the bounding DSL and the remainder of the first point.
aPositionBound(strictly positive) length of the DSS
aStepfirst step of the DSL
aRStepremainder of the first step, ie. parameter \( a \) of the bounding DSL
aShiftshift vector of the DSL
aRShiftremainder of the shift vector, ie. parameter \( omega \) of the bounding DSL.
aPositionFunctorposition functor, which returns the position of any given point/vector
uItooutput iterator used to store the vertices of the upper convex hull
lItooutput iterator used to store the vertices of the lower convex hull
Returns
last direction vector, ie. the rational slope of minimal denominator of the DSS
Template Parameters
PointVectora model of 2d point/vector
Coordinatea model of integer for the coordinates of the point/vector
Positiona model of integer for locating points in the DSS
PositionFunctora model of unary functor that returns the position of a point/vector
OutputIteratora model of output iterator

Referenced by basicTest(), comparisonLeftHull(), and smartCHSubsegment().

◆ smartCHNextVertex()

template<typename Position , typename Coordinate , typename PointVector , typename OutputIterator , typename PositionFunctor , typename TruncationFunctor1 , typename TruncationFunctor2 >
bool DGtal::functions::smartCHNextVertex ( const Position &  positionBound,
const Coordinate &  remainderBound,
PointVector X,
Coordinate &  rX,
const PointVector Y,
const Coordinate &  rY,
PointVector V,
Coordinate &  rV,
OutputIterator  ito,
const PositionFunctor &  pos,
const TruncationFunctor1 &  f1,
const TruncationFunctor2 &  f2 
)
inline

Procedure that computes the next (lower or upper) vertex of the left hull of a DSS.

Parameters
positionBoundposition of the last point of the DSS
remainderBoundremainder of the lower leaning points contained in the DSS
X(returned) last vertex of the considered side
rX(returned) remainder of X
Ylast vertex of the opposite side
rYremainder of Y
V(returned) last direction vector (unimodular with (X - Y))
rV(returned) remainder of V (not null)
itooutput iterator used to store the new vertex lying on the same side as X
posposition functor, which returns the position of any given point/vector
f1first floor function (for the vertex)
f2second floor function (for the direction vector)
Returns
'true' if the last vertex of the left hull has been reached, 'false' otherwise.
Template Parameters
Positiona model of integer for locating points in the DSS
PointVectora model of 2d point/vector
Coordinatea model of integer for the coordinates of the point/vector
OutputIteratora model of output iterator
PositionFunctora model of unary functor that returns the position of a point/vector
TruncationFunctor1a model of unary functor that implements an integer division
TruncationFunctor2a model of unary functor that implements an integer division

◆ smartCHPreviousVertex()

template<typename PointVector , typename Position , typename OutputIterator , typename TruncationFunctor1 , typename TruncationFunctor2 , typename PositionFunctor >
bool DGtal::functions::smartCHPreviousVertex ( PointVector X,
const PointVector Y,
PointVector V,
const Position &  aFirstPosition,
const Position &  aLastPosition,
OutputIterator  ito,
const PositionFunctor &  pos,
const TruncationFunctor1 &  f1,
const TruncationFunctor2 &  f2 
)
inline

Procedure that computes the previous vertex of the left hull of a DSS of main direction vector V , first upper leaning point U and first positive Bezout point L. The computation stops as soon as a computed vertex is located before aLastPosition.

Parameters
X(returned) first vertex of the left hull on the considered side
Yfirst vertex of the left hull on the opposite side
V(returned) previous direction vector
aFirstPositionposition of the first point of the subsegment
aLastPositionposition of the last point of the subsegment
itooutput iterator used to store the vertices of the left hull lying on the same side as X
posposition functor, which returns the position of any given point/vector
f1integer divisor for the direction vector update
f2integer divisor for the vertex update
Template Parameters
PointVectora model of couple of coordinates
Positiona model of integer for the position of the points
OutputIteratora model of output iterator
TruncationFunctor1a model of functor for the integer division
TruncationFunctor2a model of functor for the integer division
PositionFunctora model of functor returning the position of a point
Returns
'true' if the last vertex has been reached, 'false' otherwise

◆ square()

template<typename T >
T DGtal::functions::square ( x)
inline

Returns the value x * x

Template Parameters
Ta type with the multiply operator.
Parameters
xany value
Returns
the value x * x

Definition at line 133 of file BasicMathFunctions.h.

134  { return x * x; }

Referenced by DGtal::functors::HatPointFunction< TPoint, TScalar >::operator()(), and DGtal::functors::BallConstantPointFunction< TPoint, TScalar >::operator()().

◆ thinningVoxelComplex()

template<typename TComplex , typename TDistanceTransform = DistanceTransformation<Z3i::Space, Z3i::DigitalSet, ExactPredicateLpSeparableMetric<Z3i::Space, 3>>>
TComplex DGtal::functions::thinningVoxelComplex ( TComplex &  vc,
const std::string &  skel_type_str,
const std::string &  skel_select_type_str,
const std::string &  tables_folder,
const int &  persistence = 0,
const TDistanceTransform *  distance_transform = nullptr,
const bool  profile = false,
const bool  verbose = false 
)

Definition at line 92 of file VoxelComplexThinning.h.

101 {
102  if(verbose) {
103  using DGtal::trace;
104  trace.beginBlock("thin_function parameters:");
105  trace.info() << "skel_type_str: " << skel_type_str << std::endl;
106  trace.info() << "skel_select_type_str: " << skel_select_type_str << std::endl;
107  if(distance_transform) {
108  trace.info() << " -- provided distance_transform." << std::endl;
109  }
110  trace.info() << "persistence: " << persistence << std::endl;
111  trace.info() << "profile: " << profile << std::endl;
112  trace.info() << "verbose: " << verbose << std::endl;
113  trace.info() << "----------" << std::endl;
114  trace.endBlock();
115  }
116 
117  // Validate input skel method and skel_select
118  const bool skel_type_str_is_valid =
119  skel_type_str == "ultimate" ||
120  skel_type_str == "end" ||
121  skel_type_str == "isthmus" ||
122  skel_type_str == "1isthmus" ||
123  skel_type_str == "isthmus1";
124  if(!skel_type_str_is_valid) {
125  throw std::runtime_error("skel_type_str is not valid: \"" + skel_type_str + "\"");
126  }
127 
128  const bool skel_select_type_str_is_valid =
129  skel_select_type_str == "first" ||
130  skel_select_type_str == "random" ||
131  skel_select_type_str == "dmax";
132  if(!skel_select_type_str_is_valid) {
133  throw std::runtime_error("skel_select_type_str is not valid: \"" + skel_select_type_str + "\"");
134  }
135  // // No filesystem to check the tables folder exist. If incorrect, it will fail loading the table.
136  // const fs::path tables_folder_path{tables_folder};
137  // if(!fs::exists(tables_folder_path)) {
138  // throw std::runtime_error("tables_folder " + tables_folder_path.string() +
139  // " doesn't exist in the filesystem.\n"
140  // "tables_folder should point to the folder "
141  // "where DGtal tables are: i.e simplicity_table26_6.zlib");
142  // }
143 
144  // Create a VoxelComplex from the set
145  using KSpace = DGtal::Z3i::KSpace;
146  using Complex = TComplex;
147  using ComplexCell = typename Complex::Cell;
148  using ComplexClique = typename Complex::Clique;
149  using Point = DGtal::Z3i::Point;
150 
151  if(verbose) { DGtal::trace.beginBlock("load isthmus table"); }
152  boost::dynamic_bitset<> isthmus_table;
153  auto &sk = skel_type_str;
154  if(sk == "isthmus") {
155  const std::string tableIsthmus = tables_folder + "/isthmusicity_table26_6.zlib";
156  isthmus_table = *DGtal::functions::loadTable(tableIsthmus);
157  } else if(sk == "isthmus1" || sk == "1ishtmus") {
158  const std::string tableOneIsthmus = tables_folder + "/isthmusicityOne_table26_6.zlib";
159  isthmus_table = *DGtal::functions::loadTable(tableOneIsthmus);
160  }
161  if(verbose) { DGtal::trace.endBlock(); }
162 
163 
164  // SKEL FUNCTION:
165  // Load a look-up-table for the neighborgood of a point
166  auto pointMap =
167  *DGtal::functions::mapZeroPointNeighborhoodToConfigurationMask<Point>();
168  std::function<bool(const Complex&, const ComplexCell&)> Skel;
169  if(sk == "ultimate") {
170  Skel = DGtal::functions::skelUltimate<Complex>;
171  } else if(sk == "end") {
172  Skel = DGtal::functions::skelEnd<Complex>;
173  // else if (sk == "1is") Skel = oneIsthmus<Complex>;
174  // else if (sk == "is") Skel = skelIsthmus<Complex>;
175  } else if(sk == "isthmus1" || sk == "1ishtmus") {
176  Skel = [&isthmus_table, &pointMap](const Complex& fc,
177  const ComplexCell& c) {
178  return DGtal::functions::skelWithTable(isthmus_table, pointMap, fc, c);
179  };
180  } else if(sk == "isthmus") {
181  Skel = [&isthmus_table, &pointMap](const Complex& fc,
182  const ComplexCell& c) {
183  return DGtal::functions::skelWithTable(isthmus_table, pointMap, fc, c);
184  };
185  } else {
186  throw std::runtime_error("Invalid skel string");
187  }
188 
189  // SELECT FUNCTION
190  std::function<std::pair<typename Complex::Cell, typename Complex::Data>(
191  const ComplexClique&)>
192  Select;
193 
194  // profile
195  auto start = std::chrono::system_clock::now();
196 
197  // If dmax is chosen, but no distance_transform is provided, create one.
198  using DT = TDistanceTransform;
199  using DTDigitalSet = typename DT::PointPredicate;
200  using DTDigitalSetDomain = typename DTDigitalSet::Domain;
201  using Metric = typename DT::SeparableMetric;
202  Metric l3;
203  auto &sel = skel_select_type_str;
204  const bool compute_distance_transform = !distance_transform && sel == "dmax";
205  DTDigitalSetDomain vc_domain = compute_distance_transform ?
206  DTDigitalSetDomain(vc.space().lowerBound(), vc.space().upperBound()) :
207  // dummy domain
208  DTDigitalSetDomain(Z3i::Point::zero, Z3i::Point::diagonal(1));
209 
210  DTDigitalSet image_set = DTDigitalSet(vc_domain);
211  if(compute_distance_transform) {
212  vc.dumpVoxels(image_set);
213  }
214  // Create the distance map here (computationally expensive if not dummy).
215  DT dist_map(vc_domain, image_set, l3);
216  if(compute_distance_transform) {
217  distance_transform = &dist_map;
218  }
219 
220  if(sel == "random") {
221  Select = DGtal::functions::selectRandom<Complex>;
222  } else if(sel == "first") {
223  Select = DGtal::functions::selectFirst<Complex>;
224  } else if(sel == "dmax") {
225  Select = [&distance_transform](const ComplexClique& clique) {
226  return selectMaxValue<TDistanceTransform, Complex>(*distance_transform, clique);
227  };
228  } else {
229  throw std::runtime_error("Invalid skel select type");
230  }
231 
232  // Perform the thin/skeletonization
233  Complex vc_new(vc.space());
234  if(persistence == 0) {
235  vc_new = DGtal::functions::asymetricThinningScheme<Complex>(vc, Select, Skel, verbose);
236  } else {
237  vc_new = DGtal::functions::persistenceAsymetricThinningScheme<Complex>(vc, Select, Skel,
238  persistence, verbose);
239  }
240 
241  // profile
242  auto end = std::chrono::system_clock::now();
243  auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(end - start);
244  if(profile) {
245  std::cout << "Time elapsed: " << elapsed.count() << std::endl;
246  }
247 
248  return vc_new;
249 }
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
KhalimskySpaceND< 3, Integer > KSpace
Definition: StdDefs.h:146
Space::Point Point
Definition: StdDefs.h:168
DGtal::LinearOperator< Calculus, dim, duality, dim, duality > diagonal(const DGtal::KForm< Calculus, dim, duality > &kform)
bool skelWithTable(const boost::dynamic_bitset<> &table, const std::unordered_map< typename TComplex::Point, unsigned int > &pointToMaskMap, const TComplex &vc, const typename TComplex::Cell &cell)
DGtal::CountedPtr< boost::dynamic_bitset<> > loadTable(const std::string &input_filename, const unsigned int known_size, const bool compressed=true)
KSpace::Cell Cell

References DGtal::Trace::beginBlock(), DGtal::PointVector< dim, Integer >::diagonal(), DGtal::Trace::endBlock(), DGtal::Trace::info(), loadTable(), skelWithTable(), DGtal::trace, and DGtal::PointVector< dim, Integer >::zero.

◆ twoIsthmus()

template<typename TComplex >
bool DGtal::functions::twoIsthmus ( const TComplex &  vc,
const typename TComplex::Cell cell 
)

Check if input cell is a 2-isthmus. A voxel is a 2-isthmus if, after a thinning, its proper neighborhood is a 1-Surface isOneSurface.

See also
isOneSurface
Object::properNeighborhood
Template Parameters
TComplexVoxelComplex.
Parameters
vcinput complex.
cellapply function on input cell.
Returns
bool

Referenced by TEST_CASE_METHOD().