DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testMeaningfulScaleAnalysis.cpp
Go to the documentation of this file.
1
16
29
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
61
Profile<LogFct>
sp (
Profile<LogFct>::MEAN
);
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
73
MeaningfulScaleAnalysis<Profile<LogFct>
> msa(sp);
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
DGtal::MeaningfulScaleAnalysis
Aim: This class implements different methods used to define the meaningful scale analysis as proposed...
Definition
MeaningfulScaleAnalysis.h:113
DGtal::MeaningfulScaleAnalysis::getSlopeFromMeaningfulScales
std::pair< bool, double > getSlopeFromMeaningfulScales(const double maxSlope=-0.2, const double minSlope=-1e10, const unsigned int minSize=2) const
DGtal::MeaningfulScaleAnalysis::computeMeaningfulScales
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
DGtal::MeaningfulScaleAnalysis::noiseLevel
unsigned int noiseLevel(const unsigned int minSize=1, const double maxSlope=-0.2, const double minSlope=-1e10) const
DGtal::MeaningfulScaleAnalysis::lowerBoundedNoiseLevel
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
DGtal::Profile
Aim: This class can be used to represent a profile (PX, PY) defined from an input set of samples (Xi,...
Definition
Profile.h:137
DGtal::Profile::addValue
void addValue(const unsigned int indexX, const TValue value)
DGtal::Profile::init
void init(Iterator beginXvalues, Iterator endXvalues, const bool storeValsInStats=false)
DGtal::Profile::MEAN
@ MEAN
Definition
Profile.h:146
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
std
STL namespace.
LogFct
Definition
testMeaningfulScaleAnalysis.cpp:51
LogFct::operator()
double operator()(const double &a) const
Definition
testMeaningfulScaleAnalysis.cpp:52
TEST_CASE
TEST_CASE("int container traits", "[int][traits]")
Definition
testContainerTraits.cpp:53
SECTION
SECTION("Testing constant forward iterators")
Definition
testSimpleRandomAccessRangeFromPoint.cpp:66
REQUIRE
REQUIRE(domain.isInside(aPoint))
tests
math
testMeaningfulScaleAnalysis.cpp
Generated on
for DGtal by
1.18.0