CCCoreLib 31 May 2022
CloudCompare Core algorithms
Static Public Member Functions | Static Protected Member Functions | List of all members
CCCoreLib::StatisticalTestingTools Class Reference

Statistical testing algorithms (Chi2 distance computation, statistic filtering, etc.) More...

#include <StatisticalTestingTools.h>

Inheritance diagram for CCCoreLib::StatisticalTestingTools:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::StatisticalTestingTools:
Collaboration graph
[legend]

Static Public Member Functions

static double computeAdaptativeChi2Dist (const GenericDistribution *distrib, const GenericCloud *cloud, unsigned numberOfClasses, unsigned &finalNumberOfClasses, bool noClassCompression=false, const ScalarType *histoMin=nullptr, const ScalarType *histoMax=nullptr, unsigned *histoValues=nullptr, double *npis=nullptr)
 Computes the Chi2 distance on a sample of scalar values. More...
 
static double computeChi2Fractile (double p, int d)
 Computes the Chi2 fractile. More...
 
static double computeChi2Probability (double chi2result, int d)
 Computes the Chi2 confidence probability. More...
 
static double testCloudWithStatisticalModel (const GenericDistribution *distrib, GenericIndexedCloudPersist *theCloud, unsigned numberOfNeighbours, double pTrust, GenericProgressCallback *progressCb=nullptr, DgmOctree *inputOctree=nullptr)
 Classfies the point cloud in two category by locally applying a statistical (Chi2) test. More...
 

Static Protected Member Functions

static bool computeLocalChi2DistAtLevel (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr)
 Computes (locally) the Chi2 distance inside an octree cell. More...
 

Detailed Description

Statistical testing algorithms (Chi2 distance computation, statistic filtering, etc.)

Member Function Documentation

◆ computeAdaptativeChi2Dist()

double StatisticalTestingTools::computeAdaptativeChi2Dist ( const GenericDistribution distrib,
const GenericCloud cloud,
unsigned  numberOfClasses,
unsigned &  finalNumberOfClasses,
bool  noClassCompression = false,
const ScalarType *  histoMin = nullptr,
const ScalarType *  histoMax = nullptr,
unsigned *  histoValues = nullptr,
double *  npis = nullptr 
)
static

Computes the Chi2 distance on a sample of scalar values.

The Chi2 distance is computed between an empiric distribution generated from a set of scalar values (with a specific number of classes), and a theoretical distribution. It assures that each class of the empirical distribution is such that it respects n.pi>=5 (where n is the total number of points, and pi is the cumulative probability of the class). Therefore the number of classes can be changed by the method. If the 'noClassCompression' parameter is set to true, the above condition is not checked and distance can diverge (which should not be possible according to the Chi2 Test theory, but it can be useful for classification purposes).

Parameters
distriba theoretical distribution
clouda subset of points (associated to scalar values)
numberOfClassesinitial number of classes for the empirical distribution (0 for automatic determination, >1 otherwise)
finalNumberOfClassesfinal number of classes of the empirical distribution
noClassCompressionprevent the algorithm from performing classes compression (faster but less accurate)
histoMin[optional] minimum histogram value
histoMax[optional] maximum histogram value
[out]histoValues[optional] histogram array (its size should be equal to the initial number of classes)
[out]npis[optional] array containing the theoretical probabilities for each class (its size should be equal to the initial number of classes)
Returns
the Chi2 distance (or -1.0 if an error occurred)

◆ computeChi2Fractile()

double StatisticalTestingTools::computeChi2Fractile ( double  p,
int  d 
)
static

Computes the Chi2 fractile.

Returns the max Chi2 Distance for a given "confidence" probability and a given number of "degrees of liberty" (equivalent to the number of classes-1).

Parameters
pthe result "confidence"
dthe number of d.o.l.
Returns
the Chi2 fractile

◆ computeChi2Probability()

double StatisticalTestingTools::computeChi2Probability ( double  chi2result,
int  d 
)
static

Computes the Chi2 confidence probability.

Returns the Chi2 confidence probability for a given Chi2 distance value and a given number of "degress of liberty" (equivalent to the number of classes-1).

Parameters
chi2resultthe Chi2 distance
dthe number of d.o.l.
Returns
the Chi2 confidence probability

◆ computeLocalChi2DistAtLevel()

bool StatisticalTestingTools::computeLocalChi2DistAtLevel ( const DgmOctree::octreeCell cell,
void **  additionalParameters,
NormalizedProgress nProgress = nullptr 
)
staticprotected

Computes (locally) the Chi2 distance inside an octree cell.

Additional parameters are:

  • (GenericDistribution*) the theoretical noise distribution
  • (int) the size of a neighbourhood for local analysis
  • (int) the number of classes for the Chi2 distance computation
  • (unsigned*) a pre-allocated array (of a size equal to the number of classes)for computation acceleration
  • (bool) specifies whether negative values should be included in computation
    Parameters
    cellstructure describing the cell on which processing is applied
    additionalParameterssee method description
    nProgressoptional (normalized) progress notification (per-point)

◆ testCloudWithStatisticalModel()

double StatisticalTestingTools::testCloudWithStatisticalModel ( const GenericDistribution distrib,
GenericIndexedCloudPersist theCloud,
unsigned  numberOfNeighbours,
double  pTrust,
GenericProgressCallback progressCb = nullptr,
DgmOctree inputOctree = nullptr 
)
static

Classfies the point cloud in two category by locally applying a statistical (Chi2) test.

This algorithm is described in Daniel Girardeau-Montaut's PhD manuscript (Chapter 3. section 3.2.3). It mainly consists in determining if a point associated scalar value is part of the measurements noise (in which case the point will be considered as "unchanged") or if not (in which case the point will be considered as a trully "changed"). This determination is based on a statistical analysis (Chi2 Test) of the scalar values distribution around each point (by considering a small neighbourhood of points around each point). The classification result will depend on the Chi2 Test parameters (e.g. the number of classes - which in this case is equal to the square root of the neighbourhood size - and the confidence probability - the greater it is, the more severe the result is). WARNING : the scalar field behind the GenericIndexedCloud interface should be splet in 2, one for reading the scalar values to test (OUT - getScalarValue) and the other to save the resulting Chi2 distance (IN - setScalarValue).

Parameters
distriba theoretical noise distribution
theCloudthe point cloud to classify
numberOfNeighboursthe neighbourhood size for the local analysis
pTrustthe Chi2 Test confidence probability
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
inputOctreethe cloud octree if it has already be computed
Returns
the distance threshold for filtering (or -1 if someting went wrong during the process)

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