Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
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
57using namespace std;
58using namespace DGtal;
59
61
62int main( int argc, char** argv )
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;
75 typedef Domain::ConstIterator DomainConstIterator;
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
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// //
Structure representing an RGB triple with alpha component.
Definition Color.h:77
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
Definition Object.h:120
void show() override
Starts the event loop and display of elements.
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
Clipping plane.
Definition Display3D.h:299
DigitalSetByAssociativeContainer< Domain, std::unordered_set< typename Domain::Point > > Type
int main()
Definition testBits.cpp:56
Domain domain
Z2i::DigitalSet DigitalSet
PolyscopeViewer< Space, KSpace > MyViewer