33#include "DGtal/base/Common.h"
36#include "DGtal/io/readers/VolReader.h"
37#include "DGtal/images/ImageSelector.h"
38#include "DGtal/images/imagesSetsUtils/SetFromImage.h"
39#include "DGtal/images/SimpleThresholdForegroundPredicate.h"
40#include "DGtal/topology/helpers/Surfaces.h"
41#include "DGtal/topology/LightImplicitDigitalSurface.h"
42#include "DGtal/images/ImageHelper.h"
43#include "DGtal/topology/DigitalSurface.h"
44#include "DGtal/graph/DepthFirstVisitor.h"
45#include "DGtal/graph/GraphVisitorRange.h"
48#include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
49#include "DGtal/geometry/surfaces/estimation/IntegralInvariantVolumeEstimator.h"
52#include "DGtal/io/viewers/Viewer3D.h"
53#include "DGtal/io/colormaps/GradientColorMap.h"
61int main(
int argc,
char** argv )
66 <<
" <fileName.vol> <threshold> <radius>" << std::endl;
67 trace.
error() <<
"Example : "<< argv[0] <<
" Al.150.vol 0 7" << std::endl;
73 for (
int i = 0; i < argc; ++i )
78 unsigned int threshold = std::atoi( argv[ 2 ] );
86 std::string filename = argv[1];
88 ImagePredicate predicate = ImagePredicate( image, threshold );
97 trace.
error() <<
"Error in the Khalimsky space construction."<<std::endl;
103 MyLightImplicitDigitalSurface LightImplDigSurf( KSpaceShape, predicate, SAdj, bel );
108 typedef VisitorRange::ConstIterator SurfelConstIterator;
110 VisitorRange range(
new Visitor( digSurf, *digSurf.
begin() ) );
111 SurfelConstIterator abegin = range.begin();
112 SurfelConstIterator aend = range.end();
116 double radius = std::atof(argv[3]);
126 typedef MyIICurvatureFunctor::Value
Value;
128 MyIICurvatureFunctor curvatureFunctor;
129 curvatureFunctor.init( h, radius );
131 MyIICurvatureEstimator curvatureEstimator( curvatureFunctor );
132 curvatureEstimator.attach( KSpaceShape, predicate );
133 curvatureEstimator.setParams( radius / h );
134 curvatureEstimator.init( h, abegin, aend );
136 std::vector< Value > results;
137 std::back_insert_iterator< std::vector< Value > > resultsIt( results );
138 curvatureEstimator.eval( abegin, aend, resultsIt );
142 Value min = std::numeric_limits < Value >::max();
143 Value max = std::numeric_limits < Value >::min();
144 for (
unsigned int i = 0; i < results.size(); ++i )
146 if ( results[ i ] < min )
150 else if ( results[ i ] >
max )
156 QApplication application( argc, argv );
158 Viewer viewer( KSpaceShape );
159 viewer.setWindowTitle(
"example Integral Invariant 3D");
163 Gradient cmap_grad( min,
max );
164 cmap_grad.addColor(
Color( 50, 50, 255 ) );
165 cmap_grad.addColor(
Color( 255, 0, 0 ) );
166 cmap_grad.addColor(
Color( 255, 255, 10 ) );
168 VisitorRange range2(
new Visitor( digSurf, *digSurf.
begin() ) );
169 abegin = range2.begin();
174 for (
unsigned int i = 0; i < results.size(); ++i )
177 << KSpaceShape.
unsigns( *abegin );
181 viewer << Viewer3D<>::updateDisplay;
184 return application.exec();
Structure representing an RGB triple with alpha component.
Aim: This class is useful to perform a depth-first exploration of a graph given a starting point or s...
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
ConstIterator begin() const
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: Transforms a graph visitor into a single pass input range.
const Point & lowerBound() const
const Point & upperBound() const
Aim: implements association bewteen points lying in a digital domain and values.
Aim: This class implement an Integral Invariant estimator which computes for each surfel the volume o...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
static SCell findABel(const KSpace &K, const PointPredicate &pp, unsigned int nbtries=1000)
Aim: Represent adjacencies between surfel elements, telling if it follows an interior to exterior ord...
void beginBlock(const std::string &keyword="")
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....
DigitalSurface< MyDigitalSurfaceContainer > MyDigitalSurface
BreadthFirstVisitor< MyDigitalSurface > Visitor
DGtal is the top-level namespace which contains all DGtal functions and types.
std::string className() const
Return the style name used for drawing this object.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
static ImageContainer importVol(const std::string &filename, const Functor &aFunctor=Functor())
Aim: A functor Real -> Real that returns the 3d mean curvature by transforming the given volume....