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 using namespace DGtal;
55 int main(
int argc,
char ** argv)
64 QApplication application(argc,argv);
69 itend = image.domain().end(); it != itend; ++it)
73 viewer << DGtal::Viewer3D<>::updateDisplay;
74 trace.
info() <<
"viewer launched..."<<std::endl;
75 bool res = application.exec();
81 Predicate binaryshape(image, 0);
85 DT distancemap(image.domain(), binaryshape, l2);
88 QApplication application2(argc,argv);
91 DT::Value maxDT = (*std::max_element(distancemap.constRange().begin(),
92 distancemap.constRange().end()));
98 trace.
info() <<
"we display the dt map"<<std::endl;
103 itend = distancemap.domain().end(); it != itend;
105 if (distancemap(*it) > 0)
113 trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
114 viewer2 << DGtal::Viewer3D<>::updateDisplay;
115 trace.
info() <<
"viewer2 launched..."<<std::endl;
116 res = res && application2.exec();
119 Image imageGranulo ( image.domain() );
125 trace.
info() <<
"Computing the granulometry"<<std::endl;
128 itend = imageGranulo.domain().end(); it != itend; ++it)
130 if (distancemap(*it) > 0)
134 unsigned int radius = (
unsigned int)distancemap(*it);
141 itball != itendball; itball++)
142 if (imageGranulo.domain().isInside(*itball) &&
143 ( ball(*itball) > 0) &&
144 (imageGranulo(*itball) < radius))
145 imageGranulo.setValue(*itball, radius);
151 trace.
info() <<
"Granulometry ok nbBalls="<<cpt<< std::endl;
157 QApplication application3(argc,argv);
160 Image::Value maxG = (*std::max_element(imageGranulo.constRange().begin(),
161 imageGranulo.constRange().end()));
170 itend = imageGranulo.domain().end(); it != itend;
172 if (imageGranulo(*it) > 0)
179 trace.
info() <<
"Got "<<cpt<<
" points."<<std::endl;
180 viewer3 << DGtal::Viewer3D<>::updateDisplay;
181 trace.
info() <<
"viewer3 launched..."<<std::endl;
182 return application3.exec();
std::vector< Value >::iterator Iterator
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: implements association bewteen points lying in a digital domain and values.
MyDigitalSurface::ConstIterator ConstIterator
static Self diagonal(Component val=1)
Functor that rounds down.
Aim: Export a 3D Image using the Vol formats.
Aim: Implements basic operations that will be used in Point and Vector classes.
static const Color Yellow
Aim: implements separable l_p metrics with exact predicates.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: Define a simple Foreground predicate thresholding image values given a single thresold....
Aim: model of CEuclideanOrientedShape and CEuclideanBoundedShape concepts to create a ball in nD....
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
ImageContainerBySTLVector< Domain, Value > Image
std::vector< Value >::const_iterator ConstIterator
Structure representing an RGB triple with alpha component.
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...