DGtal  1.1.0
CubicalComplexFunctions.h
1
17 #pragma once
18
31 #if defined(CubicalComplexFunctions_RECURSES)
32 #error Recursive header files inclusion detected in CubicalComplexFunctions.h
33 #else // defined(CubicalComplexFunctions_RECURSES)
34
35 #define CubicalComplexFunctions_RECURSES
36
37 #if !defined CubicalComplexFunctions_h
38
39 #define CubicalComplexFunctions_h
40
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/topology/CubicalComplex.h"
46 #include <DGtal/topology/helpers/NeighborhoodConfigurationsHelper.h>
48
49 namespace DGtal
50 {
59  template <typename TKSpace, typename TCellContainer>
60  inline CubicalComplex< TKSpace, TCellContainer >
62  {
64  S.close();
65  return S;
66  }
67
76  template <typename TKSpace, typename TCellContainer>
77  inline CubicalComplex< TKSpace, TCellContainer >
79  {
81  S.open();
82  return S;
83  }
84
95  template <typename TKSpace, typename TCellContainer>
96  inline CubicalComplex< TKSpace, TCellContainer >&
99  {
101  for ( Dimension i = 0; i <= CC::dimension; ++i )
102  functions::setops::operator-=( S1.myCells[ i ],S2.myCells[ i ] );
103  return S1;
104  }
105
116  template <typename TKSpace, typename TCellContainer>
117  inline CubicalComplex< TKSpace, TCellContainer >
120  {
122  CC S( S1 );
123  for ( Dimension i = 0; i <= CC::dimension; ++i )
124  functions::setops::operator-=( S.myCells[ i ],S2.myCells[ i ] );
125  return S;
126  }
127
137  template <typename TKSpace, typename TCellContainer>
138  inline CubicalComplex< TKSpace, TCellContainer >
141  {
143  CC S( S1 );
144  for ( Dimension i = 0; i <= CC::dimension; ++i )
145  functions::setops::operator|=( S.myCells[ i ],S2.myCells[ i ] );
146  return S;
147  }
148
158  template <typename TKSpace, typename TCellContainer>
159  inline CubicalComplex< TKSpace, TCellContainer >&
162  {
164  for ( Dimension i = 0; i <= CC::dimension; ++i )
165  functions::setops::operator|=( S1.myCells[ i ], S2.myCells[ i ] );
166  return S1;
167  }
168
178  template <typename TKSpace, typename TCellContainer>
179  inline CubicalComplex< TKSpace, TCellContainer >
182  {
184  CC S( S1 );
185  for ( Dimension i = 0; i <= CC::dimension; ++i )
186  functions::setops::operator&=( S.myCells[ i ], S2.myCells[ i ] );
187  return S;
188  }
189
199  template <typename TKSpace, typename TCellContainer>
200  inline CubicalComplex< TKSpace, TCellContainer >&
203  {
205  for ( Dimension i = 0; i <= CC::dimension; ++i )
206  functions::setops::operator&=( S1.myCells[ i ], S2.myCells[ i ] );
207  return S1;
208  }
209
220  template <typename TKSpace, typename TCellContainer>
221  inline CubicalComplex< TKSpace, TCellContainer >
224  {
226  CC S( S1 );
227  for ( Dimension i = 0; i <= CC::dimension; ++i )
228  functions::setops::operator^=( S.myCells[ i ], S2.myCells[ i ] );
229  return S;
230  }
231
243  template <typename TKSpace, typename TCellContainer>
244  inline CubicalComplex< TKSpace, TCellContainer >&
247  {
249  for ( Dimension i = 0; i <= CC::dimension; ++i )
250  functions::setops::operator^=( S1.myCells[ i ], S2.myCells[ i ] );
251  return S1;
252  }
253
255
264  template <typename TKSpace, typename TCellContainer>
265  bool
268  {
270  ASSERT( &(S1.space()) == &(S2.space()) );
271  for ( Dimension i = 0; i <= CC::dimension; ++i )
272  if ( ! functions::isEqual( S1.myCells[ i ], S2.myCells[ i ] ) )
273  return false;
274  return true;
275  }
276
278
291  template <typename TKSpace, typename TCellContainer>
292  bool
295  {
297  ASSERT( &(S1.space()) == &(S2.space()) );
298  for ( Dimension i = 0; i <= CC::dimension; ++i )
299  if ( ! functions::isEqual( S1.myCells[ i ], S2.myCells[ i ] ) )
300  return true;
301  return false;
302  }
303
305
315  template <typename TKSpace, typename TCellContainer>
316  bool
319  {
321  ASSERT( &(S1.space()) == &(S2.space()) );
322  for ( Dimension i = 0; i <= CC::dimension; ++i )
323  if ( ! functions::isSubset( S1.myCells[ i ], S2.myCells[ i ] ) )
324  return false;
325  return true;
326  }
327
338  template <typename TKSpace, typename TCellContainer>
339  bool
342  {
344  ASSERT( &(S1.space()) == &(S2.space()) );
345  for ( Dimension i = 0; i <= CC::dimension; ++i )
346  if ( ! functions::isSubset( S2.myCells[ i ], S1.myCells[ i ] ) )
347  return false;
348  return true;
349  }
350
351  namespace functions {
352
392  template <typename TKSpace, typename TCellContainer,
393  typename CellConstIterator,
394  typename CellMapIteratorPriority >
396  CellConstIterator S_itB, CellConstIterator S_itE,
397  const CellMapIteratorPriority& priority,
398  bool hintIsSClosed = false, bool hintIsKClosed = false,
399  bool verbose = false );
400
431  template <typename TKSpace, typename TCellContainer,
432  typename BdryCellOutputIterator,
433  typename InnerCellOutputIterator>
434  void
436  const typename TKSpace::Point& kLow,
437  const typename TKSpace::Point& kUp,
438  BdryCellOutputIterator itBdry,
439  InnerCellOutputIterator itInner );
440
457  template < typename TObject, typename TKSpace, typename TCellContainer>
458  std::unique_ptr<TObject>
460
482  template<typename TComplex>
485  const TComplex & input_complex,
486  const typename TComplex::Point & center,
487  const std::unordered_map<
488  typename TComplex::Point, NeighborhoodConfiguration> & mapPointToMask);
489  } // namespace functions
490
491 } // namespace DGtal
492
493
495 // Includes inline functions.
496 #include "DGtal/topology/CubicalComplexFunctions.ih"
497
498 // //
500
501 #endif // !defined CubicalComplexFunctions_h
502
503 #undef CubicalComplexFunctions_RECURSES
504 #endif // else defined(CubicalComplexFunctions_RECURSES)
DGtal::functions::getSpelNeighborhoodConfigurationOccupancy
NeighborhoodConfiguration getSpelNeighborhoodConfigurationOccupancy(const TComplex &input_complex, const typename TComplex::Point &center, const std::unordered_map< typename TComplex::Point, NeighborhoodConfiguration > &mapPointToMask)
DGtal::functions::objectFromSpels
std::unique_ptr< TObject > objectFromSpels(const CubicalComplex< TKSpace, TCellContainer > &C)
DGtal::operator-
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
DGtal::CubicalComplex::close
void close()
DGtal::NeighborhoodConfiguration
uint32_t NeighborhoodConfiguration
Definition: NeighborhoodConfigurationsHelper.h:43
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:133
DGtal::operator<=
bool operator<=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (LesserOrEqualThan).
DGtal::operator!=
bool operator!=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Difference operator on Points/Vectors.
DGtal::operator-=
CubicalComplex< TKSpace, TCellContainer > & operator-=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:97
DGtal::functions::collapse
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)
DGtal::operator&=
CubicalComplex< TKSpace, TCellContainer > & operator&=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:201
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::operator~
CubicalComplex< TKSpace, TCellContainer > operator~(const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:61
DGtal::functions::filterCellsWithinBounds
void filterCellsWithinBounds(const CubicalComplex< TKSpace, TCellContainer > &K, const typename TKSpace::Point &kLow, const typename TKSpace::Point &kUp, BdryCellOutputIterator itBdry, InnerCellOutputIterator itInner)
DGtal::operator>=
bool operator>=(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Comparison operator on Points/Vectors (GreaterOrEqualThan).
DGtal::operator|=
CubicalComplex< TKSpace, TCellContainer > & operator|=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:160
DGtal::operator|
CubicalComplex< TKSpace, TCellContainer > operator|(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:139
DGtal::CubicalComplex::space
const KSpace & space() const
DGtal::functions::isSubset
bool isSubset(const Container &S1, const Container &S2)
Definition: SetFunctions.h:845
DGtal::uint64_t
boost::uint64_t uint64_t
unsigned 64-bit integer.
Definition: BasicTypes.h:65
CC
CubicalComplex< KSpace, Map > CC
Definition: testCubicalComplex.cpp:58
DGtal::CubicalComplex::myCells
std::vector< CellMap > myCells
Definition: CubicalComplex.h:1291
DGtal::operator&
CubicalComplex< TKSpace, TCellContainer > operator&(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:180
DGtal::CubicalComplex::open
void open()
DGtal::operator^=
CubicalComplex< TKSpace, TCellContainer > & operator^=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:245
DGtal::CubicalComplex::dimension
static const Dimension dimension
The dimension of the embedding space.
Definition: CubicalComplex.h:242
DGtal::operator*
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
DGtal::operator^
CubicalComplex< TKSpace, TCellContainer > operator^(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Definition: CubicalComplexFunctions.h:222
DGtal::operator==
bool operator==(PointVector< ptDim, LeftEuclideanRing, LeftContainer > const &lhs, PointVector< ptDim, RightEuclideanRing, RightContainer > const &rhs)
Equality operator between two Points/Vectors.
DGtal::CubicalComplex
Aim: This class represents an arbitrary cubical complex living in some Khalimsky space....
Definition: CubicalComplex.h:176
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::functions::isEqual
bool isEqual(const Container &S1, const Container &S2)
Definition: SetFunctions.h:789