DGtal 2.1.0
Loading...
Searching...
No Matches
ShortcutsGeometry.h
1
17#pragma once
18
31#if defined(ShortcutsGeometry_RECURSES)
32#error Recursive header files inclusion detected in ShortcutsGeometry.h
33#else // defined(ShortcutsGeometry_RECURSES)
35#define ShortcutsGeometry_RECURSES
36
37#if !defined ShortcutsGeometry_h
39#define ShortcutsGeometry_h
40
42#include "DGtal/helpers/Shortcuts.h"
43#include "DGtal/kernel/BasicPointPredicates.h"
44#include "DGtal/geometry/volumes/distance/LpMetric.h"
45#include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
46#include "DGtal/geometry/volumes/distance/VoronoiMap.h"
47#include "DGtal/geometry/volumes/distance/DistanceTransformation.h"
48#include "DGtal/geometry/surfaces/estimation/TrueDigitalSurfaceLocalEstimator.h"
49#include "DGtal/geometry/surfaces/estimation/VoronoiCovarianceMeasureOnDigitalSurface.h"
50#include "DGtal/geometry/surfaces/estimation/VCMDigitalSurfaceLocalEstimator.h"
51#include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
52#include "DGtal/geometry/surfaces/estimation/IntegralInvariantVolumeEstimator.h"
53#include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.h"
54#include "DGtal/geometry/meshes/CorrectedNormalCurrentComputer.h"
55
56#include "DGtal/dec/DiscreteExteriorCalculusFactory.h"
57#include "DGtal/dec/ATSolver2D.h"
59
60namespace DGtal
61{
62
63 namespace sgf = ::DGtal::functors::ShapeGeometricFunctors;
64
66 // template class ShortcutsGeometry
77 template < typename TKSpace >
78 class ShortcutsGeometry : public Shortcuts< TKSpace >
79 {
81 public:
85 using Base::getKSpace;
87
88 // ----------------------- Usual space types --------------------------------------
89 public:
90
92 typedef TKSpace KSpace;
94 typedef typename KSpace::Space Space;
96 typedef typename Space::Integer Integer;
98 typedef typename Space::Point Point;
100 typedef typename Space::Vector Vector;
102 typedef typename Space::RealVector RealVector;
104 typedef typename Space::RealPoint RealPoint;
110 typedef unsigned char GrayScale;
111
112 // ----------------------- Shortcut types --------------------------------------
113 public:
130 typedef typename KSpace::SurfelSet SurfelSet;
135 typedef ::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface;
139 typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface;
153 typedef std::set< IdxSurfel > IdxSurfelSet;
154 typedef std::vector< Surfel > SurfelRange;
155 typedef std::vector< Cell > CellRange;
156 typedef std::vector< IdxSurfel > IdxSurfelRange;
157 typedef std::vector< Scalar > Scalars;
158 typedef std::vector< RealVector > RealVectors;
159 typedef std::vector< RealPoint > RealPoints;
160
161 typedef ::DGtal::Statistic<Scalar> ScalarStatistic;
162
172
174 typedef std::vector< CurvatureTensorQuantity > CurvatureTensorQuantities;
175
177
196
197 typedef ::DGtal::Mesh<RealPoint> Mesh;
198 typedef ::DGtal::TriangulatedSurface<RealPoint> TriangulatedSurface;
199 typedef ::DGtal::PolygonalSurface<RealPoint> PolygonalSurface;
200 typedef std::map<Surfel, IdxSurfel> Surfel2Index;
201 typedef std::map<Cell, IdxVertex> Cell2Index;
202
205
206 // ----------------------- Static services --------------------------------------
207 public:
208
209 // ----------------------- Exact geometry services ------------------------------
212 public:
213
222
230 {
231 return Parameters
232 ( "projectionMaxIter", 20 )
233 ( "projectionAccuracy", 0.0001 )
234 ( "projectionGamma", 0.5 )
235 ( "gridstep", 1.0 );
236 }
237
256 static RealPoints
259 const KSpace& K,
260 const SurfelRange& surfels,
261 const Parameters& params = parametersShapeGeometry() )
262 {
263 RealVectors n_true_estimations;
264 TruePositionEstimator true_estimator;
265 int maxIter = params[ "projectionMaxIter" ].as<int>();
266 double accuracy = params[ "projectionAccuracy" ].as<double>();
267 double gamma = params[ "projectionGamma" ].as<double>();
268 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
269 true_estimator.attach( *shape );
270 true_estimator.setParams( K, PositionFunctor(), maxIter, accuracy, gamma );
271 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
272 true_estimator.eval( surfels.begin(), surfels.end(),
273 std::back_inserter( n_true_estimations ) );
274 return n_true_estimations;
275 }
276
290 static RealPoints
293 const RealPoints& points,
294 const Parameters& params = parametersShapeGeometry() )
295 {
296 RealPoints proj_points( points.size() );
297 int maxIter = params[ "projectionMaxIter" ].as<int>();
298 double accuracy = params[ "projectionAccuracy" ].as<double>();
299 double gamma = params[ "projectionGamma" ].as<double>();
300 for ( unsigned int i = 0; i < points.size(); ++i )
301 proj_points[ i ] = shape->nearestPoint( points[ i ], accuracy,
302 maxIter, gamma );
303 return proj_points;
304 }
305
324 static RealVectors
327 const KSpace& K,
328 const SurfelRange& surfels,
329 const Parameters& params = parametersShapeGeometry() )
330 {
331 RealVectors n_true_estimations;
332 TrueNormalEstimator true_estimator;
333 int maxIter = params[ "projectionMaxIter" ].as<int>();
334 double accuracy = params[ "projectionAccuracy" ].as<double>();
335 double gamma = params[ "projectionGamma" ].as<double>();
336 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
337 true_estimator.attach( *shape );
338 true_estimator.setParams( K, NormalFunctor(), maxIter, accuracy, gamma );
339 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
340 true_estimator.eval( surfels.begin(), surfels.end(),
341 std::back_inserter( n_true_estimations ) );
342 return n_true_estimations;
343 }
344
363 static Scalars
366 const KSpace& K,
367 const SurfelRange& surfels,
368 const Parameters& params = parametersShapeGeometry() )
369 {
370 Scalars n_true_estimations;
371 TrueMeanCurvatureEstimator true_estimator;
372 int maxIter = params[ "projectionMaxIter" ].as<int>();
373 double accuracy = params[ "projectionAccuracy" ].as<double>();
374 double gamma = params[ "projectionGamma" ].as<double>();
375 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
376 true_estimator.attach( *shape );
377 true_estimator.setParams( K, MeanCurvatureFunctor(), maxIter, accuracy, gamma );
378 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
379 true_estimator.eval( surfels.begin(), surfels.end(),
380 std::back_inserter( n_true_estimations ) );
381 return n_true_estimations;
382 }
383
398 static Scalars
401 const typename Base::SurfaceMesh::Faces faces,
402 const Parameters& params = parametersShapeGeometry() )
403 {
404 bool unit_u = params["unit_u"].as<int>();
405 double radius = params["r-radius"].as<double>();
406 double alpha = params["alpha"].as<double>();
407 double h = params["gridstep"].as<double>();
408 if ( alpha != 1.0 ) radius *= pow( h, alpha-1.0 );
409
410 CNCComputer computer(*mesh, unit_u);
411
412 const auto& mu0 = computer.computeMu0();
413 const auto& mu1 = computer.computeMu1();
414
415 Scalars curvatures(faces.size());
416 for (size_t i = 0; i < faces.size(); ++i)
417 {
418 const auto center = mesh->faceCentroid(faces[i]);
419 const auto area = mu0.measure(center, radius, faces[i]);
420 const auto lmu1 = mu1.measure(center, radius, faces[i]);
421 curvatures[i] = CNCComputer::meanCurvature(area, lmu1);
422 }
423
424 return curvatures;
425 }
426
448 const Parameters & params = parametersShapeGeometry() )
449 {
450 std::vector<typename Base::SurfaceMesh::Face> allFaces(mesh->nbFaces());
451 std::iota(allFaces.begin(), allFaces.end(), 0);
452
453 return getCNCMeanCurvatures(mesh, allFaces, params);
454 }
455
474 template <typename T>
476 T & digitalObject, const Parameters & params = parametersShapeGeometry() )
477 {
479 return getCNCMeanCurvatures(mesh, params);
480 }
481
501 static Scalars
504 const KSpace& K,
505 const SurfelRange& surfels,
506 const Parameters& params = parametersShapeGeometry() )
507 {
508 Scalars n_true_estimations;
509 TrueGaussianCurvatureEstimator true_estimator;
510 int maxIter = params[ "projectionMaxIter" ].as<int>();
511 double accuracy = params[ "projectionAccuracy" ].as<double>();
512 double gamma = params[ "projectionGamma" ].as<double>();
513 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
514 true_estimator.attach( *shape );
515 true_estimator.setParams( K, GaussianCurvatureFunctor(), maxIter, accuracy, gamma );
516 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
517 true_estimator.eval( surfels.begin(), surfels.end(),
518 std::back_inserter( n_true_estimations ) );
519 return n_true_estimations;
520 }
521
542 const typename Base::SurfaceMesh::Faces & faces,
543 const Parameters & params = parametersShapeGeometry() )
544 {
545 bool unit_u = params["unit_u"].as<int>();
546 double radius = params["r-radius"].as<double>();
547 double alpha = params["alpha"].as<double>();
548 double h = params["gridstep"].as<double>();
549 if ( alpha != 1.0 ) radius *= pow( h, alpha-1.0 );
550
551 CNCComputer computer(*mesh, unit_u);
552
553 const auto& mu0 = computer.computeMu0();
554 const auto& mu2 = computer.computeMu2();
555
556 Scalars curvatures(faces.size());
557 for (size_t i = 0; i < faces.size(); ++i)
558 {
559 const auto center = mesh->faceCentroid(faces[i]);
560 const auto area = mu0.measure(center, radius, faces[i]);
561 const auto lmu2 = mu2.measure(center, radius, faces[i]);
562 curvatures[i] = CNCComputer::GaussianCurvature(area, lmu2);
563 }
564
565 return curvatures;
566 }
567
589 const Parameters & params = parametersShapeGeometry() )
590 {
591 std::vector<typename Base::SurfaceMesh::Face> allFaces(mesh->nbFaces());
592 std::iota(allFaces.begin(), allFaces.end(), 0);
593
594 return getCNCGaussianCurvatures(mesh, allFaces, params);
595 }
596
615 template <typename T>
617 T & digitalObject, const Parameters & params = parametersShapeGeometry() )
618 {
620 return getCNCGaussianCurvatures(mesh, params);
621 }
622
641 static Scalars
644 const KSpace& K,
645 const SurfelRange& surfels,
646 const Parameters& params = parametersShapeGeometry() )
647 {
648 Scalars n_true_estimations;
650 int maxIter = params[ "projectionMaxIter" ].as<int>();
651 double accuracy = params[ "projectionAccuracy" ].as<double>();
652 double gamma = params[ "projectionGamma" ].as<double>();
653 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
654 true_estimator.attach( *shape );
655 true_estimator.setParams( K, FirstPrincipalCurvatureFunctor(),
656 maxIter, accuracy, gamma );
657 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
658 true_estimator.eval( surfels.begin(), surfels.end(),
659 std::back_inserter( n_true_estimations ) );
660 return n_true_estimations;
661 }
662
683 static Scalars
686 const KSpace& K,
687 const SurfelRange& surfels,
688 const Parameters& params = parametersShapeGeometry() )
689 {
690 Scalars n_true_estimations;
692 int maxIter = params[ "projectionMaxIter" ].as<int>();
693 double accuracy = params[ "projectionAccuracy" ].as<double>();
694 double gamma = params[ "projectionGamma" ].as<double>();
695 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
696 true_estimator.attach( *shape );
698 maxIter, accuracy, gamma );
699 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
700 true_estimator.eval( surfels.begin(), surfels.end(),
701 std::back_inserter( n_true_estimations ) );
702 return n_true_estimations;
703 }
704
725 static RealVectors
728 const KSpace& K,
729 const SurfelRange& surfels,
730 const Parameters& params = parametersShapeGeometry() )
731 {
732 RealVectors n_true_estimations;
734 int maxIter = params[ "projectionMaxIter" ].as<int>();
735 double accuracy = params[ "projectionAccuracy" ].as<double>();
736 double gamma = params[ "projectionGamma" ].as<double>();
737 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
738 true_estimator.attach( *shape );
739 true_estimator.setParams( K, FirstPrincipalDirectionFunctor(),
740 maxIter, accuracy, gamma );
741 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
742 true_estimator.eval( surfels.begin(), surfels.end(),
743 std::back_inserter( n_true_estimations ) );
744 return n_true_estimations;
745 }
746
767 static RealVectors
770 const KSpace& K,
771 const SurfelRange& surfels,
772 const Parameters& params = parametersShapeGeometry() )
773 {
774 RealVectors n_true_estimations;
776 int maxIter = params[ "projectionMaxIter" ].as<int>();
777 double accuracy = params[ "projectionAccuracy" ].as<double>();
778 double gamma = params[ "projectionGamma" ].as<double>();
779 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
780 true_estimator.attach( *shape );
782 maxIter, accuracy, gamma );
783 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
784 true_estimator.eval( surfels.begin(), surfels.end(),
785 std::back_inserter( n_true_estimations ) );
786 return n_true_estimations;
787 }
788
813 const KSpace& K,
814 const SurfelRange& surfels,
815 const Parameters& params = parametersShapeGeometry() )
816 {
817 CurvatureTensorQuantities n_true_estimations;
819 int maxIter = params[ "projectionMaxIter" ].as<int>();
820 double accuracy = params[ "projectionAccuracy" ].as<double>();
821 double gamma = params[ "projectionGamma" ].as<double>();
822 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
823 true_estimator.attach( *shape );
825 maxIter, accuracy, gamma );
826 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
827 true_estimator.eval( surfels.begin(), surfels.end(),
828 std::back_inserter( n_true_estimations ) );
829 return n_true_estimations;
830 }
831
856 static std::tuple<Scalars, Scalars, RealVectors, RealVectors>
859 const typename Base::SurfaceMesh::Faces& faces,
860 const Parameters& params = parametersShapeGeometry() )
861 {
862 bool unit_u = params["unit_u"].as<int>();
863 double radius = params["r-radius"].as<double>();
864 double alpha = params["alpha"].as<double>();
865 double h = params["gridstep"].as<double>();
866 if ( alpha != 1.0 ) radius *= pow( h, alpha-1.0 );
867
868 CNCComputer computer(*mesh, unit_u);
869
870 const auto& mu0 = computer.computeMu0();
871 const auto& muxy = computer.computeMuXY();
872
873 if (mesh->faceNormals().size() == 0)
874 {
875 // Try to use vertex normals if any
876 if (mesh->vertexNormals().size() == 0)
877 mesh->computeFaceNormalsFromPositions();
878 else
879 mesh->computeFaceNormalsFromVertexNormals();
880 }
881
882 const auto& normals = mesh->faceNormals();
883
884 Scalars k1(faces.size()), k2(faces.size());
885 RealVectors d1(faces.size()), d2(faces.size());
886
887 for (size_t i = 0; i < faces.size(); ++i)
888 {
889 const auto center = mesh->faceCentroid(faces[i]);
890 const auto area = mu0 .measure(center, radius, faces[i]);
891 const auto lmuxy = muxy.measure(center, radius, faces[i]);
892 std::tie(k1[i], k2[i], d1[i], d2[i]) =
893 CNCComputer::principalCurvatures(area, lmuxy, normals[faces[i]]);
894 }
895
896 return std::make_tuple(k1, k2, d1, d2);
897 }
898
924 static std::tuple<Scalars, Scalars, RealVectors, RealVectors>
927 const Parameters & params = parametersShapeGeometry() )
928 {
929 std::vector<typename Base::SurfaceMesh::Face> allFaces(mesh->nbFaces());
930 std::iota(allFaces.begin(), allFaces.end(), 0);
931
932 return getCNCPrincipalCurvaturesAndDirections(mesh, allFaces, params);
933 }
934
954 template <typename T>
955 static std::tuple<Scalars, Scalars, RealVectors, RealVectors>
957 T & digitalObject,
958 const Parameters & params = parametersShapeGeometry() )
959 {
961 return getCNCPrincipalCurvaturesAndDirections(mesh, params);
962 }
964
965 // --------------------------- geometry estimation ------------------------------
968 public:
969
981 {
982 return Parameters
983 ( "verbose", 1 )
984 ( "t-ring", 3.0 )
985 ( "kernel", "hat" )
986 ( "R-radius", 10.0 )
987 ( "r-radius", 3.0 )
988 ( "alpha", 0.33 )
989 ( "surfelEmbedding", 0 )
990 ( "unit_u" , 0 );
991 }
992
1002 static RealVectors
1004 const SurfelRange& surfels )
1005 {
1006 std::vector< RealVector > result;
1007 for ( auto s : surfels )
1008 {
1009 Dimension k = K.sOrthDir( s );
1010 bool direct = K.sDirect( s, k );
1012 t[ k ] = direct ? -1.0 : 1.0;
1013 result.push_back( t );
1014 }
1015 return result;
1016 }
1017
1033 template <typename TAnyDigitalSurface>
1034 static RealVectors
1037 const SurfelRange& surfels,
1038 const Parameters& params = parametersGeometryEstimation() )
1039 {
1040 int verbose = params[ "verbose" ].as<int>();
1041 Scalar t = params[ "t-ring" ].as<double>();
1042 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
1043 typedef LpMetric<Space> Metric;
1046 < Surfel, CanonicSCellEmbedder<KSpace> > SurfelFunctor;
1048 < SurfaceContainer, Metric, SurfelFunctor, Functor> NormalEstimator;
1049 if ( verbose > 0 )
1050 trace.info() << "- CTrivial normal t-ring=" << t << " (discrete)" << std::endl;
1051 const Functor fct( 1.0, t );
1052 const KSpace & K = surface->container().space();
1053 Metric aMetric( 2.0 );
1054 CanonicSCellEmbedder<KSpace> canonic_embedder( K );
1055 std::vector< RealVector > n_estimations;
1056 SurfelFunctor surfelFct( canonic_embedder, 1.0 );
1057 NormalEstimator estimator;
1058 estimator.attach( *surface);
1059 estimator.setParams( aMetric, surfelFct, fct, t );
1060 estimator.init( 1.0, surfels.begin(), surfels.end());
1061 estimator.eval( surfels.begin(), surfels.end(),
1062 std::back_inserter( n_estimations ) );
1063 std::transform( n_estimations.cbegin(), n_estimations.cend(), n_estimations.begin(),
1064 [] ( RealVector v ) { return -v; } );
1065 return n_estimations;
1066 }
1067
1089 template <typename TAnyDigitalSurface>
1090 static RealVectors
1093 const SurfelRange& surfels,
1094 const Parameters& params = parametersGeometryEstimation() )
1095 {
1097 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
1098 RealVectors n_estimations;
1099 int verbose = params[ "verbose" ].as<int>();
1100 std::string kernel = params[ "kernel" ].as<std::string>();
1101 Scalar h = params[ "gridstep" ].as<Scalar>();
1102 Scalar R = params[ "R-radius" ].as<Scalar>();
1103 Scalar r = params[ "r-radius" ].as<Scalar>();
1104 Scalar t = params[ "t-ring" ].as<Scalar>();
1105 Scalar alpha = params[ "alpha" ].as<Scalar>();
1106 int embedding = params[ "embedding" ].as<int>();
1107 // Adjust parameters according to gridstep if specified.
1108 if ( alpha != 1.0 ) R *= pow( h, alpha-1.0 );
1109 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1110 Surfel2PointEmbedding embType = embedding == 0 ? Pointels :
1111 embedding == 1 ? InnerSpel : OuterSpel;
1112 if ( verbose > 0 )
1113 {
1114 trace.info() << "- VCM normal kernel=" << kernel << " emb=" << embedding
1115 << " alpha=" << alpha << std::endl;
1116 trace.info() << "- VCM normal r=" << (r*h) << " (continuous) "
1117 << r << " (discrete)" << std::endl;
1118 trace.info() << "- VCM normal R=" << (R*h) << " (continuous) "
1119 << R << " (discrete)" << std::endl;
1120 trace.info() << "- VCM normal t=" << t << " (discrete)" << std::endl;
1121 }
1122 if ( kernel == "hat" )
1123 {
1124 typedef functors::HatPointFunction<Point,Scalar> KernelFunction;
1126 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
1129 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
1130 KernelFunction chi_r( 1.0, r );
1131 VCMNormalEstimator estimator;
1132 estimator.attach( *surface );
1133 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
1134 estimator.init( h, surfels.begin(), surfels.end() );
1135 estimator.eval( surfels.begin(), surfels.end(),
1136 std::back_inserter( n_estimations ) );
1137 }
1138 else if ( kernel == "ball" )
1139 {
1142 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
1145 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
1146 KernelFunction chi_r( 1.0, r );
1147 VCMNormalEstimator estimator;
1148 estimator.attach( *surface );
1149 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
1150 estimator.init( h, surfels.begin(), surfels.end() );
1151 estimator.eval( surfels.begin(), surfels.end(),
1152 std::back_inserter( n_estimations ) );
1153 }
1154 else
1155 {
1156 trace.warning() << "[ShortcutsGeometry::getVCMNormalVectors] Unknown kernel: "
1157 << kernel << std::endl;
1158 }
1159 return n_estimations;
1160 }
1161
1184 static RealVectors
1186 const SurfelRange& surfels,
1187 const Parameters& params
1189 | parametersKSpace() )
1190 {
1191 auto K = getKSpace( bimage, params );
1192 return getIINormalVectors( *bimage, K, surfels, params );
1193 }
1194
1224 static RealVectors
1226 const SurfelRange& surfels,
1227 const Parameters& params
1231 {
1232 auto K = getKSpace( params );
1233 return getIINormalVectors( *dshape, K, surfels, params );
1234 }
1235
1260 template <typename TPointPredicate>
1261 static RealVectors
1262 getIINormalVectors( const TPointPredicate& shape,
1263 const KSpace& K,
1264 const SurfelRange& surfels,
1265 const Parameters& params
1267 | parametersKSpace() )
1268 {
1269 typedef functors::IINormalDirectionFunctor<Space> IINormalFunctor;
1271 <KSpace, TPointPredicate, IINormalFunctor> IINormalEstimator;
1272
1273 RealVectors n_estimations;
1274 int verbose = params[ "verbose" ].as<int>();
1275 Scalar h = params[ "gridstep" ].as<Scalar>();
1276 Scalar r = params[ "r-radius" ].as<Scalar>();
1277 Scalar alpha = params[ "alpha" ].as<Scalar>();
1278 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1279 if ( verbose > 0 )
1280 {
1281 trace.info() << "- II normal alpha=" << alpha << std::endl;
1282 trace.info() << "- II normal r=" << (r*h) << " (continuous) "
1283 << r << " (discrete)" << std::endl;
1284 }
1285 IINormalFunctor functor;
1286 functor.init( h, r*h );
1287 IINormalEstimator ii_estimator( functor );
1288 ii_estimator.attach( K, shape );
1289 ii_estimator.setParams( r );
1290 ii_estimator.init( h, surfels.begin(), surfels.end() );
1291 ii_estimator.eval( surfels.begin(), surfels.end(),
1292 std::back_inserter( n_estimations ) );
1293 const RealVectors n_trivial = getTrivialNormalVectors( K, surfels );
1294 orientVectors( n_estimations, n_trivial );
1295 return n_estimations;
1296 }
1297
1298
1317 static Scalars
1319 const SurfelRange& surfels,
1320 const Parameters& params
1322 | parametersKSpace() )
1323 {
1324 auto K = getKSpace( bimage, params );
1325 return getIIMeanCurvatures( *bimage, K, surfels, params );
1326 }
1327
1353 static Scalars
1355 const SurfelRange& surfels,
1356 const Parameters& params
1360 {
1361 auto K = getKSpace( params );
1362 return getIIMeanCurvatures( *dshape, K, surfels, params );
1363 }
1364
1365
1387 template <typename TPointPredicate>
1388 static Scalars
1389 getIIMeanCurvatures( const TPointPredicate& shape,
1390 const KSpace& K,
1391 const SurfelRange& surfels,
1392 const Parameters& params
1394 | parametersKSpace() )
1395 {
1396 typedef functors::IIMeanCurvature3DFunctor<Space> IIMeanCurvFunctor;
1398 <KSpace, TPointPredicate, IIMeanCurvFunctor> IIMeanCurvEstimator;
1399
1400 Scalars mc_estimations;
1401 int verbose = params[ "verbose" ].as<int>();
1402 Scalar h = params[ "gridstep" ].as<Scalar>();
1403 Scalar r = params[ "r-radius" ].as<Scalar>();
1404 Scalar alpha = params[ "alpha" ].as<Scalar>();
1405 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1406 if ( verbose > 0 )
1407 {
1408 trace.info() << "- II mean curvature alpha=" << alpha << std::endl;
1409 trace.info() << "- II mean curvature r=" << (r*h) << " (continuous) "
1410 << r << " (discrete)" << std::endl;
1411 }
1412 IIMeanCurvFunctor functor;
1413 functor.init( h, r*h );
1414 IIMeanCurvEstimator ii_estimator( functor );
1415 ii_estimator.attach( K, shape );
1416 ii_estimator.setParams( r );
1417 ii_estimator.init( h, surfels.begin(), surfels.end() );
1418 ii_estimator.eval( surfels.begin(), surfels.end(),
1419 std::back_inserter( mc_estimations ) );
1420 return mc_estimations;
1421 }
1422
1441 static Scalars
1443 const SurfelRange& surfels,
1444 const Parameters& params
1446 | parametersKSpace() )
1447 {
1448 auto K = getKSpace( bimage, params );
1449 return getIIGaussianCurvatures( *bimage, K, surfels, params );
1450 }
1451
1477 static Scalars
1479 const SurfelRange& surfels,
1480 const Parameters& params
1484 {
1485 auto K = getKSpace( params );
1486 return getIIGaussianCurvatures( *dshape, K, surfels, params );
1487 }
1488
1489
1511 template <typename TPointPredicate>
1512 static Scalars
1513 getIIGaussianCurvatures( const TPointPredicate& shape,
1514 const KSpace& K,
1515 const SurfelRange& surfels,
1516 const Parameters& params
1518 | parametersKSpace() )
1519 {
1520 typedef functors::IIGaussianCurvature3DFunctor<Space> IIGaussianCurvFunctor;
1522 <KSpace, TPointPredicate, IIGaussianCurvFunctor> IIGaussianCurvEstimator;
1523
1524 Scalars mc_estimations;
1525 int verbose = params[ "verbose" ].as<int>();
1526 Scalar h = params[ "gridstep" ].as<Scalar>();
1527 Scalar r = params[ "r-radius" ].as<Scalar>();
1528 Scalar alpha = params[ "alpha" ].as<Scalar>();
1529 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1530 if ( verbose > 0 )
1531 {
1532 trace.info() << "- II Gaussian curvature alpha=" << alpha << std::endl;
1533 trace.info() << "- II Gaussian curvature r=" << (r*h) << " (continuous) "
1534 << r << " (discrete)" << std::endl;
1535 }
1536 IIGaussianCurvFunctor functor;
1537 functor.init( h, r*h );
1538 IIGaussianCurvEstimator ii_estimator( functor );
1539 ii_estimator.attach( K, shape );
1540 ii_estimator.setParams( r );
1541 ii_estimator.init( h, surfels.begin(), surfels.end() );
1542 ii_estimator.eval( surfels.begin(), surfels.end(),
1543 std::back_inserter( mc_estimations ) );
1544 return mc_estimations;
1545 }
1546
1568 const SurfelRange& surfels,
1569 const Parameters& params
1571 | parametersKSpace() )
1572 {
1573 auto K = getKSpace( bimage, params );
1574 return getIIPrincipalCurvaturesAndDirections( *bimage, K, surfels, params );
1575 }
1576
1605 const SurfelRange& surfels,
1606 const Parameters& params
1610 {
1611 auto K = getKSpace( params );
1612 return getIIPrincipalCurvaturesAndDirections( *dshape, K, surfels, params );
1613 }
1614
1615
1637 template <typename TPointPredicate>
1639 getIIPrincipalCurvaturesAndDirections( const TPointPredicate& shape,
1640 const KSpace& K,
1641 const SurfelRange& surfels,
1642 const Parameters& params
1644 | parametersKSpace() )
1645 {
1648
1649 CurvatureTensorQuantities mc_estimations;
1650 int verbose = params[ "verbose" ].as<int>();
1651 Scalar h = params[ "gridstep" ].as<Scalar>();
1652 Scalar r = params[ "r-radius" ].as<Scalar>();
1653 Scalar alpha = params[ "alpha" ].as<Scalar>();
1654 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1655 if ( verbose > 0 )
1656 {
1657 trace.info() << "- II principal curvatures and directions alpha=" << alpha << std::endl;
1658 trace.info() << "- II principal curvatures and directions r=" << (r*h) << " (continuous) "
1659 << r << " (discrete)" << std::endl;
1660 }
1661 IICurvFunctor functor;
1662 functor.init( h, r*h );
1663 IICurvEstimator ii_estimator( functor );
1664 ii_estimator.attach( K, shape );
1665 ii_estimator.setParams( r );
1666 ii_estimator.init( h, surfels.begin(), surfels.end() );
1667 ii_estimator.eval( surfels.begin(), surfels.end(),
1668 std::back_inserter( mc_estimations ) );
1669 return mc_estimations;
1670 }
1671
1673
1674 // --------------------------- AT approximation ------------------------------
1677 public:
1678
1692 {
1693 return Parameters
1694 ( "at-enabled", 1 )
1695 ( "at-alpha", 0.1 )
1696 ( "at-lambda", 0.025 )
1697 ( "at-epsilon", 0.25 )
1698 ( "at-epsilon-start", 2.0 )
1699 ( "at-epsilon-ratio", 2.0 )
1700 ( "at-max-iter", 10 )
1701 ( "at-diff-v-max", 0.0001 )
1702 ( "at-v-policy", "Maximum" );
1703 }
1704
1727 template <typename TAnyDigitalSurface,
1728 typename VectorFieldInput>
1729 static
1730 VectorFieldInput
1732 const SurfelRange& surfels,
1733 const VectorFieldInput& input,
1734 const Parameters& params
1736 {
1737 (void)surface; //param not used. FIXME: JOL
1738
1739 int verbose = params[ "verbose" ].as<int>();
1740 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1741 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1742 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1743 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1744 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1745 int max_iter = params[ "at-max-iter" ].as<int>();
1746 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1748 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1749 ATSolver2D< KSpace > at_solver( calculus, verbose );
1750 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1751 at_solver.setUp( alpha_at, lambda_at );
1752 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1753 auto output = input;
1754 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1755 return output;
1756 }
1757
1788 template <typename TAnyDigitalSurface,
1789 typename VectorFieldInput,
1790 typename CellRangeConstIterator>
1791 static
1792 VectorFieldInput
1794 CellRangeConstIterator itB,
1795 CellRangeConstIterator itE,
1797 const SurfelRange& surfels,
1798 const VectorFieldInput& input,
1799 const Parameters& params
1801 {
1802 (void)surface; //param not used FIXME: JOL
1803
1804 int verbose = params[ "verbose" ].as<int>();
1805 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1806 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1807 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1808 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1809 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1810 int max_iter = params[ "at-max-iter" ].as<int>();
1811 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1812 std::string policy = params[ "at-v-policy" ].as<std::string>();
1814 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1815 ATSolver2D< KSpace > at_solver( calculus, verbose );
1816 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1817 at_solver.setUp( alpha_at, lambda_at );
1818 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1819 auto output = input;
1820 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1821 auto p = ( policy == "Average" ) ? at_solver.Average
1822 : ( policy == "Minimum" ) ? at_solver.Minimum
1823 : at_solver.Maximum;
1824 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1825 return output;
1826 }
1827
1851 template <typename TAnyDigitalSurface>
1852 static
1853 Scalars
1855 const SurfelRange& surfels,
1856 const Scalars& input,
1857 const Parameters& params
1859 {
1860 (void)surface; //param not used FIXME: JOL
1861
1862 int verbose = params[ "verbose" ].as<int>();
1863 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1864 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1865 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1866 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1867 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1868 int max_iter = params[ "at-max-iter" ].as<int>();
1869 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1871 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1872 ATSolver2D< KSpace > at_solver( calculus, verbose );
1873 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1874 at_solver.setUp( alpha_at, lambda_at );
1875 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1876 auto output = input;
1877 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1878 return output;
1879 }
1880
1915 template <typename TAnyDigitalSurface,
1916 typename CellRangeConstIterator>
1917 static
1918 Scalars
1920 CellRangeConstIterator itB,
1921 CellRangeConstIterator itE,
1923 const SurfelRange& surfels,
1924 const Scalars& input,
1925 const Parameters& params
1927 {
1928 (void)surface; //param not used FIXME: JOL
1929
1930 int verbose = params[ "verbose" ].as<int>();
1931 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1932 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1933 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1934 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1935 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1936 int max_iter = params[ "at-max-iter" ].as<int>();
1937 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1938 std::string policy = params[ "at-v-policy" ].as<std::string>();
1940 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1941 ATSolver2D< KSpace > at_solver( calculus, verbose );
1942 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1943 at_solver.setUp( alpha_at, lambda_at );
1944 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1945 auto output = input;
1946 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1947 auto p = ( policy == "Average" ) ? at_solver.Average
1948 : ( policy == "Minimum" ) ? at_solver.Minimum
1949 : at_solver.Maximum;
1950 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1951 return output;
1952 }
1953
1955
1956 // ------------------------- Error measures services -------------------------
1959 public:
1960
1966 static void
1968 const RealVectors& ref_v )
1969 {
1970 std::transform( ref_v.cbegin(), ref_v.cend(), v.cbegin(), v.begin(),
1971 [] ( RealVector rw, RealVector w )
1972 { return rw.dot( w ) >= 0.0 ? w : -w; } );
1973 }
1974
1979 static ScalarStatistic
1981 {
1982 ScalarStatistic stat;
1983 stat.addValues( v.begin(), v.end() );
1984 stat.terminate();
1985 return stat;
1986 }
1987
1994 static Scalars
1996 const RealVectors& v2 )
1997 {
1998 Scalars v( v1.size() );
1999 if ( v1.size() == v2.size() )
2000 {
2001 auto outIt = v.begin();
2002 for ( auto it1 = v1.cbegin(), it2 = v2.cbegin(), itE1 = v1.cend();
2003 it1 != itE1; ++it1, ++it2 )
2004 {
2005 Scalar angle_error = acos( (*it1).dot( *it2 ) );
2006 *outIt++ = angle_error;
2007 }
2008 }
2009 else
2010 {
2011 trace.warning() << "[ShortcutsGeometry::getVectorsAngleDeviation]"
2012 << " v1.size()=" << v1.size() << " should be equal to "
2013 << " v2.size()=" << v2.size() << std::endl;
2014 }
2015 return v;
2016 }
2017
2022 static Scalars
2024 const Scalars & v2 )
2025 {
2026 Scalars result( v1.size() );
2027 std::transform( v2.cbegin(), v2.cend(), v1.cbegin(), result.begin(),
2028 [] ( Scalar val1, Scalar val2 )
2029 { return fabs( val1 - val2 ); } );
2030 return result;
2031 }
2032
2039 static Scalar
2041 const Scalars & v2 )
2042 {
2043 Scalar sum = 0;
2044 for ( unsigned int i = 0; i < v1.size(); i++ )
2045 sum += ( v1[ i ] - v2[ i ] ) * ( v1[ i ] - v2[ i ] );
2046 return sqrt( sum / v1.size() );
2047 }
2048
2055 static Scalar
2057 const Scalars & v2 )
2058 {
2059 Scalar sum = 0;
2060 for ( unsigned int i = 0; i < v1.size(); i++ )
2061 sum += fabs( v1[ i ] - v2[ i ] );
2062 return sum / v1.size();
2063 }
2064
2071 static Scalar
2073 const Scalars & v2 )
2074 {
2075 Scalar loo = 0;
2076 for ( unsigned int i = 0; i < v1.size(); i++ )
2077 loo = std::max( loo, fabs( v1[ i ] - v2[ i ] ) );
2078 return loo;
2079 }
2081
2082 // ----------------------- VoronoiMap services ------------------------------
2083 public:
2086
2089 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2090 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2091 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2093 return Parameters
2094 // Toricity might be moved elsewhere as this is quite a general parameter
2095 ( "toroidal-x" , false )
2096 ( "toroidal-y" , false )
2097 ( "toroidal-z" , false );
2098 }
2099
2100
2101
2110 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2111 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2112 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2115 template<uint32_t p, typename PointRange>
2118 const PointRange& sites,
2119 const Parameters& params = parametersVoronoiMap())
2120 {
2123 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2124 VoronoiPointPredicate predicate(set);
2125 Metric metric;
2126
2127 typename Map::PeriodicitySpec specs = {false, false, false};
2128 if (params["toroidal-x"].as<int>()) specs[0] = true;
2129 if (params["toroidal-y"].as<int>()) specs[1] = true;
2130 if (params["toroidal-z"].as<int>()) specs[2] = true;
2131
2132
2133 // Do not return a pointer here for two reasons:
2134 // - The distance transform will not be passed anywhere else
2135 // - The operator() is less accessible with pointers.
2136 return Map(domain, predicate, metric, specs);
2137 }
2138
2147 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2148 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2149 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2152 template<uint32_t p, typename PointRange>
2155 const PointRange& sites,
2156 const Parameters& params = parametersVoronoiMap())
2157 {
2160 DigitalSet set(*domain); set.insert(sites.begin(), sites.end());
2161 VoronoiPointPredicate predicate(set);
2162 Metric metric;
2163
2164 typename Map::PeriodicitySpec specs = {false, false, false};
2165 if (params["toroidal-x"].as<int>()) specs[0] = true;
2166 if (params["toroidal-y"].as<int>()) specs[1] = true;
2167 if (params["toroidal-z"].as<int>()) specs[2] = true;
2168
2169 // Do not return a pointer here for two reasons:
2170 // - The distance transform will not be passed anywhere else
2171 // - The operator() is less accessible with pointers.
2172 return Map(*domain, predicate, metric, specs);
2173 }
2174
2186 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2187 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2188 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2191 template<uint32_t p, typename PointRange>
2194 const PointRange& sites,
2195 const Parameters& params = parametersVoronoiMap())
2196 {
2199 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2200 VoronoiPointPredicate predicate(set);
2201 Metric metric;
2202
2203 typename Map::PeriodicitySpec specs = {false, false, false};
2204 if (params["toroidal-x"].as<int>()) specs[0] = true;
2205 if (params["toroidal-y"].as<int>()) specs[1] = true;
2206 if (params["toroidal-z"].as<int>()) specs[2] = true;
2207
2208 // Do not return a pointer here for two reasons:
2209 // - The distance transform will not be passed anywhere else
2210 // - The operator() is less accessible with pointers.
2211 return Map(domain, predicate, metric, specs);
2212 }
2213
2225 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2226 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2227 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2230 template<uint32_t p, typename PointRange>
2233 const PointRange& sites,
2234 const Parameters& params = parametersVoronoiMap())
2235 {
2238 DigitalSet set(*domain); set.insert(sites.begin(), sites.end());
2239 VoronoiPointPredicate predicate(set);
2240 Metric metric;
2241
2242 typename Map::PeriodicitySpec specs = {false, false, false};
2243 if (params["toroidal-x"].as<int>()) specs[0] = true;
2244 if (params["toroidal-y"].as<int>()) specs[1] = true;
2245 if (params["toroidal-z"].as<int>()) specs[2] = true;
2246
2247 // Do not return a pointer here for two reasons:
2248 // - The distance transform will not be passed anywhere else
2249 // - The operator() is less accessible with pointers.
2250 return Map(*domain, predicate, metric, specs);
2251 }
2252
2262 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2263 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2264 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2267 template<uint32_t p, typename PointRangeSites, typename PointRange>
2268 static std::vector<Vector> getDirectionToClosestSite(
2269 const PointRange& points,
2270 const PointRangeSites& sites,
2271 const Parameters& params = parametersVoronoiMap())
2272 {
2275
2276 // Compute domain of points
2277 Point pmin = *points.begin();
2278 Point pmax = pmin;
2279
2280 size_t pCount = 0;
2281 for (auto it = points.begin(); it != points.end(); ++it)
2282 {
2283 pCount ++;
2284 for (size_t i = 0; i < Space::dimension; ++i)
2285 {
2286 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2287 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2288 }
2289 }
2290
2291 for (auto it = sites.begin(); it != sites.end(); ++it)
2292 {
2293 for (size_t i = 0; i < Space::dimension; ++i)
2294 {
2295 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2296 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2297 }
2298 }
2299
2300 Domain domain(pmin, pmax);
2301
2302 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2303 VoronoiPointPredicate predicate(set);
2304 Metric metric;
2305
2306
2307 typename Map::PeriodicitySpec specs = {false, false, false};
2308 if (params["toroidal-x"].as<int>()) specs[0] = true;
2309 if (params["toroidal-y"].as<int>()) specs[1] = true;
2310 if (params["toroidal-z"].as<int>()) specs[2] = true;
2311
2312 auto map = Map(domain, predicate, metric, specs);
2313
2314 std::vector<Vector> directions(pCount);
2315 size_t i = 0;
2316 for (auto it = points.begin(); it != points.end(); ++it)
2317 {
2318 directions[i++] = map(*it);
2319 }
2320 return directions;
2321 }
2322
2332 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2333 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2334 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2337 template<uint32_t p, typename PointRangeSites, typename PointRange>
2338 static std::vector<typename ExactPredicateLpSeparableMetric<Space, p>::Value> getDistanceToClosestSite(
2339 const PointRange& points,
2340 const PointRangeSites& sites,
2341 const Parameters& params = parametersVoronoiMap())
2342 {
2345
2346 // Compute domain of points
2347 Point pmin = *points.begin();
2348 Point pmax = pmin;
2349
2350 size_t pCount = 0;
2351 for (auto it = points.begin(); it != points.end(); ++it)
2352 {
2353 pCount ++;
2354 for (size_t i = 0; i < Space::dimension; ++i)
2355 {
2356 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2357 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2358 }
2359 }
2360
2361 for (auto it = sites.begin(); it != sites.end(); ++it)
2362 {
2363 for (size_t i = 0; i < Space::dimension; ++i)
2364 {
2365 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2366 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2367 }
2368 }
2369
2370 Domain domain(pmin, pmax);
2371
2372 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2373 VoronoiPointPredicate predicate(set);
2374 Metric metric;
2375
2376 typename Map::PeriodicitySpec specs = {false, false, false};
2377 if (params["toroidal-x"].as<int>()) specs[0] = true;
2378 if (params["toroidal-y"].as<int>()) specs[1] = true;
2379 if (params["toroidal-z"].as<int>()) specs[2] = true;
2380
2381 auto map = Map(domain, predicate, metric, specs);
2382
2383 std::vector<typename Metric::Value> directions(pCount);
2384 size_t i = 0;
2385 for (auto it = points.begin(); it != points.end(); ++it)
2386 {
2387 directions[i++] = map(*it);
2388 }
2389 return directions;
2390 }
2391
2392
2394
2395 // ----------------------- Standard services ------------------------------
2398 public:
2399
2404
2409
2414 ShortcutsGeometry ( const ShortcutsGeometry & other ) = delete;
2415
2421
2428
2435
2437
2438 // ----------------------- Interface --------------------------------------
2439 public:
2440
2441 // ------------------------- Protected Datas ------------------------------
2442 protected:
2443
2444 // ------------------------- Private Datas --------------------------------
2445 private:
2446
2447 // ------------------------- Hidden services ------------------------------
2448 protected:
2449
2450 // ------------------------- Internals ------------------------------------
2451 private:
2452
2453 }; // end of class ShortcutsGeometry
2454
2455
2456} // namespace DGtal
2457
2458
2460// Includes inline functions.
2461
2462// //
2464
2465#endif // !defined ShortcutsGeometry_h
2466
2467#undef ShortcutsGeometry_RECURSES
2468#endif // else defined(ShortcutsGeometry_RECURSES)
Aim: This class solves Ambrosio-Tortorelli functional on a two-dimensional digital space (a 2D grid o...
Definition ATSolver2D.h:91
void getOutputScalarFieldU2(ScalarFieldOutput &output, SurfelRangeConstIterator itB, SurfelRangeConstIterator itE)
Definition ATSolver2D.h:798
void getOutputScalarFieldV0(ScalarFieldOutput &output, CellRangeConstIterator itB, CellRangeConstIterator itE, CellOutputPolicy policy=CellOutputPolicy::Average)
Definition ATSolver2D.h:824
void initInputScalarFieldU2(const ScalarFieldInput &input, SurfelRangeConstIterator itB, SurfelRangeConstIterator itE)
Definition ATSolver2D.h:330
void setUp(double a, double l)
Definition ATSolver2D.h:444
void initInputVectorFieldU2(const VectorFieldInput &input, SurfelRangeConstIterator itB, SurfelRangeConstIterator itE, bool normalize=false)
Definition ATSolver2D.h:288
bool solveGammaConvergence(double eps1=2.0, double eps2=0.25, double epsr=2.0, bool compute_smallest_epsilon_map=false, double n_oo_max=1e-4, unsigned int iter_max=10)
Definition ATSolver2D.h:657
void getOutputVectorFieldU2(VectorFieldOutput &output, SurfelRangeConstIterator itB, SurfelRangeConstIterator itE)
Definition ATSolver2D.h:772
@ Maximum
compute maximum value at cell vertices
Definition ATSolver2D.h:105
@ Average
compute average values at cell vertices
Definition ATSolver2D.h:103
@ Minimum
compute minimum value at cell vertices,
Definition ATSolver2D.h:104
Aim: Smart pointer based on reference counts.
Definition CountedPtr.h:80
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
DigitalSurfaceContainer::Surfel Surfel
DigitalSurfaceContainer::Cell Cell
Surfel Vertex
Defines the type for a vertex.
std::vector< Arc > ArcRange
The range of arcs is defined as a vector.
DigitalSurfaceContainer::SCell SCell
Aim: This class provides static members to create DEC structures from various other DGtal structures.
Aim: Implementation of the linear in time distance transformation for separable metrics.
Aim: implements separable l_p metrics with exact predicates.
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
Aim: Represents a digital surface with the topology of its dual surface. Its aim is to mimick the sta...
HalfEdgeDataStructure::HalfEdgeIndex Arc
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
Aim: This class implement an Integral Invariant estimator which computes for each surfel the volume o...
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
SpaceND< dim, Integer > Space
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: this class adapts any local functor on digital surface element to define a local estimator....
Aim: implements l_p metrics.
Definition LpMetric.h:75
Aim: Represents a multivariate polynomial, i.e. an element of , where K is some ring or field.
TEuclideanRing Component
Type for Vector elements.
static Self zero
Static const for zero PointVector.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
LightDigitalSurface::Vertex Vertex
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static Scalars getIIGaussianCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
TKSpace KSpace
Digital cellular space.
static RealVectors getIINormalVectors(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
static Scalar getScalarsNormL1(const Scalars &v1, const Scalars &v2)
static RealVectors getTrivialNormalVectors(const KSpace &K, const SurfelRange &surfels)
LightImplicitDigitalSurface< KSpace, BinaryImage > LightSurfaceContainer
MPolynomial< Space::dimension, Scalar > ScalarPolynomial
defines a multi-variate polynomial : RealPoint -> Scalar
static Scalars getIIMeanCurvatures(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
std::vector< IdxSurfel > IdxSurfelRange
Space::Point Point
Point with integer coordinates.
static RealPoints getPositions(CountedPtr< ImplicitShape3D > shape, const RealPoints &points, const Parameters &params=parametersShapeGeometry())
RealVector::Component Scalar
Floating-point numbers.
static DistanceTransformation< Space, VoronoiPointPredicate, ExactPredicateLpSeparableMetric< Space, p > > getDistanceTransformation(CountedPtr< Domain > domain, const PointRange &sites, const Parameters &params=parametersVoronoiMap())
Computes the VoronoiMap of a domain, where sites are given through a range.
static std::tuple< Scalars, Scalars, RealVectors, RealVectors > getCNCPrincipalCurvaturesAndDirections(CountedPtr< typename Base::SurfaceMesh > mesh, const Parameters &params=parametersShapeGeometry())
::DGtal::Statistic< Scalar > ScalarStatistic
ShortcutsGeometry(const ShortcutsGeometry &other)=delete
static Scalars getATScalarFieldApproximation(Scalars &features, CellRangeConstIterator itB, CellRangeConstIterator itE, CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const Scalars &input, const Parameters &params=parametersATApproximation()|parametersGeometryEstimation())
Space::Integer Integer
Integer numbers.
static Parameters parametersGeometryEstimation()
static Scalars getMeanCurvatures(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
static RealPoints getPositions(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
std::map< Cell, IdxVertex > Cell2Index
static Parameters parametersKSpace()
Definition Shortcuts.h:308
functors::IIPrincipalCurvaturesAndDirectionsFunctor< Space >::Quantity CurvatureTensorQuantity
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, GaussianCurvatureFunctor > TrueGaussianCurvatureEstimator
static CurvatureTensorQuantities getIIPrincipalCurvaturesAndDirections(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition Shortcuts.h:329
ShortcutsGeometry & operator=(const ShortcutsGeometry &other)=delete
LightDigitalSurface::SCell SCell
LightDigitalSurface::ArcRange ArcRange
sgf::ShapeGaussianCurvatureFunctor< ImplicitShape3D > GaussianCurvatureFunctor
static Parameters parametersShapeGeometry()
CorrectedNormalCurrentComputer< RealPoint, RealVector > CNCComputer
KSpace::SurfelSet SurfelSet
defines a set of surfels
static CurvatureTensorQuantities getIIPrincipalCurvaturesAndDirections(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
static Scalars getCNCGaussianCurvatures(CountedPtr< typename Base::SurfaceMesh > mesh, const typename Base::SurfaceMesh::Faces &faces, const Parameters &params=parametersShapeGeometry())
DigitalSetByAssociativeContainer< Domain, std::unordered_set< typename Domain::Point > > DigitalSet
sgf::ShapeSecondPrincipalDirectionFunctor< ImplicitShape3D > SecondPrincipalDirectionFunctor
static CurvatureTensorQuantities getIIPrincipalCurvaturesAndDirections(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static Scalars getIIGaussianCurvatures(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
sgf::ShapePositionFunctor< ImplicitShape3D > PositionFunctor
sgf::ShapeMeanCurvatureFunctor< ImplicitShape3D > MeanCurvatureFunctor
sgf::ShapeSecondPrincipalCurvatureFunctor< ImplicitShape3D > SecondPrincipalCurvatureFunctor
static void orientVectors(RealVectors &v, const RealVectors &ref_v)
Shortcuts< TKSpace > Base
unsigned char GrayScale
The type for 8-bits gray-scale elements.
static RealVectors getIINormalVectors(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static Parameters parametersATApproximation()
ShortcutsGeometry(ShortcutsGeometry &&other)=delete
static Scalars getScalarsAbsoluteDifference(const Scalars &v1, const Scalars &v2)
static VoronoiMap< Space, VoronoiPointPredicate, ExactPredicateLpSeparableMetric< Space, p > > getVoronoiMap(CountedPtr< Domain > domain, const PointRange &sites, const Parameters &params=parametersVoronoiMap())
Computes the VoronoiMap of a domain, where sites are given through a range.
std::vector< CurvatureTensorQuantity > CurvatureTensorQuantities
IdxDigitalSurface::Vertex IdxVertex
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, PositionFunctor > TruePositionEstimator
static RealVectors getNormalVectors(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
::DGtal::Mesh< RealPoint > Mesh
::DGtal::TriangulatedSurface< RealPoint > TriangulatedSurface
static VoronoiMap< Space, VoronoiPointPredicate, ExactPredicateLpSeparableMetric< Space, p > > getVoronoiMap(Domain domain, const PointRange &sites, const Parameters &params=parametersVoronoiMap())
Computes the VoronoiMap of a domain, where sites are given through a range.
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, SecondPrincipalDirectionFunctor > TrueSecondPrincipalDirectionEstimator
static std::tuple< Scalars, Scalars, RealVectors, RealVectors > getCNCPrincipalCurvaturesAndDirections(CountedPtr< typename Base::SurfaceMesh > mesh, const typename Base::SurfaceMesh::Faces &faces, const Parameters &params=parametersShapeGeometry())
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, NormalFunctor > TrueNormalEstimator
LightDigitalSurface::Arc Arc
static RealVectors getFirstPrincipalDirections(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
static Scalars getCNCGaussianCurvatures(T &digitalObject, const Parameters &params=parametersShapeGeometry())
ImageContainerBySTLVector< Domain, GrayScale > GrayScaleImage
defines a grey-level image with (hyper-)rectangular domain.
static std::vector< Vector > getDirectionToClosestSite(const PointRange &points, const PointRangeSites &sites, const Parameters &params=parametersVoronoiMap())
Computes the direction of the closest site of a range of points.
static std::vector< typename ExactPredicateLpSeparableMetric< Space, p >::Value > getDistanceToClosestSite(const PointRange &points, const PointRangeSites &sites, const Parameters &params=parametersVoronoiMap())
Computes the distance of the closest site of a range of points.
std::vector< Scalar > Scalars
::DGtal::PolygonalSurface< RealPoint > PolygonalSurface
static Scalars getIIMeanCurvatures(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static RealVectors getSecondPrincipalDirections(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
ImplicitPolynomial3Shape< Space > ImplicitShape3D
::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface
defines an arbitrary digital surface over a binary image.
static DistanceTransformation< Space, VoronoiPointPredicate, ExactPredicateLpSeparableMetric< Space, p > > getDistanceTransformation(Domain domain, const PointRange &sites, const Parameters &params=parametersVoronoiMap())
Computes the VoronoiMap of a domain, where sites are given through a range.
GaussDigitizer< Space, ImplicitShape3D > DigitizedImplicitShape3D
defines the digitization of an implicit shape.
KSpace::Space Space
Digital space.
std::vector< Cell > CellRange
IdxDigitalSurface::Arc IdxArc
ImageContainerBySTLVector< Domain, float > FloatImage
defines a float image with (hyper-)rectangular domain.
SetOfSurfels< KSpace, SurfelSet > ExplicitSurfaceContainer
defines a heavy container that represents any digital surface.
static RealVectors getCTrivialNormalVectors(CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation())
LightDigitalSurface::Face Face
static Scalars getCNCMeanCurvatures(CountedPtr< typename Base::SurfaceMesh > mesh, const typename Base::SurfaceMesh::Faces faces, const Parameters &params=parametersShapeGeometry())
static Scalars getIIMeanCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
ImageContainerBySTLVector< Domain, double > DoubleImage
defines a double image with (hyper-)rectangular domain.
functors::NotPointPredicate< DigitalSet > VoronoiPointPredicate
static std::tuple< Scalars, Scalars, RealVectors, RealVectors > getCNCPrincipalCurvaturesAndDirections(T &digitalObject, const Parameters &params=parametersShapeGeometry())
std::set< IdxSurfel > IdxSurfelSet
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, SecondPrincipalCurvatureFunctor > TrueSecondPrincipalCurvatureEstimator
Space::RealVector RealVector
Vector with floating-point coordinates.
static Parameters parametersVoronoiMap()
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, FirstPrincipalCurvatureFunctor > TrueFirstPrincipalCurvatureEstimator
ShortcutsGeometry< TKSpace > Self
static CurvatureTensorQuantities getPrincipalCurvaturesAndDirections(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
static Parameters defaultParameters()
static Scalars getCNCMeanCurvatures(T &digitalObject, const Parameters &params=parametersShapeGeometry())
::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface
defines a connected digital surface over a binary image.
static Scalars getGaussianCurvatures(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, PrincipalCurvaturesAndDirectionsFunctor > TruePrincipalCurvaturesAndDirectionsEstimator
std::vector< Surfel > SurfelRange
static RealVectors getIINormalVectors(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static Scalars getVectorsAngleDeviation(const RealVectors &v1, const RealVectors &v2)
static Scalars getCNCGaussianCurvatures(CountedPtr< typename Base::SurfaceMesh > mesh, const Parameters &params=parametersShapeGeometry())
static Scalar getScalarsNormL2(const Scalars &v1, const Scalars &v2)
Space::RealPoint RealPoint
Point with floating-point coordinates.
IndexedDigitalSurface< ExplicitSurfaceContainer > IdxDigitalSurface
defines a connected or not indexed digital surface.
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, MeanCurvatureFunctor > TrueMeanCurvatureEstimator
static Scalars getFirstPrincipalCurvatures(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
sgf::ShapeNormalVectorFunctor< ImplicitShape3D > NormalFunctor
sgf::ShapeFirstPrincipalDirectionFunctor< ImplicitShape3D > FirstPrincipalDirectionFunctor
IdxDigitalSurface::Vertex IdxSurfel
static Scalar getScalarsNormLoo(const Scalars &v1, const Scalars &v2)
static Parameters parametersDigitizedImplicitShape3D()
Definition Shortcuts.h:458
static ScalarStatistic getStatistic(const Scalars &v)
static Scalars getATScalarFieldApproximation(CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const Scalars &input, const Parameters &params=parametersATApproximation()|parametersGeometryEstimation())
LightDigitalSurface::Cell Cell
LightDigitalSurface::Surfel Surfel
sgf::ShapeFirstPrincipalCurvatureFunctor< ImplicitShape3D > FirstPrincipalCurvatureFunctor
HyperRectDomain< Space > Domain
An (hyper-)rectangular domain.
Space::Vector Vector
Vector with integer coordinates.
static Scalars getIIGaussianCurvatures(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
std::vector< RealPoint > RealPoints
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, FirstPrincipalDirectionFunctor > TrueFirstPrincipalDirectionEstimator
sgf::ShapePrincipalCurvaturesAndDirectionsFunctor< ImplicitShape3D > PrincipalCurvaturesAndDirectionsFunctor
static VectorFieldInput getATVectorFieldApproximation(CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const VectorFieldInput &input, const Parameters &params=parametersATApproximation()|parametersGeometryEstimation())
static Scalars getCNCMeanCurvatures(CountedPtr< typename Base::SurfaceMesh > mesh, const Parameters &params=parametersShapeGeometry())
static Scalars getSecondPrincipalCurvatures(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
static VectorFieldInput getATVectorFieldApproximation(Scalars &features, CellRangeConstIterator itB, CellRangeConstIterator itE, CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const VectorFieldInput &input, const Parameters &params=parametersATApproximation()|parametersGeometryEstimation())
std::vector< RealVector > RealVectors
static RealVectors getVCMNormalVectors(CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation())
std::map< Surfel, IdxSurfel > Surfel2Index
IdxDigitalSurface::ArcRange IdxArcRange
ImageContainerBySTLVector< Domain, bool > BinaryImage
defines a black and white image with (hyper-)rectangular domain.
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
Definition Shortcuts.h:102
static Parameters parametersKSpace()
Definition Shortcuts.h:308
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition Shortcuts.h:329
static Parameters parametersDigitizedImplicitShape3D()
Definition Shortcuts.h:458
static CountedPtr< SurfaceMesh > makePrimalSurfaceMesh(Cell2Index &c2i, CountedPtr< ::DGtal::DigitalSurface< TContainer > > aSurface)
Definition Shortcuts.h:2633
Aim: This class processes a set of sample values for one variable and can then compute different stat...
Definition Statistic.h:70
void addValues(Iter b, Iter e)
std::ostream & warning()
std::ostream & info()
Aim: An estimator on digital surfaces that returns the reference local geometric quantity....
void init(const Scalar _h, SurfelConstIterator itb, SurfelConstIterator ite)
Quantity eval(SurfelConstIterator it) const
void setParams(ConstAlias< KSpace > ks, Clone< GeometricFunctor > fct, const int maxIter=20, const Scalar accuracy=0.0001, const Scalar gamma=0.5)
void attach(ConstAlias< Shape > aShape)
Aim: This class adapts a VoronoiCovarianceMeasureOnDigitalSurface to be a model of CDigitalSurfaceLoc...
Aim: This class specializes the Voronoi covariance measure for digital surfaces. It adds notably the ...
Aim: Implementation of the linear in time Voronoi map construction.
Definition VoronoiMap.h:127
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
Aim: A functor Matrix -> RealVector that returns the normal direction by diagonalizing the given cova...
Aim: A functor Matrix -> std::pair<RealVector,RealVector> that returns the first and the second princ...
std::tuple< double, double, RealVector, RealVector > Quantity
PolyCalculus * calculus
CountedPtr< SH3::DigitalSurface > surface
std::vector< Point > PointRange
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition Common.h:119
Trace trace
Surfel2PointEmbedding
Possible embeddings for surfel as point(s)
Aim: A trivial embedder for signed cell, which corresponds to the canonic injection of cell centroids...
Aim: Utility class to compute curvature measures induced by (1) a corrected normal current defined by...
static std::tuple< Scalar, Scalar, RealVector, RealVector > principalCurvatures(Scalar mu0, RealTensor muXY, const RealVector &N)
static Scalar meanCurvature(Scalar mu0, Scalar mu1)
static Scalar GaussianCurvature(Scalar mu0, Scalar mu2)
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Aim: A functor Matrix -> Real that returns the Gaussian curvature by diagonalizing the given covarian...
Aim: A functor Real -> Real that returns the 3d mean curvature by transforming the given volume....
Aim: The predicate returns true when the point predicate given at construction return false....
Aim: A functor RealPoint -> Quantity that returns the first principal curvature at given point (i....
Aim: A functor RealPoint -> RealVector that returns the first principal direction at given point (i....
Aim: A functor RealPoint -> Quantity that returns the gaussian curvature at given point.
Aim: A functor RealPoint -> Quantity that returns the mean curvature at given point.
Aim: A functor RealPoint -> Quantity that returns the normal vector at given point.
Aim: A functor RealPoint -> Quantity that returns the position of the point itself.
Aim: A functor RealPoint -> (Scalar,Scalar,RealVector,RealVector that returns the principal curvature...
Aim: A functor RealPoint -> Quantity that returns the second principal curvature at given point (i....
Aim: A functor RealPoint -> RealVector that returns the second principal direction at given point (i....
Aim: A functor Surfel -> Quantity that returns the outer normal vector at given surfel.
KSpace K
std::unordered_map< Cell, CubicalCellData > Map
Domain domain