File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
3dBorderExtraction.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/viewers/PolyscopeViewer.h"
#include "DGtal/io/Color.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
Include dependency graph for 3dBorderExtraction.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2011/03/25

An example file named 3dBorderExtraction.

This file is part of the DGtal library.

Definition in file 3dBorderExtraction.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 62 of file 3dBorderExtraction.cpp.

63{
64 typedef SpaceND< 3,int > Z3;
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}
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.
MetricAdjacency< Space, 2 > Adj18
Definition StdDefs.h:161
Space Z3
Definition StdDefs.h:145
MetricAdjacency< Space, 1 > Adj6
Definition StdDefs.h:159
DigitalTopology< Adj6, Adj18 > DT6_18
Definition StdDefs.h:164
Clipping plane.
Definition Display3D.h:299
DigitalSetByAssociativeContainer< Domain, std::unordered_set< typename Domain::Point > > Type
Domain domain
Z2i::DigitalSet DigitalSet
PolyscopeViewer< Space, KSpace > MyViewer

References domain, DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insertNew(), DGtal::JORDAN_DT, and DGtal::PolyscopeViewer< Space, KSpace >::show().