ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
masc::ContextBasedFeature Struct Reference

Context-based feature. More...

#include <ContextBasedFeature.h>

Inheritance diagram for masc::ContextBasedFeature:
Collaboration diagram for masc::ContextBasedFeature:

Public Types

enum  ContextBasedFeatureType { Invalid = 0 , DZ , DH }
 
typedef QSharedPointer< ContextBasedFeatureShared
 
- Public Types inherited from masc::Feature
enum class  Type {
  PointFeature , NeighborhoodFeature , ContextBasedFeature , DualCloudFeature ,
  Invalid
}
 Feature type. More...
 
enum  Stat {
  NO_STAT , MEAN , MODE , MEDIAN ,
  STD , RANGE , SKEW
}
 
enum  Operation {
  NO_OPERATION , MINUS , PLUS , DIVIDE ,
  MULTIPLY
}
 
typedef QSharedPointer< FeatureShared
 Shared type. More...
 
typedef std::vector< SharedSet
 Set of features. More...
 

Public Member Functions

 ContextBasedFeature (ContextBasedFeatureType p_type, int p_kNN=1, double p_scale=std::numeric_limits< double >::quiet_NaN(), int p_ctxClassLabel=0)
 Default constructor. More...
 
virtual Type getType () const override
 Returns the type (must be reimplemented by child struct) More...
 
virtual Feature::Shared clone () const override
 Clones this feature. More...
 
virtual bool prepare (const CorePoints &corePoints, QString &error, cloudViewer::GenericProgressCallback *progressCb=nullptr, SFCollector *generatedScalarFields=nullptr) override
 Prepares the feature (compute the scalar field, etc.) More...
 
virtual bool finish (const CorePoints &corePoints, QString &error) override
 Finishes the feature preparation (update the scalar field, etc.) More...
 
virtual bool checkValidity (QString corePointRole, QString &error) const override
 Checks the feature definition validity. More...
 
virtual QString toString () const override
 Returns the formatted description. More...
 
bool computeValue (cloudViewer::DgmOctree::NeighboursSet &pointsInNeighbourhood, const CCVector3 &queryPoint, ScalarType &outputValue) const
 Compute the feature value on a set of points. More...
 
- Public Member Functions inherited from masc::Feature
 Feature (double p_scale=std::numeric_limits< double >::quiet_NaN(), Source::Type p_source=Source::ScalarField, QString p_sourceName=QString())
 Default constructor. More...
 
virtual ~Feature ()
 Destructor. More...
 
bool scaled () const
 Returns whether the feature has an associated scale. More...
 

Static Public Member Functions

static QString ToString (ContextBasedFeatureType type)
 
static ContextBasedFeatureType FromString (const QString &token)
 
static ContextBasedFeatureType FromUpperString (const QString &token)
 
- Static Public Member Functions inherited from masc::Feature
static QString StatToString (Stat stat)
 
static QString OpToString (Operation op)
 
static bool ExtractSources (const Set &features, Source::Set &sources)
 Extracts the set of 'sources' from a set of features. More...
 
static bool SaveSources (const Source::Set &sources, QString filename)
 Saves a set of 'sources' to a file. More...
 
static bool LoadSources (Source::Set &sources, QString filename)
 Loads a set of 'sources' from a file. More...
 
static bool CheckSFExistence (ccPointCloud *cloud, const char *resultSFName)
 
static cloudViewer::ScalarFieldPrepareSF (ccPointCloud *cloud, const char *resultSFName, SFCollector *generatedScalarFields, SFCollector::Behavior behavior)
 
static ScalarType PerformMathOp (double s1, double s2, Operation op)
 Performs a mathematical operation between two scalars. More...
 
static bool PerformMathOp (cloudViewer::ScalarField *sf1, const cloudViewer::ScalarField *sf2, Operation op)
 
static bool PerformMathOp (const IScalarFieldWrapper &sf1, const IScalarFieldWrapper &sf2, Operation op, cloudViewer::ScalarField *outSF)
 

Public Attributes

ContextBasedFeatureType type
 Neighborhood feature type. More...
 
int kNN
 
int ctxClassLabel
 Context class (label) More...
 
cloudViewer::ScalarFieldsf
 The computed scalar. More...
 
- Public Attributes inherited from masc::Feature
double scale
 Scale (diameter) More...
 
ccPointCloudcloud1
 
ccPointCloudcloud2
 
QString cloud1Label
 
QString cloud2Label
 
Source source
 
Stat stat
 
Operation op
 
bool sf1WasAlreadyExisting
 
bool sf2WasAlreadyExisting
 

Detailed Description

Context-based feature.

Definition at line 32 of file ContextBasedFeature.h.

Member Typedef Documentation

◆ Shared

Definition at line 34 of file ContextBasedFeature.h.

Member Enumeration Documentation

◆ ContextBasedFeatureType

Enumerator
Invalid 
DZ 
DH 

Definition at line 36 of file ContextBasedFeature.h.

Constructor & Destructor Documentation

◆ ContextBasedFeature()

masc::ContextBasedFeature::ContextBasedFeature ( ContextBasedFeatureType  p_type,
int  p_kNN = 1,
double  p_scale = std::numeric_limits<double>::quiet_NaN(),
int  p_ctxClassLabel = 0 
)
inline

Default constructor.

Definition at line 67 of file ContextBasedFeature.h.

