DGtal  1.0.0
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)
34 
35 #define ShortcutsGeometry_RECURSES
36 
37 #if !defined ShortcutsGeometry_h
38 
39 #define ShortcutsGeometry_h
40 
42 #include "DGtal/helpers/Shortcuts.h"
43 #include "DGtal/geometry/volumes/distance/ExactPredicateLpSeparableMetric.h"
44 #include "DGtal/geometry/surfaces/estimation/TrueDigitalSurfaceLocalEstimator.h"
45 #include "DGtal/geometry/surfaces/estimation/VoronoiCovarianceMeasureOnDigitalSurface.h"
46 #include "DGtal/geometry/surfaces/estimation/VCMDigitalSurfaceLocalEstimator.h"
47 #include "DGtal/geometry/surfaces/estimation/IIGeometricFunctors.h"
48 #include "DGtal/geometry/surfaces/estimation/IntegralInvariantVolumeEstimator.h"
49 #include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.h"
51 
52 namespace DGtal
53 {
54 
55  namespace sgf = ::DGtal::functors::ShapeGeometricFunctors;
56 
58  // template class ShortcutsGeometry
69  template < typename TKSpace >
70  class ShortcutsGeometry : public Shortcuts< TKSpace >
71  {
73  public:
77  using Base::getKSpace;
79 
80  // ----------------------- Usual space types --------------------------------------
81  public:
82 
84  typedef TKSpace KSpace;
86  typedef typename KSpace::Space Space;
88  typedef typename Space::Integer Integer;
90  typedef typename Space::Point Point;
92  typedef typename Space::Vector Vector;
94  typedef typename Space::RealVector RealVector;
96  typedef typename Space::RealPoint RealPoint;
98  typedef typename RealVector::Component Scalar;
102  typedef unsigned char GrayScale;
103 
104  // ----------------------- Shortcut types --------------------------------------
105  public:
122  typedef typename KSpace::SurfelSet SurfelSet;
127  typedef ::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface;
131  typedef ::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface;
135  typedef typename LightDigitalSurface::Cell Cell;
138  typedef typename LightDigitalSurface::Arc Arc;
139  typedef typename LightDigitalSurface::Face Face;
143  typedef typename IdxDigitalSurface::Arc IdxArc;
145  typedef std::set< IdxSurfel > IdxSurfelSet;
146  typedef std::vector< Surfel > SurfelRange;
147  typedef std::vector< Cell > CellRange;
148  typedef std::vector< IdxSurfel > IdxSurfelRange;
149  typedef std::vector< Scalar > Scalars;
150  typedef std::vector< RealVector > RealVectors;
151  typedef std::vector< RealPoint > RealPoints;
152 
153  typedef ::DGtal::Statistic<Scalar> ScalarStatistic;
154 
167 
168  typedef ::DGtal::Mesh<RealPoint> Mesh;
169  typedef ::DGtal::TriangulatedSurface<RealPoint> TriangulatedSurface;
170  typedef ::DGtal::PolygonalSurface<RealPoint> PolygonalSurface;
171  typedef std::map<Surfel, IdxSurfel> Surfel2Index;
172  typedef std::map<Cell, IdxVertex> Cell2Index;
173 
174  // ----------------------- Static services --------------------------------------
175  public:
176 
177  // ----------------------- True geometry services ------------------------------
178  public:
179 
182  {
183  return parametersShapeGeometry()
185  }
186 
194  {
195  return Parameters
196  ( "projectionMaxIter", 20 )
197  ( "projectionAccuracy", 0.0001 )
198  ( "projectionGamma", 0.5 )
199  ( "gridstep", 1.0 );
200  }
201 
220  static RealPoints
223  const KSpace& K,
224  const SurfelRange& surfels,
225  const Parameters& params = parametersShapeGeometry() )
226  {
227  RealVectors n_true_estimations;
228  TruePositionEstimator true_estimator;
229  int maxIter = params[ "projectionMaxIter" ].as<int>();
230  double accuracy = params[ "projectionAccuracy" ].as<double>();
231  double gamma = params[ "projectionGamma" ].as<double>();
232  Scalar gridstep = params[ "gridstep" ].as<Scalar>();
233  true_estimator.attach( *shape );
234  true_estimator.setParams( K, PositionFunctor(), maxIter, accuracy, gamma );
235  true_estimator.init( gridstep, surfels.begin(), surfels.end() );
236  true_estimator.eval( surfels.begin(), surfels.end(),
237  std::back_inserter( n_true_estimations ) );
238  return n_true_estimations;
239  }
240 
254  static RealPoints
257  const RealPoints& points,
258  const Parameters& params = parametersShapeGeometry() )
259  {
260  RealPoints proj_points( points.size() );
261  int maxIter = params[ "projectionMaxIter" ].as<int>();
262  double accuracy = params[ "projectionAccuracy" ].as<double>();
263  double gamma = params[ "projectionGamma" ].as<double>();
264  for ( unsigned int i = 0; i < points.size(); ++i )
265  proj_points[ i ] = shape->nearestPoint( points[ i ], accuracy,
266  maxIter, gamma );
267  return proj_points;
268  }
269 
288  static RealVectors
291  const KSpace& K,
292  const SurfelRange& surfels,
293  const Parameters& params = parametersShapeGeometry() )
294  {
295  RealVectors n_true_estimations;
296  TrueNormalEstimator true_estimator;
297  int maxIter = params[ "projectionMaxIter" ].as<int>();
298  double accuracy = params[ "projectionAccuracy" ].as<double>();
299  double gamma = params[ "projectionGamma" ].as<double>();
300  Scalar gridstep = params[ "gridstep" ].as<Scalar>();
301  true_estimator.attach( *shape );
302  true_estimator.setParams( K, NormalFunctor(), maxIter, accuracy, gamma );
303  true_estimator.init( gridstep, surfels.begin(), surfels.end() );
304  true_estimator.eval( surfels.begin(), surfels.end(),
305  std::back_inserter( n_true_estimations ) );
306  return n_true_estimations;
307  }
308 
327  static Scalars
330  const KSpace& K,
331  const SurfelRange& surfels,
332  const Parameters& params = parametersShapeGeometry() )
333  {
334  Scalars n_true_estimations;
335  TrueMeanCurvatureEstimator true_estimator;
336  int maxIter = params[ "projectionMaxIter" ].as<int>();
337  double accuracy = params[ "projectionAccuracy" ].as<double>();
338  double gamma = params[ "projectionGamma" ].as<double>();
339  Scalar gridstep = params[ "gridstep" ].as<Scalar>();
340  true_estimator.attach( *shape );
341  true_estimator.setParams( K, MeanCurvatureFunctor(), maxIter, accuracy, gamma );
342  true_estimator.init( gridstep, surfels.begin(), surfels.end() );
343  true_estimator.eval( surfels.begin(), surfels.end(),
344  std::back_inserter( n_true_estimations ) );
345  return n_true_estimations;
346  }
347 
367  static Scalars
370  const KSpace& K,
371  const SurfelRange& surfels,
372  const Parameters& params = parametersShapeGeometry() )
373  {
374  Scalars n_true_estimations;
375  TrueGaussianCurvatureEstimator true_estimator;
376  int maxIter = params[ "projectionMaxIter" ].as<int>();
377  double accuracy = params[ "projectionAccuracy" ].as<double>();
378  double gamma = params[ "projectionGamma" ].as<double>();
379  Scalar gridstep = params[ "gridstep" ].as<Scalar>();
380  true_estimator.attach( *shape );
381  true_estimator.setParams( K, GaussianCurvatureFunctor(), maxIter, accuracy, gamma );
382  true_estimator.init( gridstep, surfels.begin(), surfels.end() );
383  true_estimator.eval( surfels.begin(), surfels.end(),
384  std::back_inserter( n_true_estimations ) );
385  return n_true_estimations;
386  }
387 
388 
389 
390  // --------------------------- geometry estimation ------------------------------
391  public:
392 
403  {
404  return Parameters
405  ( "verbose", 1 )
406  ( "t-ring", 3.0 )
407  ( "kernel", "hat" )
408  ( "R-radius", 10.0 )
409  ( "r-radius", 3.0 )
410  ( "alpha", 0.33 )
411  ( "surfelEmbedding", 0 );
412  }
413 
423  static RealVectors
425  const SurfelRange& surfels )
426  {
427  std::vector< RealVector > result;
428  for ( auto s : surfels )
429  {
430  Dimension k = K.sOrthDir( s );
431  bool direct = K.sDirect( s, k );
433  t[ k ] = direct ? -1.0 : 1.0;
434  result.push_back( t );
435  }
436  return result;
437  }
438 
454  template <typename TAnyDigitalSurface>
455  static RealVectors
458  const SurfelRange& surfels,
459  const Parameters& params = parametersGeometryEstimation() )
460  {
461  int verbose = params[ "verbose" ].as<int>();
462  Scalar t = params[ "t-ring" ].as<double>();
463  typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
467  < Surfel, CanonicSCellEmbedder<KSpace> > SurfelFunctor;
469  < SurfaceContainer, Metric, SurfelFunctor, Functor> NormalEstimator;
470  if ( verbose > 0 )
471  trace.info() << " CTrivial normal t=" << t << " (discrete)" << std::endl;
472  const Functor fct( 1.0, t );
473  const KSpace & K = surface->container().space();
474  Metric aMetric;
475  CanonicSCellEmbedder<KSpace> canonic_embedder( K );
476  std::vector< RealVector > n_estimations;
477  SurfelFunctor surfelFct( canonic_embedder, 1.0 );
478  NormalEstimator estimator;
479  estimator.attach( *surface);
480  estimator.setParams( aMetric, surfelFct, fct, t );
481  estimator.init( 1.0, surfels.begin(), surfels.end());
482  estimator.eval( surfels.begin(), surfels.end(),
483  std::back_inserter( n_estimations ) );
484  std::transform( n_estimations.cbegin(), n_estimations.cend(), n_estimations.begin(),
485  [] ( RealVector v ) { return -v; } );
486  return n_estimations;
487  }
488 
510  template <typename TAnyDigitalSurface>
511  static RealVectors
514  const SurfelRange& surfels,
515  const Parameters& params = parametersGeometryEstimation() )
516  {
518  typedef typename TAnyDigitalSurface::DigitalSurfaceContainer SurfaceContainer;
519  RealVectors n_estimations;
520  int verbose = params[ "verbose" ].as<int>();
521  std::string kernel = params[ "kernel" ].as<std::string>();
522  Scalar h = params[ "gridstep" ].as<Scalar>();
523  Scalar R = params[ "R-radius" ].as<Scalar>();
524  Scalar r = params[ "r-radius" ].as<Scalar>();
525  Scalar t = params[ "t-ring" ].as<Scalar>();
526  Scalar alpha = params[ "alpha" ].as<Scalar>();
527  int embedding = params[ "embedding" ].as<int>();
528  // Adjust parameters according to gridstep if specified.
529  if ( alpha != 1.0 ) R *= pow( h, alpha-1.0 );
530  if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
531  Surfel2PointEmbedding embType = embedding == 0 ? Pointels :
532  embedding == 1 ? InnerSpel : OuterSpel;
533  if ( verbose > 0 )
534  {
535  trace.info() << "- VCM normal kernel=" << kernel << " emb=" << embedding
536  << " alpha=" << alpha << std::endl;
537  trace.info() << "- VCM normal r=" << (r*h) << " (continuous) "
538  << r << " (discrete)" << std::endl;
539  trace.info() << "- VCM normal R=" << (R*h) << " (continuous) "
540  << R << " (discrete)" << std::endl;
541  trace.info() << "- VCM normal t=" << t << " (discrete)" << std::endl;
542  }
543  if ( kernel == "hat" )
544  {
545  typedef functors::HatPointFunction<Point,Scalar> KernelFunction;
547  < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
548  typedef functors::VCMNormalVectorFunctor<VCMOnSurface> NormalVFunctor;
550  < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
551  KernelFunction chi_r( 1.0, r );
552  VCMNormalEstimator estimator;
553  estimator.attach( *surface );
554  estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
555  estimator.init( h, surfels.begin(), surfels.end() );
556  estimator.eval( surfels.begin(), surfels.end(),
557  std::back_inserter( n_estimations ) );
558  }
559  else if ( kernel == "ball" )
560  {
563  < SurfaceContainer, Metric, KernelFunction > VCMOnSurface;
564  typedef functors::VCMNormalVectorFunctor<VCMOnSurface> NormalVFunctor;
566  < SurfaceContainer, Metric, KernelFunction, NormalVFunctor> VCMNormalEstimator;
567  KernelFunction chi_r( 1.0, r );
568  VCMNormalEstimator estimator;
569  estimator.attach( *surface );
570  estimator.setParams( embType, R, r, chi_r, t, Metric(), verbose > 0 );
571  estimator.init( h, surfels.begin(), surfels.end() );
572  estimator.eval( surfels.begin(), surfels.end(),
573  std::back_inserter( n_estimations ) );
574  }
575  else
576  {
577  trace.warning() << "[ShortcutsGeometry::getVCMNormalVectors] Unknown kernel: "
578  << kernel << std::endl;
579  }
580  return n_estimations;
581  }
582 
601  static RealVectors
603  const SurfelRange& surfels,
604  const Parameters& params
606  | parametersKSpace() )
607  {
608  auto K = getKSpace( bimage, params );
609  return getIINormalVectors( *bimage, K, surfels, params );
610  }
611 
637  static RealVectors
639  const SurfelRange& surfels,
640  const Parameters& params
642  | parametersKSpace()
644  {
645  auto K = getKSpace( params );
646  return getIINormalVectors( *dshape, K, surfels, params );
647  }
648 
669  template <typename TPointPredicate>
670  static RealVectors
671  getIINormalVectors( const TPointPredicate& shape,
672  const KSpace& K,
673  const SurfelRange& surfels,
674  const Parameters& params
676  | parametersKSpace() )
677  {
678  typedef functors::IINormalDirectionFunctor<Space> IINormalFunctor;
680  <KSpace, TPointPredicate, IINormalFunctor> IINormalEstimator;
681 
682  RealVectors n_estimations;
683  int verbose = params[ "verbose" ].as<int>();
684  Scalar h = params[ "gridstep" ].as<Scalar>();
685  Scalar r = params[ "r-radius" ].as<Scalar>();
686  Scalar alpha = params[ "alpha" ].as<Scalar>();
687  if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
688  if ( verbose > 0 )
689  {
690  trace.info() << "- II normal alpha=" << alpha << std::endl;
691  trace.info() << "- II normal r=" << (r*h) << " (continuous) "
692  << r << " (discrete)" << std::endl;
693  }
694  IINormalFunctor functor;
695  functor.init( h, r*h );
696  IINormalEstimator ii_estimator( functor );
697  ii_estimator.attach( K, shape );
698  ii_estimator.setParams( r );
699  ii_estimator.init( h, surfels.begin(), surfels.end() );
700  ii_estimator.eval( surfels.begin(), surfels.end(),
701  std::back_inserter( n_estimations ) );
702  const RealVectors n_trivial = getTrivialNormalVectors( K, surfels );
703  orientVectors( n_estimations, n_trivial );
704  return n_estimations;
705  }
706 
707 
726  static Scalars
728  const SurfelRange& surfels,
729  const Parameters& params
731  | parametersKSpace() )
732  {
733  auto K = getKSpace( bimage, params );
734  return getIIMeanCurvatures( *bimage, K, surfels, params );
735  }
736 
762  static Scalars
764  const SurfelRange& surfels,
765  const Parameters& params
767  | parametersKSpace()
769  {
770  auto K = getKSpace( params );
771  return getIIMeanCurvatures( *dshape, K, surfels, params );
772  }
773 
774 
796  template <typename TPointPredicate>
797  static Scalars
798  getIIMeanCurvatures( const TPointPredicate& shape,
799  const KSpace& K,
800  const SurfelRange& surfels,
801  const Parameters& params
803  | parametersKSpace() )
804  {
805  typedef functors::IIMeanCurvature3DFunctor<Space> IIMeanCurvFunctor;
807  <KSpace, TPointPredicate, IIMeanCurvFunctor> IIMeanCurvEstimator;
808 
809  Scalars mc_estimations;
810  int verbose = params[ "verbose" ].as<int>();
811  Scalar h = params[ "gridstep" ].as<Scalar>();
812  Scalar r = params[ "r-radius" ].as<Scalar>();
813  Scalar alpha = params[ "alpha" ].as<Scalar>();
814  if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
815  if ( verbose > 0 )
816  {
817  trace.info() << "- II mean curvature alpha=" << alpha << std::endl;
818  trace.info() << "- II mean curvature r=" << (r*h) << " (continuous) "
819  << r << " (discrete)" << std::endl;
820  }
821  IIMeanCurvFunctor functor;
822  functor.init( h, r*h );
823  IIMeanCurvEstimator ii_estimator( functor );
824  ii_estimator.attach( K, shape );
825  ii_estimator.setParams( r );
826  ii_estimator.init( h, surfels.begin(), surfels.end() );
827  ii_estimator.eval( surfels.begin(), surfels.end(),
828  std::back_inserter( mc_estimations ) );
829  return mc_estimations;
830  }
831 
850  static Scalars
852  const SurfelRange& surfels,
853  const Parameters& params
855  | parametersKSpace() )
856  {
857  auto K = getKSpace( bimage, params );
858  return getIIGaussianCurvatures( *bimage, K, surfels, params );
859  }
860 
886  static Scalars
888  const SurfelRange& surfels,
889  const Parameters& params
891  | parametersKSpace()
893  {
894  auto K = getKSpace( params );
895  return getIIGaussianCurvatures( *dshape, K, surfels, params );
896  }
897 
898 
920  template <typename TPointPredicate>
921  static Scalars
922  getIIGaussianCurvatures( const TPointPredicate& shape,
923  const KSpace& K,
924  const SurfelRange& surfels,
925  const Parameters& params
927  | parametersKSpace() )
928  {
929  typedef functors::IIGaussianCurvature3DFunctor<Space> IIGaussianCurvFunctor;
931  <KSpace, TPointPredicate, IIGaussianCurvFunctor> IIGaussianCurvEstimator;
932 
933  Scalars mc_estimations;
934  int verbose = params[ "verbose" ].as<int>();
935  Scalar h = params[ "gridstep" ].as<Scalar>();
936  Scalar r = params[ "r-radius" ].as<Scalar>();
937  Scalar alpha = params[ "alpha" ].as<Scalar>();
938  if ( alpha != 1.0 ) r *= pow( h, alpha-1.0 );
939  if ( verbose > 0 )
940  {
941  trace.info() << "- II Gaussian curvature alpha=" << alpha << std::endl;
942  trace.info() << "- II Gaussian curvature r=" << (r*h) << " (continuous) "
943  << r << " (discrete)" << std::endl;
944  }
945  IIGaussianCurvFunctor functor;
946  functor.init( h, r*h );
947  IIGaussianCurvEstimator ii_estimator( functor );
948  ii_estimator.attach( K, shape );
949  ii_estimator.setParams( r );
950  ii_estimator.init( h, surfels.begin(), surfels.end() );
951  ii_estimator.eval( surfels.begin(), surfels.end(),
952  std::back_inserter( mc_estimations ) );
953  return mc_estimations;
954  }
955 
956 
957 
958  // ------------------------- Error measures services -------------------------
959 
965  static void
967  const RealVectors& ref_v )
968  {
969  std::transform( ref_v.cbegin(), ref_v.cend(), v.cbegin(), v.begin(),
970  [] ( RealVector rw, RealVector w )
971  { return rw.dot( w ) >= 0.0 ? w : -w; } );
972  }
973 
978  static ScalarStatistic
979  getStatistic( const Scalars& v )
980  {
981  ScalarStatistic stat;
982  stat.addValues( v.begin(), v.end() );
983  stat.terminate();
984  return stat;
985  }
986 
993  static Scalars
995  const RealVectors& v2 )
996  {
997  Scalars v( v1.size() );
998  if ( v1.size() == v2.size() )
999  {
1000  auto outIt = v.begin();
1001  for ( auto it1 = v1.cbegin(), it2 = v2.cbegin(), itE1 = v1.cend();
1002  it1 != itE1; ++it1, ++it2 )
1003  {
1004  Scalar angle_error = acos( (*it1).dot( *it2 ) );
1005  *outIt++ = angle_error;
1006  }
1007  }
1008  else
1009  {
1010  trace.warning() << "[ShortcutsGeometry::getVectorsAngleDeviation]"
1011  << " v1.size()=" << v1.size() << " should be equal to "
1012  << " v2.size()=" << v2.size() << std::endl;
1013  }
1014  return v;
1015  }
1016 
1021  static Scalars
1023  const Scalars & v2 )
1024  {
1025  Scalars result( v1.size() );
1026  std::transform( v2.cbegin(), v2.cend(), v1.cbegin(), result.begin(),
1027  [] ( Scalar val1, Scalar val2 )
1028  { return fabs( val1 - val2 ); } );
1029  return result;
1030  }
1031 
1038  static Scalar
1040  const Scalars & v2 )
1041  {
1042  Scalar sum = 0;
1043  for ( unsigned int i = 0; i < v1.size(); i++ )
1044  sum += ( v1[ i ] - v2[ i ] ) * ( v1[ i ] - v2[ i ] );
1045  return sqrt( sum / v1.size() );
1046  }
1047 
1054  static Scalar
1056  const Scalars & v2 )
1057  {
1058  Scalar sum = 0;
1059  for ( unsigned int i = 0; i < v1.size(); i++ )
1060  sum += fabs( v1[ i ] - v2[ i ] );
1061  return sum / v1.size();
1062  }
1063 
1070  static Scalar
1072  const Scalars & v2 )
1073  {
1074  Scalar loo = 0;
1075  for ( unsigned int i = 0; i < v1.size(); i++ )
1076  loo = std::max( loo, fabs( v1[ i ] - v2[ i ] ) );
1077  return loo;
1078  }
1079 
1080  // ----------------------- Standard services ------------------------------
1081  public:
1082 
1086  ShortcutsGeometry() = delete;
1087 
1091  ~ShortcutsGeometry() = delete;
1092 
1097  ShortcutsGeometry ( const ShortcutsGeometry & other ) = delete;
1098 
1103  ShortcutsGeometry ( ShortcutsGeometry && other ) = delete;
1104 
1110  ShortcutsGeometry & operator= ( const ShortcutsGeometry & other ) = delete;
1111 
1117  ShortcutsGeometry & operator= ( ShortcutsGeometry && other ) = delete;
1118 
1119  // ----------------------- Interface --------------------------------------
1120  public:
1121 
1122  // ------------------------- Protected Datas ------------------------------
1123  protected:
1124 
1125  // ------------------------- Private Datas --------------------------------
1126  private:
1127 
1128  // ------------------------- Hidden services ------------------------------
1129  protected:
1130 
1131  // ------------------------- Internals ------------------------------------
1132  private:
1133 
1134  }; // end of class ShortcutsGeometry
1135 
1136 
1137 } // namespace DGtal
1138 
1139 
1141 // Includes inline functions.
1142 
1143 // //
1145 
1146 #endif // !defined ShortcutsGeometry_h
1147 
1148 #undef ShortcutsGeometry_RECURSES
1149 #endif // else defined(ShortcutsGeometry_RECURSES)
1150 
static Scalars getIIMeanCurvatures(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
std::vector< Surfel > SurfelRange
LightDigitalSurface::Face Face
ShortcutsGeometry & operator=(const ShortcutsGeometry &other)=delete
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, NormalFunctor > TrueNormalEstimator
void init(const Scalar _h, SurfelConstIterator itb, SurfelConstIterator ite)
static Scalar getScalarsNormL2(const Scalars &v1, const Scalars &v2)
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, PositionFunctor > TruePositionEstimator
InHalfPlaneBySimple3x3Matrix< Point, double > Functor
static Scalars getMeanCurvatures(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
SetOfSurfels< KSpace, SurfelSet > ExplicitSurfaceContainer
defines a heavy container that represents any digital surface.
std::vector< Arc > ArcRange
The range of arcs is defined as a vector.
Aim: Estimates normal vector by convolution of elementary normal vector to adjacent surfel.
TKSpace KSpace
Digital cellular space.
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
::DGtal::DigitalSurface< LightSurfaceContainer > LightDigitalSurface
defines a connected digital surface over a binary image.
Aim: This class adapts a VoronoiCovarianceMeasureOnDigitalSurface to be a model of CDigitalSurfaceLoc...
static RealVectors getNormalVectors(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
Aim: A functor RealPoint -> Quantity that returns the position of the point itself.
void attach(ConstAlias< Shape > aShape)
ImageContainerBySTLVector< Domain, float > FloatImage
defines a float image with (hyper-)rectangular domain.
ImageContainerBySTLVector< Domain, GrayScale > GrayScaleImage
defines a grey-level image with (hyper-)rectangular domain.
IndexedDigitalSurface< ExplicitSurfaceContainer > IdxDigitalSurface
defines a connected or not indexed digital surface.
Aim: Smart pointer based on reference counts.
Definition: CountedPtr.h:79
Trace trace
Definition: Common.h:144
RealPoint nearestPoint(const RealPoint &aPoint, const double accuracy=0.0001, const int maxIter=20, const double gamma=0.5) const
::DGtal::Mesh< RealPoint > Mesh
bool sDirect(const SCell &p, Dimension k) const
Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.
std::vector< IdxSurfel > IdxSurfelRange
Space::RealPoint RealPoint
Point with floating-point coordinates.
std::vector< RealVector > RealVectors
Definition: Shortcuts.h:176
ShortcutsGeometry< TKSpace > Self
static Scalars getIIGaussianCurvatures(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
MPolynomial< Space::dimension, Scalar > ScalarPolynomial
defines a multi-variate polynomial : RealPoint -> Scalar
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
static Scalars getVectorsAngleDeviation(const RealVectors &v1, const RealVectors &v2)
DGtal::uint32_t Dimension
Definition: Common.h:127
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
Definition: Shortcuts.h:101
sgf::ShapeGaussianCurvatureFunctor< ImplicitShape3D > GaussianCurvatureFunctor
IdxDigitalSurface::Vertex IdxSurfel
LightImplicitDigitalSurface< KSpace, BinaryImage > LightSurfaceContainer
std::map< Cell, IdxVertex > Cell2Index
static RealPoints getPositions(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
LightDigitalSurface::Surfel Surfel
static Scalars getIIMeanCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
static ScalarStatistic getStatistic(const Scalars &v)
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, MeanCurvatureFunctor > TrueMeanCurvatureEstimator
Aim: A functor Surfel -> Quantity that returns the outer normal vector at given surfel.
auto dot(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::dotProduct(*this, v))
Dot product with a PointVector.
LightDigitalSurface::Cell Cell
static Scalars getIIGaussianCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
Shortcuts< TKSpace > Base
unsigned char GrayScale
The type for 8-bits gray-scale elements.
Aim: Represents a multivariate polynomial, i.e. an element of , where K is some ring or field.
Definition: MPolynomial.h:58
Aim: This class processes a set of sample values for one variable and can then compute different stat...
Definition: Statistic.h:69
static RealVectors getCTrivialNormalVectors(CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation())
Aim: This class implement an Integral Invariant estimator which computes for each surfel the covarian...
TKSpace KSpace
Digital cellular space.
Definition: Shortcuts.h:108
ImageContainerBySTLVector< Domain, bool > BinaryImage
defines a black and white image with (hyper-)rectangular domain.
Aim: This class implement an Integral Invariant estimator which computes for each surfel the volume o...
KSpace::Space Space
Digital space.
std::vector< Cell > CellRange
KSpace::SurfelSet SurfelSet
defines a set of surfels
Aim: implements separable l_p metrics with exact predicates.
static Scalars getIIGaussianCurvatures(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
SCellRange SurfelRange
Definition: Shortcuts.h:173
Dimension sOrthDir(const SCell &s) const
Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is c...
IdxDigitalSurface::ArcRange IdxArcRange
std::vector< Scalar > Scalars
DigitalSurfaceContainer::SCell SCell
Aim: This class specializes the Voronoi covariance measure for digital surfaces. It adds notably the ...
Aim: A functor RealPoint -> Quantity that returns the mean curvature at given point.
void addValues(Iter b, Iter e)
std::map< Surfel, IdxSurfel > Surfel2Index
std::vector< RealPoint > RealPoints
Space::Vector Vector
Vector with integer coordinates.
static void orientVectors(RealVectors &v, const RealVectors &ref_v)
Aim: A functor Matrix -> RealVector that returns the normal direction by diagonalizing the given cova...
std::set< IdxSurfel > IdxSurfelSet
Aim: A class for computing the Gauss digitization of some Euclidean shape, i.e. its intersection with...
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition: Shortcuts.h:327
DigitalSurfaceContainer::Cell Cell
HyperRectDomain< Space > Domain
An (hyper-)rectangular domain.
void setParams(ConstAlias< KSpace > ks, Clone< GeometricFunctor > fct, const int maxIter=20, const Scalar accuracy=0.0001, const Scalar gamma=0.5)
LightDigitalSurface::Vertex Vertex
static Scalars getIIMeanCurvatures(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
::DGtal::DigitalSurface< ExplicitSurfaceContainer > DigitalSurface
defines an arbitrary digital surface over a binary image.
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
static Parameters parametersGeometryEstimation()
Space::Integer Integer
Integer numbers.
ImageContainerBySTLVector< Domain, double > DoubleImage
defines a double image with (hyper-)rectangular domain.
Surfel Vertex
Defines the type for a vertex.
Aim: A functor RealPoint -> Quantity that returns the normal vector at given point.
static RealVectors getIINormalVectors(CountedPtr< DigitizedImplicitShape3D > dshape, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace()|parametersDigitizedImplicitShape3D())
static Parameters defaultParameters()
IdxDigitalSurface::Arc IdxArc
RealVector::Component Scalar
Floating-point numbers.
Definition: Shortcuts.h:122
LightDigitalSurface::ArcRange ArcRange
static Scalars getScalarsAbsoluteDifference(const Scalars &v1, const Scalars &v2)
DGtal is the top-level namespace which contains all DGtal functions and types.
static Parameters parametersKSpace()
Definition: Shortcuts.h:306
sgf::ShapeMeanCurvatureFunctor< ImplicitShape3D > MeanCurvatureFunctor
static Scalar getScalarsNormL1(const Scalars &v1, const Scalars &v2)
Quantity eval(SurfelConstIterator it) const
int max(int a, int b)
Aim: An estimator on digital surfaces that returns the reference local geometric quantity....
Aim: A functor Real -> Real that returns the 3d mean curvature by transforming the given volume....
std::ostream & warning()
std::ostream & info()
Aim: Represents a digital surface with the topology of its dual surface. Its aim is to mimick the sta...
TrueDigitalSurfaceLocalEstimator< KSpace, ImplicitShape3D, GaussianCurvatureFunctor > TrueGaussianCurvatureEstimator
::DGtal::PolygonalSurface< RealPoint > PolygonalSurface
static Scalar getScalarsNormLoo(const Scalars &v1, const Scalars &v2)
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
ImplicitPolynomial3Shape< Space > ImplicitShape3D
static RealVectors getVCMNormalVectors(CountedPtr< TAnyDigitalSurface > surface, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation())
Aim: this class adapts any local functor on digital surface element to define a local estimator....
LightDigitalSurface::SCell SCell
static Parameters parametersDigitizedImplicitShape3D()
Definition: Shortcuts.h:456
std::vector< Scalar > Scalars
Definition: Shortcuts.h:175
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as connected surfels....
Definition: SetOfSurfels.h:73
GaussDigitizer< Space, ImplicitShape3D > DigitizedImplicitShape3D
defines the digitization of an implicit shape.
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
RealVector::Component Scalar
Floating-point numbers.
std::vector< RealPoint > RealPoints
Definition: Shortcuts.h:177
sgf::ShapeNormalVectorFunctor< ImplicitShape3D > NormalFunctor
HalfEdgeDataStructure::HalfEdgeIndex Arc
static RealVectors getIINormalVectors(const TPointPredicate &shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
Aim: A functor RealPoint -> Quantity that returns the gaussian curvature at given point.
::DGtal::TriangulatedSurface< RealPoint > TriangulatedSurface
static RealVectors getTrivialNormalVectors(const KSpace &K, const SurfelRange &surfels)
Space::Point Point
Point with integer coordinates.
static Self zero
Static const for zero PointVector.
Definition: PointVector.h:1582
IdxDigitalSurface::Vertex IdxVertex
KSpace K
Space::RealVector RealVector
Vector with floating-point coordinates.
std::vector< RealVector > RealVectors
static RealVectors getIINormalVectors(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
DigitalSurfaceContainer::Surfel Surfel
static Scalars getGaussianCurvatures(CountedPtr< ImplicitShape3D > shape, const KSpace &K, const SurfelRange &surfels, const Parameters &params=parametersShapeGeometry())
static Parameters parametersShapeGeometry()
sgf::ShapePositionFunctor< ImplicitShape3D > PositionFunctor
Aim: A functor Matrix -> Real that returns the Gaussian curvature by diagonalizing the given covarian...
Surfel2PointEmbedding
Possible embeddings for surfel as point(s)
::DGtal::Statistic< Scalar > ScalarStatistic
Aim: This class is used to simplify shape and surface creation. With it, you can create new shapes an...
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
LightDigitalSurface::Arc Arc