DGtal  1.1.0
Typedefs | Functions
testIntegralInvariantShortcuts.cpp File Reference
#include <iostream>
#include <vector>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtalCatch.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/helpers/Shortcuts.h"
#include "DGtal/helpers/ShortcutsGeometry.h"
Include dependency graph for testIntegralInvariantShortcuts.cpp:

Go to the source code of this file.

Typedefs

typedef Shortcuts< Z3i::KSpaceSH3
 
typedef ShortcutsGeometry< Z3i::KSpaceSHG3
 

Functions

 TEST_CASE ("Testing IntegralInvariant Shortcuts API")
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2020/03/14

Functions for testing class IntegralInvariantShortcuts.

This file is part of the DGtal library.

Definition in file testIntegralInvariantShortcuts.cpp.

Typedef Documentation

◆ SH3

Definition at line 46 of file testIntegralInvariantShortcuts.cpp.

◆ SHG3

Definition at line 47 of file testIntegralInvariantShortcuts.cpp.

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Testing IntegralInvariant Shortcuts API"  )

Definition at line 53 of file testIntegralInvariantShortcuts.cpp.

54 {
56  params( "polynomial", "goursat" )( "gridstep", 1. );
57  auto implicit_shape = SH3::makeImplicitShape3D ( params );
58  auto digitized_shape = SH3::makeDigitizedImplicitShape3D( implicit_shape, params );
59  auto binary_image = SH3::makeBinaryImage( digitized_shape, params );
60  auto K = SH3::getKSpace( params );
61  auto embedder = SH3::getCellEmbedder( K );
62  auto surface = SH3::makeLightDigitalSurface( binary_image, K, params );
63  auto surfels = SH3::getSurfelRange( surface, params );
64 
65  trace.info() << "Nb surfels= " << surfels.size() << std::endl;
66 
67  //Computing some differential quantities
68  params("r-radius", 3.0);
69 
70  //We compute the curvature tensor, the mean and the Gaussian curvature
71  auto Tcurv = SHG3::getIIPrincipalCurvaturesAndDirections(binary_image, surfels, params);
72  auto Kcurv = SHG3::getIIGaussianCurvatures( binary_image, surfels, params);
73 
74  std::vector<double> k1,k2,G;
75  for(auto &result: Tcurv)
76  {
77  k1.push_back( std::get<0>(result) );
78  k2.push_back( std::get<1>(result) );
79  G.push_back( ( std::get<0>(result) * std::get<1>(result)) );
80  }
81 
82  SECTION("Testing that mean/Gaussian/tensor curvature shortucut values match")
83  {
84  for(std::size_t i = 0; i < G.size(); ++i)
85  REQUIRE( Kcurv[i] == Approx( G[i] ) );
86  }
87 }

References DGtal::Shortcuts< TKSpace >::defaultParameters(), DGtal::ShortcutsGeometry< TKSpace >::defaultParameters(), DGtal::Shortcuts< TKSpace >::getCellEmbedder(), DGtal::ShortcutsGeometry< TKSpace >::getIIGaussianCurvatures(), DGtal::ShortcutsGeometry< TKSpace >::getIIPrincipalCurvaturesAndDirections(), DGtal::Shortcuts< TKSpace >::getKSpace(), DGtal::Shortcuts< TKSpace >::getSurfelRange(), DGtal::Trace::info(), K, DGtal::Shortcuts< TKSpace >::makeBinaryImage(), DGtal::Shortcuts< TKSpace >::makeDigitizedImplicitShape3D(), DGtal::Shortcuts< TKSpace >::makeImplicitShape3D(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurface(), DGtal::ShortcutsGeometry< TKSpace >::parametersGeometryEstimation(), REQUIRE(), SECTION(), and DGtal::trace.

DGtal::Shortcuts::getCellEmbedder
static CanonicCellEmbedder< KSpace > getCellEmbedder(const KSpace &K)
Definition: Shortcuts.h:437
DGtal::trace
Trace trace
Definition: Common.h:150
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::ShortcutsGeometry::getIIGaussianCurvatures
static Scalars getIIGaussianCurvatures(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
Definition: ShortcutsGeometry.h:1105
REQUIRE
REQUIRE(domain.isInside(aPoint))
DGtal::ShortcutsGeometry::parametersGeometryEstimation
static Parameters parametersGeometryEstimation()
Definition: ShortcutsGeometry.h:644
DGtal::Trace::info
std::ostream & info()
DGtal::Shortcuts::defaultParameters
static Parameters defaultParameters()
Definition: Shortcuts.h:202
DGtal::Shortcuts::makeImplicitShape3D
static CountedPtr< ImplicitShape3D > makeImplicitShape3D(const Parameters &params=parametersImplicitShape3D())
Definition: Shortcuts.h:281
DGtal::Shortcuts::makeDigitizedImplicitShape3D
static CountedPtr< DigitizedImplicitShape3D > makeDigitizedImplicitShape3D(CountedPtr< ImplicitShape3D > shape, Parameters params=parametersDigitizedImplicitShape3D())
Definition: Shortcuts.h:522
DGtal::Shortcuts::makeLightDigitalSurface
static CountedPtr< LightDigitalSurface > makeLightDigitalSurface(CountedPtr< BinaryImage > bimage, const KSpace &K, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1061
DGtal::Shortcuts::getKSpace
static KSpace getKSpace(const Point &low, const Point &up, Parameters params=parametersKSpace())
Definition: Shortcuts.h:331
DGtal::ShortcutsGeometry::getIIPrincipalCurvaturesAndDirections
static CurvatureTensorQuantities getIIPrincipalCurvaturesAndDirections(CountedPtr< BinaryImage > bimage, const SurfelRange &surfels, const Parameters &params=parametersGeometryEstimation()|parametersKSpace())
Definition: ShortcutsGeometry.h:1230
DGtal::ShortcutsGeometry::defaultParameters
static Parameters defaultParameters()
Definition: ShortcutsGeometry.h:209
SECTION
SECTION("Testing constant forward iterators")
Definition: testSimpleRandomAccessRangeFromPoint.cpp:66
DGtal::Shortcuts::getSurfelRange
static SurfelRange getSurfelRange(CountedPtr< ::DGtal::DigitalSurface< TDigitalSurfaceContainer > > surface, const Parameters &params=parametersDigitalSurface())
Definition: Shortcuts.h:1546
DGtal::Shortcuts::makeBinaryImage
static CountedPtr< BinaryImage > makeBinaryImage(Domain shapeDomain)
Definition: Shortcuts.h:560