References masc::Feature::scale.

Referenced by clone().

Member Function Documentation

◆ checkValidity()

bool ContextBasedFeature::checkValidity ( QString  corePointRole,
QString &  error 
) const
overridevirtual

◆ clone()

virtual Feature::Shared masc::ContextBasedFeature::clone ( ) const
inlineoverridevirtual

Clones this feature.

Implements masc::Feature.

Definition at line 81 of file ContextBasedFeature.h.

References ContextBasedFeature().

◆ computeValue()

bool ContextBasedFeature::computeValue ( cloudViewer::DgmOctree::NeighboursSet pointsInNeighbourhood,
const CCVector3 queryPoint,
ScalarType &  outputValue 
) const

◆ finish()

bool ContextBasedFeature::finish ( const CorePoints corePoints,
QString &  error 
)
overridevirtual

Finishes the feature preparation (update the scalar field, etc.)

Reimplemented from masc::Feature.

Definition at line 323 of file ContextBasedFeature.cpp.

References cloudViewer::ScalarField::computeMinAndMax(), corePoints, error(), cloudViewer::ScalarField::getName(), and sf.

◆ FromString()

static ContextBasedFeatureType masc::ContextBasedFeature::FromString ( const QString &  token)
inlinestatic

Definition at line 53 of file ContextBasedFeature.h.

References FromUpperString().

◆ FromUpperString()

static ContextBasedFeatureType masc::ContextBasedFeature::FromUpperString ( const QString &  token)
inlinestatic

Definition at line 56 of file ContextBasedFeature.h.

References DH, DZ, and Invalid.

Referenced by CreateFeaturesFromCommand(), and FromString().

◆ getType()

virtual Type masc::ContextBasedFeature::getType ( ) const
inlineoverridevirtual

Returns the type (must be reimplemented by child struct)

Implements masc::Feature.

Definition at line 80 of file ContextBasedFeature.h.

References masc::Feature::ContextBasedFeature.

◆ prepare()

bool ContextBasedFeature::prepare ( const CorePoints corePoints,
QString &  error,
cloudViewer::GenericProgressCallback progressCb = nullptr,
SFCollector generatedScalarFields = nullptr 
)
overridevirtual

Prepares the feature (compute the scalar field, etc.)

Implements masc::Feature.

Definition at line 65 of file ContextBasedFeature.cpp.

References cloudViewer::PointCloudTpl< T >::addPoint(), SFCollector::CAN_REMOVE, masc::Feature::CheckSFExistence(), checkValidity(), masc::Feature::cloud1, masc::Feature::cloud1Label, cloudViewer::ScalarField::computeMinAndMax(), ccGenericPointCloud::computeOctree(), corePoints, ctxClassLabel, DH, DZ, Vector3Tpl< double >::fromArray(), masc::Tools::GetClassificationSF(), cloudViewer::ScalarField::getName(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::PointCloudTpl< T >::getPoint(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::PointCloudTpl< T >::getScalarFieldIndexByName(), cloudViewer::ScalarField::getValue(), kNN, max(), cloudViewer::DgmOctree::MAX_OCTREE_LEVEL, masc::Feature::Source::name, NAN_VALUE, nProgress, octreeLevel, cloudViewer::NormalizedProgress::oneStep(), masc::Feature::PrepareSF(), CVLog::Print(), ccPointCloud::reserve(), masc::Feature::scale, masc::Feature::scaled(), cloudViewer::PointCloudTpl< T >::setCurrentOutScalarField(), cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::ScalarField::setValue(), sf, masc::Feature::sf1WasAlreadyExisting, cloudViewer::GenericCloud::size(), cloudViewer::PointCloudTpl< T >::size(), masc::Feature::source, cloudViewer::GenericProgressCallback::stop(), ToString(), type, Tuple3Tpl< Type >::u, CVLog::Warning(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ toString()

QString ContextBasedFeature::toString ( ) const
overridevirtual

Returns the formatted description.

Implements masc::Feature.

Definition at line 350 of file ContextBasedFeature.cpp.

References masc::Feature::cloud1Label, ctxClassLabel, kNN, masc::Feature::scale, masc::Feature::scaled(), ToString(), and type.

◆ ToString()

static QString masc::ContextBasedFeature::ToString ( ContextBasedFeatureType  type)
inlinestatic

Definition at line 38 of file ContextBasedFeature.h.

References DH, DZ, Invalid, and type.

Referenced by CreateFeaturesFromCommand(), prepare(), and toString().

Member Data Documentation

◆ ctxClassLabel

int masc::ContextBasedFeature::ctxClassLabel

Context class (label)

Definition at line 109 of file ContextBasedFeature.h.

Referenced by computeValue(), prepare(), and toString().

◆ kNN

int masc::ContextBasedFeature::kNN

Definition at line 107 of file ContextBasedFeature.h.

Referenced by checkValidity(), prepare(), and toString().

◆ sf

cloudViewer::ScalarField* masc::ContextBasedFeature::sf

The computed scalar.

Definition at line 111 of file ContextBasedFeature.h.

Referenced by finish(), and prepare().

◆ type

ContextBasedFeatureType masc::ContextBasedFeature::type

Neighborhood feature type.

Warning
different from the feature type

Definition at line 104 of file ContextBasedFeature.h.

Referenced by checkValidity(), computeValue(), prepare(), toString(), and ToString().


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