DGtal  1.5.beta
DGtal::MeaningfulScaleAnalysis< TProfile > Class Template Reference

Aim: This class implements different methods used to define the meaningful scale analysis as proposed in [67] . In particular, it uses the Profile class to represent a multi-scale profile and to compute a meaningful scale. It also permits to get a noise estimation from the given profile. More...

#include <DGtal/math/MeaningfulScaleAnalysis.h>

Public Types

typedef TProfile Profile
 

Public Member Functions

 MeaningfulScaleAnalysis (ConstAlias< Profile > aProfile)
 
 ~MeaningfulScaleAnalysis ()
 
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
 
std::pair< bool, double > getSlopeFromMeaningfulScales (const double maxSlope=-0.2, const double minSlope=-1e10, const unsigned int minSize=2) 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
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Protected Member Functions

 MeaningfulScaleAnalysis ()
 

Protected Attributes

const ProfilemyProfile
 

Private Member Functions

 MeaningfulScaleAnalysis (const MeaningfulScaleAnalysis &other)
 
MeaningfulScaleAnalysisoperator= (const MeaningfulScaleAnalysis &other)
 

Detailed Description

template<typename TProfile>
class DGtal::MeaningfulScaleAnalysis< TProfile >

Aim: This class implements different methods used to define the meaningful scale analysis as proposed in [67] . In particular, it uses the Profile class to represent a multi-scale profile and to compute a meaningful scale. It also permits to get a noise estimation from the given profile.

Description of class 'MeaningfulScaleAnalysis'

A typical example is for instance the length of maximal segments obtained at different scales.

First we construct a Profile:

// we need to have the Profile header:
#include "DGtal/math/Profile.h"
// with a log functor to obtain log scale profile:
struct LogFct{
float operator()(const float &a) const {
return log(a);
}
};
...
Profile<LogFct> sp (Profile<LogFct>::MEAN);
sp.init(6);

Then, we can add values to the profile:

sp.addValue(0,22);
sp.addValue(1,15);
sp.addValue(2,8);
sp.addValue(3,17);
sp.addValue(4,7);
sp.addValue(5,2);

Finally we can construct the MeaningfulScaleAnalysis object and obtain the meaningful scale:

MeaningfulScaleAnalysis<Profile<LogFct>> msa(sp);
std::vector< std::pair<uint, uint> > intervals;
msa.computeMeaningfulScales(intervals, 1);
unsigned int n = msa.noiseLevel();
See also
testMeaningfulScaleAnalysis
Template Parameters
TProfilethe type of the profile class.

Definition at line 112 of file MeaningfulScaleAnalysis.h.

Member Typedef Documentation

◆ Profile

template<typename TProfile >
typedef TProfile DGtal::MeaningfulScaleAnalysis< TProfile >::Profile

Definition at line 117 of file MeaningfulScaleAnalysis.h.

Constructor & Destructor Documentation

◆ MeaningfulScaleAnalysis() [1/3]

template<typename TProfile >
DGtal::MeaningfulScaleAnalysis< TProfile >::MeaningfulScaleAnalysis ( ConstAlias< Profile aProfile)

Constructor

◆ ~MeaningfulScaleAnalysis()

template<typename TProfile >
DGtal::MeaningfulScaleAnalysis< TProfile >::~MeaningfulScaleAnalysis ( )

Destructor.

◆ MeaningfulScaleAnalysis() [2/3]

template<typename TProfile >
DGtal::MeaningfulScaleAnalysis< TProfile >::MeaningfulScaleAnalysis ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

◆ MeaningfulScaleAnalysis() [3/3]

template<typename TProfile >
DGtal::MeaningfulScaleAnalysis< TProfile >::MeaningfulScaleAnalysis ( const MeaningfulScaleAnalysis< TProfile > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ computeMeaningfulScales()

template<typename TProfile >
void DGtal::MeaningfulScaleAnalysis< TProfile >::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

A meaningful scale is an interval of scales of length no smaller than [min_width] and in which the profile has slopes below [max_slope] and above [min_slope]. This method computes the sequence of meaningful scales for surfel [idx].

Parameters
[out]intervals(returns) a list of meaningful scales.
[in]minSizethe minimum length for the meaningful scales.
[in]maxSlopethe maximum allowed slope for length evolution.
[in]minSlopethe minimum allowed slope for length evolution.

Referenced by TEST_CASE().

◆ getSlopeFromMeaningfulScales()

template<typename TProfile >
std::pair<bool, double> DGtal::MeaningfulScaleAnalysis< TProfile >::getSlopeFromMeaningfulScales ( const double  maxSlope = -0.2,
const double  minSlope = -1e10,
const unsigned int  minSize = 2 
) const

Compute the profile slope of the first meaningful scale interval computed by a simple linear regression model.

Returns
a pair<bool, double> giving the slope and indicating if a meaningful scale was found or not. If no meaningful scale interval was found, it simply return the slope obtained from the linear regression.
Parameters
[in]maxSlopethe maximum allowed slope for length evolution.
[in]minSlopethe minimum allowed slope for length evolution.
[in]minSizethe minimum length for the meaningful scales.

Referenced by TEST_CASE().

◆ isValid()

template<typename TProfile >
bool DGtal::MeaningfulScaleAnalysis< TProfile >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ lowerBoundedNoiseLevel()

template<typename TProfile >
unsigned int DGtal::MeaningfulScaleAnalysis< TProfile >::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

The noise level is the first scale of the first meaningful scale. A meaningful scale is an interval of scales of length no smaller than [minWidth] and in which the profile has slopes below [maxSlope]. The lower bounded noise level also requires minimum lenghs for different scales. Therefore the profile must be greater that [lower_bound_at_scale_1]+[lower_bound_slope]*scale.

Parameters
[in]minSizethe minimum length for the meaningful scales.
[in]maxSlopethe maximum allowed slope for length evolution.
[in]minSlopethe minimum allowed slope for length evolution.
[in]lowerBoundAtScale1the lower bound for the profile at scale 1.
[in]lowerBoundSlopethe slope of the lower bound for the profile (for instance -1 for digital contours, -3 for digital image graphs since area values are divided by (scale)^3.
Returns
the noise level or zero is none was found.
See also
meaningfulScales

Referenced by TEST_CASE().

◆ noiseLevel()

template<typename TProfile >
unsigned int DGtal::MeaningfulScaleAnalysis< TProfile >::noiseLevel ( const unsigned int  minSize = 1,
const double  maxSlope = -0.2,
const double  minSlope = -1e10 
) const

The noise level is the first scale of the first meaningful scale. A meaningful scale is an interval of scales of length no smaller than [min_width] and in which the profile has slopes below [max_slope].

Parameters
[in]minSizethe minimum length for the meaningful scales.
[in]maxSlopethe maximum allowed slope for length evolution.
[in]minSlopethe minimum allowed slope for length evolution.
Returns
the noise level or zero is none was found.
See also
meaningfulScales

Referenced by TEST_CASE().

◆ operator=()

template<typename TProfile >
MeaningfulScaleAnalysis& DGtal::MeaningfulScaleAnalysis< TProfile >::operator= ( const MeaningfulScaleAnalysis< TProfile > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

◆ selfDisplay()

template<typename TProfile >
void DGtal::MeaningfulScaleAnalysis< TProfile >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

◆ myProfile

template<typename TProfile >
const Profile& DGtal::MeaningfulScaleAnalysis< TProfile >::myProfile
protected

Definition at line 234 of file MeaningfulScaleAnalysis.h.


The documentation for this class was generated from the following file: