31 #if defined(NeighborhoodConfigurationsGenerators_RECURSES) 32 #error Recursive header files inclusion detected in NeighborhoodConfigurationsGenerators.h 33 #else // defined(NeighborhoodConfigurationsGenerators_RECURSES) 35 #define NeighborhoodConfigurationsGenerators_RECURSES 37 #if !defined NeighborhoodConfigurationsGenerators_h 39 #define NeighborhoodConfigurationsGenerators_h 45 #include "DGtal/topology/Object.h" 46 #include "DGtal/helpers/StdDefs.h" 47 #include <unordered_map> 48 #include "boost/dynamic_bitset.hpp" 49 #include <DGtal/topology/helpers/NeighborhoodConfigurationsHelper.h> 50 #include "DGtal/topology/VoxelComplexFunctions.h" 69 template <
typename TObject,
typename TMap>
72 const typename TObject::DigitalTopology & dt,
75 typedef typename TObject::DigitalSet DigitalSet;
80 Point p1 = Point::diagonal( -1 );
81 Point p2 = Point::diagonal( 1 );
82 Point c = Point::diagonal( 0 );
84 DigitalSet shapeSet(
domain );
85 TObject shape( dt, shapeSet );
87 for ( DomainConstIterator it =
domain.begin(); it !=
domain.end(); ++it )
90 &&
"[generateSimplicityTable] number of configurations is too high." );
91 unsigned int nbCfg = 1 << k;
94 if ( ( cfg % 1000 ) == 0 )
98 shape.pointSet().clear();
99 shape.pointSet().insert( c );
101 for ( DomainConstIterator it =
domain.begin(); it !=
domain.end(); ++it )
105 if ( cfg & mask ) shape.pointSet().insert( *it );
109 bool simple = shape.isSimple( c );
130 template <
typename TVoxelComplex,
typename TMap>
135 const TVoxelComplex & ,
140 using Object =
typename TVoxelComplex::Object;
145 using KSpace =
typename TVoxelComplex::KSpace;
149 ForegroundAdjacency adjF;
150 BackgroundAdjacency adjB;
152 DigitalTopologyProperties::JORDAN_DT);
154 Point p1 = Point::diagonal( -1 );
155 Point p2 = Point::diagonal( 1 );
156 Point c = Point::diagonal( 0 );
158 DigitalSet shapeSet(
domain );
159 Object shape( dt, shapeSet );
161 for ( DomainConstIterator it =
domain.begin(); it !=
domain.end(); ++it )
164 &&
"[generateVoxelComplexTable] number of configurations is too high." );
165 unsigned int nbCfg = 1 << k;
169 ks.
init(shape.
domain().lowerBound() + Point::diagonal( -1 ) ,
170 shape.
domain().upperBound() + Point::diagonal( 1 ),
172 TVoxelComplex vc(ks);
174 for (
unsigned int cfg = 0; cfg < nbCfg; ++cfg ){
175 if ( ( cfg % 1000 ) == 0 )
178 vc.insertVoxelPoint(c);
179 unsigned int mask = 1;
180 for ( DomainConstIterator it =
domain.begin(); it !=
domain.end(); ++it ){
182 if ( cfg & mask ) vc.insertVoxelPoint( *it );
186 const auto &kcell = vc.space().uSpel(c);
187 bool predicate_output = skelFunction(vc, kcell);
188 map[ cfg ] = predicate_output;
195 #endif // !defined NeighborhoodConfigurationsGenerators_h 197 #undef NeighborhoodConfigurationsGenerators_RECURSES 198 #endif // else defined(NeighborhoodConfigurationsGenerators_RECURSES) Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
HyperRectDomain< Space > Domain
void progressBar(const double currentValue, const double maximalValue)
void generateSimplicityTable(const typename TObject::DigitalTopology &dt, TMap &map)
MyDigitalSurface::ConstIterator ConstIterator
uint32_t NeighborhoodConfiguration
TDigitalTopology DigitalTopology
Aim: Represents a digital topology as a couple of adjacency relations.
DigitalTopology::BackgroundAdjacency BackgroundAdjacency
DigitalTopology::ForegroundAdjacency ForegroundAdjacency
bool init(const Point &lower, const Point &upper, bool isClosed)
const Domain & domain() const
DGtal is the top-level namespace which contains all DGtal functions and types.
void generateVoxelComplexTable(TMap &map, std::function< bool(const TVoxelComplex &, const typename TVoxelComplex::Cell &) > skelFunction)
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...