59{
66 int radius1 = 6;
67 EuclideanShape ball1( c1, radius1 );
69 shape1.attach( ball1 );
70 shape1.init(
RealPoint( -10.0, -10.0, -10.0 ),
73 int radius2 = 5;
74 EuclideanShape ball2( c2, radius2 );
76 shape2.attach( ball2 );
77 shape2.init(
RealPoint( -10.0, -10.0, -10.0 ),
81 std::cerr << std::endl;
83 it != it_end; ++it )
84 {
86 label += shape2( *it ) ? 2 : 0;
88 std::cerr << (int)
image( *it );
89 }
90 std::cerr << std::endl;
92
94 trace.
beginBlock(
"Construct the Khalimsky space from the image domain." );
97 if (!space_ok)
98 {
99 trace.
error() <<
"Error in the Khamisky space construction."<<std::endl;
100 return 2;
101 }
104
108 MySurfelAdjacency surfAdj( true );
115
118 FSurfelPredicate surfPredicate10(
K,
image, 1, 0 );
119 Frontier frontier10 =
120 new FrontierContainer(
K, surfPredicate10, surfAdj, bel10 );
121
124 FSurfelPredicate surfPredicate20(
K,
image, 2, 0 );
125 Frontier frontier20 =
126 new FrontierContainer(
K, surfPredicate20, surfAdj, bel20 );
127
130 BSurfelPredicate surfPredicate3(
K,
image, 3 );
131 Boundary boundary3 =
132 new BoundaryContainer(
K, surfPredicate3, surfAdj, bel32 );
135
140
142
143 unsigned int nbSurfels10 = 0;
145 for ( Frontier::ConstIterator
146 it = frontier10.begin(), it_end = frontier10.end();
147 it != it_end; ++it, ++nbSurfels10 )
148 viewer << *it;
149
150 unsigned int nbSurfels20 = 0;
152 for ( Frontier::ConstIterator
153 it = frontier20.begin(), it_end = frontier20.end();
154 it != it_end; ++it, ++nbSurfels20 )
155 viewer << *it;
156
157 unsigned int nbSurfels3 = 0;
158 viewer <<
Color( 255, 130, 15 );
159 for ( Boundary::ConstIterator
160 it = boundary3.begin(), it_end = boundary3.end();
161 it != it_end; ++it, ++nbSurfels3 )
162 viewer << *it;
163 trace.
info() <<
"nbSurfels10 = " << nbSurfels10
164 << ", nbSurfels20 = " << nbSurfels20
165 << ", nbSurfels3 = " << nbSurfels3 << std::endl;
168 return 0;
170}
Structure representing an RGB triple with alpha component.
static const Color Yellow
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Iterator for HyperRectDomain.
const ConstIterator & begin() const
const Point & lowerBound() const
const Point & upperBound() const
const ConstIterator & end() const
Aim: implements association bewteen points lying in a digital domain and values.
void setValue(const Point &aPoint, const Value &aValue)
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SCell sSpel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
static const constexpr Sign POS
SCell sIncident(const SCell &c, Dimension k, bool up) const
Return the forward or backward signed cell incident to [c] along axis [k], depending on [up].
Aim: Implements basic operations that will be used in Point and Vector classes.
void show() override
Starts the event loop and display of elements.
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
Aim: The predicate on surfels that represents the frontier between a region and its complementary in ...
Aim: The predicate on surfels that represents the frontier between two regions in an image....
Space::RealPoint RealPoint
std::uint8_t uint8_t
unsigned 8-bit integer.
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
GaussDigitizer< Space, ImplicitShape > DigitalShape