DGtal 1.4.0
Loading...
Searching...
No Matches
3dBorderExtraction.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/viewers/Viewer3D.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 63 of file 3dBorderExtraction.cpp.

64{
65 typedef SpaceND< 3,int > Z3;
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}
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...
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
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
MyPointD Point
Domain domain
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet

References DGtal::HyperRectDomain< TSpace >::begin(), domain, DGtal::HyperRectDomain< TSpace >::end(), DGtal::DigitalSetByAssociativeContainer< TDomain, TContainer >::insertNew(), DGtal::JORDAN_DT, DGtal::Viewer3D< TSpace, TKSpace >::show(), and DGtal::Display3D< Space, KSpace >::updateDisplay.