37 #include "DGtal/base/Common.h"
38 #include "DGtal/helpers/StdDefs.h"
40 #include "DGtal/images/ImageContainerBySTLVector.h"
42 #include "DGtal/io/readers/VolReader.h"
43 #include "DGtal/io/writers/VolWriter.h"
45 #include "DGtal/images/SimpleThresholdForegroundPredicate.h"
46 #include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
47 #include "DGtal/shapes/implicit/ImplicitBall.h"
48 #include "DGtal/base/BasicFunctors.h"
50 #include "DGtal/io/viewers/Viewer3D.h"
51 #include "DGtal/io/colormaps/GradientColorMap.h"
53 #include <boost/algorithm/minmax_element.hpp>
55 using namespace DGtal;
57 int main(
int argc,
char ** argv)
66 QApplication application(argc,argv);
71 itend = image.domain().end(); it != itend; ++it)
75 viewer << DGtal::Viewer3D<>::updateDisplay;
76 trace.
info() <<
"viewer launched..."<<std::endl;
77 bool res = application.exec();
83 Predicate binaryshape(image, 0);
87 DT distancemap(image.domain(), binaryshape, l2);
90 QApplication application2(argc,argv);
93 DT::Value maxDT = (*boost::first_max_element(distancemap.constRange().begin(),
94 distancemap.constRange().end()));
100 trace.
info() <<
"we display the dt map"<<std::endl;
105 itend = distancemap.domain().end(); it != itend;
107 if (distancemap(*it) > 0)
115 trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
116 viewer2 << DGtal::Viewer3D<>::updateDisplay;
117 trace.
info() <<
"viewer2 launched..."<<std::endl;
118 res = res && application2.exec();
121 Image imageGranulo ( image.domain() );
127 trace.
info() <<
"Computing the granulometry"<<std::endl;
130 itend = imageGranulo.domain().end(); it != itend; ++it)
132 if (distancemap(*it) > 0)
136 unsigned int radius = (
unsigned int)distancemap(*it);
143 itball != itendball; itball++)
144 if (imageGranulo.domain().isInside(*itball) &&
145 ( ball(*itball) > 0) &&
146 (imageGranulo(*itball) < radius))
147 imageGranulo.setValue(*itball, radius);
153 trace.
info() <<
"Granulometry ok nbBalls="<<cpt<< std::endl;
159 QApplication application3(argc,argv);
162 Image::Value maxG = (*boost::first_max_element(imageGranulo.constRange().begin(),
163 imageGranulo.constRange().end()));
172 itend = imageGranulo.domain().end(); it != itend;
174 if (imageGranulo(*it) > 0)
181 trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
182 viewer3 << DGtal::Viewer3D<>::updateDisplay;
183 trace.
info() <<
"viewer3 launched..."<<std::endl;
184 return res && application3.exec();
Structure representing an RGB triple with alpha component.
static const Color Yellow
Aim: implements separable l_p metrics with exact predicates.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Iterator for HyperRectDomain.
std::vector< Value >::const_iterator ConstIterator
std::vector< Value >::iterator Iterator
Aim: implements association bewteen points lying in a digital domain and values.
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
Aim: Implements basic operations that will be used in Point and Vector classes.
static Self diagonal(Component val=1)
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Aim: Define a simple Foreground predicate thresholding image values given a single thresold....
MyDigitalSurface::ConstIterator ConstIterator
Point center(const std::vector< Point > &points)
DGtal is the top-level namespace which contains all DGtal functions and types.
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: Export a 3D Image using the Vol formats.
Functor that rounds down.
int main(int argc, char **argv)
ImageContainerBySTLVector< Domain, Value > Image