DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
3dBorderExtraction.cpp
Go to the documentation of this file.
1
16
29
30
42
44
#include <iostream>
45
#include "DGtal/base/Common.h"
46
47
#include "DGtal/io/readers/VolReader.h"
48
#include "DGtal/io/viewers/PolyscopeViewer.h"
49
#include "DGtal/io/Color.h"
50
#include "DGtal/images/ImageSelector.h"
51
#include "DGtal/helpers/StdDefs.h"
52
#include "ConfigExamples.h"
53
54
56
57
using namespace
std
;
58
using namespace
DGtal
;
59
61
62
int
main
()
63
{
64
typedef
SpaceND< 3,int >
Z3;
65
typedef
MetricAdjacency< Z3, 1 >
Adj6;
66
typedef
MetricAdjacency< Z3, 2 >
Adj18;
67
typedef
DigitalTopology< Adj6, Adj18 >
DT6_18;
68
69
Adj6 adj6;
70
Adj18 adj18;
71
DT6_18 dt6_18( adj6, adj18,
JORDAN_DT
);
72
73
typedef
Z3::Point
Point
;
74
typedef
HyperRectDomain< Z3 >
Domain
;
75
typedef
Domain::ConstIterator
DomainConstIterator;
76
typedef
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type
DigitalSet
;
77
typedef
Object<DT6_18, DigitalSet>
ObjectType;
78
79
Point
p1( -50, -50, -50 );
80
Point
p2( 50, 50, 50 );
81
Domain
domain
( p1, p2 );
82
Point
c( 0, 0 );
83
// diamond of radius 30
84
DigitalSet
diamond_set(
domain
);
85
for
( DomainConstIterator it =
domain
.begin(); it !=
domain
.end(); ++it )
86
{
87
if
( (*it - c ).norm1() <= 30 ) diamond_set.
insertNew
( *it );
88
}
89
ObjectType diamond( dt6_18, diamond_set );
90
// The following line takes almost no time.
91
ObjectType diamond_clone( diamond );
92
// Since one of the objects is modified, the set is duplicated at the following line
93
diamond_clone.pointSet().erase( c );
94
ObjectType bdiamond = diamond.border();
// one component
95
ObjectType bdiamond_clone = diamond_clone.border();
// two components
96
97
typedef
PolyscopeViewer<>
MyViewer
;
98
MyViewer
viewer;
99
viewer<<
Color
(250, 250,250);
100
viewer << bdiamond_clone;
101
viewer << bdiamond ;
102
viewer <<
ClippingPlane
(1,1,0,5);
103
viewer.
show
();
104
return
0;
105
106
}
107
// //
DGtal::Color::Color
Color()
Definition
Color.h:139
DGtal::DigitalSetByAssociativeContainer::insertNew
void insertNew(const Point &p)
DGtal::DigitalTopology< Adj6, Adj18 >
DGtal::HyperRectDomain
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Definition
HyperRectDomain.h:100
DGtal::HyperRectDomain< Space >::ConstIterator
Iterator ConstIterator
Definition
HyperRectDomain.h:125
DGtal::MetricAdjacency
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
Definition
MetricAdjacency.h:80
DGtal::Object
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
Definition
Object.h:120
DGtal::PolyscopeViewer
Definition
PolyscopeViewer.h:57
DGtal::PolyscopeViewer::show
void show() override
Starts the event loop and display of elements.
Definition
PolyscopeViewer.h:73
DGtal::SpaceND
Definition
SpaceND.h:96
DGtal::Domain
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::JORDAN_DT
@ JORDAN_DT
Definition
DigitalTopology.h:57
std
STL namespace.
DGtal::ClippingPlane::ClippingPlane
ClippingPlane(double _a, double _b, double _c, double _d)
Definition
Display3D.h:300
DGtal::DigitalSetSelector::Type
DigitalSetByAssociativeContainer< Domain, std::unordered_set< typename Domain::Point > > Type
Definition
DigitalSetSelector.h:102
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
domain
Domain domain
Definition
testProjection.cpp:88
DigitalSet
Z2i::DigitalSet DigitalSet
Definition
testVoronoiMapComplete.cpp:40
MyViewer
PolyscopeViewer< Space, KSpace > MyViewer
Definition
viewer3D-10-interaction.cpp:64
examples
topology
3dBorderExtraction.cpp
Generated on
for DGtal by
1.18.0