DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testDigitalSetToCellularGridConverter.cpp
Go to the documentation of this file.
1
16
29
31
#include <iostream>
32
#include <map>
33
#include "DGtal/base/Common.h"
34
#include "ConfigTest.h"
35
#include "DGtal/helpers/StdDefs.h"
36
// Cellular grid converter
37
#include "DGtal/topology/CubicalComplex.h"
38
// Shape construction
39
#include "DGtal/shapes/GaussDigitizer.h"
40
#include "DGtal/shapes/Shapes.h"
41
#include "DGtal/shapes/EuclideanShapesDecorator.h"
42
#include "DGtal/shapes/parametric/Flower2D.h"
44
45
using namespace
std
;
46
using namespace
DGtal
;
47
using namespace
functors
;
48
using namespace
Z2i
;
49
51
// Functions for testing class digitalSetToCubicalComplexes.
53
class
testDigitalSetToCellularGridConverter
54
{
55
typedef
Flower2D< Space >
MyEuclideanShape
;
56
typedef
map<Cell, CubicalCellData>
Map
;
57
typedef
CubicalComplex< KSpace, Map >
CC
;
58
typedef
GaussDigitizer< Space, MyEuclideanShape >
MyGaussDigitizer
;
59
private
:
60
KSpace
K
;
61
MyGaussDigitizer
digShape
;
62
public
:
63
testDigitalSetToCellularGridConverter
() {}
64
bool
extractCells
()
65
{
66
MyEuclideanShape
shape(
RealPoint
( 0.0, 0.0 ), 16, 5, 5, M_PI_2/2. );
67
digShape
.
attach
( shape );
68
digShape
.
init
( shape.
getLowerBound
(), shape.
getUpperBound
(), 1.0 );
69
Domain
domainShape =
digShape
.
getDomain
();
70
K
.
init
( domainShape.lowerBound(), domainShape.upperBound(),
true
);
71
DigitalSet
aSet ( domainShape );
72
Shapes<Domain>::digitalShaper
( aSet,
digShape
);
73
74
CC
complex (
K
);
75
complex.construct <
DigitalSet
> ( aSet );
76
return
true
;
77
}
78
};
79
80
// Standard services - public :
81
82
int
main
(
int
/* argc */
,
char
**
/* argv */
)
83
{
84
bool
res =
true
;
85
testDigitalSetToCellularGridConverter
test
;
86
trace
.
beginBlock
(
"DigitalSetToCellularGridConverter"
);
87
trace
.
beginBlock
(
"Testing extraction of 0D cells"
);
88
res &=
test
.extractCells();
89
trace
.
endBlock
();
90
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
91
trace
.
endBlock
();
92
return
res ? 0 : 1;
93
}
94
// //
DGtal::CubicalComplex< KSpace, Map >
DGtal::Flower2D< Space >
DGtal::Flower2D::getLowerBound
RealPoint getLowerBound() const
Definition
Flower2D.h:135
DGtal::Flower2D::getUpperBound
RealPoint getUpperBound() const
Definition
Flower2D.h:144
DGtal::GaussDigitizer< Space, MyEuclideanShape >
DGtal::GaussDigitizer::attach
void attach(ConstAlias< EuclideanShape > shape)
DGtal::GaussDigitizer::init
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
DGtal::GaussDigitizer::getDomain
Domain getDomain() const
DGtal::KhalimskySpaceND::init
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
DGtal::Shapes::digitalShaper
static void digitalShaper(TDigitalSet &aSet, const TShapeFunctor &aFunctor)
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::Trace::endBlock
double endBlock()
DGtal::Domain
testDigitalSetToCellularGridConverter
Definition
testDigitalSetToCellularGridConverter.cpp:54
testDigitalSetToCellularGridConverter::digShape
MyGaussDigitizer digShape
Definition
testDigitalSetToCellularGridConverter.cpp:61
testDigitalSetToCellularGridConverter::K
KSpace K
Definition
testDigitalSetToCellularGridConverter.cpp:60
testDigitalSetToCellularGridConverter::CC
CubicalComplex< KSpace, Map > CC
Definition
testDigitalSetToCellularGridConverter.cpp:57
testDigitalSetToCellularGridConverter::Map
map< Cell, CubicalCellData > Map
Definition
testDigitalSetToCellularGridConverter.cpp:56
testDigitalSetToCellularGridConverter::MyGaussDigitizer
GaussDigitizer< Space, MyEuclideanShape > MyGaussDigitizer
Definition
testDigitalSetToCellularGridConverter.cpp:58
testDigitalSetToCellularGridConverter::testDigitalSetToCellularGridConverter
testDigitalSetToCellularGridConverter()
Definition
testDigitalSetToCellularGridConverter.cpp:63
testDigitalSetToCellularGridConverter::extractCells
bool extractCells()
Definition
testDigitalSetToCellularGridConverter.cpp:64
testDigitalSetToCellularGridConverter::MyEuclideanShape
Flower2D< Space > MyEuclideanShape
Definition
testDigitalSetToCellularGridConverter.cpp:55
DGtal::Z2i
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal::Z2i::KSpace
KhalimskySpaceND< 2, Integer > KSpace
Definition
StdDefs.h:77
DGtal::Z2i::RealPoint
Space::RealPoint RealPoint
Definition
StdDefs.h:97
DGtal::Z2i::DigitalSet
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
Definition
StdDefs.h:100
DGtal::functors
functors namespace gathers all DGtal functors.
Definition
BasicBoolFunctors.h:49
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
test
bool test(const I &itb, const I &ite)
Definition
testMostCenteredMSEstimator.cpp:71
tests
topology
testDigitalSetToCellularGridConverter.cpp
Generated on
for DGtal by
1.18.0