DGtal  1.2.0
testMeaningfulScaleAnalysis.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "ConfigTest.h"
34 #include "DGtalCatch.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/math/Profile.h"
37 #include "DGtal/math/MeaningfulScaleAnalysis.h"
38 
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 // Functions for testing class MeaningfulScaleAnalysis.
47 
48 
49 
50 
51 struct LogFct{
52  double operator()(const double &a) const {
53  return log(a);
54  }
55 };
56 
57 
58 TEST_CASE( "Testing MeaningfulScaleAnalysis" )
59 {
60 
62  sp.init(6);
63 
64  SECTION("Testing noise level detect of Profile")
65  {
66  sp.addValue(0,22);
67  sp.addValue(1,15);
68  sp.addValue(2,8);
69  sp.addValue(3,17);
70  sp.addValue(4,7);
71  sp.addValue(5,2);
72 
74  std::vector< std::pair<unsigned int, unsigned int> > interval;
75  msa.computeMeaningfulScales(interval, 1);
77  msa.lowerBoundedNoiseLevel(0,10,2,2,2);
78  unsigned int n = msa.noiseLevel();
79  REQUIRE( interval[0].first == 1 );
80  REQUIRE( interval[0].second == 3 );
81  REQUIRE( interval[1].first == 4 );
82  REQUIRE( n == 1 );
83  }
84 
85 
86 
87 }
88 
Aim: This class implements different methods used to define the meaningful scale analysis as proposed...
std::pair< bool, double > getSlopeFromMeaningfulScales(const double maxSlope=-0.2, const double minSlope=-1e10, const unsigned int minSize=2) const
void computeMeaningfulScales(std::vector< std::pair< unsigned int, unsigned int > > &intervals, const unsigned int minSize=1, const double maxSlope=-0.2, const double minSlope=-1e10) const
unsigned int noiseLevel(const unsigned int minSize=1, const double maxSlope=-0.2, const double minSlope=-1e10) const
unsigned int lowerBoundedNoiseLevel(const unsigned int minSize=1, const double maxSlope=-0.2, const double minSlope=-1e10, const double lowerBoundAtScale1=1.0, const double lowerBoundSlope=-2.0) const
Aim: This class can be used to represent a profile (PX, PY) defined from an input set of samples (Xi,...
Definition: Profile.h:137
void addValue(const unsigned int indexX, const TValue value)
void init(Iterator beginXvalues, Iterator endXvalues, const bool storeValsInStats=false)
DGtal is the top-level namespace which contains all DGtal functions and types.
TEST_CASE("Testing MeaningfulScaleAnalysis")
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))