DGtal 1.3.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/geometry/volumes/distance/LpMetric.h"
44#include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
45#include "DGtal/geometry/surfaces/estimation/TrueDigitalSurfaceLocalEstimator.h"
46#include "DGtal/geometry/surfaces/estimation/VoronoiCovarianceMeasureOnDigitalSurface.h"
47#include "DGtal/geometry/surfaces/estimation/VCMDigitalSurfaceLocalEstimator.h"
48#include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
49#include "DGtal/geometry/surfaces/estimation/IntegralInvariantVolumeEstimator.h"
50#include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.h"
51
52#if defined(WITH_EIGEN)
53#include "DGtal/dec/DiscreteExteriorCalculusFactory.h"
54#include "DGtal/dec/ATSolver2D.h"
55#endif // defined(WITH_EIGEN)
57
58namespace DGtal
59{
60
61 namespace sgf = ::DGtal::functors::ShapeGeometricFunctors;
62
64 // template class ShortcutsGeometry
75 template < typename TKSpace >
76 class ShortcutsGeometry : public Shortcuts< TKSpace >
77 {
79 public:
83 using Base::getKSpace;
85
86 // ----------------------- Usual space types --------------------------------------
87 public:
88
90 typedef TKSpace KSpace;
92 typedef typename KSpace::Space Space;
94 typedef typename Space::Integer Integer;
96 typedef typename Space::Point Point;
98 typedef typename Space::Vector Vector;
102 typedef typename Space::RealPoint RealPoint;
108 typedef unsigned char GrayScale;
109
110 // ----------------------- Shortcut types --------------------------------------
111 public:
128 typedef typename KSpace::SurfelSet SurfelSet;
133 typedef ::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface;
137 typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface;
151 typedef std::set< IdxSurfel > IdxSurfelSet;
152 typedef std::vector< Surfel > SurfelRange;
153 typedef std::vector< Cell > CellRange;
154 typedef std::vector< IdxSurfel > IdxSurfelRange;
155 typedef std::vector< Scalar > Scalars;
156 typedef std::vector< RealVector > RealVectors;
157 typedef std::vector< RealPoint > RealPoints;
158
159 typedef ::DGtal::Statistic<Scalar> ScalarStatistic;
160
170
172 typedef std::vector< CurvatureTensorQuantity > CurvatureTensorQuantities;
173
174
193
194 typedef ::DGtal::Mesh<RealPoint> Mesh;
195 typedef ::DGtal::TriangulatedSurface<RealPoint> TriangulatedSurface;
196 typedef ::DGtal::PolygonalSurface<RealPoint> PolygonalSurface;
197 typedef std::map<Surfel, IdxSurfel> Surfel2Index;
198 typedef std::map<Cell, IdxVertex> Cell2Index;
199
200 // ----------------------- Static services --------------------------------------
201 public:
202
203 // ----------------------- Exact geometry services ------------------------------
206 public:
207
210 {
214 }
215
223 {
224 return Parameters
225 ( "projectionMaxIter", 20 )
226 ( "projectionAccuracy", 0.0001 )
227 ( "projectionGamma", 0.5 )
228 ( "gridstep", 1.0 );
229 }
230
249 static RealPoints
252 const KSpace& K,
253 const SurfelRange& surfels,
254 const Parameters& params = parametersShapeGeometry() )
255 {
256 RealVectors n_true_estimations;
257 TruePositionEstimator true_estimator;
258 int maxIter = params[ "projectionMaxIter" ].as<int>();
259 double accuracy = params[ "projectionAccuracy" ].as<double>();
260 double gamma = params[ "projectionGamma" ].as<double>();
261 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
262 true_estimator.attach( *shape );
263 true_estimator.setParams( K, PositionFunctor(), maxIter, accuracy, gamma );
264 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
265 true_estimator.eval( surfels.begin(), surfels.end(),
266 std::back_inserter( n_true_estimations ) );
267 return n_true_estimations;
268 }
269
283 static RealPoints
286 const RealPoints& points,
287 const Parameters& params = parametersShapeGeometry() )
288 {
289 RealPoints proj_points( points.size() );
290 int maxIter = params[ "projectionMaxIter" ].as<int>();
291 double accuracy = params[ "projectionAccuracy" ].as<double>();
292 double gamma = params[ "projectionGamma" ].as<double>();
293 for ( unsigned int i = 0; i < points.size(); ++i )
294 proj_points[ i ] = shape->nearestPoint( points[ i ], accuracy,
295 maxIter, gamma );
296 return proj_points;
297 }
298
317 static RealVectors
320 const KSpace& K,
321 const SurfelRange& surfels,
322 const Parameters& params = parametersShapeGeometry() )
323 {
324 RealVectors n_true_estimations;
325 TrueNormalEstimator true_estimator;
326 int maxIter = params[ "projectionMaxIter" ].as<int>();
327 double accuracy = params[ "projectionAccuracy" ].as<double>();
328 double gamma = params[ "projectionGamma" ].as<double>();
329 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
330 true_estimator.attach( *shape );
331 true_estimator.setParams( K, NormalFunctor(), maxIter, accuracy, gamma );
332 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
333 true_estimator.eval( surfels.begin(), surfels.end(),
334 std::back_inserter( n_true_estimations ) );
335 return n_true_estimations;
336 }
337
356 static Scalars
359 const KSpace& K,
360 const SurfelRange& surfels,
361 const Parameters& params = parametersShapeGeometry() )
362 {
363 Scalars n_true_estimations;
364 TrueMeanCurvatureEstimator true_estimator;
365 int maxIter = params[ "projectionMaxIter" ].as<int>();
366 double accuracy = params[ "projectionAccuracy" ].as<double>();
367 double gamma = params[ "projectionGamma" ].as<double>();
368 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
369 true_estimator.attach( *shape );
370 true_estimator.setParams( K, MeanCurvatureFunctor(), maxIter, accuracy, gamma );
371 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
372 true_estimator.eval( surfels.begin(), surfels.end(),
373 std::back_inserter( n_true_estimations ) );
374 return n_true_estimations;
375 }
376
396 static Scalars
399 const KSpace& K,
400 const SurfelRange& surfels,
401 const Parameters& params = parametersShapeGeometry() )
402 {
403 Scalars n_true_estimations;
404 TrueGaussianCurvatureEstimator true_estimator;
405 int maxIter = params[ "projectionMaxIter" ].as<int>();
406 double accuracy = params[ "projectionAccuracy" ].as<double>();
407 double gamma = params[ "projectionGamma" ].as<double>();
408 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
409 true_estimator.attach( *shape );
410 true_estimator.setParams( K, GaussianCurvatureFunctor(), maxIter, accuracy, gamma );
411 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
412 true_estimator.eval( surfels.begin(), surfels.end(),
413 std::back_inserter( n_true_estimations ) );
414 return n_true_estimations;
415 }
416
437 static Scalars
440 const KSpace& K,
441 const SurfelRange& surfels,
442 const Parameters& params = parametersShapeGeometry() )
443 {
444 Scalars n_true_estimations;
446 int maxIter = params[ "projectionMaxIter" ].as<int>();
447 double accuracy = params[ "projectionAccuracy" ].as<double>();
448 double gamma = params[ "projectionGamma" ].as<double>();
449 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
450 true_estimator.attach( *shape );
451 true_estimator.setParams( K, FirstPrincipalCurvatureFunctor(),
452 maxIter, accuracy, gamma );
453 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
454 true_estimator.eval( surfels.begin(), surfels.end(),
455 std::back_inserter( n_true_estimations ) );
456 return n_true_estimations;
457 }
458
479 static Scalars
482 const KSpace& K,
483 const SurfelRange& surfels,
484 const Parameters& params = parametersShapeGeometry() )
485 {
486 Scalars n_true_estimations;
488 int maxIter = params[ "projectionMaxIter" ].as<int>();
489 double accuracy = params[ "projectionAccuracy" ].as<double>();
490 double gamma = params[ "projectionGamma" ].as<double>();
491 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
492 true_estimator.attach( *shape );
494 maxIter, accuracy, gamma );
495 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
496 true_estimator.eval( surfels.begin(), surfels.end(),
497 std::back_inserter( n_true_estimations ) );
498 return n_true_estimations;
499 }
500
521 static RealVectors
524 const KSpace& K,
525 const SurfelRange& surfels,
526 const Parameters& params = parametersShapeGeometry() )
527 {
528 RealVectors n_true_estimations;
530 int maxIter = params[ "projectionMaxIter" ].as<int>();
531 double accuracy = params[ "projectionAccuracy" ].as<double>();
532 double gamma = params[ "projectionGamma" ].as<double>();
533 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
534 true_estimator.attach( *shape );
535 true_estimator.setParams( K, FirstPrincipalDirectionFunctor(),
536 maxIter, accuracy, gamma );
537 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
538 true_estimator.eval( surfels.begin(), surfels.end(),
539 std::back_inserter( n_true_estimations ) );
540 return n_true_estimations;
541 }
542
563 static RealVectors
566 const KSpace& K,
567 const SurfelRange& surfels,
568 const Parameters& params = parametersShapeGeometry() )
569 {
570 RealVectors n_true_estimations;
572 int maxIter = params[ "projectionMaxIter" ].as<int>();
573 double accuracy = params[ "projectionAccuracy" ].as<double>();
574 double gamma = params[ "projectionGamma" ].as<double>();
575 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
576 true_estimator.attach( *shape );
578 maxIter, accuracy, gamma );
579 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
580 true_estimator.eval( surfels.begin(), surfels.end(),
581 std::back_inserter( n_true_estimations ) );
582 return n_true_estimations;
583 }
584
609 const KSpace& K,
610 const SurfelRange& surfels,
611 const Parameters& params = parametersShapeGeometry() )
612 {
613 CurvatureTensorQuantities n_true_estimations;
615 int maxIter = params[ "projectionMaxIter" ].as<int>();
616 double accuracy = params[ "projectionAccuracy" ].as<double>();
617 double gamma = params[ "projectionGamma" ].as<double>();
618 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
619 true_estimator.attach( *shape );
621 maxIter, accuracy, gamma );
622 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
623 true_estimator.eval( surfels.begin(), surfels.end(),
624 std::back_inserter( n_true_estimations ) );
625 return n_true_estimations;
626 }
627
629
630 // --------------------------- geometry estimation ------------------------------
633 public:
634
645 {
646 return Parameters
647 ( "verbose", 1 )
648 ( "t-ring", 3.0 )
649 ( "kernel", "hat" )
650 ( "R-radius", 10.0 )
651 ( "r-radius", 3.0 )
652 ( "alpha", 0.33 )
653 ( "surfelEmbedding", 0 );
654 }
655
665 static RealVectors
667 const SurfelRange& surfels )
668 {
669 std::vector< RealVector > result;
670 for ( auto s : surfels )
671 {
672 Dimension k = K.sOrthDir( s );
673 bool direct = K.sDirect( s, k );
675 t[ k ] = direct ? -1.0 : 1.0;
676 result.push_back( t );
677 }
678 return result;
679 }
680
696 template <typename TAnyDigitalSurface>
697 static RealVectors
700 const SurfelRange& surfels,
701 const Parameters& params = parametersGeometryEstimation() )
702 {
703 int verbose = params[ "verbose" ].as<int>();
704 Scalar t = params[ "t-ring" ].as<double>();
705 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
706 typedef LpMetric<Space> Metric;
709 < Surfel, CanonicSCellEmbedder<KSpace> > SurfelFunctor;
711 < SurfaceContainer, Metric, SurfelFunctor, Functor> NormalEstimator;
712 if ( verbose > 0 )
713 trace.info() << "- CTrivial normal t-ring=" << t << " (discrete)" << std::endl;
714 const Functor fct( 1.0, t );
715 const KSpace & K = surface->container().space();
716 Metric aMetric( 2.0 );
717 CanonicSCellEmbedder<KSpace> canonic_embedder( K );
718 std::vector< RealVector > n_estimations;
719 SurfelFunctor surfelFct( canonic_embedder, 1.0 );
720 NormalEstimator estimator;
721 estimator.attach( *surface);
722 estimator.setParams( aMetric, surfelFct, fct, t );
723 estimator.init( 1.0, surfels.begin(), surfels.end());
724 estimator.eval( surfels.begin(), surfels.end(),
725 std::back_inserter( n_estimations ) );
726 std::transform( n_estimations.cbegin(), n_estimations.cend(), n_estimations.begin(),
727 [] ( RealVector v ) { return -v; } );
728 return n_estimations;
729 }
730
752 template <typename TAnyDigitalSurface>
753 static RealVectors
756 const SurfelRange& surfels,
757 const Parameters& params = parametersGeometryEstimation() )
758 {
760 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
761 RealVectors n_estimations;
762 int verbose = params[ "verbose" ].as<int>();
763 std::string kernel = params[ "kernel" ].as<std::string>();
764 Scalar h = params[ "gridstep" ].as<Scalar>();
765 Scalar R = params[ "R-radius" ].as<Scalar>();
766 Scalar r = params[ "r-radius" ].as<Scalar>();
767 Scalar t = params[ "t-ring" ].as<Scalar>();
768 Scalar alpha = params[ "alpha" ].as<Scalar>();
769 int embedding = params[ "embedding" ].as<int>();
770 // Adjust parameters according to gridstep if specified.
771 if ( alpha != 1.0 ) R *= pow( h, alpha-1.0 );
772 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
773 Surfel2PointEmbedding embType = embedding == 0 ? Pointels :
774 embedding == 1 ? InnerSpel : OuterSpel;
775 if ( verbose > 0 )
776 {
777 trace.info() << "- VCM normal kernel=" << kernel << " emb=" << embedding
778 << " alpha=" << alpha << std::endl;
779 trace.info() << "- VCM normal r=" << (r*h) << " (continuous) "
780 << r << " (discrete)" << std::endl;
781 trace.info() << "- VCM normal R=" << (R*h) << " (continuous) "
782 << R << " (discrete)" << std::endl;
783 trace.info() << "- VCM normal t=" << t << " (discrete)" << std::endl;
784 }
785 if ( kernel == "hat" )
786 {
787 typedef functors::HatPointFunction<Point,Scalar> KernelFunction;
789 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
792 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
793 KernelFunction chi_r( 1.0, r );
794 VCMNormalEstimator estimator;
795 estimator.attach( *surface );
796 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
797 estimator.init( h, surfels.begin(), surfels.end() );
798 estimator.eval( surfels.begin(), surfels.end(),
799 std::back_inserter( n_estimations ) );
800 }
801 else if ( kernel == "ball" )
802 {
805 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
808 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
809 KernelFunction chi_r( 1.0, r );
810 VCMNormalEstimator estimator;
811 estimator.attach( *surface );
812 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
813 estimator.init( h, surfels.begin(), surfels.end() );
814 estimator.eval( surfels.begin(), surfels.end(),
815 std::back_inserter( n_estimations ) );
816 }
817 else
818 {
819 trace.warning() << "[ShortcutsGeometry::getVCMNormalVectors] Unknown kernel: "
820 << kernel << std::endl;
821 }
822 return n_estimations;
823 }
824
847 static RealVectors
849 const SurfelRange& surfels,
850 const Parameters& params
852 | parametersKSpace() )
853 {
854 auto K = getKSpace( bimage, params );
855 return getIINormalVectors( *bimage, K, surfels, params );
856 }
857
887 static RealVectors
889 const SurfelRange& surfels,
890 const Parameters& params
894 {
895 auto K = getKSpace( params );
896 return getIINormalVectors( *dshape, K, surfels, params );
897 }
898
923 template <typename TPointPredicate>
924 static RealVectors
925 getIINormalVectors( const TPointPredicate& shape,
926 const KSpace& K,
927 const SurfelRange& surfels,
928 const Parameters& params
930 | parametersKSpace() )
931 {
932 typedef functors::IINormalDirectionFunctor<Space> IINormalFunctor;
934 <KSpace, TPointPredicate, IINormalFunctor> IINormalEstimator;
935
936 RealVectors n_estimations;
937 int verbose = params[ "verbose" ].as<int>();
938 Scalar h = params[ "gridstep" ].as<Scalar>();
939 Scalar r = params[ "r-radius" ].as<Scalar>();
940 Scalar alpha = params[ "alpha" ].as<Scalar>();
941 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
942 if ( verbose > 0 )
943 {
944 trace.info() << "- II normal alpha=" << alpha << std::endl;
945 trace.info() << "- II normal r=" << (r*h) << " (continuous) "
946 << r << " (discrete)" << std::endl;
947 }
948 IINormalFunctor functor;
949 functor.init( h, r*h );
950 IINormalEstimator ii_estimator( functor );
951 ii_estimator.attach( K, shape );
952 ii_estimator.setParams( r );
953 ii_estimator.init( h, surfels.begin(), surfels.end() );
954 ii_estimator.eval( surfels.begin(), surfels.end(),
955 std::back_inserter( n_estimations ) );
956 const RealVectors n_trivial = getTrivialNormalVectors( K, surfels );
957 orientVectors( n_estimations, n_trivial );
958 return n_estimations;
959 }
960
961
980 static Scalars
982 const SurfelRange& surfels,
983 const Parameters& params
985 | parametersKSpace() )
986 {
987 auto K = getKSpace( bimage, params );
988 return getIIMeanCurvatures( *bimage, K, surfels, params );
989 }
990
1016 static Scalars
1018 const SurfelRange& surfels,
1019 const Parameters& params
1023 {
1024 auto K = getKSpace( params );
1025 return getIIMeanCurvatures( *dshape, K, surfels, params );
1026 }
1027
1028
1050 template <typename TPointPredicate>
1051 static Scalars
1052 getIIMeanCurvatures( const TPointPredicate& shape,
1053 const KSpace& K,
1054 const SurfelRange& surfels,
1055 const Parameters& params
1057 | parametersKSpace() )
1058 {
1059 typedef functors::IIMeanCurvature3DFunctor<Space> IIMeanCurvFunctor;
1061 <KSpace, TPointPredicate, IIMeanCurvFunctor> IIMeanCurvEstimator;
1062
1063 Scalars mc_estimations;
1064 int verbose = params[ "verbose" ].as<int>();
1065 Scalar h = params[ "gridstep" ].as<Scalar>();
1066 Scalar r = params[ "r-radius" ].as<Scalar>();
1067 Scalar alpha = params[ "alpha" ].as<Scalar>();
1068 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1069 if ( verbose > 0 )
1070 {
1071 trace.info() << "- II mean curvature alpha=" << alpha << std::endl;
1072 trace.info() << "- II mean curvature r=" << (r*h) << " (continuous) "
1073 << r << " (discrete)" << std::endl;
1074 }
1075 IIMeanCurvFunctor functor;
1076 functor.init( h, r*h );
1077 IIMeanCurvEstimator ii_estimator( functor );
1078 ii_estimator.attach( K, shape );
1079 ii_estimator.setParams( r );
1080 ii_estimator.init( h, surfels.begin(), surfels.end() );
1081 ii_estimator.eval( surfels.begin(), surfels.end(),
1082 std::back_inserter( mc_estimations ) );
1083 return mc_estimations;
1084 }
1085
1104 static Scalars
1106 const SurfelRange& surfels,
1107 const Parameters& params
1109 | parametersKSpace() )
1110 {
1111 auto K = getKSpace( bimage, params );
1112 return getIIGaussianCurvatures( *bimage, K, surfels, params );
1113 }
1114
1140 static Scalars
1142 const SurfelRange& surfels,
1143 const Parameters& params
1147 {
1148 auto K = getKSpace( params );
1149 return getIIGaussianCurvatures( *dshape, K, surfels, params );
1150 }
1151
1152
1174 template <typename TPointPredicate>
1175 static Scalars
1176 getIIGaussianCurvatures( const TPointPredicate& shape,
1177 const KSpace& K,
1178 const SurfelRange& surfels,
1179 const Parameters& params
1181 | parametersKSpace() )
1182 {
1183 typedef functors::IIGaussianCurvature3DFunctor<Space> IIGaussianCurvFunctor;
1185 <KSpace, TPointPredicate, IIGaussianCurvFunctor> IIGaussianCurvEstimator;
1186
1187 Scalars mc_estimations;
1188 int verbose = params[ "verbose" ].as<int>();
1189 Scalar h = params[ "gridstep" ].as<Scalar>();
1190 Scalar r = params[ "r-radius" ].as<Scalar>();
1191 Scalar alpha = params[ "alpha" ].as<Scalar>();
1192 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1193 if ( verbose > 0 )
1194 {
1195 trace.info() << "- II Gaussian curvature alpha=" << alpha << std::endl;
1196 trace.info() << "- II Gaussian curvature r=" << (r*h) << " (continuous) "
1197 << r << " (discrete)" << std::endl;
1198 }
1199 IIGaussianCurvFunctor functor;
1200 functor.init( h, r*h );
1201 IIGaussianCurvEstimator ii_estimator( functor );
1202 ii_estimator.attach( K, shape );
1203 ii_estimator.setParams( r );
1204 ii_estimator.init( h, surfels.begin(), surfels.end() );
1205 ii_estimator.eval( surfels.begin(), surfels.end(),
1206 std::back_inserter( mc_estimations ) );
1207 return mc_estimations;
1208 }
1209
1231 const SurfelRange& surfels,
1232 const Parameters& params
1234 | parametersKSpace() )
1235 {
1236 auto K = getKSpace( bimage, params );
1237 return getIIPrincipalCurvaturesAndDirections( *bimage, K, surfels, params );
1238 }
1239
1268 const SurfelRange& surfels,
1269 const Parameters& params
1273 {
1274 auto K = getKSpace( params );
1275 return getIIPrincipalCurvaturesAndDirections( *dshape, K, surfels, params );
1276 }
1277
1278
1300 template <typename TPointPredicate>
1302 getIIPrincipalCurvaturesAndDirections( const TPointPredicate& shape,
1303 const KSpace& K,
1304 const SurfelRange& surfels,
1305 const Parameters& params
1307 | parametersKSpace() )
1308 {
1311
1312 CurvatureTensorQuantities mc_estimations;
1313 int verbose = params[ "verbose" ].as<int>();
1314 Scalar h = params[ "gridstep" ].as<Scalar>();
1315 Scalar r = params[ "r-radius" ].as<Scalar>();
1316 Scalar alpha = params[ "alpha" ].as<Scalar>();
1317 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1318 if ( verbose > 0 )
1319 {
1320 trace.info() << "- II principal curvatures and directions alpha=" << alpha << std::endl;
1321 trace.info() << "- II principal curvatures and directions r=" << (r*h) << " (continuous) "
1322 << r << " (discrete)" << std::endl;
1323 }
1324 IICurvFunctor functor;
1325 functor.init( h, r*h );
1326 IICurvEstimator ii_estimator( functor );
1327 ii_estimator.attach( K, shape );
1328 ii_estimator.setParams( r );
1329 ii_estimator.init( h, surfels.begin(), surfels.end() );
1330 ii_estimator.eval( surfels.begin(), surfels.end(),
1331 std::back_inserter( mc_estimations ) );
1332 return mc_estimations;
1333 }
1334
1336
1337 // --------------------------- AT approximation ------------------------------
1340 public:
1341
1356 {
1357#if defined(WITH_EIGEN)
1358 return Parameters
1359 ( "at-enabled", 1 )
1360 ( "at-alpha", 0.1 )
1361 ( "at-lambda", 0.025 )
1362 ( "at-epsilon", 0.25 )
1363 ( "at-epsilon-start", 2.0 )
1364 ( "at-epsilon-ratio", 2.0 )
1365 ( "at-max-iter", 10 )
1366 ( "at-diff-v-max", 0.0001 )
1367 ( "at-v-policy", "Maximum" );
1368#else // defined(WITH_EIGEN)
1369 return Parameters( "at-enabled", 0 );
1370#endif// defined(WITH_EIGEN)
1371 }
1372
1373#if defined(WITH_EIGEN)
1374
1398 template <typename TAnyDigitalSurface,
1399 typename VectorFieldInput>
1400 static
1401 VectorFieldInput
1403 const SurfelRange& surfels,
1404 const VectorFieldInput& input,
1405 const Parameters& params
1407 {
1408 int verbose = params[ "verbose" ].as<int>();
1409 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1410 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1411 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1412 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1413 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1414 int max_iter = params[ "at-max-iter" ].as<int>();
1415 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1417 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1418 ATSolver2D< KSpace > at_solver( calculus, verbose );
1419 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1420 at_solver.setUp( alpha_at, lambda_at );
1421 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1422 auto output = input;
1423 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1424 return output;
1425 }
1426
1458 template <typename TAnyDigitalSurface,
1459 typename VectorFieldInput,
1460 typename CellRangeConstIterator>
1461 static
1462 VectorFieldInput
1464 CellRangeConstIterator itB,
1465 CellRangeConstIterator itE,
1467 const SurfelRange& surfels,
1468 const VectorFieldInput& input,
1469 const Parameters& params
1471 {
1472 int verbose = params[ "verbose" ].as<int>();
1473 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1474 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1475 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1476 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1477 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1478 int max_iter = params[ "at-max-iter" ].as<int>();
1479 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1480 std::string policy = params[ "at-v-policy" ].as<std::string>();
1482 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1483 ATSolver2D< KSpace > at_solver( calculus, verbose );
1484 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1485 at_solver.setUp( alpha_at, lambda_at );
1486 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1487 auto output = input;
1488 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1489 auto p = ( policy == "Average" ) ? at_solver.Average
1490 : ( policy == "Minimum" ) ? at_solver.Minimum
1491 : at_solver.Maximum;
1492 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1493 return output;
1494 }
1495
1520 template <typename TAnyDigitalSurface>
1521 static
1522 Scalars
1524 const SurfelRange& surfels,
1525 const Scalars& input,
1526 const Parameters& params
1528 {
1529 int verbose = params[ "verbose" ].as<int>();
1530 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1531 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1532 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1533 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1534 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1535 int max_iter = params[ "at-max-iter" ].as<int>();
1536 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1538 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1539 ATSolver2D< KSpace > at_solver( calculus, verbose );
1540 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1541 at_solver.setUp( alpha_at, lambda_at );
1542 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1543 auto output = input;
1544 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1545 return output;
1546 }
1547
1583 template <typename TAnyDigitalSurface,
1584 typename CellRangeConstIterator>
1585 static
1586 Scalars
1588 CellRangeConstIterator itB,
1589 CellRangeConstIterator itE,
1591 const SurfelRange& surfels,
1592 const Scalars& input,
1593 const Parameters& params
1595 {
1596 int verbose = params[ "verbose" ].as<int>();
1597 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1598 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1599 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1600 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1601 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1602 int max_iter = params[ "at-max-iter" ].as<int>();
1603 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1604 std::string policy = params[ "at-v-policy" ].as<std::string>();
1606 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1607 ATSolver2D< KSpace > at_solver( calculus, verbose );
1608 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1609 at_solver.setUp( alpha_at, lambda_at );
1610 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1611 auto output = input;
1612 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1613 auto p = ( policy == "Average" ) ? at_solver.Average
1614 : ( policy == "Minimum" ) ? at_solver.Minimum
1615 : at_solver.Maximum;
1616 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1617 return output;
1618 }
1619
1620#endif // defined(WITH_EIGEN)
1621
1623
1624 // ------------------------- Error measures services -------------------------
1627 public:
1628
1634 static void
1636 const RealVectors& ref_v )
1637 {
1638 std::transform( ref_v.cbegin(), ref_v.cend(), v.cbegin(), v.begin(),
1639 [] ( RealVector rw, RealVector w )
1640 { return rw.dot( w ) >= 0.0 ? w : -w; } );
1641 }
1642
1647 static ScalarStatistic
1649 {
1650 ScalarStatistic stat;
1651 stat.addValues( v.begin(), v.end() );
1652 stat.terminate();
1653 return stat;
1654 }
1655
1662 static Scalars
1664 const RealVectors& v2 )
1665 {
1666 Scalars v( v1.size() );
1667 if ( v1.size() == v2.size() )
1668 {
1669 auto outIt = v.begin();
1670 for ( auto it1 = v1.cbegin(), it2 = v2.cbegin(), itE1 = v1.cend();
1671 it1 != itE1; ++it1, ++it2 )
1672 {
1673 Scalar angle_error = acos( (*it1).dot( *it2 ) );
1674 *outIt++ = angle_error;
1675 }
1676 }
1677 else
1678 {
1679 trace.warning() << "[ShortcutsGeometry::getVectorsAngleDeviation]"
1680 << " v1.size()=" << v1.size() << " should be equal to "
1681 << " v2.size()=" << v2.size() << std::endl;
1682 }
1683 return v;
1684 }
1685
1690 static Scalars
1692 const Scalars & v2 )
1693 {
1694 Scalars result( v1.size() );
1695 std::transform( v2.cbegin(), v2.cend(), v1.cbegin(), result.begin(),
1696 [] ( Scalar val1, Scalar val2 )
1697 { return fabs( val1 - val2 ); } );
1698 return result;
1699 }
1700
1707 static Scalar
1709 const Scalars & v2 )
1710 {
1711 Scalar sum = 0;
1712 for ( unsigned int i = 0; i < v1.size(); i++ )
1713 sum += ( v1[ i ] - v2[ i ] ) * ( v1[ i ] - v2[ i ] );
1714 return sqrt( sum / v1.size() );
1715 }
1716
1723 static Scalar
1725 const Scalars & v2 )
1726 {
1727 Scalar sum = 0;
1728 for ( unsigned int i = 0; i < v1.size(); i++ )
1729 sum += fabs( v1[ i ] - v2[ i ] );
1730 return sum / v1.size();
1731 }
1732
1739 static Scalar
1741 const Scalars & v2 )
1742 {
1743 Scalar loo = 0;
1744 for ( unsigned int i = 0; i < v1.size(); i++ )
1745 loo = std::max( loo, fabs( v1[ i ] - v2[ i ] ) );
1746 return loo;
1747 }
1748
1750
1751 // ----------------------- Standard services ------------------------------
1754 public:
1755
1760
1765
1770 ShortcutsGeometry ( const ShortcutsGeometry & other ) = delete;
1771
1777
1784
1791
1793
1794 // ----------------------- Interface --------------------------------------
1795 public:
1796
1797 // ------------------------- Protected Datas ------------------------------
1798 protected:
1799
1800 // ------------------------- Private Datas --------------------------------
1801 private:
1802
1803 // ------------------------- Hidden services ------------------------------
1804 protected:
1805
1806 // ------------------------- Internals ------------------------------------
1807 private:
1808
1809 }; // end of class ShortcutsGeometry
1810
1811
1812} // namespace DGtal
1813
1814
1816// Includes inline functions.
1817
1818// //
1820
1821#endif // !defined ShortcutsGeometry_h
1822
1823#undef ShortcutsGeometry_RECURSES
1824#endif // else defined(ShortcutsGeometry_RECURSES)
1825
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:797
void getOutputScalarFieldV0(ScalarFieldOutput &output, CellRangeConstIterator itB, CellRangeConstIterator itE, CellOutputPolicy policy=CellOutputPolicy::Average)
Definition: ATSolver2D.h:823
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:656
void getOutputVectorFieldU2(VectorFieldOutput &output, SurfelRangeConstIterator itB, SurfelRangeConstIterator itE)
Definition: ATSolver2D.h:771
@ 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
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: 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.
Definition: MPolynomial.h:955
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
static Self zero
Static const for zero PointVector.
Definition: PointVector.h:1595
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Definition: SetOfSurfels.h:74
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.
::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:311
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:332
ShortcutsGeometry & operator=(const ShortcutsGeometry &other)=delete
LightDigitalSurface::SCell SCell
LightDigitalSurface::ArcRange ArcRange
sgf::ShapeGaussianCurvatureFunctor< ImplicitShape3D > GaussianCurvatureFunctor
static Parameters parametersShapeGeometry()
KSpace::SurfelSet SurfelSet
defines a set of surfels
static CurvatureTensorQuantities getIIPrincipalCurvaturesAndDirections(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
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)
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
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, SecondPrincipalDirectionFunctor > TrueSecondPrincipalDirectionEstimator
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, NormalFunctor > TrueNormalEstimator
LightDigitalSurface::Arc Arc
static RealVectors getFirstPrincipalDirections(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
ImageContainerBySTLVector< Domain, GrayScale > GrayScaleImage
defines a grey-level image with (hyper-)rectangular domain.
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.
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 getIIMeanCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
ImageContainerBySTLVector< Domain, double > DoubleImage
defines a double image with (hyper-)rectangular domain.
std::set< IdxSurfel > IdxSurfelSet
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, SecondPrincipalCurvatureFunctor > TrueSecondPrincipalCurvatureEstimator
Space::RealVector RealVector
Vector with floating-point coordinates.
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()
::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 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:461
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 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:105
static Parameters parametersKSpace()
Definition: Shortcuts.h:311
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition: Shortcuts.h:332
static Parameters parametersDigitizedImplicitShape3D()
Definition: Shortcuts.h:461
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
PointVector< dim, Integer > Point
Points in DGtal::SpaceND.
Definition: SpaceND.h:110
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: 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
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:137
Trace trace
Definition: Common.h:154
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: 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: 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.
InHalfPlaneBySimple3x3Matrix< Point, double > Functor
KSpace K