DGtal 2.0.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 using Face = typename Base::SurfaceMesh::Face;
405
406 bool unit_u = params["unit_u"].as<int>();
407 double radius = params["r-radius"].as<double>();
408 double alpha = params["alpha"].as<double>();
409 double h = params["gridstep"].as<double>();
410 if ( alpha != 1.0 ) radius *= pow( h, alpha-1.0 );
411
412 CNCComputer computer(*mesh, unit_u);
413
414 const auto& mu0 = computer.computeMu0();
415 const auto& mu1 = computer.computeMu1();
416
417 Scalars curvatures(faces.size());
418 for (size_t i = 0; i < faces.size(); ++i)
419 {
420 const auto center = mesh->faceCentroid(faces[i]);
421 const auto area = mu0.measure(center, radius, faces[i]);
422 const auto lmu1 = mu1.measure(center, radius, faces[i]);
423 curvatures[i] = CNCComputer::meanCurvature(area, lmu1);
424 }
425
426 return curvatures;
427 }
428
450 const Parameters & params = parametersShapeGeometry() )
451 {
452 std::vector<typename Base::SurfaceMesh::Face> allFaces(mesh->nbFaces());
453 std::iota(allFaces.begin(), allFaces.end(), 0);
454
455 return getCNCMeanCurvatures(mesh, allFaces, params);
456 }
457
476 template <typename T>
478 T & digitalObject, const Parameters & params = parametersShapeGeometry() )
479 {
481 return getCNCMeanCurvatures(mesh, params);
482 }
483
503 static Scalars
506 const KSpace& K,
507 const SurfelRange& surfels,
508 const Parameters& params = parametersShapeGeometry() )
509 {
510 Scalars n_true_estimations;
511 TrueGaussianCurvatureEstimator true_estimator;
512 int maxIter = params[ "projectionMaxIter" ].as<int>();
513 double accuracy = params[ "projectionAccuracy" ].as<double>();
514 double gamma = params[ "projectionGamma" ].as<double>();
515 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
516 true_estimator.attach( *shape );
517 true_estimator.setParams( K, GaussianCurvatureFunctor(), maxIter, accuracy, gamma );
518 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
519 true_estimator.eval( surfels.begin(), surfels.end(),
520 std::back_inserter( n_true_estimations ) );
521 return n_true_estimations;
522 }
523
544 const typename Base::SurfaceMesh::Faces & faces,
545 const Parameters & params = parametersShapeGeometry() )
546 {
547 using Face = typename Base::SurfaceMesh::Face;
548
549 bool unit_u = params["unit_u"].as<int>();
550 double radius = params["r-radius"].as<double>();
551 double alpha = params["alpha"].as<double>();
552 double h = params["gridstep"].as<double>();
553 if ( alpha != 1.0 ) radius *= pow( h, alpha-1.0 );
554
555 CNCComputer computer(*mesh, unit_u);
556
557 const auto& mu0 = computer.computeMu0();
558 const auto& mu2 = computer.computeMu2();
559
560 Scalars curvatures(faces.size());
561 for (size_t i = 0; i < faces.size(); ++i)
562 {
563 const auto center = mesh->faceCentroid(faces[i]);
564 const auto area = mu0.measure(center, radius, faces[i]);
565 const auto lmu2 = mu2.measure(center, radius, faces[i]);
566 curvatures[i] = CNCComputer::GaussianCurvature(area, lmu2);
567 }
568
569 return curvatures;
570 }
571
593 const Parameters & params = parametersShapeGeometry() )
594 {
595 std::vector<typename Base::SurfaceMesh::Face> allFaces(mesh->nbFaces());
596 std::iota(allFaces.begin(), allFaces.end(), 0);
597
598 return getCNCGaussianCurvatures(mesh, allFaces, params);
599 }
600
619 template <typename T>
621 T & digitalObject, const Parameters & params = parametersShapeGeometry() )
622 {
624 return getCNCGaussianCurvatures(mesh, params);
625 }
626
645 static Scalars
648 const KSpace& K,
649 const SurfelRange& surfels,
650 const Parameters& params = parametersShapeGeometry() )
651 {
652 Scalars n_true_estimations;
654 int maxIter = params[ "projectionMaxIter" ].as<int>();
655 double accuracy = params[ "projectionAccuracy" ].as<double>();
656 double gamma = params[ "projectionGamma" ].as<double>();
657 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
658 true_estimator.attach( *shape );
659 true_estimator.setParams( K, FirstPrincipalCurvatureFunctor(),
660 maxIter, accuracy, gamma );
661 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
662 true_estimator.eval( surfels.begin(), surfels.end(),
663 std::back_inserter( n_true_estimations ) );
664 return n_true_estimations;
665 }
666
687 static Scalars
690 const KSpace& K,
691 const SurfelRange& surfels,
692 const Parameters& params = parametersShapeGeometry() )
693 {
694 Scalars n_true_estimations;
696 int maxIter = params[ "projectionMaxIter" ].as<int>();
697 double accuracy = params[ "projectionAccuracy" ].as<double>();
698 double gamma = params[ "projectionGamma" ].as<double>();
699 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
700 true_estimator.attach( *shape );
702 maxIter, accuracy, gamma );
703 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
704 true_estimator.eval( surfels.begin(), surfels.end(),
705 std::back_inserter( n_true_estimations ) );
706 return n_true_estimations;
707 }
708
729 static RealVectors
732 const KSpace& K,
733 const SurfelRange& surfels,
734 const Parameters& params = parametersShapeGeometry() )
735 {
736 RealVectors n_true_estimations;
738 int maxIter = params[ "projectionMaxIter" ].as<int>();
739 double accuracy = params[ "projectionAccuracy" ].as<double>();
740 double gamma = params[ "projectionGamma" ].as<double>();
741 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
742 true_estimator.attach( *shape );
743 true_estimator.setParams( K, FirstPrincipalDirectionFunctor(),
744 maxIter, accuracy, gamma );
745 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
746 true_estimator.eval( surfels.begin(), surfels.end(),
747 std::back_inserter( n_true_estimations ) );
748 return n_true_estimations;
749 }
750
771 static RealVectors
774 const KSpace& K,
775 const SurfelRange& surfels,
776 const Parameters& params = parametersShapeGeometry() )
777 {
778 RealVectors n_true_estimations;
780 int maxIter = params[ "projectionMaxIter" ].as<int>();
781 double accuracy = params[ "projectionAccuracy" ].as<double>();
782 double gamma = params[ "projectionGamma" ].as<double>();
783 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
784 true_estimator.attach( *shape );
786 maxIter, accuracy, gamma );
787 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
788 true_estimator.eval( surfels.begin(), surfels.end(),
789 std::back_inserter( n_true_estimations ) );
790 return n_true_estimations;
791 }
792
817 const KSpace& K,
818 const SurfelRange& surfels,
819 const Parameters& params = parametersShapeGeometry() )
820 {
821 CurvatureTensorQuantities n_true_estimations;
823 int maxIter = params[ "projectionMaxIter" ].as<int>();
824 double accuracy = params[ "projectionAccuracy" ].as<double>();
825 double gamma = params[ "projectionGamma" ].as<double>();
826 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
827 true_estimator.attach( *shape );
829 maxIter, accuracy, gamma );
830 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
831 true_estimator.eval( surfels.begin(), surfels.end(),
832 std::back_inserter( n_true_estimations ) );
833 return n_true_estimations;
834 }
835
860 static std::tuple<Scalars, Scalars, RealVectors, RealVectors>
863 const typename Base::SurfaceMesh::Faces& faces,
864 const Parameters& params = parametersShapeGeometry() )
865 {
866 using Face = typename Base::SurfaceMesh::Face;
867
868 bool unit_u = params["unit_u"].as<int>();
869 double radius = params["r-radius"].as<double>();
870 double alpha = params["alpha"].as<double>();
871 double h = params["gridstep"].as<double>();
872 if ( alpha != 1.0 ) radius *= pow( h, alpha-1.0 );
873
874 CNCComputer computer(*mesh, unit_u);
875
876 const auto& mu0 = computer.computeMu0();
877 const auto& muxy = computer.computeMuXY();
878
879 if (mesh->faceNormals().size() == 0)
880 {
881 // Try to use vertex normals if any
882 if (mesh->vertexNormals().size() == 0)
883 mesh->computeFaceNormalsFromPositions();
884 else
885 mesh->computeFaceNormalsFromVertexNormals();
886 }
887
888 const auto& normals = mesh->faceNormals();
889
890 Scalars k1(faces.size()), k2(faces.size());
891 RealVectors d1(faces.size()), d2(faces.size());
892
893 for (size_t i = 0; i < faces.size(); ++i)
894 {
895 const auto center = mesh->faceCentroid(faces[i]);
896 const auto area = mu0 .measure(center, radius, faces[i]);
897 const auto lmuxy = muxy.measure(center, radius, faces[i]);
898 std::tie(k1[i], k2[i], d1[i], d2[i]) =
899 CNCComputer::principalCurvatures(area, lmuxy, normals[faces[i]]);
900 }
901
902 return std::make_tuple(k1, k2, d1, d2);
903 }
904
930 static std::tuple<Scalars, Scalars, RealVectors, RealVectors>
933 const Parameters & params = parametersShapeGeometry() )
934 {
935 std::vector<typename Base::SurfaceMesh::Face> allFaces(mesh->nbFaces());
936 std::iota(allFaces.begin(), allFaces.end(), 0);
937
938 return getCNCPrincipalCurvaturesAndDirections(mesh, allFaces, params);
939 }
940
960 template <typename T>
961 static std::tuple<Scalars, Scalars, RealVectors, RealVectors>
963 T & digitalObject,
964 const Parameters & params = parametersShapeGeometry() )
965 {
967 return getCNCPrincipalCurvaturesAndDirections(mesh, params);
968 }
970
971 // --------------------------- geometry estimation ------------------------------
974 public:
975
987 {
988 return Parameters
989 ( "verbose", 1 )
990 ( "t-ring", 3.0 )
991 ( "kernel", "hat" )
992 ( "R-radius", 10.0 )
993 ( "r-radius", 3.0 )
994 ( "alpha", 0.33 )
995 ( "surfelEmbedding", 0 )
996 ( "unit_u" , 0 );
997 }
998
1008 static RealVectors
1010 const SurfelRange& surfels )
1011 {
1012 std::vector< RealVector > result;
1013 for ( auto s : surfels )
1014 {
1015 Dimension k = K.sOrthDir( s );
1016 bool direct = K.sDirect( s, k );
1018 t[ k ] = direct ? -1.0 : 1.0;
1019 result.push_back( t );
1020 }
1021 return result;
1022 }
1023
1039 template <typename TAnyDigitalSurface>
1040 static RealVectors
1043 const SurfelRange& surfels,
1044 const Parameters& params = parametersGeometryEstimation() )
1045 {
1046 int verbose = params[ "verbose" ].as<int>();
1047 Scalar t = params[ "t-ring" ].as<double>();
1048 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
1049 typedef LpMetric<Space> Metric;
1052 < Surfel, CanonicSCellEmbedder<KSpace> > SurfelFunctor;
1054 < SurfaceContainer, Metric, SurfelFunctor, Functor> NormalEstimator;
1055 if ( verbose > 0 )
1056 trace.info() << "- CTrivial normal t-ring=" << t << " (discrete)" << std::endl;
1057 const Functor fct( 1.0, t );
1058 const KSpace & K = surface->container().space();
1059 Metric aMetric( 2.0 );
1060 CanonicSCellEmbedder<KSpace> canonic_embedder( K );
1061 std::vector< RealVector > n_estimations;
1062 SurfelFunctor surfelFct( canonic_embedder, 1.0 );
1063 NormalEstimator estimator;
1064 estimator.attach( *surface);
1065 estimator.setParams( aMetric, surfelFct, fct, t );
1066 estimator.init( 1.0, surfels.begin(), surfels.end());
1067 estimator.eval( surfels.begin(), surfels.end(),
1068 std::back_inserter( n_estimations ) );
1069 std::transform( n_estimations.cbegin(), n_estimations.cend(), n_estimations.begin(),
1070 [] ( RealVector v ) { return -v; } );
1071 return n_estimations;
1072 }
1073
1095 template <typename TAnyDigitalSurface>
1096 static RealVectors
1099 const SurfelRange& surfels,
1100 const Parameters& params = parametersGeometryEstimation() )
1101 {
1103 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
1104 RealVectors n_estimations;
1105 int verbose = params[ "verbose" ].as<int>();
1106 std::string kernel = params[ "kernel" ].as<std::string>();
1107 Scalar h = params[ "gridstep" ].as<Scalar>();
1108 Scalar R = params[ "R-radius" ].as<Scalar>();
1109 Scalar r = params[ "r-radius" ].as<Scalar>();
1110 Scalar t = params[ "t-ring" ].as<Scalar>();
1111 Scalar alpha = params[ "alpha" ].as<Scalar>();
1112 int embedding = params[ "embedding" ].as<int>();
1113 // Adjust parameters according to gridstep if specified.
1114 if ( alpha != 1.0 ) R *= pow( h, alpha-1.0 );
1115 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1116 Surfel2PointEmbedding embType = embedding == 0 ? Pointels :
1117 embedding == 1 ? InnerSpel : OuterSpel;
1118 if ( verbose > 0 )
1119 {
1120 trace.info() << "- VCM normal kernel=" << kernel << " emb=" << embedding
1121 << " alpha=" << alpha << std::endl;
1122 trace.info() << "- VCM normal r=" << (r*h) << " (continuous) "
1123 << r << " (discrete)" << std::endl;
1124 trace.info() << "- VCM normal R=" << (R*h) << " (continuous) "
1125 << R << " (discrete)" << std::endl;
1126 trace.info() << "- VCM normal t=" << t << " (discrete)" << std::endl;
1127 }
1128 if ( kernel == "hat" )
1129 {
1130 typedef functors::HatPointFunction<Point,Scalar> KernelFunction;
1132 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
1135 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
1136 KernelFunction chi_r( 1.0, r );
1137 VCMNormalEstimator estimator;
1138 estimator.attach( *surface );
1139 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
1140 estimator.init( h, surfels.begin(), surfels.end() );
1141 estimator.eval( surfels.begin(), surfels.end(),
1142 std::back_inserter( n_estimations ) );
1143 }
1144 else if ( kernel == "ball" )
1145 {
1148 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
1151 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
1152 KernelFunction chi_r( 1.0, r );
1153 VCMNormalEstimator estimator;
1154 estimator.attach( *surface );
1155 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
1156 estimator.init( h, surfels.begin(), surfels.end() );
1157 estimator.eval( surfels.begin(), surfels.end(),
1158 std::back_inserter( n_estimations ) );
1159 }
1160 else
1161 {
1162 trace.warning() << "[ShortcutsGeometry::getVCMNormalVectors] Unknown kernel: "
1163 << kernel << std::endl;
1164 }
1165 return n_estimations;
1166 }
1167
1190 static RealVectors
1192 const SurfelRange& surfels,
1193 const Parameters& params
1195 | parametersKSpace() )
1196 {
1197 auto K = getKSpace( bimage, params );
1198 return getIINormalVectors( *bimage, K, surfels, params );
1199 }
1200
1230 static RealVectors
1232 const SurfelRange& surfels,
1233 const Parameters& params
1237 {
1238 auto K = getKSpace( params );
1239 return getIINormalVectors( *dshape, K, surfels, params );
1240 }
1241
1266 template <typename TPointPredicate>
1267 static RealVectors
1268 getIINormalVectors( const TPointPredicate& shape,
1269 const KSpace& K,
1270 const SurfelRange& surfels,
1271 const Parameters& params
1273 | parametersKSpace() )
1274 {
1275 typedef functors::IINormalDirectionFunctor<Space> IINormalFunctor;
1277 <KSpace, TPointPredicate, IINormalFunctor> IINormalEstimator;
1278
1279 RealVectors n_estimations;
1280 int verbose = params[ "verbose" ].as<int>();
1281 Scalar h = params[ "gridstep" ].as<Scalar>();
1282 Scalar r = params[ "r-radius" ].as<Scalar>();
1283 Scalar alpha = params[ "alpha" ].as<Scalar>();
1284 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1285 if ( verbose > 0 )
1286 {
1287 trace.info() << "- II normal alpha=" << alpha << std::endl;
1288 trace.info() << "- II normal r=" << (r*h) << " (continuous) "
1289 << r << " (discrete)" << std::endl;
1290 }
1291 IINormalFunctor functor;
1292 functor.init( h, r*h );
1293 IINormalEstimator ii_estimator( functor );
1294 ii_estimator.attach( K, shape );
1295 ii_estimator.setParams( r );
1296 ii_estimator.init( h, surfels.begin(), surfels.end() );
1297 ii_estimator.eval( surfels.begin(), surfels.end(),
1298 std::back_inserter( n_estimations ) );
1299 const RealVectors n_trivial = getTrivialNormalVectors( K, surfels );
1300 orientVectors( n_estimations, n_trivial );
1301 return n_estimations;
1302 }
1303
1304
1323 static Scalars
1325 const SurfelRange& surfels,
1326 const Parameters& params
1328 | parametersKSpace() )
1329 {
1330 auto K = getKSpace( bimage, params );
1331 return getIIMeanCurvatures( *bimage, K, surfels, params );
1332 }
1333
1359 static Scalars
1361 const SurfelRange& surfels,
1362 const Parameters& params
1366 {
1367 auto K = getKSpace( params );
1368 return getIIMeanCurvatures( *dshape, K, surfels, params );
1369 }
1370
1371
1393 template <typename TPointPredicate>
1394 static Scalars
1395 getIIMeanCurvatures( const TPointPredicate& shape,
1396 const KSpace& K,
1397 const SurfelRange& surfels,
1398 const Parameters& params
1400 | parametersKSpace() )
1401 {
1402 typedef functors::IIMeanCurvature3DFunctor<Space> IIMeanCurvFunctor;
1404 <KSpace, TPointPredicate, IIMeanCurvFunctor> IIMeanCurvEstimator;
1405
1406 Scalars mc_estimations;
1407 int verbose = params[ "verbose" ].as<int>();
1408 Scalar h = params[ "gridstep" ].as<Scalar>();
1409 Scalar r = params[ "r-radius" ].as<Scalar>();
1410 Scalar alpha = params[ "alpha" ].as<Scalar>();
1411 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1412 if ( verbose > 0 )
1413 {
1414 trace.info() << "- II mean curvature alpha=" << alpha << std::endl;
1415 trace.info() << "- II mean curvature r=" << (r*h) << " (continuous) "
1416 << r << " (discrete)" << std::endl;
1417 }
1418 IIMeanCurvFunctor functor;
1419 functor.init( h, r*h );
1420 IIMeanCurvEstimator ii_estimator( functor );
1421 ii_estimator.attach( K, shape );
1422 ii_estimator.setParams( r );
1423 ii_estimator.init( h, surfels.begin(), surfels.end() );
1424 ii_estimator.eval( surfels.begin(), surfels.end(),
1425 std::back_inserter( mc_estimations ) );
1426 return mc_estimations;
1427 }
1428
1447 static Scalars
1449 const SurfelRange& surfels,
1450 const Parameters& params
1452 | parametersKSpace() )
1453 {
1454 auto K = getKSpace( bimage, params );
1455 return getIIGaussianCurvatures( *bimage, K, surfels, params );
1456 }
1457
1483 static Scalars
1485 const SurfelRange& surfels,
1486 const Parameters& params
1490 {
1491 auto K = getKSpace( params );
1492 return getIIGaussianCurvatures( *dshape, K, surfels, params );
1493 }
1494
1495
1517 template <typename TPointPredicate>
1518 static Scalars
1519 getIIGaussianCurvatures( const TPointPredicate& shape,
1520 const KSpace& K,
1521 const SurfelRange& surfels,
1522 const Parameters& params
1524 | parametersKSpace() )
1525 {
1526 typedef functors::IIGaussianCurvature3DFunctor<Space> IIGaussianCurvFunctor;
1528 <KSpace, TPointPredicate, IIGaussianCurvFunctor> IIGaussianCurvEstimator;
1529
1530 Scalars mc_estimations;
1531 int verbose = params[ "verbose" ].as<int>();
1532 Scalar h = params[ "gridstep" ].as<Scalar>();
1533 Scalar r = params[ "r-radius" ].as<Scalar>();
1534 Scalar alpha = params[ "alpha" ].as<Scalar>();
1535 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1536 if ( verbose > 0 )
1537 {
1538 trace.info() << "- II Gaussian curvature alpha=" << alpha << std::endl;
1539 trace.info() << "- II Gaussian curvature r=" << (r*h) << " (continuous) "
1540 << r << " (discrete)" << std::endl;
1541 }
1542 IIGaussianCurvFunctor functor;
1543 functor.init( h, r*h );
1544 IIGaussianCurvEstimator ii_estimator( functor );
1545 ii_estimator.attach( K, shape );
1546 ii_estimator.setParams( r );
1547 ii_estimator.init( h, surfels.begin(), surfels.end() );
1548 ii_estimator.eval( surfels.begin(), surfels.end(),
1549 std::back_inserter( mc_estimations ) );
1550 return mc_estimations;
1551 }
1552
1574 const SurfelRange& surfels,
1575 const Parameters& params
1577 | parametersKSpace() )
1578 {
1579 auto K = getKSpace( bimage, params );
1580 return getIIPrincipalCurvaturesAndDirections( *bimage, K, surfels, params );
1581 }
1582
1611 const SurfelRange& surfels,
1612 const Parameters& params
1616 {
1617 auto K = getKSpace( params );
1618 return getIIPrincipalCurvaturesAndDirections( *dshape, K, surfels, params );
1619 }
1620
1621
1643 template <typename TPointPredicate>
1645 getIIPrincipalCurvaturesAndDirections( const TPointPredicate& shape,
1646 const KSpace& K,
1647 const SurfelRange& surfels,
1648 const Parameters& params
1650 | parametersKSpace() )
1651 {
1654
1655 CurvatureTensorQuantities mc_estimations;
1656 int verbose = params[ "verbose" ].as<int>();
1657 Scalar h = params[ "gridstep" ].as<Scalar>();
1658 Scalar r = params[ "r-radius" ].as<Scalar>();
1659 Scalar alpha = params[ "alpha" ].as<Scalar>();
1660 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1661 if ( verbose > 0 )
1662 {
1663 trace.info() << "- II principal curvatures and directions alpha=" << alpha << std::endl;
1664 trace.info() << "- II principal curvatures and directions r=" << (r*h) << " (continuous) "
1665 << r << " (discrete)" << std::endl;
1666 }
1667 IICurvFunctor functor;
1668 functor.init( h, r*h );
1669 IICurvEstimator ii_estimator( functor );
1670 ii_estimator.attach( K, shape );
1671 ii_estimator.setParams( r );
1672 ii_estimator.init( h, surfels.begin(), surfels.end() );
1673 ii_estimator.eval( surfels.begin(), surfels.end(),
1674 std::back_inserter( mc_estimations ) );
1675 return mc_estimations;
1676 }
1677
1679
1680 // --------------------------- AT approximation ------------------------------
1683 public:
1684
1698 {
1699 return Parameters
1700 ( "at-enabled", 1 )
1701 ( "at-alpha", 0.1 )
1702 ( "at-lambda", 0.025 )
1703 ( "at-epsilon", 0.25 )
1704 ( "at-epsilon-start", 2.0 )
1705 ( "at-epsilon-ratio", 2.0 )
1706 ( "at-max-iter", 10 )
1707 ( "at-diff-v-max", 0.0001 )
1708 ( "at-v-policy", "Maximum" );
1709 }
1710
1733 template <typename TAnyDigitalSurface,
1734 typename VectorFieldInput>
1735 static
1736 VectorFieldInput
1738 const SurfelRange& surfels,
1739 const VectorFieldInput& input,
1740 const Parameters& params
1742 {
1743 (void)surface; //param not used. FIXME: JOL
1744
1745 int verbose = params[ "verbose" ].as<int>();
1746 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1747 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1748 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1749 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1750 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1751 int max_iter = params[ "at-max-iter" ].as<int>();
1752 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1754 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1755 ATSolver2D< KSpace > at_solver( calculus, verbose );
1756 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1757 at_solver.setUp( alpha_at, lambda_at );
1758 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1759 auto output = input;
1760 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1761 return output;
1762 }
1763
1794 template <typename TAnyDigitalSurface,
1795 typename VectorFieldInput,
1796 typename CellRangeConstIterator>
1797 static
1798 VectorFieldInput
1800 CellRangeConstIterator itB,
1801 CellRangeConstIterator itE,
1803 const SurfelRange& surfels,
1804 const VectorFieldInput& input,
1805 const Parameters& params
1807 {
1808 (void)surface; //param not used FIXME: JOL
1809
1810 int verbose = params[ "verbose" ].as<int>();
1811 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1812 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1813 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1814 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1815 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1816 int max_iter = params[ "at-max-iter" ].as<int>();
1817 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1818 std::string policy = params[ "at-v-policy" ].as<std::string>();
1820 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1821 ATSolver2D< KSpace > at_solver( calculus, verbose );
1822 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1823 at_solver.setUp( alpha_at, lambda_at );
1824 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1825 auto output = input;
1826 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1827 auto p = ( policy == "Average" ) ? at_solver.Average
1828 : ( policy == "Minimum" ) ? at_solver.Minimum
1829 : at_solver.Maximum;
1830 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1831 return output;
1832 }
1833
1857 template <typename TAnyDigitalSurface>
1858 static
1859 Scalars
1861 const SurfelRange& surfels,
1862 const Scalars& input,
1863 const Parameters& params
1865 {
1866 (void)surface; //param not used FIXME: JOL
1867
1868 int verbose = params[ "verbose" ].as<int>();
1869 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1870 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1871 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1872 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1873 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1874 int max_iter = params[ "at-max-iter" ].as<int>();
1875 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1877 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1878 ATSolver2D< KSpace > at_solver( calculus, verbose );
1879 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1880 at_solver.setUp( alpha_at, lambda_at );
1881 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1882 auto output = input;
1883 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1884 return output;
1885 }
1886
1921 template <typename TAnyDigitalSurface,
1922 typename CellRangeConstIterator>
1923 static
1924 Scalars
1926 CellRangeConstIterator itB,
1927 CellRangeConstIterator itE,
1929 const SurfelRange& surfels,
1930 const Scalars& input,
1931 const Parameters& params
1933 {
1934 (void)surface; //param not used FIXME: JOL
1935
1936 int verbose = params[ "verbose" ].as<int>();
1937 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1938 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1939 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1940 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1941 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1942 int max_iter = params[ "at-max-iter" ].as<int>();
1943 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1944 std::string policy = params[ "at-v-policy" ].as<std::string>();
1946 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1947 ATSolver2D< KSpace > at_solver( calculus, verbose );
1948 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1949 at_solver.setUp( alpha_at, lambda_at );
1950 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1951 auto output = input;
1952 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1953 auto p = ( policy == "Average" ) ? at_solver.Average
1954 : ( policy == "Minimum" ) ? at_solver.Minimum
1955 : at_solver.Maximum;
1956 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1957 return output;
1958 }
1959
1961
1962 // ------------------------- Error measures services -------------------------
1965 public:
1966
1972 static void
1974 const RealVectors& ref_v )
1975 {
1976 std::transform( ref_v.cbegin(), ref_v.cend(), v.cbegin(), v.begin(),
1977 [] ( RealVector rw, RealVector w )
1978 { return rw.dot( w ) >= 0.0 ? w : -w; } );
1979 }
1980
1985 static ScalarStatistic
1987 {
1988 ScalarStatistic stat;
1989 stat.addValues( v.begin(), v.end() );
1990 stat.terminate();
1991 return stat;
1992 }
1993
2000 static Scalars
2002 const RealVectors& v2 )
2003 {
2004 Scalars v( v1.size() );
2005 if ( v1.size() == v2.size() )
2006 {
2007 auto outIt = v.begin();
2008 for ( auto it1 = v1.cbegin(), it2 = v2.cbegin(), itE1 = v1.cend();
2009 it1 != itE1; ++it1, ++it2 )
2010 {
2011 Scalar angle_error = acos( (*it1).dot( *it2 ) );
2012 *outIt++ = angle_error;
2013 }
2014 }
2015 else
2016 {
2017 trace.warning() << "[ShortcutsGeometry::getVectorsAngleDeviation]"
2018 << " v1.size()=" << v1.size() << " should be equal to "
2019 << " v2.size()=" << v2.size() << std::endl;
2020 }
2021 return v;
2022 }
2023
2028 static Scalars
2030 const Scalars & v2 )
2031 {
2032 Scalars result( v1.size() );
2033 std::transform( v2.cbegin(), v2.cend(), v1.cbegin(), result.begin(),
2034 [] ( Scalar val1, Scalar val2 )
2035 { return fabs( val1 - val2 ); } );
2036 return result;
2037 }
2038
2045 static Scalar
2047 const Scalars & v2 )
2048 {
2049 Scalar sum = 0;
2050 for ( unsigned int i = 0; i < v1.size(); i++ )
2051 sum += ( v1[ i ] - v2[ i ] ) * ( v1[ i ] - v2[ i ] );
2052 return sqrt( sum / v1.size() );
2053 }
2054
2061 static Scalar
2063 const Scalars & v2 )
2064 {
2065 Scalar sum = 0;
2066 for ( unsigned int i = 0; i < v1.size(); i++ )
2067 sum += fabs( v1[ i ] - v2[ i ] );
2068 return sum / v1.size();
2069 }
2070
2077 static Scalar
2079 const Scalars & v2 )
2080 {
2081 Scalar loo = 0;
2082 for ( unsigned int i = 0; i < v1.size(); i++ )
2083 loo = std::max( loo, fabs( v1[ i ] - v2[ i ] ) );
2084 return loo;
2085 }
2087
2088 // ----------------------- VoronoiMap services ------------------------------
2089 public:
2092
2095 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2096 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2097 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2099 return Parameters
2100 // Toricity might be moved elsewhere as this is quite a general parameter
2101 ( "toroidal-x" , false )
2102 ( "toroidal-y" , false )
2103 ( "toroidal-z" , false );
2104 }
2105
2106
2107
2116 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2117 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2118 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2121 template<uint32_t p, typename PointRange>
2124 const PointRange& sites,
2125 const Parameters& params = parametersVoronoiMap())
2126 {
2129 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2130 VoronoiPointPredicate predicate(set);
2131 Metric metric;
2132
2133 typename Map::PeriodicitySpec specs = {false, false, false};
2134 if (params["toroidal-x"].as<int>()) specs[0] = true;
2135 if (params["toroidal-y"].as<int>()) specs[1] = true;
2136 if (params["toroidal-z"].as<int>()) specs[2] = true;
2137
2138
2139 // Do not return a pointer here for two reasons:
2140 // - The distance transform will not be passed anywhere else
2141 // - The operator() is less accessible with pointers.
2142 return Map(domain, predicate, metric, specs);
2143 }
2144
2153 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2154 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2155 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2158 template<uint32_t p, typename PointRange>
2161 const PointRange& sites,
2162 const Parameters& params = parametersVoronoiMap())
2163 {
2166 DigitalSet set(*domain); set.insert(sites.begin(), sites.end());
2167 VoronoiPointPredicate predicate(set);
2168 Metric metric;
2169
2170 typename Map::PeriodicitySpec specs = {false, false, false};
2171 if (params["toroidal-x"].as<int>()) specs[0] = true;
2172 if (params["toroidal-y"].as<int>()) specs[1] = true;
2173 if (params["toroidal-z"].as<int>()) specs[2] = true;
2174
2175 // Do not return a pointer here for two reasons:
2176 // - The distance transform will not be passed anywhere else
2177 // - The operator() is less accessible with pointers.
2178 return Map(*domain, predicate, metric, specs);
2179 }
2180
2192 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2193 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2194 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2197 template<uint32_t p, typename PointRange>
2200 const PointRange& sites,
2201 const Parameters& params = parametersVoronoiMap())
2202 {
2205 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2206 VoronoiPointPredicate predicate(set);
2207 Metric metric;
2208
2209 typename Map::PeriodicitySpec specs = {false, false, false};
2210 if (params["toroidal-x"].as<int>()) specs[0] = true;
2211 if (params["toroidal-y"].as<int>()) specs[1] = true;
2212 if (params["toroidal-z"].as<int>()) specs[2] = true;
2213
2214 // Do not return a pointer here for two reasons:
2215 // - The distance transform will not be passed anywhere else
2216 // - The operator() is less accessible with pointers.
2217 return Map(domain, predicate, metric, specs);
2218 }
2219
2231 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2232 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2233 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2236 template<uint32_t p, typename PointRange>
2239 const PointRange& sites,
2240 const Parameters& params = parametersVoronoiMap())
2241 {
2244 DigitalSet set(*domain); set.insert(sites.begin(), sites.end());
2245 VoronoiPointPredicate predicate(set);
2246 Metric metric;
2247
2248 typename Map::PeriodicitySpec specs = {false, false, false};
2249 if (params["toroidal-x"].as<int>()) specs[0] = true;
2250 if (params["toroidal-y"].as<int>()) specs[1] = true;
2251 if (params["toroidal-z"].as<int>()) specs[2] = true;
2252
2253 // Do not return a pointer here for two reasons:
2254 // - The distance transform will not be passed anywhere else
2255 // - The operator() is less accessible with pointers.
2256 return Map(*domain, predicate, metric, specs);
2257 }
2258
2268 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2269 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2270 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2273 template<uint32_t p, typename PointRangeSites, typename PointRange>
2274 static std::vector<Vector> getDirectionToClosestSite(
2275 const PointRange& points,
2276 const PointRangeSites& sites,
2277 const Parameters& params = parametersVoronoiMap())
2278 {
2281
2282 // Compute domain of points
2283 Point pmin = *points.begin();
2284 Point pmax = pmin;
2285
2286 size_t pCount = 0;
2287 for (auto it = points.begin(); it != points.end(); ++it)
2288 {
2289 pCount ++;
2290 for (size_t i = 0; i < Space::dimension; ++i)
2291 {
2292 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2293 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2294 }
2295 }
2296
2297 for (auto it = sites.begin(); it != sites.end(); ++it)
2298 {
2299 for (size_t i = 0; i < Space::dimension; ++i)
2300 {
2301 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2302 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2303 }
2304 }
2305
2306 Domain domain(pmin, pmax);
2307
2308 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2309 VoronoiPointPredicate predicate(set);
2310 Metric metric;
2311
2312
2313 typename Map::PeriodicitySpec specs = {false, false, false};
2314 if (params["toroidal-x"].as<int>()) specs[0] = true;
2315 if (params["toroidal-y"].as<int>()) specs[1] = true;
2316 if (params["toroidal-z"].as<int>()) specs[2] = true;
2317
2318 auto map = Map(domain, predicate, metric, specs);
2319
2320 std::vector<Vector> directions(pCount);
2321 size_t i = 0;
2322 for (auto it = points.begin(); it != points.end(); ++it)
2323 {
2324 directions[i++] = map(*it);
2325 }
2326 return directions;
2327 }
2328
2338 // - toroidal-x [false]: If the domain is toroidal in the first dimension
2339 // - toroidal-y [false]: If the domain is toroidal in the second dimension
2340 // - toroidal-z [false]: If the domain is toroidal in the third dimension
2343 template<uint32_t p, typename PointRangeSites, typename PointRange>
2344 static std::vector<typename ExactPredicateLpSeparableMetric<Space, p>::Value> getDistanceToClosestSite(
2345 const PointRange& points,
2346 const PointRangeSites& sites,
2347 const Parameters& params = parametersVoronoiMap())
2348 {
2351
2352 // Compute domain of points
2353 Point pmin = *points.begin();
2354 Point pmax = pmin;
2355
2356 size_t pCount = 0;
2357 for (auto it = points.begin(); it != points.end(); ++it)
2358 {
2359 pCount ++;
2360 for (size_t i = 0; i < Space::dimension; ++i)
2361 {
2362 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2363 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2364 }
2365 }
2366
2367 for (auto it = sites.begin(); it != sites.end(); ++it)
2368 {
2369 for (size_t i = 0; i < Space::dimension; ++i)
2370 {
2371 pmin[i] = std::min(pmin[i], (*it)[i] - 1);
2372 pmax[i] = std::max(pmax[i], (*it)[i] + 1);
2373 }
2374 }
2375
2376 Domain domain(pmin, pmax);
2377
2378 DigitalSet set(domain); set.insert(sites.begin(), sites.end());
2379 VoronoiPointPredicate predicate(set);
2380 Metric metric;
2381
2382 typename Map::PeriodicitySpec specs = {false, false, false};
2383 if (params["toroidal-x"].as<int>()) specs[0] = true;
2384 if (params["toroidal-y"].as<int>()) specs[1] = true;
2385 if (params["toroidal-z"].as<int>()) specs[2] = true;
2386
2387 auto map = Map(domain, predicate, metric, specs);
2388
2389 std::vector<typename Metric::Value> directions(pCount);
2390 size_t i = 0;
2391 for (auto it = points.begin(); it != points.end(); ++it)
2392 {
2393 directions[i++] = map(*it);
2394 }
2395 return directions;
2396 }
2397
2398
2400
2401 // ----------------------- Standard services ------------------------------
2404 public:
2405
2410
2415
2420 ShortcutsGeometry ( const ShortcutsGeometry & other ) = delete;
2421
2427
2434
2441
2443
2444 // ----------------------- Interface --------------------------------------
2445 public:
2446
2447 // ------------------------- Protected Datas ------------------------------
2448 protected:
2449
2450 // ------------------------- Private Datas --------------------------------
2451 private:
2452
2453 // ------------------------- Hidden services ------------------------------
2454 protected:
2455
2456 // ------------------------- Internals ------------------------------------
2457 private:
2458
2459 }; // end of class ShortcutsGeometry
2460
2461
2462} // namespace DGtal
2463
2464
2466// Includes inline functions.
2467
2468// //
2470
2471#endif // !defined ShortcutsGeometry_h
2472
2473#undef ShortcutsGeometry_RECURSES
2474#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
LightDigitalSurface::Face Face
Definition Shortcuts.h:163
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