DGtal  0.9.2
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 {
51  namespace functions {
52 
61  template <typename TKSpace, typename TCellContainer>
62  inline CubicalComplex< TKSpace, TCellContainer >
64  {
66  S.close();
67  return S;
68  }
69 
78  template <typename TKSpace, typename TCellContainer>
81  {
83  S.open();
84  return S;
85  }
86 
97  template <typename TKSpace, typename TCellContainer>
101  {
103  for ( Dimension i = 0; i <= CC::dimension; ++i )
104  setops::operator-=( S1.myCells[ i ],S2.myCells[ i ] );
105  return S1;
106  }
107 
118  template <typename TKSpace, typename TCellContainer>
122  {
124  CC S( S1 );
125  for ( Dimension i = 0; i <= CC::dimension; ++i )
126  setops::operator-=( S.myCells[ i ],S2.myCells[ i ] );
127  return S;
128  }
129 
139  template <typename TKSpace, typename TCellContainer>
143  {
145  CC S( S1 );
146  for ( Dimension i = 0; i <= CC::dimension; ++i )
147  setops::operator|=( S.myCells[ i ],S2.myCells[ i ] );
148  return S;
149  }
150 
160  template <typename TKSpace, typename TCellContainer>
164  {
166  for ( Dimension i = 0; i <= CC::dimension; ++i )
167  setops::operator|=( S1.myCells[ i ], S2.myCells[ i ] );
168  return S1;
169  }
170 
180  template <typename TKSpace, typename TCellContainer>
184  {
186  CC S( S1 );
187  for ( Dimension i = 0; i <= CC::dimension; ++i )
188  setops::operator&=( S.myCells[ i ], S2.myCells[ i ] );
189  return S;
190  }
191 
201  template <typename TKSpace, typename TCellContainer>
205  {
207  for ( Dimension i = 0; i <= CC::dimension; ++i )
208  setops::operator&=( S1.myCells[ i ], S2.myCells[ i ] );
209  return S1;
210  }
211 
222  template <typename TKSpace, typename TCellContainer>
226  {
228  CC S( S1 );
229  for ( Dimension i = 0; i <= CC::dimension; ++i )
230  setops::operator^=( S.myCells[ i ], S2.myCells[ i ] );
231  return S;
232  }
233 
245  template <typename TKSpace, typename TCellContainer>
249  {
251  for ( Dimension i = 0; i <= CC::dimension; ++i )
252  setops::operator^=( S1.myCells[ i ], S2.myCells[ i ] );
253  return S1;
254  }
255 
257 
266  template <typename TKSpace, typename TCellContainer>
267  bool
270  {
272  ASSERT( &(S1.space()) == &(S2.space()) );
273  for ( Dimension i = 0; i <= CC::dimension; ++i )
274  if ( ! isEqual( S1.myCells[ i ], S2.myCells[ i ] ) )
275  return false;
276  return true;
277  }
278 
280 
293  template <typename TKSpace, typename TCellContainer>
294  bool
297  {
299  ASSERT( &(S1.space()) == &(S2.space()) );
300  for ( Dimension i = 0; i <= CC::dimension; ++i )
301  if ( ! isEqual( S1.myCells[ i ], S2.myCells[ i ] ) )
302  return true;
303  return false;
304  }
305 
307 
317  template <typename TKSpace, typename TCellContainer>
318  bool
319  operator<=( const CubicalComplex< TKSpace, TCellContainer >& S1,
321  {
323  ASSERT( &(S1.space()) == &(S2.space()) );
324  for ( Dimension i = 0; i <= CC::dimension; ++i )
325  if ( ! isSubset( S1.myCells[ i ], S2.myCells[ i ] ) )
326  return false;
327  return true;
328  }
329 
340  template <typename TKSpace, typename TCellContainer>
341  bool
344  {
346  ASSERT( &(S1.space()) == &(S2.space()) );
347  for ( Dimension i = 0; i <= CC::dimension; ++i )
348  if ( ! isSubset( S2.myCells[ i ], S1.myCells[ i ] ) )
349  return false;
350  return true;
351  }
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 
462  template<typename TComplex>
465  const TComplex & input_complex,
466  const typename TComplex::Point & center,
467  const std::unordered_map<
468  typename TComplex::Point, NeighborhoodConfiguration> & mapPointToMask);
469  } // namespace functions
470 
471 } // namespace DGtal
472 
473 
475 // Includes inline functions.
476 #include "DGtal/topology/CubicalComplexFunctions.ih"
477 
478 // //
480 
481 #endif // !defined CubicalComplexFunctions_h
482 
483 #undef CubicalComplexFunctions_RECURSES
484 #endif // else defined(CubicalComplexFunctions_RECURSES)
bool operator==(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > operator*(const CubicalComplex< TKSpace, TCellContainer > &)
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::uint32_t Dimension
Definition: Common.h:113
CubicalComplex< TKSpace, TCellContainer > & operator-=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > operator~(const CubicalComplex< TKSpace, TCellContainer > &)
uint32_t NeighborhoodConfiguration
bool operator!=(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
bool operator>=(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
NeighborhoodConfiguration getSpelNeighborhoodConfigurationOccupancy(const TComplex &input_complex, const typename TComplex::Point &center, const std::unordered_map< typename TComplex::Point, NeighborhoodConfiguration > &mapPointToMask)
CubicalComplex< TKSpace, TCellContainer > operator^(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > & operator^=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > operator|(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
Aim: This class represents an arbitrary cubical complex living in some Khalimsky space. Cubical complexes are sets of cells of different dimensions related together with incidence relations. Two cells in a cubical complex are incident if and only if they are incident in the surrounding Khalimsky space. In other words, cubical complexes are defined here as subsets of Khalimsky spaces.
bool isEqual(const Container &S1, const Container &S2)
Definition: SetFunctions.h:789
CubicalComplex< TKSpace, TCellContainer > & operator&=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::vector< CellMap > myCells
const KSpace & space() const
boost::uint64_t uint64_t
unsigned 64-bit integer.
Definition: BasicTypes.h:65
bool isSubset(const Container &S1, const Container &S2)
Definition: SetFunctions.h:845
CubicalComplex< TKSpace, TCellContainer > operator-(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
void filterCellsWithinBounds(const CubicalComplex< TKSpace, TCellContainer > &K, const typename TKSpace::Point &kLow, const typename TKSpace::Point &kUp, BdryCellOutputIterator itBdry, InnerCellOutputIterator itInner)
CubicalComplex< TKSpace, TCellContainer > & operator|=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
CubicalComplex< TKSpace, TCellContainer > operator&(const CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
static const Dimension dimension
The dimension of the embedding space.