An homotopic thinning is an iterative removal of simple points from a given digital object.
#include <iostream>
#include <queue>
#include <QImageReader>
#include <QtGui/qapplication.h>
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/helpers/StdDefs.h"
using namespace std;
using namespace DGtal;
using namespace Z3i;
int main( int argc, char** argv )
{
QApplication application(argc,argv);
viewer.setWindowTitle("simpleExample3DViewer");
viewer.show();
Point p1( -50, -50, -50 );
for ( Domain::ConstIterator it = domain.begin(); it != domain.end(); ++it )
{
if ( ((*it - c ).norm() <= 25) && ((*it - c ).norm() >= 18)
&& ( (((*it)[0] <= 3)&& ((*it)[0] >= -3))|| (((*it)[1] <= 3)&& ((*it)[1] >= -3)))){
shape_set.insertNew( *it );
}
}
int nb_simple=0;
int layer = 0;
do
{
std::queue<DigitalSet::Iterator> Q;
for ( DigitalSet::Iterator it = S.begin(); it != S.end(); ++it )
if ( shape.isSimple( *it ) )
Q.push( it );
nb_simple = 0;
while ( ! Q.empty() )
{
DigitalSet::Iterator it = Q.front();
Q.pop();
if ( shape.isSimple( *it ) )
{
cerr << "point simple " << (*it) << endl;
S.erase( *it );
++nb_simple;
}
}
++layer;
}
while ( nb_simple != 0 );
viewer <<
SetMode3D( shape_set.className(),
"Paving" );
viewer << S ;
viewer <<
SetMode3D( shape_set.className(),
"PavingTransp" );
viewer << CustomColors3D(
Color(250, 0,0, 25),
Color(250, 0,0, 5));
viewer << shape_set;
viewer<< Viewer3D::updateDisplay;
return application.exec();
}