ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
masc::Feature Struct Referenceabstract

Generic feature descriptor. More...

#include <FeaturesInterface.h>

Inheritance diagram for masc::Feature:
Collaboration diagram for masc::Feature:

Classes

struct  Source
 Sources of values for this feature. More...
 

Public Types

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< Feature > Shared
 Shared type. More...
 
typedef std::vector< Shared > Set
 Set of features. More...
 

Public Member Functions

 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...
 
virtual Type getType () const =0
 Returns the type (must be reimplemented by child struct) More...
 
virtual QString toString () const =0
 Returns the formatted description. More...
 
virtual Feature::Shared clone () const =0
 Clones this feature. More...
 
virtual bool prepare (const CorePoints &corePoints, QString &error, cloudViewer::GenericProgressCallback *progressCb=nullptr, SFCollector *generatedScalarFields=nullptr)=0
 Prepares the feature (compute the scalar field, etc.) More...
 
virtual bool finish (const CorePoints &corePoints, QString &error)
 Finishes the feature preparation (update the scalar field, etc.) More...
 
bool scaled () const
 Returns whether the feature has an associated scale. More...
 
virtual bool checkValidity (QString corePointRole, QString &error) const
 Checks the feature definition validity. More...
 

Static Public Member Functions

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::ScalarField * PrepareSF (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

double scale
 Scale (diameter) More...
 
ccPointCloud * cloud1
 
ccPointCloud * cloud2
 
QString cloud1Label
 
QString cloud2Label
 
Source source
 
Stat stat
 
Operation op
 
bool sf1WasAlreadyExisting
 
bool sf2WasAlreadyExisting
 

Detailed Description

Generic feature descriptor.

Definition at line 46 of file FeaturesInterface.h.

Member Typedef Documentation

◆ Set

typedef std::vector<Shared> masc::Feature::Set

Set of features.

Definition at line 52 of file FeaturesInterface.h.

◆ Shared

typedef QSharedPointer<Feature> masc::Feature::Shared

Shared type.

Definition at line 49 of file FeaturesInterface.h.

Member Enumeration Documentation

◆ Operation

Enumerator
NO_OPERATION 
MINUS 
PLUS 
DIVIDE 
MULTIPLY 

Definition at line 95 of file FeaturesInterface.h.

◆ Stat

Enumerator
NO_STAT 
MEAN 
MODE 
MEDIAN 
STD 
RANGE 
SKEW 

Definition at line 65 of file FeaturesInterface.h.

◆ Type

enum masc::Feature::Type
strong

Feature type.

Enumerator
PointFeature 

Point features (scalar field, etc.)

NeighborhoodFeature 

Neighborhood based features for a given scale

ContextBasedFeature 

Contextual based features

DualCloudFeature 

Dual Cloud features: requires 2 point clouds

Invalid 

Invalid feature

Definition at line 56 of file FeaturesInterface.h.

Constructor & Destructor Documentation

◆ Feature()

masc::Feature::Feature ( double  p_scale = std::numeric_limits<double>::quiet_NaN(),
Source::Type  p_source = Source::ScalarField,
QString  p_sourceName = QString() 
)
inline

Default constructor.

Definition at line 138 of file FeaturesInterface.h.

◆ ~Feature()

virtual masc::Feature::~Feature ( )
inlinevirtual

Destructor.

Definition at line 151 of file FeaturesInterface.h.

Member Function Documentation

◆ CheckSFExistence()

bool Feature::CheckSFExistence ( ccPointCloud *  cloud,
const char *  resultSFName 
)
static

Creates (or resets) a scalar field with the given name on the input core points cloud

Definition at line 19 of file FeaturesInterface.cpp.

References cloudViewer::PointCloudTpl< T >::getScalarFieldIndexByName().

Referenced by masc::ContextBasedFeature::prepare(), masc::NeighborhoodFeature::prepare(), and masc::PointFeature::prepare().

◆ checkValidity()

virtual bool masc::Feature::checkValidity ( QString  corePointRole,
QString &  error 
) const
inlinevirtual

◆ clone()

virtual Feature::Shared masc::Feature::clone ( ) const
pure virtual

◆ ExtractSources()

bool Feature::ExtractSources ( const Set &  features,
Source::Set &  sources 
)
static

Extracts the set of 'sources' from a set of features.

Definition at line 195 of file FeaturesInterface.cpp.

References CVLog::Warning().

Referenced by q3DMASCPlugin::doClassifyAction(), q3DMASCPlugin::doTrainAction(), and Command3DMASCClassif::process().

◆ finish()

virtual bool masc::Feature::finish ( const CorePoints &  corePoints,
QString &  error 
)
inlinevirtual

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

Reimplemented in masc::PointFeature, masc::NeighborhoodFeature, and masc::ContextBasedFeature.

Definition at line 170 of file FeaturesInterface.h.

◆ getType()

virtual Type masc::Feature::getType ( ) const
pure virtual

Returns the type (must be reimplemented by child struct)

Implemented in masc::PointFeature, masc::NeighborhoodFeature, masc::DualCloudFeature, and masc::ContextBasedFeature.

Referenced by checkValidity().

◆ LoadSources()

bool Feature::LoadSources ( Source::Set &  sources,
QString  filename 
)
static

◆ OpToString()

static QString masc::Feature::OpToString ( Operation  op)
inlinestatic

◆ PerformMathOp() [1/3]

bool Feature::PerformMathOp ( cloudViewer::ScalarField *  sf1,
const cloudViewer::ScalarField *  sf2,
Feature::Operation  op 
)
static

Performs a mathematical operation between two scalar fields (they must have the same size!)

Definition at line 95 of file FeaturesInterface.cpp.

References cloudViewer::ScalarField::computeMinAndMax(), cloudViewer::ScalarField::getValue(), NO_OPERATION, op, PerformMathOp(), and cloudViewer::ScalarField::setValue().

◆ PerformMathOp() [2/3]

bool Feature::PerformMathOp ( const IScalarFieldWrapper &  sf1,
const IScalarFieldWrapper &  sf2,
Operation  op,
cloudViewer::ScalarField *  outSF 
)
static

Performs a mathematical operation between two scalar fields (they must have the same size!)

Definition at line 116 of file FeaturesInterface.cpp.

References cloudViewer::ScalarField::computeMinAndMax(), NO_OPERATION, op, PerformMathOp(), IScalarFieldWrapper::pointValue(), cloudViewer::ScalarField::setValue(), and IScalarFieldWrapper::size().

◆ PerformMathOp() [3/3]

ScalarType Feature::PerformMathOp ( double  s1,
double  s2,
Operation  op 
)
static

Performs a mathematical operation between two scalars.

Definition at line 72 of file FeaturesInterface.cpp.

References DIVIDE, MINUS, MULTIPLY, NAN_VALUE, op, and PLUS.

Referenced by ComputeMathOpWithNearestNeighbor(), masc::NeighborhoodFeature::finish(), masc::PointFeature::finish(), and PerformMathOp().

◆ prepare()

virtual bool masc::Feature::prepare ( const CorePoints &  corePoints,
QString &  error,
cloudViewer::GenericProgressCallback *  progressCb = nullptr,
SFCollector *  generatedScalarFields = nullptr 
)
pure virtual

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

Implemented in masc::PointFeature, masc::NeighborhoodFeature, masc::DualCloudFeature, and masc::ContextBasedFeature.

◆ PrepareSF()

◆ SaveSources()

bool Feature::SaveSources ( const Source::Set &  sources,
QString  filename 
)
static

Saves a set of 'sources' to a file.

Definition at line 138 of file FeaturesInterface.cpp.

References QtCompat::endl(), filename, and CVLog::Warning().

Referenced by Command3DMASCClassif::process().

◆ scaled()

◆ StatToString()

static QString masc::Feature::StatToString ( Stat  stat)
inlinestatic

Definition at line 75 of file FeaturesInterface.h.

References MEAN, MEDIAN, MODE, RANGE, SKEW, stat, and STD.

Referenced by masc::PointFeature::prepare(), and masc::PointFeature::toString().

◆ toString()

virtual QString masc::Feature::toString ( ) const
pure virtual

Returns the formatted description.

Implemented in masc::PointFeature, masc::NeighborhoodFeature, masc::DualCloudFeature, and masc::ContextBasedFeature.

Member Data Documentation

◆ cloud1

◆ cloud1Label

◆ cloud2

◆ cloud2Label

◆ op

◆ scale

◆ sf1WasAlreadyExisting

◆ sf2WasAlreadyExisting

bool masc::Feature::sf2WasAlreadyExisting

◆ source

◆ stat


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