ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
BasePclModule Class Referenceabstract

Base abstract class for each implemented PCL filter. More...

#include <BasePclModule.h>

Inheritance diagram for BasePclModule:
[legend]
Collaboration diagram for BasePclModule:
[legend]

Signals

void entityHasChanged (ccHObject *)
 Signal emitted when an entity is (visually) modified. More...
 
void newEntity (ccHObject *)
 Signal emitted when a new entity is created by the filter. More...
 
void newErrorMessage (QString)
 Signal emitted when a new error message is produced. More...
 

Public Member Functions

 BasePclModule (PclModuleDescription desc=PclModuleDescription(), ccPluginInterface *parent_plugin=0)
 Default constructor. More...
 
QAction * getAction ()
 Get the action associated with the button used in menu and toolbar creation. More...
 
virtual QString getErrorMessage (int errorCode)
 Returns the error message corresponding to a given error code. More...
 
QString getStatusTip () const
 Returns the status tip. More...
 
QString getModuleName () const
 Returns the name of the filter. More...
 
QString getEntryName () const
 Returns the entry name. More...
 
QIcon getIcon () const
 Returns the icon associated with the button. More...
 
void setShowProgressBar (bool status)
 Sets whether to show a progressbar while computing or not. More...
 
std::vector< std::string > getSelectedAvailableScalarFields ()
 
ccPointCloud * getSelectedEntityAsCCPointCloud () const
 Returns the first selected entity as a ccPointCloud. More...
 
ccHObject * getSelectedEntityAsCCHObject () const
 Returns the first selected entity as a ccHObject. More...
 
ccHObject::Container getSelectedThatHaveMetaData (const QString key) const
 Get selected object that also have the provided metadata key. More...
 
void getAllEntitiesOfType (CV_CLASS_ENUM type, ccHObject::Container &entities)
 Returns all the objects in db tree of type "type". More...
 
void getAllEntitiesThatHaveMetaData (QString key, ccHObject::Container &entities)
 
void getSelectedEntitiesThatAreCCPointCloud (ccHObject::Container &entities)
 get all entities that are selected and that also are cc_point_cloud More...
 
void getSelectedEntitiesThatAre (CV_CLASS_ENUM kind, ccHObject::Container &entities)
 
int hasSelectedRGB ()
 Returns 1 if the first selected entity has RGB info. More...
 
int hasSelectedScalarField ()
 Returns 1 if the first selected entity has at least one scalar field. More...
 
int hasSelectedScalarField (std::string field_name)
 
int isFirstSelectedCcPointCloud ()
 Returns 1 if the first selected object is a ccPointCloud. More...
 
virtual void updateSelectedEntities (const ccHObject::Container &selectedEntities)
 Updates the internal copy of selected entities. More...
 
virtual int compute ()=0
 Performs the actual filter job. More...
 
void setMainAppInterface (ecvMainAppInterface *app)
 Sets associated CC application interface (to access DB) More...
 
ecvMainAppInterface * getMainAppInterface ()
 
ccPluginInterface * getParentPlugin () const
 Returns the associated parent plugin interface. More...
 

Protected Slots

int performAction ()
 Returns is called when the dialog window is accepted. More...
 

Protected Member Functions

virtual int checkSelected ()
 Checks if current selection is compliant with the filter. More...
 
virtual int openInputDialog ()
 
virtual int openOutputDialog ()
 
virtual void getParametersFromDialog ()
 Collects parameters from the filter dialog (if openDialog is successful) More...
 
virtual int checkParameters ()
 
virtual int start ()
 Starts computation. More...
 
virtual void initAction ()
 Initializes the corresponding action. More...
 
void throwError (int errCode)
 

Protected Attributes

QAction * m_action
 Forces the Ui to be updated. More...
 
ccHObject::Container m_selected
 Pointer to the main window. More...
 
PclModuleDescription m_desc
 Associated dialog. More...
 
ecvMainAppInterface * m_app
 Associated application interface. More...
 
ccPluginInterface * m_parent_plugin
 associated parent plugin of the filter More...
 
bool m_show_progress
 Do we want to show a progress bar when the filter works? More...
 

Detailed Description

Base abstract class for each implemented PCL filter.

Note
Remember to override compute(), at least
Author
DAHAI LU

Constructor & Destructor Documentation

◆ BasePclModule()

BasePclModule::BasePclModule ( PclModuleDescription  desc = PclModuleDescription(),
ccPluginInterface *  parent_plugin = 0 
)

Default constructor.

Parameters
[in]desca PclModuleDescription structure containing filter infos
[in]parent_pluginparent plugin (optional)

References initAction(), and m_parent_plugin.

