DGtal 1.4.0
|
functions
namespace gathers all DGtal functionsxs.
More...
Namespaces | |
namespace | Hull2D |
Hull2D namespace gathers useful functions to compute and return the convex hull or the alpha-shape of a range of 2D points. | |
namespace | 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. | |
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. | |
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 : [105]]. | |
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. | |
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. | |
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 : [105]]. | |
template<typename T > | |
T | power (const T &aVal, const unsigned int exponent) |
template<typename T > | |
T | roundToUpperPowerOfTwo (const T &n) |
template<typename T > | |
T | abs (const T &a) |
template<typename T > | |
T | square (T x) |
template<typename T > | |
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 ¢er, 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) |
functions
namespace gathers all DGtal functionsxs.
T DGtal::functions::abs | ( | const T & | a | ) |
Return the absolute value of an instance of type T.
T | the type of elements to compare (model of boost::LessThanComparable). |
a | first value |
Definition at line 116 of file BasicMathFunctions.h.
Container & DGtal::functions::assignDifference | ( | Container & | S1, |
const Container & | S2 ) |
Set difference operation. Updates the set S1 as S1 - S2.
[in,out] | S1 | an input set, S1 - S2 as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
Referenced by makeDifference(), and DGtal::functions::setops::operator-=().
Container & DGtal::functions::assignDifference | ( | Container & | S1, |
const Container & | S2 ) |
Set difference operation. Updates the set S1 as S1 - S2.
[in,out] | S1 | an input set, S1 - S2 as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 918 of file SetFunctions.h.
Container & DGtal::functions::assignIntersection | ( | Container & | S1, |
const Container & | S2 ) |
Set intersection operation. Updates the set S1 as \( S1 \cap S2 \).
[in,out] | S1 | an input set, \( S1 \cap S2 \) as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
Referenced by makeIntersection(), and DGtal::functions::setops::operator&=().
Container & DGtal::functions::assignIntersection | ( | Container & | S1, |
const Container & | S2 ) |
Set intersection operation. Updates the set S1 as \( S1 \cap S2 \).
[in,out] | S1 | an input set, \( S1 \cap S2 \) as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 1104 of file SetFunctions.h.
Container & DGtal::functions::assignSymmetricDifference | ( | Container & | S1, |
const Container & | S2 ) |
Set symmetric difference operation. Updates the set S1 as \( S1 \Delta S2 \).
[in,out] | S1 | an input set, \( S1 \Delta S2 \) as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
Referenced by makeSymmetricDifference(), and DGtal::functions::setops::operator^=().
Container & DGtal::functions::assignSymmetricDifference | ( | Container & | S1, |
const Container & | S2 ) |
Set symmetric difference operation. Updates the set S1 as \( S1 \Delta S2 \).
[in,out] | S1 | an input set, \( S1 \Delta S2 \) as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 1198 of file SetFunctions.h.
Container & DGtal::functions::assignUnion | ( | Container & | S1, |
const Container & | S2 ) |
Set union operation. Updates the set S1 as \( S1 \cup S2 \).
[in,out] | S1 | an input set, \( S1 \cup S2 \) as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
Referenced by makeUnion(), and DGtal::functions::setops::operator|=().
Container & DGtal::functions::assignUnion | ( | Container & | S1, |
const Container & | S2 ) |
Set union operation. Updates the set S1 as \( S1 \cup S2 \).
[in,out] | S1 | an input set, \( S1 \cup S2 \) as output. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 1012 of file SetFunctions.h.
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 ) |
Referenced by thinningVoxelComplex().
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)
aDSS | any DSS |
bool DGtal::functions::checkOnePoint | ( | const ArithmeticalDSS< TCoordinate, TInteger, adjacency > & | aDSS | ) |
Checks the validity of the DSS when it contains only one point.
aDSS | any DSS |
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.
aDSS | any DSS |
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[.
aDSS | any DSS |
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).
TKSpace | the digital space in which lives the cubical complex. |
TCellContainer | the associative container used to store cells within the cubical complex. |
CellConstIterator | any forward const iterator on Cell. |
CellMapIteratorPriority | any type defining a method 'bool operator()( const Cell&, const Cell&) const'. Defines the order in which cells are collapsed. |
[in,out] | K | the complex that is collapsed. |
S_itB | the start of a range of cells which is included in [K]. | |
S_itE | the end of a range of cells which is included in [K]. | |
priority | the object that assign a priority to each cell. | |
hintIsSClosed | indicates if [S_itb,S_ite) is a closed set (faster in this case). | |
hintIsKClosed | indicates that complex K is closed. | |
verbose | outputs some information during processing when 'true'. |
Referenced by main(), main(), SCENARIO(), and SCENARIO().
std::vector< TObject > DGtal::functions::connectedComponents | ( | const TObject & | input_obj, |
bool | verbose ) |
Get all connected components of the input object.
TObject | Object Type |
input_obj | input object |
verbose | flag to be verbose at execution |
|
constexpr |
T | any model of bounded number. |
K | a non negative number |
e | a non negative integer |
e
-dimensional array of width \( 2K+1 \), computed at compile time.Definition at line 75 of file ConstExpressions.h.
References const_middle(), const_pow(), and K.
Referenced by const_middle().
|
constexpr |
T | any model of bounded number. |
b | a number |
e | a non negative integer |
Definition at line 60 of file ConstExpressions.h.
References const_pow().
Referenced by const_middle(), and const_pow().
|
inline |
Returns the value x * x * x
T | a type with the multiply operator. |
x | any value |
Definition at line 144 of file BasicMathFunctions.h.
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.
TKSpace | the digital space in which lives the cubical complex. |
TCellContainer | the associative container used to store cells within the cubical complex. |
BdryCellOutputIterator | any output iterator on TCubicalComplex::Cell. |
InnerCellOutputIterator | any output iterator on TCubicalComplex::Cell. |
[in] | K | any cubical complex. |
[in] | kLow | any Khalimsky coordinate representing the lowest possible cell. |
[in] | kUp | any Khalimsky coordinate representing the uppermost possible cell. |
[in,out] | itBdry | An 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] | itInner | An 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. |
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.
TObject | the type of object whose simpleness we wish to precompute. Includes the topology. |
TMap | the type used to store the mapping configuration -> bool. |
dt | an instance of the digital topology. |
map | (modified) the mapping configuration -> bool. |
Definition at line 71 of file NeighborhoodTablesGenerators.h.
References domain, dt, DGtal::Trace::progressBar(), and DGtal::trace.
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.
TVoxelComplex | the type of the VoxelComplex whose property we wish to precompute. |
TMap | the type used to store the mapping configuration -> bool. |
map | (modified) the mapping configuration -> bool. |
skelFunction | a predicate function related to the property we want to check. |
Definition at line 132 of file NeighborhoodTablesGenerators.h.
References domain, DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::Trace::progressBar(), and DGtal::trace.
Referenced by main().
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).
TComplex | Complex type. |
input_complex | input complex. Used to check what points are occupied. |
center | of the neighborhood. It doesn't matter if center belongs or not to input_complex. |
mapPointToMask | map[Point]->configuration, where Point is inside a DxD cube centered in {0,0,..} in ND. |
bool DGtal::functions::isEqual | ( | const Container & | S1, |
const Container & | S2 ) |
Equality test.
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
Referenced by DGtal::operator!=(), and DGtal::operator==().
bool DGtal::functions::isEqual | ( | const Container & | S1, |
const Container & | S2 ) |
Equality test.
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 815 of file SetFunctions.h.
bool DGtal::functions::isOneSurface | ( | const TObject & | small_obj | ) |
Check if input object is a simple closed curve. Object must be:
TObject | Object Type |
small_obj | input object |
bool DGtal::functions::isSubset | ( | const Container & | S1, |
const Container & | S2 ) |
Inclusion test.
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
Referenced by DGtal::operator<=(), and DGtal::operator>=().
bool DGtal::functions::isSubset | ( | const Container & | S1, |
const Container & | S2 ) |
Inclusion test.
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 869 of file SetFunctions.h.
bool DGtal::functions::isZeroSurface | ( | const TObject & | small_obj | ) |
Check if the object contains, exclusively, two disconnected voxels.
TObject | Object Type |
small_obj | input object |
|
inline |
Load existing look up table existing in file_name, precalculated tables can be accessed including the header: "DGtal/topology/tables/NeighborhoodTables.h"
dimension | of the space input_filename table refers. 2 or 3 |
input_filename | plain text containing the bool table. |
compressed | true if table to read has been compressed with zlib. |
|
inline |
Load existing look up table existing in file_name, precalculated tables can be accessed including the header: "DGtal/topology/tables/NeighborhoodTables.h"
input_filename | plain text containing the bool table. |
known_size | of the bitset, for 2D = 256 (2^8), 3D = 67108864 (2^26) |
compressed | true if table to read has been compressed with zlib. |
Referenced by SCENARIO(), SCENARIO(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), testSetTable(), and thinningVoxelComplex().
Container DGtal::functions::makeDifference | ( | const Container & | S1, |
const Container & | S2 ) |
Set difference operation. Returns the difference of S1 - S2.
[in] | S1 | an input set |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
References assignDifference().
Referenced by DGtal::functions::setops::operator-().
Container DGtal::functions::makeDifference | ( | const Container & | S1, |
const Container & | S2 ) |
Set difference operation. Returns the difference of S1 - S2.
[in] | S1 | an input set |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 965 of file SetFunctions.h.
References assignDifference().
Container DGtal::functions::makeIntersection | ( | const Container & | S1, |
const Container & | S2 ) |
Set intersection operation. Returns the set \( S1 \cap S2 \).
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
References assignIntersection().
Referenced by DGtal::functions::setops::operator&().
Container DGtal::functions::makeIntersection | ( | const Container & | S1, |
const Container & | S2 ) |
Set intersection operation. Returns the set \( S1 \cap S2 \).
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 1149 of file SetFunctions.h.
References assignIntersection().
Container DGtal::functions::makeSymmetricDifference | ( | const Container & | S1, |
const Container & | S2 ) |
Set symmetric difference operation. Returns the set \( S1 \Delta S2 \).
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
References assignSymmetricDifference().
Referenced by DGtal::functions::setops::operator^().
Container DGtal::functions::makeSymmetricDifference | ( | const Container & | S1, |
const Container & | S2 ) |
Set symmetric difference operation. Returns the set \( S1 \Delta S2 \).
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 1243 of file SetFunctions.h.
References assignSymmetricDifference().
Container DGtal::functions::makeUnion | ( | const Container & | S1, |
const Container & | S2 ) |
Set union operation. Returns the set \( S1 \cup S2 \).
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
ordered | when '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.
References assignUnion().
Referenced by DGtal::functions::setops::operator|().
Container DGtal::functions::makeUnion | ( | const Container & | S1, |
const Container & | S2 ) |
Set union operation. Returns the set \( S1 \cup S2 \).
[in] | S1 | an input set. |
[in] | S2 | another input set. |
Container | any type of container (even a sequence, a set, an unordered_set, a map, etc). |
Definition at line 1057 of file SetFunctions.h.
References assignUnion().
|
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, ...}.
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
TPoint | type of point to create map and input the desired dimension. |
Referenced by SCENARIO(), TEST_CASE(), TEST_CASE(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), TEST_CASE_METHOD(), and thinningVoxelComplex().
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.
TObject | with its associdated DigitalSet and DigitalTopology |
TKSpace | kspace type of the input CubicalComplex. |
TCellContainer | cell container type of the input CubicalComplex |
C | input CubicalComplex |
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.
TComplex | VoxelComplex. |
vc | input complex. |
cell | apply function on input cell. |
Referenced by main().
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 ) |
Referenced by thinningVoxelComplex().
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.
aVal | the value |
exponent | the exponent |
T | scalar value type (must have '*' operator). |
Definition at line 73 of file BasicMathFunctions.h.
Referenced by testBasicMathFunctions().
|
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 : [105]].
aDSS | bounding DSS |
aPositionBound | position of the last point of the subsegment (should be located after the first point of aDSS). |
uIto | output iterator used to store the vertices of the upper convex hull |
lIto | output iterator used to store the vertices of the lower convex hull |
DSS | a model of arithmetical DSS |
OutputIterator | a model of output iterator |
|
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.
U | last upper convex hull vertex |
L | last lower convex hull vertex |
V | last valid Bezout vector (main direction vector) |
aFirstPosition | position of the first point of the subsegment |
aLastPosition | position of the last point of the subsegment |
aPositionFunctor | position functor, which returns the position of any given point/vector |
uIto | output iterator used to store the vertices of the upper convex hull |
lIto | output iterator used to store the vertices of the lower convex hull |
PointVector | a model of 2d point/vector |
Position | a model of integer for the position of the point in the bounding DSS |
PositionFunctor | a model of unary functor that returns the position of a point/vector |
OutputIterator | a model of output iterator |
Referenced by basicTest2(), and reversedSmartCHSubsegment().
T DGtal::functions::roundToUpperPowerOfTwo | ( | const T & | n | ) |
Compute the next higher power of two of the given argument n of type T.
T | the type of the element T |
n | an element of type T (casted to unsigned integer). |
Definition at line 102 of file BasicMathFunctions.h.
References DGtal::Bits::mostSignificantBit().
Referenced by DGtal::Viewer3D< TSpace, TKSpace >::GLTextureImage::GLTextureImage(), and testBasicMathFunctions().
std::pair< typename TComplex::Cell, typename TComplex::Data > DGtal::functions::selectFirst | ( | const typename TComplex::Clique & | clique | ) |
Select first voxel of input clique.
TComplex | input CubicalComplex |
clique | from where cell is chosen. |
Referenced by thinningVoxelComplex().
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:
TDistanceTransform | Container type for the distance map. |
TComplex | input CubicalComplex |
dist_map | container holding the values. |
clique | from where cell is chosen. |
Referenced by thinningVoxelComplex().
std::pair< typename TComplex::Cell, typename TComplex::Data > DGtal::functions::selectRandom | ( | const typename TComplex::Clique & | clique | ) |
Select random voxel from input clique.
TComplex | input CubicalComplex |
clique | from where cell is chosen. |
Referenced by thinningVoxelComplex().
std::pair< typename TComplex::Cell, typename TComplex::Data > DGtal::functions::selectRandom | ( | const typename TComplex::Clique & | clique, |
TRandomGenerator & | gen ) |
Select random voxel from input clique.
TComplex | CubicalComplex |
TRandomGenerator | RandomGenerator |
clique | from where cell is chosen |
gen | random generator |
bool DGtal::functions::skelEnd | ( | const TComplex & | vc, |
const typename TComplex::Cell & | cell ) |
Check if input cell only has one neighbor, using Object::topology.
TComplex | VoxelComplex |
vc | input voxel complex. |
cell | c apply function on this voxel cell. |
Referenced by thinningVoxelComplex().
bool DGtal::functions::skelIsthmus | ( | const TComplex & | vc, |
const typename TComplex::Cell & | cell ) |
Check if input cell is a 1 or 2 Isthmus.
TComplex | VoxelComplex. |
vc | input complex. |
cell | apply function on input cell. |
Referenced by main().
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.
TComplex | VoxelComplex. |
vc | input complex. |
cell | apply function on input cell. |
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.
TComplex | VoxelComplex |
vc | input voxel complex. |
cell | c apply function on this voxel cell. |
Referenced by thinningVoxelComplex().
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.
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:
TComplex | input CubicalComplex type. |
table | [configuration]->bool |
pointToMaskMap | map[neighborhood points] to a bit mask. Used to get the neighborhood configuration. |
vc | input complex. |
cell | input 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. |
Referenced by thinningVoxelComplex().
|
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 : [105]].
aDSL | bounding DSL |
aFirstPoint | first point of the DSS |
aLength | (strictly positive) length of the DSS |
uIto | output iterator used to store the vertices of the upper convex hull |
lIto | output iterator used to store the vertices of the lower convex hull |
DSL | a model of arithmetical DSL |
OutputIterator | a model of output iterator |
|
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.
aFirstPoint | first point of the DSS |
aRemainderBound | difference between the intercept mu of the bounding DSL and the remainder of the first point. |
aPositionBound | (strictly positive) length of the DSS |
aStep | first step of the DSL |
aRStep | remainder of the first step, ie. parameter \( a \) of the bounding DSL |
aShift | shift vector of the DSL |
aRShift | remainder of the shift vector, ie. parameter \( omega \) of the bounding DSL. |
aPositionFunctor | position functor, which returns the position of any given point/vector |
uIto | output iterator used to store the vertices of the upper convex hull |
lIto | output iterator used to store the vertices of the lower convex hull |
PointVector | a model of 2d point/vector |
Coordinate | a model of integer for the coordinates of the point/vector |
Position | a model of integer for locating points in the DSS |
PositionFunctor | a model of unary functor that returns the position of a point/vector |
OutputIterator | a model of output iterator |
Referenced by basicTest(), comparisonLeftHull(), and smartCHSubsegment().
|
inline |
Procedure that computes the next (lower or upper) vertex of the left hull of a DSS.
positionBound | position of the last point of the DSS |
remainderBound | remainder of the lower leaning points contained in the DSS |
X | (returned) last vertex of the considered side |
rX | (returned) remainder of X |
Y | last vertex of the opposite side |
rY | remainder of Y |
V | (returned) last direction vector (unimodular with (X - Y)) |
rV | (returned) remainder of V (not null) |
ito | output iterator used to store the new vertex lying on the same side as X |
pos | position functor, which returns the position of any given point/vector |
f1 | first floor function (for the vertex) |
f2 | second floor function (for the direction vector) |
Position | a model of integer for locating points in the DSS |
PointVector | a model of 2d point/vector |
Coordinate | a model of integer for the coordinates of the point/vector |
OutputIterator | a model of output iterator |
PositionFunctor | a model of unary functor that returns the position of a point/vector |
TruncationFunctor1 | a model of unary functor that implements an integer division |
TruncationFunctor2 | a model of unary functor that implements an integer division |
|
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.
X | (returned) first vertex of the left hull on the considered side |
Y | first vertex of the left hull on the opposite side |
V | (returned) previous direction vector |
aFirstPosition | position of the first point of the subsegment |
aLastPosition | position of the last point of the subsegment |
ito | output iterator used to store the vertices of the left hull lying on the same side as X |
pos | position functor, which returns the position of any given point/vector |
f1 | integer divisor for the direction vector update |
f2 | integer divisor for the vertex update |
PointVector | a model of couple of coordinates |
Position | a model of integer for the position of the points |
OutputIterator | a model of output iterator |
TruncationFunctor1 | a model of functor for the integer division |
TruncationFunctor2 | a model of functor for the integer division |
PositionFunctor | a model of functor returning the position of a point |
|
inline |
Returns the value x * x
T | a type with the multiply operator. |
x | any value |
Definition at line 133 of file BasicMathFunctions.h.
Referenced by DGtal::functors::BallConstantPointFunction< TPoint, TScalar >::operator()(), and DGtal::functors::HatPointFunction< TPoint, TScalar >::operator()().
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.
References asymetricThinningScheme(), DGtal::Trace::beginBlock(), DGtal::PointVector< dim, Integer >::diagonal(), DGtal::Trace::endBlock(), DGtal::Trace::info(), loadTable(), mapZeroPointNeighborhoodToConfigurationMask(), persistenceAsymetricThinningScheme(), selectFirst(), selectMaxValue(), selectRandom(), skelEnd(), skelUltimate(), skelWithTable(), DGtal::trace, and DGtal::PointVector< dim, Integer >::zero.
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.
TComplex | VoxelComplex. |
vc | input complex. |
cell | apply function on input cell. |
Referenced by main().