ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::ScalarField Class Reference

A simple scalar field (to be associated to a point cloud) More...

#include <ScalarField.h>

Inheritance diagram for cloudViewer::ScalarField:
Collaboration diagram for cloudViewer::ScalarField:

Public Member Functions

 ScalarField (const char *name=nullptr)
 Default constructor. More...
 
 ScalarField (const ScalarField &sf)
 Copy constructor. More...
 
void setName (const char *name)
 Sets scalar field name. More...
 
const char * getName () const
 Returns scalar field name. More...
 
void computeMeanAndVariance (ScalarType &mean, ScalarType *variance=nullptr) const
 
virtual void computeMinAndMax ()
 Determines the min and max values. More...
 
void flagValueAsInvalid (std::size_t index)
 Sets the value as 'invalid' (i.e. NAN_VALUE) More...
 
std::size_t countValidValues () const
 Returns the number of valid values in this scalar field. More...
 
ScalarType getMin () const
 Returns the minimum value. More...
 
ScalarType getMax () const
 Returns the maximum value. More...
 
void fill (ScalarType fillValue=0)
 Fills the array with a particular value. More...
 
bool reserveSafe (std::size_t count)
 Reserves memory (no exception thrown) More...
 
bool resizeSafe (std::size_t count, bool initNewElements=false, ScalarType valueForNewElements=0)
 Resizes memory (no exception thrown) More...
 
ScalarType & getValue (std::size_t index)
 
const ScalarType & getValue (std::size_t index) const
 
void setValue (std::size_t index, ScalarType value)
 
void addElement (ScalarType value)
 
unsigned currentSize () const
 
void swap (std::size_t i1, std::size_t i2)
 
 ~ScalarField () override=default
 Default destructor. More...
 
- Public Member Functions inherited from CCShareable
 CCShareable ()
 Default constructor. More...
 
virtual void link ()
 Increase counter. More...
 
virtual void release ()
 Decrease counter and deletes object when 0. More...
 
virtual unsigned getLinkCount () const
 Returns the current link count. More...
 

Static Public Member Functions

static ScalarType NaN ()
 Returns the specific NaN value. More...
 
static bool ValidValue (ScalarType value)
 Returns whether a scalar value is valid or not. More...
 

Protected Attributes

char m_name [256]
 Scalar field name. More...
 
ScalarType m_minVal
 Minimum value. More...
 
ScalarType m_maxVal
 Maximum value. More...
 
- Protected Attributes inherited from CCShareable
unsigned m_linkCount
 Links counter. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CCShareable
virtual ~CCShareable ()
 Destructor. More...
 

Detailed Description

A simple scalar field (to be associated to a point cloud)

A mono-dimensionnal array of scalar values. It has also specific parameters for display purposes.

Invalid values can be represented by NAN_VALUE.

Definition at line 25 of file ScalarField.h.

Constructor & Destructor Documentation

◆ ScalarField() [1/2]

ScalarField::ScalarField ( const char *  name = nullptr)
explicit

Default constructor.

[SHAREABLE] Call 'link' when associating this structure to an object.

Parameters
namescalar field name

Definition at line 16 of file ScalarField.cpp.

References name, and setName().

◆ ScalarField() [2/2]

ScalarField::ScalarField ( const ScalarField sf)

Copy constructor.

Parameters
sfscalar field to copy
Warning
May throw a std::bad_alloc exception

Definition at line 18 of file ScalarField.cpp.

References m_name, and setName().

◆ ~ScalarField()

cloudViewer::ScalarField::~ScalarField ( )
overridedefault

Default destructor.

Call release instead.

Member Function Documentation

◆ addElement()

◆ computeMeanAndVariance()

void ScalarField::computeMeanAndVariance ( ScalarType &  mean,
ScalarType *  variance = nullptr 
) const

Computes the mean value (and optionally the variance value) of the scalar field

Parameters
meana field to store the mean value
varianceif not void, the variance will be computed and stored here

Definition at line 41 of file ScalarField.cpp.

References abs(), ecvColor::LookUpTable::at(), count, size, and ValidValue().

Referenced by ccComparisonDlg::computeApproxDistances(), ccComparisonDlg::computeDistances(), define_ScalarField(), CommandFilterBySFValue::process(), and cloudViewer::utility::pybind_scalarfield().

◆ computeMinAndMax()

◆ countValidValues()

std::size_t ScalarField::countValidValues ( ) const

Returns the number of valid values in this scalar field.

Definition at line 29 of file ScalarField.cpp.

References ecvColor::LookUpTable::at(), count, size, and ValidValue().

Referenced by ccEntityAction::computeStatParams(), CommandSubsample::process(), and ccEntityAction::sfSetAsCoord().

