31#if defined(NeighborhoodConvexityAnalyzer_RECURSES)
32#error Recursive header files inclusion detected in NeighborhoodConvexityAnalyzer.h
35#define NeighborhoodConvexityAnalyzer_RECURSES
37#if !defined NeighborhoodConvexityAnalyzer_h
39#define NeighborhoodConvexityAnalyzer_h
48#include <unordered_set>
49#include "DGtal/base/Common.h"
50#include "DGtal/base/Clone.h"
51#include "DGtal/base/ConstExpressions.h"
52#include "DGtal/base/TimeStampMemoizer.h"
53#include "DGtal/kernel/CPointPredicate.h"
54#include "DGtal/kernel/CBoundedNumber.h"
55#include "DGtal/kernel/domains/HyperRectDomain.h"
56#include "DGtal/topology/CCellularGridSpaceND.h"
57#include "DGtal/topology/KhalimskySpaceND.h"
58#include "DGtal/geometry/volumes/DigitalConvexity.h"
93 template <
typename TKSpace,
int K >
167 Size memoizer_size = 0 )
221 template <
typename Po
intPredicate >
290 int mask = with_center
300 bool memoized = p.second;
307 std::vector< Point > localX;
319 std::vector< Point > localX;
357 int mask = with_center
367 bool memoized = p.second;
374 std::vector< Point > localCompX;
387 std::vector< Point > localCompX;
426 int mask = with_center
433 std::vector< Point > localX;
449 int mask = with_center
456 std::vector< Point > localCompX;
474 bool complement,
bool with_center )
479 if ( ! with_center ) current.reset(
middle );
480 else current.set(
middle );
484 if ( with_center ) current.set(
middle );
493 void getLocalX( std::vector< Point >& localX,
bool with_center )
const;
499 void getLocalCompX( std::vector< Point >& localCompX,
bool with_center )
const;
560 (
bool compX,
bool with_center )
const;
570 (
bool compX,
bool with_center )
const;
580 (
Configuration cfg, std::vector< BasicConfiguration > & result )
const;
603#include "NeighborhoodConvexityAnalyzer.ih"
610#undef NeighborhoodConvexityAnalyzer_RECURSES
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Aim: A helper class to build polytopes from digital sets and to check digital k-convexity and full co...
bool isFullyConvex(const PointRange &X, bool convex0=false) const
bool is0Convex(const PointRange &X) const
const KSpace & space() const
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
static const constexpr Dimension dimension
Aim: A class that models a neighborhood and that provides services to analyse the convexity properti...
bool isComplementaryFullyConvex(bool with_center)
Computation
Enum types indicating the possible type of local computations.
@ Convexity_CompX_with_center
@ FullConvexity_X_without_center
@ Convexity_X_with_center
@ FullConvexity_CompX_with_center
@ FullConvexity_X_with_center
@ FullConvexity_CompX_without_center
@ Convexity_X_without_center
@ Convexity_CompX_without_center
static const Size neigh_size
NeighborhoodConvexityAnalyzer(Clone< KSpace > aKSpace, Size memoizer_size=0)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static Configuration makeConfiguration(Configuration current, bool complement, bool with_center)
std::bitset< 512 > myBasicFullConvexityTable
Stores the full convexity property of the basic 3x3 neighborhood configurations.
NeighborhoodConvexityAnalyzer(Point lo, Point hi, Size memoizer_size=0)
int myComputations
Stores which properties have already been computed.
void computeBasicFullConvexityTable()
std::vector< Point > PointRange
Domain myDomain
The bounded domain in which computations are carried out.
std::bitset< functions::const_pow(2 *K+1, dimension) > Configuration
bool is0Convex(bool with_center)
bool isFullyConvex(bool with_center)
const KSpace & space() const
static const Dimension dimension
const Domain & domain() const
bool is0ConvexCollapsible()
void setCenter(Point c, const PointPredicate &X)
~NeighborhoodConvexityAnalyzer()=default
bool isFullyConvexCollapsible()
int myResults
Stores the properties boolean values.
bool checkBasicConfigurations0Convexity(bool compX, bool with_center) const
HyperRectDomain< Space > Domain
DigitalConvexity< KSpace > myDigConv
The digital convexity that is used for checking full convexity.
bool checkBasicConfigurationsFullConvexity(bool compX, bool with_center) const
bool myCenterInX
tells if the center belongs to X
void getLocalCompX(std::vector< Point > &localCompX, bool with_center) const
Configuration configuration() const
Size myNbInX
The number of points of the neighborhood that belongs to X (center omitted).
Configuration myCfgX
Stores the local configuration for X (without the center)
NeighborhoodConvexityAnalyzer()=default
TimeStampMemoizer< Configuration, bool > myMemoizer
The memoizer.
static const bool false_positive
std::bitset< 512 > myBasic0ConvexityTable
Stores the 0-convexity property of the basic 3x3 neighborhood configurations.
void getLocalX(std::vector< Point > &localX, bool with_center) const
bool isComplementary0Convex(bool with_center)
Self & operator=(const Self &other)=default
bool isCenterInX() const
Tells if the current center belongs to the shape X.
std::bitset< 9 > BasicConfiguration
Point myCenter
The current center of the neighborhood.
NeighborhoodConvexityAnalyzer< TKSpace, K > Self
void computeBasicConfigurations(Configuration cfg, std::vector< BasicConfiguration > &result) const
std::vector< BasicConfiguration > myBasicCfgX
Stores the basic local configurations associated to myCfgX, for speed-up.
BasicConfiguration computeCentralBasicConfiguration(Configuration cfg, Dimension i, Dimension j) const
NeighborhoodConvexityAnalyzer(const Self &other)=default
std::pair< Value, bool > get(const Key &key)
void set(const Key &key, const Value &value)
constexpr T const_pow(T b, unsigned int e)
constexpr T const_middle(T K, unsigned int e)
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...