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:
Collaboration diagram for BasePclModule:

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 ()
 
ccPointCloudgetSelectedEntityAsCCPointCloud () const
 Returns the first selected entity as a ccPointCloud. More...
 
ccHObjectgetSelectedEntityAsCCHObject () 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...
 
ecvMainAppInterfacegetMainAppInterface ()
 
ccPluginInterfacegetParentPlugin () 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...
 
ecvMainAppInterfacem_app
 Associated application interface. More...
 
ccPluginInterfacem_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

Definition at line 53 of file BasePclModule.h.

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)

Definition at line 37 of file BasePclModule.cpp.

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 PoissonReconstruction, NurbsSurfaceReconstruction, NurbsCurveFitting, MarchingCubeReconstruction, GreedyTriangulation, ConvexConcaveHullReconstruction, SACSegmentation, RegionGrowingSegmentation, MinimumCutSegmentation, EuclideanClusterSegmentation, DONSegmentation, TemplateAlignment, CorrespondenceMatching, ProjectionFilter, GeneralFilters, and ExtractSIFT.

Definition at line 239 of file BasePclModule.h.

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, PoissonReconstruction, NurbsSurfaceReconstruction, NurbsCurveFitting, MarchingCubeReconstruction, GreedyTriangulation, ConvexConcaveHullReconstruction, SACSegmentation, RegionGrowingSegmentation, MinimumCutSegmentation, EuclideanClusterSegmentation, DONSegmentation, TemplateAlignment, CorrespondenceMatching, and ExtractSIFT.

Definition at line 139 of file BasePclModule.cpp.

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.

Definition at line 216 of file BasePclModule.cpp.

References m_action.

Referenced by qPCL::addPclModule().

◆ getAllEntitiesOfType()

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

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

Definition at line 285 of file BasePclModule.cpp.

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.

Definition at line 292 of file BasePclModule.cpp.

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

Definition at line 210 of file BasePclModule.cpp.

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, PoissonReconstruction, NurbsSurfaceReconstruction, NurbsCurveFitting, MarchingCubeReconstruction, GreedyTriangulation, ConvexConcaveHullReconstruction, SACSegmentation, RegionGrowingSegmentation, MinimumCutSegmentation, EuclideanClusterSegmentation, DONSegmentation, TemplateAlignment, CorrespondenceMatching, ProjectionFilter, GeneralFilters, and ExtractSIFT.

Definition at line 218 of file BasePclModule.cpp.

References getModuleName().

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

◆ getIcon()

QIcon BasePclModule::getIcon ( ) const

Returns the icon associated with the button.

Definition at line 214 of file BasePclModule.cpp.

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

Definition at line 165 of file BasePclModule.h.

References m_app.

◆ getModuleName()

QString BasePclModule::getModuleName ( ) const

Returns the name of the filter.

Definition at line 208 of file BasePclModule.cpp.

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.

Definition at line 168 of file BasePclModule.h.

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.

Definition at line 344 of file BasePclModule.cpp.

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

Definition at line 315 of file BasePclModule.cpp.

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

Definition at line 304 of file BasePclModule.cpp.

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

Definition at line 266 of file BasePclModule.cpp.

References m_selected.

◆ getSelectedEntityAsCCPointCloud()

◆ getSelectedThatHaveMetaData()

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

Get selected object that also have the provided metadata key.

Definition at line 273 of file BasePclModule.cpp.

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

Definition at line 212 of file BasePclModule.cpp.

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.

Definition at line 365 of file BasePclModule.cpp.

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.

Definition at line 335 of file BasePclModule.cpp.

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

Definition at line 326 of file BasePclModule.cpp.

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

◆ initAction()

void BasePclModule::initAction ( )
protectedvirtual

Initializes the corresponding action.

Action can be retrieved with getAction.

Definition at line 44 of file BasePclModule.cpp.

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 PoissonReconstruction, NurbsSurfaceReconstruction, NurbsCurveFitting, MarchingCubeReconstruction, GreedyTriangulation, ConvexConcaveHullReconstruction, SACSegmentation, RegionGrowingSegmentation, MinimumCutSegmentation, EuclideanClusterSegmentation, DONSegmentation, TemplateAlignment, CorrespondenceMatching, StatisticalOutliersRemover, ProjectionFilter, MLSSmoothingUpsampling, GeneralFilters, NormalEstimation, and ExtractSIFT.

Definition at line 215 of file BasePclModule.h.

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

Definition at line 225 of file BasePclModule.h.

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

Definition at line 68 of file BasePclModule.cpp.

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)

Definition at line 161 of file BasePclModule.h.

References m_app.

Referenced by qPCL::addPclModule().

◆ setShowProgressBar()

void BasePclModule::setShowProgressBar ( bool  status)
inline

Sets whether to show a progressbar while computing or not.

Definition at line 95 of file BasePclModule.h.

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)

Definition at line 162 of file BasePclModule.cpp.

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)

Definition at line 53 of file BasePclModule.cpp.

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.

Definition at line 61 of file BasePclModule.cpp.

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)

Definition at line 269 of file BasePclModule.h.

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.

Definition at line 293 of file BasePclModule.h.

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

◆ m_parent_plugin

ccPluginInterface* BasePclModule::m_parent_plugin
protected

associated parent plugin of the filter

Definition at line 299 of file BasePclModule.h.

Referenced by BasePclModule(), and getParentPlugin().

◆ m_selected

ccHObject::Container BasePclModule::m_selected
protected

◆ m_show_progress

bool BasePclModule::m_show_progress
protected

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

Definition at line 302 of file BasePclModule.h.

Referenced by setShowProgressBar(), and start().


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