DGtal 1.4.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#include "DGtal/dec/DiscreteExteriorCalculusFactory.h"
53#include "DGtal/dec/ATSolver2D.h"
55
56namespace DGtal
57{
58
59 namespace sgf = ::DGtal::functors::ShapeGeometricFunctors;
60
62 // template class ShortcutsGeometry
73 template < typename TKSpace >
74 class ShortcutsGeometry : public Shortcuts< TKSpace >
75 {
77 public:
81 using Base::getKSpace;
83
84 // ----------------------- Usual space types --------------------------------------
85 public:
86
88 typedef TKSpace KSpace;
90 typedef typename KSpace::Space Space;
92 typedef typename Space::Integer Integer;
94 typedef typename Space::Point Point;
96 typedef typename Space::Vector Vector;
98 typedef typename Space::RealVector RealVector;
100 typedef typename Space::RealPoint RealPoint;
106 typedef unsigned char GrayScale;
107
108 // ----------------------- Shortcut types --------------------------------------
109 public:
126 typedef typename KSpace::SurfelSet SurfelSet;
131 typedef ::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface;
135 typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface;
149 typedef std::set< IdxSurfel > IdxSurfelSet;
150 typedef std::vector< Surfel > SurfelRange;
151 typedef std::vector< Cell > CellRange;
152 typedef std::vector< IdxSurfel > IdxSurfelRange;
153 typedef std::vector< Scalar > Scalars;
154 typedef std::vector< RealVector > RealVectors;
155 typedef std::vector< RealPoint > RealPoints;
156
157 typedef ::DGtal::Statistic<Scalar> ScalarStatistic;
158
168
170 typedef std::vector< CurvatureTensorQuantity > CurvatureTensorQuantities;
171
172
191
192 typedef ::DGtal::Mesh<RealPoint> Mesh;
193 typedef ::DGtal::TriangulatedSurface<RealPoint> TriangulatedSurface;
194 typedef ::DGtal::PolygonalSurface<RealPoint> PolygonalSurface;
195 typedef std::map<Surfel, IdxSurfel> Surfel2Index;
196 typedef std::map<Cell, IdxVertex> Cell2Index;
197
198 // ----------------------- Static services --------------------------------------
199 public:
200
201 // ----------------------- Exact geometry services ------------------------------
204 public:
205
213
221 {
222 return Parameters
223 ( "projectionMaxIter", 20 )
224 ( "projectionAccuracy", 0.0001 )
225 ( "projectionGamma", 0.5 )
226 ( "gridstep", 1.0 );
227 }
228
247 static RealPoints
250 const KSpace& K,
251 const SurfelRange& surfels,
252 const Parameters& params = parametersShapeGeometry() )
253 {
254 RealVectors n_true_estimations;
255 TruePositionEstimator true_estimator;
256 int maxIter = params[ "projectionMaxIter" ].as<int>();
257 double accuracy = params[ "projectionAccuracy" ].as<double>();
258 double gamma = params[ "projectionGamma" ].as<double>();
259 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
260 true_estimator.attach( *shape );
261 true_estimator.setParams( K, PositionFunctor(), maxIter, accuracy, gamma );
262 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
263 true_estimator.eval( surfels.begin(), surfels.end(),
264 std::back_inserter( n_true_estimations ) );
265 return n_true_estimations;
266 }
267
281 static RealPoints
284 const RealPoints& points,
285 const Parameters& params = parametersShapeGeometry() )
286 {
287 RealPoints proj_points( points.size() );
288 int maxIter = params[ "projectionMaxIter" ].as<int>();
289 double accuracy = params[ "projectionAccuracy" ].as<double>();
290 double gamma = params[ "projectionGamma" ].as<double>();
291 for ( unsigned int i = 0; i < points.size(); ++i )
292 proj_points[ i ] = shape->nearestPoint( points[ i ], accuracy,
293 maxIter, gamma );
294 return proj_points;
295 }
296
315 static RealVectors
318 const KSpace& K,
319 const SurfelRange& surfels,
320 const Parameters& params = parametersShapeGeometry() )
321 {
322 RealVectors n_true_estimations;
323 TrueNormalEstimator true_estimator;
324 int maxIter = params[ "projectionMaxIter" ].as<int>();
325 double accuracy = params[ "projectionAccuracy" ].as<double>();
326 double gamma = params[ "projectionGamma" ].as<double>();
327 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
328 true_estimator.attach( *shape );
329 true_estimator.setParams( K, NormalFunctor(), maxIter, accuracy, gamma );
330 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
331 true_estimator.eval( surfels.begin(), surfels.end(),
332 std::back_inserter( n_true_estimations ) );
333 return n_true_estimations;
334 }
335
354 static Scalars
357 const KSpace& K,
358 const SurfelRange& surfels,
359 const Parameters& params = parametersShapeGeometry() )
360 {
361 Scalars n_true_estimations;
362 TrueMeanCurvatureEstimator true_estimator;
363 int maxIter = params[ "projectionMaxIter" ].as<int>();
364 double accuracy = params[ "projectionAccuracy" ].as<double>();
365 double gamma = params[ "projectionGamma" ].as<double>();
366 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
367 true_estimator.attach( *shape );
368 true_estimator.setParams( K, MeanCurvatureFunctor(), maxIter, accuracy, gamma );
369 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
370 true_estimator.eval( surfels.begin(), surfels.end(),
371 std::back_inserter( n_true_estimations ) );
372 return n_true_estimations;
373 }
374
394 static Scalars
397 const KSpace& K,
398 const SurfelRange& surfels,
399 const Parameters& params = parametersShapeGeometry() )
400 {
401 Scalars n_true_estimations;
402 TrueGaussianCurvatureEstimator true_estimator;
403 int maxIter = params[ "projectionMaxIter" ].as<int>();
404 double accuracy = params[ "projectionAccuracy" ].as<double>();
405 double gamma = params[ "projectionGamma" ].as<double>();
406 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
407 true_estimator.attach( *shape );
408 true_estimator.setParams( K, GaussianCurvatureFunctor(), maxIter, accuracy, gamma );
409 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
410 true_estimator.eval( surfels.begin(), surfels.end(),
411 std::back_inserter( n_true_estimations ) );
412 return n_true_estimations;
413 }
414
435 static Scalars
438 const KSpace& K,
439 const SurfelRange& surfels,
440 const Parameters& params = parametersShapeGeometry() )
441 {
442 Scalars n_true_estimations;
444 int maxIter = params[ "projectionMaxIter" ].as<int>();
445 double accuracy = params[ "projectionAccuracy" ].as<double>();
446 double gamma = params[ "projectionGamma" ].as<double>();
447 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
448 true_estimator.attach( *shape );
449 true_estimator.setParams( K, FirstPrincipalCurvatureFunctor(),
450 maxIter, accuracy, gamma );
451 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
452 true_estimator.eval( surfels.begin(), surfels.end(),
453 std::back_inserter( n_true_estimations ) );
454 return n_true_estimations;
455 }
456
477 static Scalars
480 const KSpace& K,
481 const SurfelRange& surfels,
482 const Parameters& params = parametersShapeGeometry() )
483 {
484 Scalars n_true_estimations;
486 int maxIter = params[ "projectionMaxIter" ].as<int>();
487 double accuracy = params[ "projectionAccuracy" ].as<double>();
488 double gamma = params[ "projectionGamma" ].as<double>();
489 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
490 true_estimator.attach( *shape );
492 maxIter, accuracy, gamma );
493 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
494 true_estimator.eval( surfels.begin(), surfels.end(),
495 std::back_inserter( n_true_estimations ) );
496 return n_true_estimations;
497 }
498
519 static RealVectors
522 const KSpace& K,
523 const SurfelRange& surfels,
524 const Parameters& params = parametersShapeGeometry() )
525 {
526 RealVectors n_true_estimations;
528 int maxIter = params[ "projectionMaxIter" ].as<int>();
529 double accuracy = params[ "projectionAccuracy" ].as<double>();
530 double gamma = params[ "projectionGamma" ].as<double>();
531 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
532 true_estimator.attach( *shape );
533 true_estimator.setParams( K, FirstPrincipalDirectionFunctor(),
534 maxIter, accuracy, gamma );
535 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
536 true_estimator.eval( surfels.begin(), surfels.end(),
537 std::back_inserter( n_true_estimations ) );
538 return n_true_estimations;
539 }
540
561 static RealVectors
564 const KSpace& K,
565 const SurfelRange& surfels,
566 const Parameters& params = parametersShapeGeometry() )
567 {
568 RealVectors n_true_estimations;
570 int maxIter = params[ "projectionMaxIter" ].as<int>();
571 double accuracy = params[ "projectionAccuracy" ].as<double>();
572 double gamma = params[ "projectionGamma" ].as<double>();
573 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
574 true_estimator.attach( *shape );
576 maxIter, accuracy, gamma );
577 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
578 true_estimator.eval( surfels.begin(), surfels.end(),
579 std::back_inserter( n_true_estimations ) );
580 return n_true_estimations;
581 }
582
607 const KSpace& K,
608 const SurfelRange& surfels,
609 const Parameters& params = parametersShapeGeometry() )
610 {
611 CurvatureTensorQuantities n_true_estimations;
613 int maxIter = params[ "projectionMaxIter" ].as<int>();
614 double accuracy = params[ "projectionAccuracy" ].as<double>();
615 double gamma = params[ "projectionGamma" ].as<double>();
616 Scalar gridstep = params[ "gridstep" ].as<Scalar>();
617 true_estimator.attach( *shape );
619 maxIter, accuracy, gamma );
620 true_estimator.init( gridstep, surfels.begin(), surfels.end() );
621 true_estimator.eval( surfels.begin(), surfels.end(),
622 std::back_inserter( n_true_estimations ) );
623 return n_true_estimations;
624 }
625
627
628 // --------------------------- geometry estimation ------------------------------
631 public:
632
643 {
644 return Parameters
645 ( "verbose", 1 )
646 ( "t-ring", 3.0 )
647 ( "kernel", "hat" )
648 ( "R-radius", 10.0 )
649 ( "r-radius", 3.0 )
650 ( "alpha", 0.33 )
651 ( "surfelEmbedding", 0 );
652 }
653
663 static RealVectors
665 const SurfelRange& surfels )
666 {
667 std::vector< RealVector > result;
668 for ( auto s : surfels )
669 {
670 Dimension k = K.sOrthDir( s );
671 bool direct = K.sDirect( s, k );
673 t[ k ] = direct ? -1.0 : 1.0;
674 result.push_back( t );
675 }
676 return result;
677 }
678
694 template <typename TAnyDigitalSurface>
695 static RealVectors
698 const SurfelRange& surfels,
699 const Parameters& params = parametersGeometryEstimation() )
700 {
701 int verbose = params[ "verbose" ].as<int>();
702 Scalar t = params[ "t-ring" ].as<double>();
703 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
704 typedef LpMetric<Space> Metric;
707 < Surfel, CanonicSCellEmbedder<KSpace> > SurfelFunctor;
709 < SurfaceContainer, Metric, SurfelFunctor, Functor> NormalEstimator;
710 if ( verbose > 0 )
711 trace.info() << "- CTrivial normal t-ring=" << t << " (discrete)" << std::endl;
712 const Functor fct( 1.0, t );
713 const KSpace & K = surface->container().space();
714 Metric aMetric( 2.0 );
715 CanonicSCellEmbedder<KSpace> canonic_embedder( K );
716 std::vector< RealVector > n_estimations;
717 SurfelFunctor surfelFct( canonic_embedder, 1.0 );
718 NormalEstimator estimator;
719 estimator.attach( *surface);
720 estimator.setParams( aMetric, surfelFct, fct, t );
721 estimator.init( 1.0, surfels.begin(), surfels.end());
722 estimator.eval( surfels.begin(), surfels.end(),
723 std::back_inserter( n_estimations ) );
724 std::transform( n_estimations.cbegin(), n_estimations.cend(), n_estimations.begin(),
725 [] ( RealVector v ) { return -v; } );
726 return n_estimations;
727 }
728
750 template <typename TAnyDigitalSurface>
751 static RealVectors
754 const SurfelRange& surfels,
755 const Parameters& params = parametersGeometryEstimation() )
756 {
758 typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
759 RealVectors n_estimations;
760 int verbose = params[ "verbose" ].as<int>();
761 std::string kernel = params[ "kernel" ].as<std::string>();
762 Scalar h = params[ "gridstep" ].as<Scalar>();
763 Scalar R = params[ "R-radius" ].as<Scalar>();
764 Scalar r = params[ "r-radius" ].as<Scalar>();
765 Scalar t = params[ "t-ring" ].as<Scalar>();
766 Scalar alpha = params[ "alpha" ].as<Scalar>();
767 int embedding = params[ "embedding" ].as<int>();
768 // Adjust parameters according to gridstep if specified.
769 if ( alpha != 1.0 ) R *= pow( h, alpha-1.0 );
770 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
771 Surfel2PointEmbedding embType = embedding == 0 ? Pointels :
772 embedding == 1 ? InnerSpel : OuterSpel;
773 if ( verbose > 0 )
774 {
775 trace.info() << "- VCM normal kernel=" << kernel << " emb=" << embedding
776 << " alpha=" << alpha << std::endl;
777 trace.info() << "- VCM normal r=" << (r*h) << " (continuous) "
778 << r << " (discrete)" << std::endl;
779 trace.info() << "- VCM normal R=" << (R*h) << " (continuous) "
780 << R << " (discrete)" << std::endl;
781 trace.info() << "- VCM normal t=" << t << " (discrete)" << std::endl;
782 }
783 if ( kernel == "hat" )
784 {
785 typedef functors::HatPointFunction<Point,Scalar> KernelFunction;
787 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
790 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
791 KernelFunction chi_r( 1.0, r );
792 VCMNormalEstimator estimator;
793 estimator.attach( *surface );
794 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
795 estimator.init( h, surfels.begin(), surfels.end() );
796 estimator.eval( surfels.begin(), surfels.end(),
797 std::back_inserter( n_estimations ) );
798 }
799 else if ( kernel == "ball" )
800 {
803 < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
806 < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
807 KernelFunction chi_r( 1.0, r );
808 VCMNormalEstimator estimator;
809 estimator.attach( *surface );
810 estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
811 estimator.init( h, surfels.begin(), surfels.end() );
812 estimator.eval( surfels.begin(), surfels.end(),
813 std::back_inserter( n_estimations ) );
814 }
815 else
816 {
817 trace.warning() << "[ShortcutsGeometry::getVCMNormalVectors] Unknown kernel: "
818 << kernel << std::endl;
819 }
820 return n_estimations;
821 }
822
845 static RealVectors
847 const SurfelRange& surfels,
848 const Parameters& params
850 | parametersKSpace() )
851 {
852 auto K = getKSpace( bimage, params );
853 return getIINormalVectors( *bimage, K, surfels, params );
854 }
855
885 static RealVectors
887 const SurfelRange& surfels,
888 const Parameters& params
892 {
893 auto K = getKSpace( params );
894 return getIINormalVectors( *dshape, K, surfels, params );
895 }
896
921 template <typename TPointPredicate>
922 static RealVectors
923 getIINormalVectors( const TPointPredicate& shape,
924 const KSpace& K,
925 const SurfelRange& surfels,
926 const Parameters& params
928 | parametersKSpace() )
929 {
930 typedef functors::IINormalDirectionFunctor<Space> IINormalFunctor;
932 <KSpace, TPointPredicate, IINormalFunctor> IINormalEstimator;
933
934 RealVectors n_estimations;
935 int verbose = params[ "verbose" ].as<int>();
936 Scalar h = params[ "gridstep" ].as<Scalar>();
937 Scalar r = params[ "r-radius" ].as<Scalar>();
938 Scalar alpha = params[ "alpha" ].as<Scalar>();
939 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
940 if ( verbose > 0 )
941 {
942 trace.info() << "- II normal alpha=" << alpha << std::endl;
943 trace.info() << "- II normal r=" << (r*h) << " (continuous) "
944 << r << " (discrete)" << std::endl;
945 }
946 IINormalFunctor functor;
947 functor.init( h, r*h );
948 IINormalEstimator ii_estimator( functor );
949 ii_estimator.attach( K, shape );
950 ii_estimator.setParams( r );
951 ii_estimator.init( h, surfels.begin(), surfels.end() );
952 ii_estimator.eval( surfels.begin(), surfels.end(),
953 std::back_inserter( n_estimations ) );
954 const RealVectors n_trivial = getTrivialNormalVectors( K, surfels );
955 orientVectors( n_estimations, n_trivial );
956 return n_estimations;
957 }
958
959
978 static Scalars
980 const SurfelRange& surfels,
981 const Parameters& params
983 | parametersKSpace() )
984 {
985 auto K = getKSpace( bimage, params );
986 return getIIMeanCurvatures( *bimage, K, surfels, params );
987 }
988
1014 static Scalars
1016 const SurfelRange& surfels,
1017 const Parameters& params
1021 {
1022 auto K = getKSpace( params );
1023 return getIIMeanCurvatures( *dshape, K, surfels, params );
1024 }
1025
1026
1048 template <typename TPointPredicate>
1049 static Scalars
1050 getIIMeanCurvatures( const TPointPredicate& shape,
1051 const KSpace& K,
1052 const SurfelRange& surfels,
1053 const Parameters& params
1055 | parametersKSpace() )
1056 {
1057 typedef functors::IIMeanCurvature3DFunctor<Space> IIMeanCurvFunctor;
1059 <KSpace, TPointPredicate, IIMeanCurvFunctor> IIMeanCurvEstimator;
1060
1061 Scalars mc_estimations;
1062 int verbose = params[ "verbose" ].as<int>();
1063 Scalar h = params[ "gridstep" ].as<Scalar>();
1064 Scalar r = params[ "r-radius" ].as<Scalar>();
1065 Scalar alpha = params[ "alpha" ].as<Scalar>();
1066 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1067 if ( verbose > 0 )
1068 {
1069 trace.info() << "- II mean curvature alpha=" << alpha << std::endl;
1070 trace.info() << "- II mean curvature r=" << (r*h) << " (continuous) "
1071 << r << " (discrete)" << std::endl;
1072 }
1073 IIMeanCurvFunctor functor;
1074 functor.init( h, r*h );
1075 IIMeanCurvEstimator ii_estimator( functor );
1076 ii_estimator.attach( K, shape );
1077 ii_estimator.setParams( r );
1078 ii_estimator.init( h, surfels.begin(), surfels.end() );
1079 ii_estimator.eval( surfels.begin(), surfels.end(),
1080 std::back_inserter( mc_estimations ) );
1081 return mc_estimations;
1082 }
1083
1102 static Scalars
1104 const SurfelRange& surfels,
1105 const Parameters& params
1107 | parametersKSpace() )
1108 {
1109 auto K = getKSpace( bimage, params );
1110 return getIIGaussianCurvatures( *bimage, K, surfels, params );
1111 }
1112
1138 static Scalars
1140 const SurfelRange& surfels,
1141 const Parameters& params
1145 {
1146 auto K = getKSpace( params );
1147 return getIIGaussianCurvatures( *dshape, K, surfels, params );
1148 }
1149
1150
1172 template <typename TPointPredicate>
1173 static Scalars
1174 getIIGaussianCurvatures( const TPointPredicate& shape,
1175 const KSpace& K,
1176 const SurfelRange& surfels,
1177 const Parameters& params
1179 | parametersKSpace() )
1180 {
1181 typedef functors::IIGaussianCurvature3DFunctor<Space> IIGaussianCurvFunctor;
1183 <KSpace, TPointPredicate, IIGaussianCurvFunctor> IIGaussianCurvEstimator;
1184
1185 Scalars mc_estimations;
1186 int verbose = params[ "verbose" ].as<int>();
1187 Scalar h = params[ "gridstep" ].as<Scalar>();
1188 Scalar r = params[ "r-radius" ].as<Scalar>();
1189 Scalar alpha = params[ "alpha" ].as<Scalar>();
1190 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1191 if ( verbose > 0 )
1192 {
1193 trace.info() << "- II Gaussian curvature alpha=" << alpha << std::endl;
1194 trace.info() << "- II Gaussian curvature r=" << (r*h) << " (continuous) "
1195 << r << " (discrete)" << std::endl;
1196 }
1197 IIGaussianCurvFunctor functor;
1198 functor.init( h, r*h );
1199 IIGaussianCurvEstimator ii_estimator( functor );
1200 ii_estimator.attach( K, shape );
1201 ii_estimator.setParams( r );
1202 ii_estimator.init( h, surfels.begin(), surfels.end() );
1203 ii_estimator.eval( surfels.begin(), surfels.end(),
1204 std::back_inserter( mc_estimations ) );
1205 return mc_estimations;
1206 }
1207
1229 const SurfelRange& surfels,
1230 const Parameters& params
1232 | parametersKSpace() )
1233 {
1234 auto K = getKSpace( bimage, params );
1235 return getIIPrincipalCurvaturesAndDirections( *bimage, K, surfels, params );
1236 }
1237
1266 const SurfelRange& surfels,
1267 const Parameters& params
1271 {
1272 auto K = getKSpace( params );
1273 return getIIPrincipalCurvaturesAndDirections( *dshape, K, surfels, params );
1274 }
1275
1276
1298 template <typename TPointPredicate>
1300 getIIPrincipalCurvaturesAndDirections( const TPointPredicate& shape,
1301 const KSpace& K,
1302 const SurfelRange& surfels,
1303 const Parameters& params
1305 | parametersKSpace() )
1306 {
1309
1310 CurvatureTensorQuantities mc_estimations;
1311 int verbose = params[ "verbose" ].as<int>();
1312 Scalar h = params[ "gridstep" ].as<Scalar>();
1313 Scalar r = params[ "r-radius" ].as<Scalar>();
1314 Scalar alpha = params[ "alpha" ].as<Scalar>();
1315 if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
1316 if ( verbose > 0 )
1317 {
1318 trace.info() << "- II principal curvatures and directions alpha=" << alpha << std::endl;
1319 trace.info() << "- II principal curvatures and directions r=" << (r*h) << " (continuous) "
1320 << r << " (discrete)" << std::endl;
1321 }
1322 IICurvFunctor functor;
1323 functor.init( h, r*h );
1324 IICurvEstimator ii_estimator( functor );
1325 ii_estimator.attach( K, shape );
1326 ii_estimator.setParams( r );
1327 ii_estimator.init( h, surfels.begin(), surfels.end() );
1328 ii_estimator.eval( surfels.begin(), surfels.end(),
1329 std::back_inserter( mc_estimations ) );
1330 return mc_estimations;
1331 }
1332
1334
1335 // --------------------------- AT approximation ------------------------------
1338 public:
1339
1354 {
1355#if defined(WITH_EIGEN)
1356 return Parameters
1357 ( "at-enabled", 1 )
1358 ( "at-alpha", 0.1 )
1359 ( "at-lambda", 0.025 )
1360 ( "at-epsilon", 0.25 )
1361 ( "at-epsilon-start", 2.0 )
1362 ( "at-epsilon-ratio", 2.0 )
1363 ( "at-max-iter", 10 )
1364 ( "at-diff-v-max", 0.0001 )
1365 ( "at-v-policy", "Maximum" );
1366#else // defined(WITH_EIGEN)
1367 return Parameters( "at-enabled", 0 );
1368#endif// defined(WITH_EIGEN)
1369 }
1370
1371#if defined(WITH_EIGEN)
1372
1396 template <typename TAnyDigitalSurface,
1397 typename VectorFieldInput>
1398 static
1399 VectorFieldInput
1401 const SurfelRange& surfels,
1402 const VectorFieldInput& input,
1403 const Parameters& params
1405 {
1406 (void)surface; //param not used. FIXME: JOL
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 (void)surface; //param not used FIXME: JOL
1473
1474 int verbose = params[ "verbose" ].as<int>();
1475 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1476 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1477 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1478 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1479 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1480 int max_iter = params[ "at-max-iter" ].as<int>();
1481 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1482 std::string policy = params[ "at-v-policy" ].as<std::string>();
1484 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1485 ATSolver2D< KSpace > at_solver( calculus, verbose );
1486 at_solver.initInputVectorFieldU2( input, surfels.cbegin(), surfels.cend() );
1487 at_solver.setUp( alpha_at, lambda_at );
1488 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1489 auto output = input;
1490 at_solver.getOutputVectorFieldU2( output, surfels.cbegin(), surfels.cend() );
1491 auto p = ( policy == "Average" ) ? at_solver.Average
1492 : ( policy == "Minimum" ) ? at_solver.Minimum
1493 : at_solver.Maximum;
1494 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1495 return output;
1496 }
1497
1522 template <typename TAnyDigitalSurface>
1523 static
1524 Scalars
1526 const SurfelRange& surfels,
1527 const Scalars& input,
1528 const Parameters& params
1530 {
1531 (void)surface; //param not used FIXME: JOL
1532
1533 int verbose = params[ "verbose" ].as<int>();
1534 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1535 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1536 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1537 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1538 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1539 int max_iter = params[ "at-max-iter" ].as<int>();
1540 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1542 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1543 ATSolver2D< KSpace > at_solver( calculus, verbose );
1544 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1545 at_solver.setUp( alpha_at, lambda_at );
1546 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1547 auto output = input;
1548 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1549 return output;
1550 }
1551
1587 template <typename TAnyDigitalSurface,
1588 typename CellRangeConstIterator>
1589 static
1590 Scalars
1592 CellRangeConstIterator itB,
1593 CellRangeConstIterator itE,
1595 const SurfelRange& surfels,
1596 const Scalars& input,
1597 const Parameters& params
1599 {
1600 (void)surface; //param not used FIXME: JOL
1601
1602 int verbose = params[ "verbose" ].as<int>();
1603 Scalar alpha_at = params[ "at-alpha" ].as<Scalar>();
1604 Scalar lambda_at = params[ "at-lambda" ].as<Scalar>();
1605 Scalar epsilon1 = params[ "at-epsilon-start" ].as<Scalar>();
1606 Scalar epsilon2 = params[ "at-epsilon" ].as<Scalar>();
1607 Scalar epsilonr = params[ "at-epsilon-ratio" ].as<Scalar>();
1608 int max_iter = params[ "at-max-iter" ].as<int>();
1609 Scalar diff_v_max= params[ "at-diff-v-max" ].as<Scalar>();
1610 std::string policy = params[ "at-v-policy" ].as<std::string>();
1612 const auto calculus = CalculusFactory::createFromNSCells<2>( surfels.cbegin(), surfels.cend() );
1613 ATSolver2D< KSpace > at_solver( calculus, verbose );
1614 at_solver.initInputScalarFieldU2( input, surfels.cbegin(), surfels.cend() );
1615 at_solver.setUp( alpha_at, lambda_at );
1616 at_solver.solveGammaConvergence( epsilon1, epsilon2, epsilonr, false, diff_v_max, max_iter );
1617 auto output = input;
1618 at_solver.getOutputScalarFieldU2( output, surfels.cbegin(), surfels.cend() );
1619 auto p = ( policy == "Average" ) ? at_solver.Average
1620 : ( policy == "Minimum" ) ? at_solver.Minimum
1621 : at_solver.Maximum;
1622 at_solver.getOutputScalarFieldV0( features, itB, itE, p );
1623 return output;
1624 }
1625
1626#endif // defined(WITH_EIGEN)
1627
1629
1630 // ------------------------- Error measures services -------------------------
1633 public:
1634
1640 static void
1642 const RealVectors& ref_v )
1643 {
1644 std::transform( ref_v.cbegin(), ref_v.cend(), v.cbegin(), v.begin(),
1645 [] ( RealVector rw, RealVector w )
1646 { return rw.dot( w ) >= 0.0 ? w : -w; } );
1647 }
1648
1653 static ScalarStatistic
1655 {
1656 ScalarStatistic stat;
1657 stat.addValues( v.begin(), v.end() );
1658 stat.terminate();
1659 return stat;
1660 }
1661
1668 static Scalars
1670 const RealVectors& v2 )
1671 {
1672 Scalars v( v1.size() );
1673 if ( v1.size() == v2.size() )
1674 {
1675 auto outIt = v.begin();
1676 for ( auto it1 = v1.cbegin(), it2 = v2.cbegin(), itE1 = v1.cend();
1677 it1 != itE1; ++it1, ++it2 )
1678 {
1679 Scalar angle_error = acos( (*it1).dot( *it2 ) );
1680 *outIt++ = angle_error;
1681 }
1682 }
1683 else
1684 {
1685 trace.warning() << "[ShortcutsGeometry::getVectorsAngleDeviation]"
1686 << " v1.size()=" << v1.size() << " should be equal to "
1687 << " v2.size()=" << v2.size() << std::endl;
1688 }
1689 return v;
1690 }
1691
1696 static Scalars
1698 const Scalars & v2 )
1699 {
1700 Scalars result( v1.size() );
1701 std::transform( v2.cbegin(), v2.cend(), v1.cbegin(), result.begin(),
1702 [] ( Scalar val1, Scalar val2 )
1703 { return fabs( val1 - val2 ); } );
1704 return result;
1705 }
1706
1713 static Scalar
1715 const Scalars & v2 )
1716 {
1717 Scalar sum = 0;
1718 for ( unsigned int i = 0; i < v1.size(); i++ )
1719 sum += ( v1[ i ] - v2[ i ] ) * ( v1[ i ] - v2[ i ] );
1720 return sqrt( sum / v1.size() );
1721 }
1722
1729 static Scalar
1731 const Scalars & v2 )
1732 {
1733 Scalar sum = 0;
1734 for ( unsigned int i = 0; i < v1.size(); i++ )
1735 sum += fabs( v1[ i ] - v2[ i ] );
1736 return sum / v1.size();
1737 }
1738
1745 static Scalar
1747 const Scalars & v2 )
1748 {
1749 Scalar loo = 0;
1750 for ( unsigned int i = 0; i < v1.size(); i++ )
1751 loo = std::max( loo, fabs( v1[ i ] - v2[ i ] ) );
1752 return loo;
1753 }
1754
1756
1757 // ----------------------- Standard services ------------------------------
1760 public:
1761
1766
1771
1776 ShortcutsGeometry ( const ShortcutsGeometry & other ) = delete;
1777
1783
1790
1797
1799
1800 // ----------------------- Interface --------------------------------------
1801 public:
1802
1803 // ------------------------- Protected Datas ------------------------------
1804 protected:
1805
1806 // ------------------------- Private Datas --------------------------------
1807 private:
1808
1809 // ------------------------- Hidden services ------------------------------
1810 protected:
1811
1812 // ------------------------- Internals ------------------------------------
1813 private:
1814
1815 }; // end of class ShortcutsGeometry
1816
1817
1818} // namespace DGtal
1819
1820
1822// Includes inline functions.
1823
1824// //
1826
1827#endif // !defined ShortcutsGeometry_h
1828
1829#undef ShortcutsGeometry_RECURSES
1830#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
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.
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.
::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
PolyCalculus * calculus
CountedPtr< SH3::DigitalSurface > surface
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition Common.h:136
Trace trace
Definition Common.h:153
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