59{
66 int radius1 = 6;
67 EuclideanShape ball1( c1, radius1 );
73 int radius2 = 5;
74 EuclideanShape ball2( c2, radius2 );
81 std::cerr << std::endl;
83 it != it_end; ++it )
84 {
86 label += shape2( *it ) ? 2 : 0;
87 image.setValue( *it, label );
88 std::cerr << (int)
image( *it );
89 }
90 std::cerr << std::endl;
92
94 trace.beginBlock(
"Construct the Khalimsky space from the image domain." );
96 bool space_ok =
K.init(
domain.lowerBound(),
domain.upperBound(),
true );
97 if (!space_ok)
98 {
99 trace.error() <<
"Error in the Khamisky space construction."<<std::endl;
100 return 2;
101 }
104
106 trace.beginBlock(
"Set up digital surface." );
108 MySurfelAdjacency surfAdj( true );
115
116 SCell vox1 =
K.sSpel( c1 +
Point( radius1, 0, 0 ),
K.POS );
117 SCell bel10 =
K.sIncident( vox1, 0,
true );
118 FSurfelPredicate surfPredicate10(
K,
image, 1, 0 );
119 Frontier frontier10 =
120 new FrontierContainer(
K, surfPredicate10, surfAdj, bel10 );
121
122 SCell vox2 =
K.sSpel( c2 -
Point( radius2, 0, 0 ),
K.POS );
123 SCell bel20 =
K.sIncident( vox2, 0,
false );
124 FSurfelPredicate surfPredicate20(
K,
image, 2, 0 );
125 Frontier frontier20 =
126 new FrontierContainer(
K, surfPredicate20, surfAdj, bel20 );
127
128 SCell vox3 =
K.sSpel( c1 -
Point( radius1, 0, 0 ),
K.POS );
129 SCell bel32 =
K.sIncident( vox3, 0,
false );
130 BSurfelPredicate surfPredicate3(
K,
image, 3 );
131 Boundary boundary3 =
132 new BoundaryContainer(
K, surfPredicate3, surfAdj, bel32 );
135
137 trace.beginBlock(
"Displaying surface in PolyscopeViewer." );
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...
void attach(ConstAlias< EuclideanShape > shape)
void init(const RealPoint &xLow, const RealPoint &xUp, typename RealVector::Component gridStep)
Aim: implements association bewteen points lying in a digital domain and values.
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
void show() override
Starts the event loop and display of elements.
PointVector< dim, double > RealPoint
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
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....
KhalimskySpaceND< 3, Integer > KSpace
Space::RealPoint RealPoint
std::uint8_t uint8_t
unsigned 8-bit integer.
GaussDigitizer< Space, ImplicitShape > DigitalShape