![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Several scalar field treatment algorithms (gradient, classification, etc.) More...
#include <ScalarFieldTools.h>


Static Public Member Functions | |
| 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) |
| static bool | applyScalarFieldGaussianFilter (PointCoordinateType sigma, GenericIndexedCloudPersist *theCloud, PointCoordinateType sigmaSF, GenericProgressCallback *progressCb=nullptr, DgmOctree *theOctree=nullptr) |
| 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) |
| 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) |
Static Protected Member Functions | |
| static bool | computeMeanGradientOnPatch (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr) |
| static bool | computeCellGaussianFilter (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr) |
Several scalar field treatment algorithms (gradient, classification, etc.)
This toolbox provides several algorithms to apply treatments and handle scalar fields
Definition at line 35 of file ScalarFieldTools.h.
|
static |
Computes a spatial gaussian filter on a scalar field associated to a point cloud The "amplitutde" of the Gaussian filter must be specified (sigma). As 99% of the Gaussian distribution is between -3*sigma and +3*sigma around the mean value, this filter will only look for neighbors within a sphere of radius 3*sigma. One can also use the filter as a Bilateral filter. In this case the weights are computed considering the difference of the neighbors SF values with the current point SF value (also following a Gaussian distribution). Warning: this method assumes the input scalar field is different from the output one.
| sigma | filter variance |
| theCloud | a point cloud (associated to scalar values) |
| sigmaSF | if strictly positive, the variance for the 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 |
Definition at line 231 of file ScalarFieldTools.cpp.
References cloudViewer::DgmOctree::build(), computeCellGaussianFilter(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::executeFunctionForAllCellsAtLevel(), cloudViewer::DgmOctree::findBestLevelForAGivenNeighbourhoodSizeExtraction(), cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::GenericCloud::size(), cloudViewer::GenericProgressCallback::textCanBeEdited(), and cloudViewer::GenericProgressCallback::update().
Referenced by cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation(), and ccEntityAction::sfGaussianFilter().
|
staticprotected |
"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 :
| cell | structure describing the cell on which processing is applied |
| additionalParameters | see method description |
| nProgress | optional (normalized) progress notification (per-point) |
Definition at line 289 of file ScalarFieldTools.cpp.
References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::alreadyVisitedNeighbourhoodSize, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), cloudViewer::DgmOctree::findNeighborsInASphereStartingFromCell(), cloudViewer::ReferenceCloud::getAssociatedCloud(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::ReferenceCloud::getPointPersistentPtr(), cloudViewer::GenericCloud::getPointScalarValue(), cloudViewer::ReferenceCloud::getPointScalarValue(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, NAN_VALUE, nProgress, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::DgmOctree::octreeCell::parentOctree, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::pointsInNeighbourhood, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::ReferenceCloud::size(), cloudViewer::DgmOctree::octreeCell::truncatedCode, and cloudViewer::ScalarField::ValidValue().
Referenced by applyScalarFieldGaussianFilter().
|
static |
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.
| 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) |
Definition at line 520 of file ScalarFieldTools.cpp.
References abs(), computeScalarFieldExtremas(), cloudViewer::GenericCloud::getPointScalarValue(), cloudViewer::KMeanClass::maxValue, cloudViewer::KMeanClass::mean, cloudViewer::KMeanClass::minValue, cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::GenericCloud::size(), cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::stop(), cloudViewer::GenericProgressCallback::textCanBeEdited(), cloudViewer::GenericProgressCallback::update(), and cloudViewer::ScalarField::ValidValue().
|
staticprotected |
"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 :
| cell | structure describing the cell on which processing is applied |
| additionalParameters | see method description |
| nProgress | optional (normalized) progress notification (per-point) |
Definition at line 113 of file ScalarFieldTools.cpp.
References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::alreadyVisitedNeighbourhoodSize, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), cloudViewer::DgmOctree::findNeighborsInASphereStartingFromCell(), cloudViewer::ReferenceCloud::getAssociatedCloud(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::ReferenceCloud::getPointPersistentPtr(), cloudViewer::ReferenceCloud::getPointScalarValue(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, NAN_VALUE, cloudViewer::DgmOctree::octreeCell::parentOctree, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::pointsInNeighbourhood, cloudViewer::DgmOctree::NearestNeighboursSphericalSearchStruct::prepare(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, cloudViewer::ReferenceCloud::size(), cloudViewer::DgmOctree::octreeCell::truncatedCode, and cloudViewer::ScalarField::ValidValue().
Referenced by computeScalarFieldGradient().
|
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
| theCloud | the point cloud |
Definition at line 695 of file ScalarFieldTools.cpp.
References count, cloudViewer::GenericCloud::getPointScalarValue(), NAN_VALUE, cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().
Referenced by cloudViewer::FastMarchingForPropagation::init().
|
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
| theCloud | the point cloud |
Definition at line 716 of file ScalarFieldTools.cpp.
References count, cloudViewer::GenericCloud::getPointScalarValue(), NAN_VALUE, cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().
|
static |
Compute the extreme values of a scalar field.
| 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 |
Definition at line 419 of file ScalarFieldTools.cpp.
References cloudViewer::GenericCloud::getPointScalarValue(), NAN_VALUE, cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().
Referenced by computeKmeans(), computeScalarFieldHistogram(), define_ScalarFieldTools(), and cloudViewer::CloudSamplingTools::resampleCloudSpatially().
|
static |
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.
| 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 |
Definition at line 37 of file ScalarFieldTools.cpp.
References AVERAGE_NUMBER_OF_POINTS_FOR_GRADIENT_COMPUTATION, cloudViewer::DgmOctree::build(), computeMeanGradientOnPatch(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::executeFunctionForAllCellsAtLevel(), cloudViewer::DgmOctree::findBestLevelForAGivenNeighbourhoodSizeExtraction(), cloudViewer::DgmOctree::findBestLevelForAGivenPopulationPerCell(), cloudViewer::DgmOctree::getCellSize(), octreeLevel, CCShareable::release(), cloudViewer::ScalarField::reserveSafe(), result, and cloudViewer::GenericCloud::size().
Referenced by ccLibAlgorithms::ApplyCCLibAlgorithm(), ccTrace::buildGradientCost(), and cloudViewer::AutoSegmentationTools::frontPropagationBasedSegmentation().
|
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.
| theCloud | a point cloud (associated to scalar values) |
| numberOfClasses | number of histogram classes |
| histo | number of elements per histogram class |
Definition at line 464 of file ScalarFieldTools.cpp.
References computeScalarFieldExtremas(), cloudViewer::GenericCloud::getPointScalarValue(), cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().
|
static |
Count the number of valid values in a scalar field.
| theCloud | a point cloud, with a scalar field activated |
Definition at line 447 of file ScalarFieldTools.cpp.
References count, cloudViewer::GenericCloud::getPointScalarValue(), cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().
Referenced by cloudViewer::WeibullDistribution::computeChi2Dist(), and cloudViewer::NormalDistribution::computeChi2Dist().
|
static |
Multiplies two scalar fields of the same size.
The first scalar field is updated (S1 = S1*S2).
| 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) |
Definition at line 399 of file ScalarFieldTools.cpp.
References cloudViewer::GenericCloud::getPointScalarValue(), NAN_VALUE, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().
|
static |
Definition at line 32 of file ScalarFieldTools.cpp.
|
static |
Sets the distance value associated to a point.
Generic function that can be used with the GenericCloud::foreach() method.
| P | a 3D point |
| scalarValue | its associated scalar value |
Definition at line 22 of file ScalarFieldTools.cpp.
References NAN_VALUE.
Referenced by cloudViewer::DistanceComputationTools::computeCloud2MeshDistances(), cloudViewer::DistanceComputationTools::computeGeodesicDistances(), and define_ScalarFieldTools().
|
static |
Sets the distance value associated to a point to zero.
Generic function that can be used with the GenericCloud::foreach() method.
| P | a 3D point |
| scalarValue | its associated scalar value |
Definition at line 27 of file ScalarFieldTools.cpp.
Referenced by cloudViewer::GeometricalAnalysisTools::FlagDuplicatePoints().