DGtal
0.6.devel
|
Part of the Topology package.
This part of the manual describes how to use the helper class Surfaces to build digital surfaces, closed or open, or contours within digital surfaces. A lot of the ideas, concepts, algorithms, documentation and code is a backport from ImaGene.
All the code presented here require:
The surfaces classes offers the possibility to extract an open or closed contour as a sequence of surfels obtained from a DigitalSet and a starting surfel. The full code of this example is available in file ctopo-2.cpp .
The first step to extract the surfel boudary of a 2D digital set is to obtain an initial boundary surfel:
The first surfel can also be displayed in red with Board2D:
Then you can extract the sequence of consecutive surfels:
and display it:
You will obtain the following ordered sequence of surfels:
The resulting sequence of surfels does not necessary present an open contour (try for instance image "samples/circleR10modif.pgm"):
With only few modifications we can apply the same extraction on 3D surfel set. The file ctopo-2-3d.cpp shows the same previous example adapted in 3D.
with the same code we can get a surfel boundary:
From this SCell all the surfel connected sets can be extracted:
To see both initial surfel and the surfel set, we can use the transparent mode:
To avoid surfel superposition we need to increase with a small shift the surfel size, for this purpose you can add the following key:
or use the special mode "Highlighted" which increase automaticly the surfel size.
You can obtain for instance the following visualisation:
Since in 3D there are several choice for the direction used to exctract surfel boundary, we can specify the constant direction need to drive the surfel extraction:
After extracting the two surfels cut you may obtain the following visualisation:
The class Surfaces provides other useful function to extract connected boundary surfels from a digital set and given a surfel adjacency definition. The example 3dKSSurfaceExtraction.cpp shows an example of such an extraction.
From a domain we construct a DigitalSet inserting points under given conditions (see. 3dKSSurfaceExtraction.cpp for more details)
With this domain bounding points (p1, p2), a KhalimskySpace is constructed and a SurfelAdjacency definition is introduced.
Then we can extract all connected surfels from the digitalSet surface :
After processing a simple display of each resulting connecting component you can obtain such a visualisation:
Here since the last argument is set to true, the resulting SignedKhalimskySpaceND are signed in order to indicate the direction of exterior. You can also get the SignefKhalimskySpaceND with default sign:
and you will get the resulting cell display: