DGtal 1.4.2
Loading...
Searching...
No Matches
3dBorderExtraction.cpp
Go to the documentation of this file.
1
44#include <iostream>
45#include "DGtal/base/Common.h"
46
47#include "DGtal/io/readers/VolReader.h"
48#include "DGtal/io/DrawWithDisplay3DModifier.h"
49#include "DGtal/io/viewers/Viewer3D.h"
50#include "DGtal/io/Color.h"
51#include "DGtal/images/ImageSelector.h"
52#include "DGtal/helpers/StdDefs.h"
53#include "ConfigExamples.h"
54
55
57
58using namespace std;
59using namespace DGtal;
60
62
63int main( int argc, char** argv )
64{
65 typedef SpaceND< 3,int > Z3;
66 typedef MetricAdjacency< Z3, 1 > Adj6;
67 typedef MetricAdjacency< Z3, 2 > Adj18;
68 typedef DigitalTopology< Adj6, Adj18 > DT6_18;
69
70 Adj6 adj6;
71 Adj18 adj18;
72 DT6_18 dt6_18( adj6, adj18, JORDAN_DT );
73
74 typedef Z3::Point Point;
76 typedef Domain::ConstIterator DomainConstIterator;
78 typedef Object<DT6_18, DigitalSet> ObjectType;
79
80 Point p1( -50, -50, -50 );
81 Point p2( 50, 50, 50 );
82 Domain domain( p1, p2 );
83 Point c( 0, 0 );
84 // diamond of radius 30
85 DigitalSet diamond_set( domain );
86 for ( DomainConstIterator it = domain.begin(); it != domain.end(); ++it )
87 {
88 if ( (*it - c ).norm1() <= 30 ) diamond_set.insertNew( *it );
89 }
90 ObjectType diamond( dt6_18, diamond_set );
91 // The following line takes almost no time.
92 ObjectType diamond_clone( diamond );
93 // Since one of the objects is modified, the set is duplicated at the following line
94 diamond_clone.pointSet().erase( c );
95 ObjectType bdiamond = diamond.border(); // one component
96 ObjectType bdiamond_clone = diamond_clone.border(); // two components
97
98 QApplication application(argc,argv);
99 typedef Viewer3D<> MyViewer;
100 MyViewer viewer;
101 viewer.show();
102 viewer<< CustomColors3D(Color(250, 250,250),Color(250, 250,250));
103 viewer << bdiamond_clone;
104 viewer << bdiamond ;
105 viewer << ClippingPlane(1,1,0,5, false) << MyViewer::updateDisplay;
106 return application.exec();
107
108}
109// //
Structure representing an RGB triple with alpha component.
Definition Color.h:68
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: Represents a digital topology as a couple of adjacency relations.
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
const ConstIterator & begin() const
const ConstIterator & end() const
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
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
int main()
Definition testBits.cpp:56
MyPointD Point
Domain domain
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet