DGtal  0.9.2
testMeaningfulScaleAnalysis.cpp
1 
30 #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);
76  msa.getSlopeFromMeaningfulScales(0,0,2);
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 
STL namespace.
Aim: This class implements different methods used to define the meaningful scale analysis as proposed...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This class can be used to represent a profile (PX, PY) defined from an input set of samples (Xi...
Definition: Profile.h:137