Member Function Documentation

◆ checkParameters()

virtual int BasePclModule::checkParameters ( )
inlineprotectedvirtual

Checks that the parameters retrieved by getParametersFromDialog are valid Automatically called by performAction. Does nothing by default. Must be overridden if necessary.

Returns
1 if parameters are valid (error code otherwise)

Reimplemented in TemplateAlignment, ExtractSIFT, CorrespondenceMatching, DONSegmentation, EuclideanClusterSegmentation, MinimumCutSegmentation, RegionGrowingSegmentation, SACSegmentation, ConvexConcaveHullReconstruction, GreedyTriangulation, MarchingCubeReconstruction, NurbsCurveFitting, NurbsSurfaceReconstruction, PoissonReconstruction, GeneralFilters, and ProjectionFilter.

Referenced by performAction().

◆ checkSelected()

int BasePclModule::checkSelected ( )
protectedvirtual

Checks if current selection is compliant with the filter.

If not, an error is returned and computation stops. By default, baseclass method simply checks that selection is composed of one and only one ccPointCloud. This method should be overridden if necessary.

Returns
1 if selection is compliant (error code otherwise)

Reimplemented in FastGlobalRegistrationFilter, TemplateAlignment, ExtractSIFT, CorrespondenceMatching, DONSegmentation, EuclideanClusterSegmentation, MinimumCutSegmentation, RegionGrowingSegmentation, SACSegmentation, ConvexConcaveHullReconstruction, GreedyTriangulation, MarchingCubeReconstruction, NurbsCurveFitting, NurbsSurfaceReconstruction, and PoissonReconstruction.

References m_selected, and CV_TYPES::POINT_CLOUD.

Referenced by performAction(), and updateSelectedEntities().

◆ compute()

◆ entityHasChanged

void BasePclModule::entityHasChanged ( ccHObject *  )
signal

Signal emitted when an entity is (visually) modified.

Referenced by qPCL::addPclModule(), and NormalEstimation::compute().

◆ getAction()

QAction * BasePclModule::getAction ( )

Get the action associated with the button used in menu and toolbar creation.

References m_action.

◆ getAllEntitiesOfType()

void BasePclModule::getAllEntitiesOfType ( CV_CLASS_ENUM  type,
ccHObject::Container &  entities 
)

Returns all the objects in db tree of type "type".

References ecvMainAppInterface::dbRootObject(), ccHObject::filterChildren(), m_app, and type.

Referenced by getAllEntitiesThatHaveMetaData().

◆ getAllEntitiesThatHaveMetaData()

void BasePclModule::getAllEntitiesThatHaveMetaData ( QString  key,
ccHObject::Container &  entities 
)

Returns all the existent hierarchical objects which have a specific metadata May return an empty container if none found.

References getAllEntitiesOfType(), and CV_TYPES::HIERARCHY_OBJECT.

◆ getEntryName()

QString BasePclModule::getEntryName ( ) const

Returns the entry name.

Entry name is used when creating the corresponding QAction by initAction

References m_desc, and PclModuleDescription::m_entry_name.

Referenced by initAction().

◆ getErrorMessage()

QString BasePclModule::getErrorMessage ( int  errorCode)
virtual

Returns the error message corresponding to a given error code.

Each filter have a set of possible error message to be used given bt getFilterErrorMessage() Baseclass implementation provides some generic messages.

Note
These messages can be replaced by re-implementing this method and handling the same codes BEFORE calling the baseclass method

Reimplemented in FastGlobalRegistrationFilter, TemplateAlignment, ExtractSIFT, GeneralFilters, CorrespondenceMatching, DONSegmentation, EuclideanClusterSegmentation, MinimumCutSegmentation, RegionGrowingSegmentation, SACSegmentation, ConvexConcaveHullReconstruction, GreedyTriangulation, MarchingCubeReconstruction, NurbsCurveFitting, NurbsSurfaceReconstruction, PoissonReconstruction, and ProjectionFilter.

References getModuleName().

Referenced by ProjectionFilter::getErrorMessage(), PoissonReconstruction::getErrorMessage(), NurbsSurfaceReconstruction::getErrorMessage(), ExtractSIFT::getErrorMessage(), MarchingCubeReconstruction::getErrorMessage(), DONSegmentation::getErrorMessage(), ConvexConcaveHullReconstruction::getErrorMessage(), NurbsCurveFitting::getErrorMessage(), RegionGrowingSegmentation::getErrorMessage(), MinimumCutSegmentation::getErrorMessage(), EuclideanClusterSegmentation::getErrorMessage(), GeneralFilters::getErrorMessage(), GreedyTriangulation::getErrorMessage(), SACSegmentation::getErrorMessage(), CorrespondenceMatching::getErrorMessage(), TemplateAlignment::getErrorMessage(), FastGlobalRegistrationFilter::getErrorMessage(), and throwError().

