Several scalar field treatment algorithms (gradient, classification, etc.)
More...
#include <ScalarFieldTools.h>
|
static ScalarType | computeMeanScalarValue (GenericCloud *theCloud) |
| Computes the mean value of a scalar field associated to a cloud. More...
|
|
static ScalarType | computeMeanSquareScalarValue (GenericCloud *theCloud) |
| Computes the mean square value of a scalar field associated to a cloud. More...
|
|
static int | computeScalarFieldGradient (GenericIndexedCloudPersist *theCloud, PointCoordinateType radius, bool euclideanDistances, bool sameInAndOutScalarField=false, GenericProgressCallback *progressCb=nullptr, DgmOctree *theOctree=nullptr) |
| Computes the geometrical gradient of a scalar field associated to a point cloud. More...
|
|
static bool | applyScalarFieldGaussianFilter (PointCoordinateType sigma, GenericIndexedCloudPersist *theCloud, PointCoordinateType sigmaSF, GenericProgressCallback *progressCb=nullptr, DgmOctree *theOctree=nullptr) |
| Computes a spatial gaussian filter on a scalar field associated to a point cloud. More...
|
|
static void | multiplyScalarFields (GenericIndexedCloud *firstCloud, GenericIndexedCloud *secondCloud, GenericProgressCallback *progressCb=nullptr) |
| Multiplies two scalar fields of the same size. More...
|
|
static void | computeScalarFieldHistogram (const GenericCloud *theCloud, unsigned numberOfClasses, std::vector< int > &histo) |
| Computes an histogram of the scalar field with a given number of classes. More...
|
|
static void | computeScalarFieldExtremas (const GenericCloud *theCloud, ScalarType &minV, ScalarType &maxV) |
| Compute the extreme values of a scalar field. More...
|
|
static unsigned | countScalarFieldValidValues (const GenericCloud *theCloud) |
| Count the number of valid values in a scalar field. More...
|
|
static bool | computeKmeans (const GenericCloud *theCloud, unsigned char K, KMeanClass kmcc[], GenericProgressCallback *progressCb=nullptr) |
| Classifies automaticaly a scalar field in K classes with the K-means algorithm. More...
|
|
static void | SetScalarValueToNaN (const CCVector3 &P, ScalarType &scalarValue) |
| Sets the distance value associated to a point. More...
|
|
static void | SetScalarValueToZero (const CCVector3 &P, ScalarType &scalarValue) |
| Sets the distance value associated to a point to zero. More...
|
|
static void | SetScalarValueInverted (const CCVector3 &P, ScalarType &scalarValue) |
|
Several scalar field treatment algorithms (gradient, classification, etc.)
This toolbox provides several algorithms to apply treatments and handle scalar fields
◆ applyScalarFieldGaussianFilter()
Computes a spatial gaussian filter on a scalar field associated to a point cloud.
The "amplitutde" of the gaussian filter must be precised (sigma). As 99% of the gaussian distribution is between -3*sigma and +3*sigma around the mean value, this filter will only look for neighbouring points (around each point) in a sphere of radius 3*sigma. It also permits to use the filter as a bilateral filter. Where the wights are computed also considering the distance of the neighbor's scalar value from the current point scalar value. (weighted with gaussian as distances are) Warning: this method assumes the input scalar field is different from output.
- Parameters
-
sigma | filter variance |
theCloud | a point cloud (associated to scalar values) |
sigmaSF | the sigma for the bilateral filter. when different than -1 turns the gaussian filter into a bilateral filter |
progressCb | the client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
theOctree | the octree, if it has already been computed |
- Returns
- success
◆ computeCellGaussianFilter()
"Cellular" function to apply a gaussian filter on the scalar values of points inside an octree cell
This function is meant to be applied to all cells of the octree The method also permits to use a bilateral behaviour for the filter. This is automatically switched on if its sigmaSF parameter in additionalParameters is different than -1 (it is of the form DgmOctree::localFunctionPtr). See ScalarFieldTools::applyScalarFieldGaussianFilter. Method parameters (defined in "additionalParameters") are :
- (PointCoordinateType*) sigma
- (std::vector<ScalarType>*) the smoothed values
- Parameters
-
cell | structure describing the cell on which processing is applied |
additionalParameters | see method description |
nProgress | optional (normalized) progress notification (per-point) |
◆ computeKmeans()
Classifies automaticaly a scalar field in K classes with the K-means algorithm.
The initial K classes positions are regularly spaced between the lowest and the highest values of the scalar field. Eventually the algorithm will converge and produce K classes.
- Parameters
-
theCloud | a point cloud (associated to scalar values) |
K | the number of classes |
kmcc | an array of size K which will be filled with the computed classes limits (see ScalarFieldTools::KmeanClass) |
progressCb | the client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
◆ computeMeanGradientOnPatch()
"Cellular" function to compute the gradient norms of points inside an octree cell
This function is meant to be applied to all cells of the octree (it is of the form DgmOctree::localFunctionPtr). See ScalarFieldTools::computeScalarFieldGradient. Method parameters (defined in "additionalParameters") are :
- (GenericCloud*) the point cloud
- (bool*) specifies if the scalar values are euclidean distances
- (PointCoordinateType*) radius
- (std::vector<ScalarType>*) the gradient norms container
- Parameters
-
cell | structure describing the cell on which processing is applied |
additionalParameters | see method description |
nProgress | optional (normalized) progress notification (per-point) |
◆ computeMeanScalarValue()
ScalarType ScalarFieldTools::computeMeanScalarValue |
( |
GenericCloud * |
theCloud | ) |
|
|
static |
Computes the mean value of a scalar field associated to a cloud.
Returns the mean of SF values associated to each point of a cloud Warning: be sure to activate an OUTPUT scalar field on the cloud
- Parameters
-
- Returns
- the associated scalar field mean value
◆ computeMeanSquareScalarValue()
ScalarType ScalarFieldTools::computeMeanSquareScalarValue |
( |
GenericCloud * |
theCloud | ) |
|
|
static |
Computes the mean square value of a scalar field associated to a cloud.
Returns the mean of squared SF values associated to each point of a cloud Warning: be sure to activate an OUTPUT scalar field on the cloud
- Parameters
-
- Returns
- the associated scalar field mean of squares value
◆ computeScalarFieldExtremas()
void ScalarFieldTools::computeScalarFieldExtremas |
( |
const GenericCloud * |
theCloud, |
|
|
ScalarType & |
minV, |
|
|
ScalarType & |
maxV |
|
) |
| |
|
static |
Compute the extreme values of a scalar field.
- Parameters
-
theCloud | a point cloud, with a scalar field activated |
minV | a field to store the minimum value |
maxV | a field to store the maximum value |
◆ computeScalarFieldGradient()
Computes the geometrical gradient of a scalar field associated to a point cloud.
See Daniel Girardeau-Montaut's PhD manuscript (Chapter 3, section 3.3.2) for more information. As explained in this section, if the scalar field corresponds to (euclidean) distances between the points and another entity, then it is possible to filter out aberrant values.
- Parameters
-
theCloud | a point cloud (associated to scalar values) |
radius | spherical neighborhood size (or 0 for automatic size) |
euclideanDistances | indicates if the scalar values are euclidean distances |
sameInAndOutScalarField | specifies that the 'in' and 'out' scalar field of the input point cloud are the same structure |
progressCb | the client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
theOctree | the octree, if it has already been computed |
- Returns
- error code (0 if ok)
◆ computeScalarFieldHistogram()
void ScalarFieldTools::computeScalarFieldHistogram |
( |
const GenericCloud * |
theCloud, |
|
|
unsigned |
numberOfClasses, |
|
|
std::vector< int > & |
histo |
|
) |
| |
|
static |
Computes an histogram of the scalar field with a given number of classes.
The scalar values are projected in a given number of classes, regularly spaced between the lowest and the highest value of the scalar field.
- Parameters
-
theCloud | a point cloud (associated to scalar values) |
numberOfClasses | number of histogram classes |
histo | number of elements per histogram class |
◆ countScalarFieldValidValues()
unsigned ScalarFieldTools::countScalarFieldValidValues |
( |
const GenericCloud * |
theCloud | ) |
|
|
static |
Count the number of valid values in a scalar field.
- Parameters
-
theCloud | a point cloud, with a scalar field activated |
◆ multiplyScalarFields()
Multiplies two scalar fields of the same size.
The first scalar field is updated (S1 = S1*S2).
- Parameters
-
firstCloud | the first point cloud (associated to scalar values) |
secondCloud | the second point cloud (associated to scalar values) |
progressCb | the client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback) |
◆ SetScalarValueToNaN()
void ScalarFieldTools::SetScalarValueToNaN |
( |
const CCVector3 & |
P, |
|
|
ScalarType & |
scalarValue |
|
) |
| |
|
static |
Sets the distance value associated to a point.
Generic function that can be used with the GenericCloud::foreach() method.
- Parameters
-
P | a 3D point |
scalarValue | its associated scalar value |
◆ SetScalarValueToZero()
void ScalarFieldTools::SetScalarValueToZero |
( |
const CCVector3 & |
P, |
|
|
ScalarType & |
scalarValue |
|
) |
| |
|
static |
Sets the distance value associated to a point to zero.
Generic function that can be used with the GenericCloud::foreach() method.
- Parameters
-
P | a 3D point |
scalarValue | its associated scalar value |
The documentation for this class was generated from the following files:
- ScalarFieldTools.h
- ScalarFieldTools.cpp