DGtal  1.4.beta
VoxelComplexFunctions.h
1 
17 #pragma once
18 
32 #if defined(VoxelComplexFunctions_RECURSES)
33 #error Recursive header files inclusion detected in VoxelComplexFunctions.h
34 #else // defined(VoxelComplexFunctions_RECURSES)
36 #define VoxelComplexFunctions_RECURSES
37 
38 #if !defined VoxelComplexFunctions_h
40 #define VoxelComplexFunctions_h
41 
43 // Inclusions
44 #include <iostream>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/topology/VoxelComplex.h"
48 namespace DGtal
49 {
50  namespace functions {
51 
52  template < typename TComplex >
53  TComplex
55  TComplex & vc ,
56  std::function<
57  std::pair<typename TComplex::Cell, typename TComplex::Data> (
58  const typename TComplex::Clique &)
59  > Select ,
60  std::function<
61  bool(
62  const TComplex & ,
63  const typename TComplex::Cell & )
64  > Skel,
65  bool verbose = false
66  );
67 
68  template < typename TComplex >
69  TComplex
71  TComplex & vc ,
72  std::function<
73  std::pair<typename TComplex::Cell, typename TComplex::Data> (
74  const typename TComplex::Clique &)
75  > Select ,
76  std::function<
77  bool(
78  const TComplex & ,
79  const typename TComplex::Cell & )
80  > Skel,
81  uint32_t persistence,
82  bool verbose = false
83  );
85 // Select Functions
94  template < typename TComplex >
95  std::pair<typename TComplex::Cell, typename TComplex::Data>
97  const typename TComplex::Clique & clique);
98 
107  template < typename TComplex >
108  std::pair<typename TComplex::Cell, typename TComplex::Data>
110  const typename TComplex::Clique & clique);
111 
122  template < typename TComplex, typename TRandomGenerator >
123  std::pair<typename TComplex::Cell, typename TComplex::Data>
125  const typename TComplex::Clique & clique,
126  TRandomGenerator & gen);
127 
153  template < typename TDistanceTransform, typename TComplex >
154  std::pair<typename TComplex::Cell, typename TComplex::Data>
156  const TDistanceTransform & dist_map,
157  const typename TComplex::Clique & clique);
159 // Skeleton Functions
176  template < typename TComplex >
177  bool
179  const TComplex & vc,
180  const typename TComplex::Cell & cell);
181 
191  template < typename TComplex >
192  bool
194  const TComplex & vc,
195  const typename TComplex::Cell & cell);
196 
210  template < typename TComplex >
211  bool
213  const TComplex & vc,
214  const typename TComplex::Cell & cell);
215 
228  template < typename TComplex >
229  bool
231  const TComplex & vc,
232  const typename TComplex::Cell & cell);
233 
249  template < typename TComplex >
250  bool
252  const TComplex & vc,
253  const typename TComplex::Cell & cell);
254 
269  template < typename TComplex >
270  bool
272  const TComplex & vc,
273  const typename TComplex::Cell & cell);
274 
313  template < typename TComplex >
314  bool
316  const boost::dynamic_bitset<> & table,
317  const std::unordered_map<typename TComplex::Point, unsigned int> & pointToMaskMap,
318  const TComplex & vc,
319  const typename TComplex::Cell & cell);
321 // Helpers for Objects
332  template < typename TObject >
333  bool
334  isZeroSurface(const TObject & small_obj) ;
335 
349  template < typename TObject >
350  bool
351  isOneSurface(const TObject & small_obj) ;
352 
365  template <typename TObject >
366  std::vector< TObject >
367  connectedComponents(const TObject & input_obj, bool verbose);
368  } // namespace functions
369 
371  //Operators between VoxelComplexes//
372 
384  template <typename TKSpace, typename TCellContainer>
388  {
390  for ( Dimension i = 0; i <= VC::dimension; ++i )
391  functions::setops::operator-=( S1.myCells[ i ],S2.myCells[ i ] );
392  return S1;
393  }
394 
406  template <typename TKSpace, typename TCellContainer>
407  inline VoxelComplex< TKSpace, TCellContainer >
410  {
412  VC S(S1);
413  for ( Dimension i = 0; i <= VC::dimension; ++i )
414  functions::setops::operator-=( S.myCells[ i ],S2.myCells[ i ] );
415  return S;
416  }
417 } // namespace DGtal
418 
419 
421 // Includes inline functions.
422 #include "DGtal/topology/VoxelComplexFunctions.ih"
423 
424 // //
426 
427 #endif // !defined VoxelComplexFunctions_h
428 
429 #undef VoxelComplexFunctions_RECURSES
430 #endif // else defined(VoxelComplexFunctions_RECURSES)
std::vector< CellMap > myCells
This class represents a voxel complex living in some Khalimsky space. Voxel complexes are derived fro...
Definition: VoxelComplex.h:91
bool skelIsthmus(const TComplex &vc, const typename TComplex::Cell &cell)
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)
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)
bool isZeroSurface(const TObject &small_obj)
bool skelSimple(const TComplex &vc, const typename TComplex::Cell &cell)
bool isOneSurface(const TObject &small_obj)
bool skelEnd(const TComplex &vc, const typename TComplex::Cell &cell)
std::pair< typename TComplex::Cell, typename TComplex::Data > selectMaxValue(const TDistanceTransform &dist_map, const typename TComplex::Clique &clique)
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)
std::pair< typename TComplex::Cell, typename TComplex::Data > selectFirst(const typename TComplex::Clique &clique)
std::pair< typename TComplex::Cell, typename TComplex::Data > selectRandom(const typename TComplex::Clique &clique)
std::vector< TObject > connectedComponents(const TObject &input_obj, bool verbose)
bool skelUltimate(const TComplex &vc, const typename TComplex::Cell &cell)
bool twoIsthmus(const TComplex &vc, const typename TComplex::Cell &cell)
bool oneIsthmus(const TComplex &vc, const typename TComplex::Cell &cell)
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
DGtal::uint32_t Dimension
Definition: Common.h:136
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
CubicalComplex< TKSpace, TCellContainer > & operator-=(CubicalComplex< TKSpace, TCellContainer > &, const CubicalComplex< TKSpace, TCellContainer > &)
KSpace::Cell Cell