◆ getIcon()

QIcon BasePclModule::getIcon ( ) const

Returns the icon associated with the button.

References m_desc, and PclModuleDescription::m_icon.

Referenced by initAction().

◆ getMainAppInterface()

ecvMainAppInterface* BasePclModule::getMainAppInterface ( )
inline

Returns associated CC application interface for accessing to some of mainWindow methods

References m_app.

◆ getModuleName()

QString BasePclModule::getModuleName ( ) const

Returns the name of the filter.

References m_desc, and PclModuleDescription::m_module_name.

Referenced by getErrorMessage(), and start().

◆ getParametersFromDialog()

virtual void BasePclModule::getParametersFromDialog ( )
inlineprotectedvirtual

◆ getParentPlugin()

ccPluginInterface* BasePclModule::getParentPlugin ( ) const
inline

Returns the associated parent plugin interface.

References m_parent_plugin.

◆ getSelectedAvailableScalarFields()

std::vector< std::string > BasePclModule::getSelectedAvailableScalarFields ( )

Returns a vector of strings representing the names of the available scalar fields For the first selected entity.

References cloudViewer::PointCloudTpl< T >::getNumberOfScalarFields(), cloudViewer::PointCloudTpl< T >::getScalarFieldName(), and getSelectedEntityAsCCPointCloud().

Referenced by ExtractSIFT::openInputDialog().

◆ getSelectedEntitiesThatAre()

void BasePclModule::getSelectedEntitiesThatAre ( CV_CLASS_ENUM  kind,
ccHObject::Container &  entities 
)

get all entities that are selected and that also are of the specified type

References ccObject::isA(), and m_selected.

◆ getSelectedEntitiesThatAreCCPointCloud()

void BasePclModule::getSelectedEntitiesThatAreCCPointCloud ( ccHObject::Container &  entities)

get all entities that are selected and that also are cc_point_cloud

References ccObject::isA(), m_selected, and CV_TYPES::POINT_CLOUD.

◆ getSelectedEntityAsCCHObject()

ccHObject * BasePclModule::getSelectedEntityAsCCHObject ( ) const

Returns the first selected entity as a ccHObject.

Returns
nullptr if no object is selected

References m_selected.

◆ getSelectedEntityAsCCPointCloud()

◆ getSelectedThatHaveMetaData()

ccHObject::Container BasePclModule::getSelectedThatHaveMetaData ( const QString  key) const

Get selected object that also have the provided metadata key.

References ccObject::hasMetaData(), and m_selected.

◆ getStatusTip()

QString BasePclModule::getStatusTip ( ) const

Returns the status tip.

Status tip is visualized in status bar when button is hovered. used in QAction creation

References m_desc, and PclModuleDescription::m_status_tip.

Referenced by initAction().

◆ hasSelectedRGB()

int BasePclModule::hasSelectedRGB ( )

Returns 1 if the first selected entity has RGB info.

References getSelectedEntityAsCCPointCloud(), ccPointCloud::hasColors(), and isFirstSelectedCcPointCloud().

Referenced by ExtractSIFT::checkSelected(), and ExtractSIFT::openInputDialog().

◆ hasSelectedScalarField() [1/2]

int BasePclModule::hasSelectedScalarField ( )

Returns 1 if the first selected entity has at least one scalar field.

References getSelectedEntityAsCCPointCloud(), ccPointCloud::hasScalarFields(), and isFirstSelectedCcPointCloud().

Referenced by ExtractSIFT::checkSelected().

◆ hasSelectedScalarField() [2/2]

int BasePclModule::hasSelectedScalarField ( std::string  field_name)

Returns 1 if the first selected entity has a scalar field with name field_name

References cloudViewer::PointCloudTpl< T >::getScalarFieldIndexByName(), getSelectedEntityAsCCPointCloud(), and result.

◆ initAction()

void BasePclModule::initAction ( )
protectedvirtual

Initializes the corresponding action.

Action can be retrieved with getAction.

References getEntryName(), getIcon(), getStatusTip(), m_action, and performAction().

Referenced by BasePclModule().

◆ isFirstSelectedCcPointCloud()

◆ newEntity

◆ newErrorMessage

void BasePclModule::newErrorMessage ( QString  )
signal

Signal emitted when a new error message is produced.

Referenced by qPCL::addPclModule(), and throwError().

◆ openInputDialog()

virtual int BasePclModule::openInputDialog ( )
inlineprotectedvirtual