◆ currentSize()

◆ fill()

◆ flagValueAsInvalid()

void cloudViewer::ScalarField::flagValueAsInvalid ( std::size_t  index)
inline

Sets the value as 'invalid' (i.e. NAN_VALUE)

Definition at line 66 of file ScalarField.h.

References ecvColor::LookUpTable::at(), and NaN().

Referenced by define_ScalarField(), LoadScan(), and cloudViewer::utility::pybind_scalarfield().

◆ getMax()

◆ getMin()

◆ getName()

◆ getValue() [1/2]

◆ getValue() [2/2]

const ScalarType& cloudViewer::ScalarField::getValue ( std::size_t  index) const
inline

Definition at line 93 of file ScalarField.h.

References ecvColor::LookUpTable::at().

◆ NaN()

static ScalarType cloudViewer::ScalarField::NaN ( )
inlinestatic

Returns the specific NaN value.

Definition at line 46 of file ScalarField.h.

References NAN_VALUE.

Referenced by define_ScalarField(), flagValueAsInvalid(), and cloudViewer::utility::pybind_scalarfield().

◆ reserveSafe()

◆ resizeSafe()

◆ setName()

◆ setValue()

◆ swap()

void cloudViewer::ScalarField::swap ( std::size_t  i1,
std::size_t  i2 
)
inline

Definition at line 103 of file ScalarField.h.

References ecvColor::LookUpTable::at(), and std::swap().

Referenced by cloudViewer::utility::pybind_scalarfield().

◆ ValidValue()

static bool cloudViewer::ScalarField::ValidValue ( ScalarType  value)
inlinestatic

Returns whether a scalar value is valid or not.

Definition at line 61 of file ScalarField.h.

Referenced by ccScalarFieldArithmeticsDlg::Apply(), applySqrtToPointDist(), ComparePointsAndTriangles(), cloudViewer::StatisticalTestingTools::computeAdaptativeChi2Dist(), cloudViewer::ScalarFieldTools::computeCellGaussianFilter(), cloudViewer::WeibullDistribution::computeChi2Dist(), cloudViewer::NormalDistribution::computeChi2Dist(), cloudViewer::WeibullDistribution::ComputeG(), AnglesCustomPlot::computeHistogram(), cloudViewer::ScalarFieldTools::computeKmeans(), cloudViewer::StatisticalTestingTools::computeLocalChi2DistAtLevel(), computeMeanAndVariance(), cloudViewer::ScalarFieldTools::computeMeanGradientOnPatch(), cloudViewer::ScalarFieldTools::computeMeanScalarValue(), cloudViewer::ScalarFieldTools::computeMeanSquareScalarValue(), computeMinAndMax(), cloudViewer::NormalDistribution::computeParameters(), cloudViewer::WeibullDistribution::computeParameters(), DistanceMapGenerationTool::ComputeRadialDist(), cloudViewer::ScalarFieldTools::computeScalarFieldExtremas(), cloudViewer::ScalarFieldTools::computeScalarFieldHistogram(), ccEntityAction::computeStatParams(), cloudViewer::GeometricalAnalysisTools::ComputeWeightedCrossCovarianceMatrix(), cloudViewer::ScalarFieldTools::countScalarFieldValidValues(), countValidValues(), DistanceMapGenerationTool::CreateMap(), define_ScalarField(), cloudViewer::DistanceComputationTools::diff(), ccSubsamplingDlg::enableSFModulation(), cloudViewer::DgmOctree::findNearestNeighborsStartingFromCell(), ccRasterizeTool::generateContours(), cloudViewer::DgmOctree::getPointsInNeighbourCellsAround(), LasField::getSafeValue(), cloudViewer::ScalarFieldTools::multiplyScalarFields(), CommandSubsample::process(), cloudViewer::utility::pybind_scalarfield(), cloudViewer::ICPRegistrationTools::Register(), cloudViewer::CloudSamplingTools::resampleCloudSpatially(), and SaveScan().

Member Data Documentation

◆ m_maxVal

ScalarType cloudViewer::ScalarField::m_maxVal
protected

Maximum value.

Definition at line 120 of file ScalarField.h.

Referenced by computeMinAndMax(), and getMax().

◆ m_minVal

ScalarType cloudViewer::ScalarField::m_minVal
protected

Minimum value.

Definition at line 118 of file ScalarField.h.

Referenced by computeMinAndMax(), and getMin().

◆ m_name

char cloudViewer::ScalarField::m_name[256]
protected

Scalar field name.

Definition at line 115 of file ScalarField.h.

Referenced by getName(), ScalarField(), and setName().


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