Opens the input dialog window. Where the user can supply parameters for the computation Automatically called by performAction. Does nothing by default. Must be overridden if a dialog must be displayed.

Returns
1 if dialog has been successfully executed, 0 if canceled, negative error code otherwise

Reimplemented in TemplateAlignment, ExtractSIFT, GeneralFilters, CorrespondenceMatching, DONSegmentation, EuclideanClusterSegmentation, MinimumCutSegmentation, RegionGrowingSegmentation, SACSegmentation, ConvexConcaveHullReconstruction, GreedyTriangulation, MarchingCubeReconstruction, NurbsCurveFitting, NurbsSurfaceReconstruction, PoissonReconstruction, MLSSmoothingUpsampling, ProjectionFilter, NormalEstimation, and StatisticalOutliersRemover.

Referenced by performAction().

◆ openOutputDialog()

virtual int BasePclModule::openOutputDialog ( )
inlineprotectedvirtual

Opens the output dialog window. To be used when the computations have output to be shown in a dedicated dialog (as plots, histograms, etc) Automatically called by performAction. Does nothing by default. Must be overridden if a output dialog must be displayed.

Returns
1 if dialog has been successfully executed, 0 if canceled, negative error code otherwise

Referenced by performAction().

◆ performAction

int BasePclModule::performAction ( )
protectedslot

Returns is called when the dialog window is accepted.

it can be overridden but normally should not be necessary the parameters will be retrieved from the dialog via the getParametersFromDialog() method this always need to be overridden. Called when action is triggered

Note
performAction calls start() in base class

References ccHObject::applyGLTransformation_recursive(), checkParameters(), checkSelected(), getParametersFromDialog(), ccHObject::getViewId(), m_app, m_selected, openInputDialog(), openOutputDialog(), CV_TYPES::POINT_CLOUD, ecvMainAppInterface::putObjectBackIntoDBTree(), ecvDisplayTools::RedrawDisplay(), ecvDisplayTools::RemoveBB(), ecvMainAppInterface::removeObjectTemporarilyFromDBTree(), ccHObject::setRedrawFlagRecursive(), ecvDisplayTools::SetRedrawRecursive(), start(), throwError(), and ccHObjectCaster::ToPointCloud().

Referenced by initAction().

◆ setMainAppInterface()

void BasePclModule::setMainAppInterface ( ecvMainAppInterface *  app)
inline

Sets associated CC application interface (to access DB)

References m_app.

◆ setShowProgressBar()

void BasePclModule::setShowProgressBar ( bool  status)
inline

Sets whether to show a progressbar while computing or not.

References m_show_progress.

◆ start()

int BasePclModule::start ( )
protectedvirtual

Starts computation.

Automatically called by performAction. By default, baseclass method simply calls compute Can be overridden if needed (e.g. a pre-processing step before compute())

Returns
1 if whole process is successful (error code otherwise)

References doCompute(), getModuleName(), m_show_progress, s_computeStatus, s_computing, s_module, cloudViewer::utility::Sleep(), and throwError().

Referenced by performAction().

◆ throwError()

void BasePclModule::throwError ( int  errCode)
protected

Emits the error corresponding to a given error code (see newErrorMessage) Error messages are retrieved from getErrorMessage() and getFilterErrorMessage()

Parameters
errCodeError code (identifies a given error message)

References getErrorMessage(), and newErrorMessage().

Referenced by performAction(), and start().

◆ updateSelectedEntities()

void BasePclModule::updateSelectedEntities ( const ccHObject::Container &  selectedEntities)
virtual

Updates the internal copy of selected entities.

'selectedEntities' is a vector of pointers to selected entities.

References checkSelected(), m_action, and m_selected.

Member Data Documentation

◆ m_action

QAction* BasePclModule::m_action
protected

Forces the Ui to be updated.

Simply calls m_q_parent->UpdateUI(); The filter action (created by initAction)

Referenced by getAction(), initAction(), and updateSelectedEntities().

◆ m_app

◆ m_desc

PclModuleDescription BasePclModule::m_desc
protected

Associated dialog.

Created inside the derived class constructor Filter information Contains all informations about the given filter, as name etc.. Passed to the BasePclModule class constructor.

Referenced by getEntryName(), getIcon(), getModuleName(), and getStatusTip().

◆ m_parent_plugin

ccPluginInterface* BasePclModule::m_parent_plugin
protected

associated parent plugin of the filter

Referenced by BasePclModule(), and getParentPlugin().

◆ m_selected

◆ m_show_progress

bool BasePclModule::m_show_progress
protected

Do we want to show a progress bar when the filter works?

Referenced by setShowProgressBar(), and start().


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