MeVisLab Toolbox Reference
mlPCLModule.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code author="Wolf Spindler"
3//----------------------------------------------------------------------------------
5
12//----------------------------------------------------------------------------------
13#pragma once
14
15#include "MLPCLSupportSystem.h"
16#include <mlModuleIncludes.h>
18#include <mlPCLBaseObject.h>
19
21
22//----------------------------------------------------------------------------------
24//----------------------------------------------------------------------------------
26{
27public:
37 int numPCLInputs=0, int numPCLOutputs=0,
38 bool createEnumAndNotify=false);
39
41 ~PCLModule() override;
42
45
48
53
57
60
63
66
69
74
80 template <typename PCL_OBJECT_PTR_TYPE>
81 inline void setOutputPCLObject(size_t outIdx,
83 {
84 PCLBaseObject *outBaseObject = getOutputPCLBaseObject(outIdx);
85 if (!outBaseObject){
86 // Create a new base object if there is still no one.
88 setOutputPCLBaseObject(outIdx, outBaseObjectPtr); // Also touches since base value is set.
89 }
90 else{
91 outBaseObject->getPCLObjectPtrsContainer().setPCLObjectPointer(outputPCLObjectPtr);
92 getOutputPCLBaseObjectField(outIdx).touch();
93 }
94 }
95
100 inline void clearOutputPCLPointers(size_t outIdx)
101 {
102 setOutputPCLObject(outIdx, MLPointCloudXYZPtr());
103 }
104
106 std::vector<PCLBaseObjectPtr> getNonNullConnectedInputPCLBaseObjects() const;
107
112
117
120
123
125 void setStatusString(const std::string &statusStr);
126
128 std::string getStatusString() const;
129
132
133protected:
136
139
144
145private:
146
148 StringField *_statusFld;
149
151 EnumField *_updateModeFld;
152
154 NotifyField *_updateFld;
155
157 std::vector<BaseField*> _pclInputConnectors;
158
160 std::vector<BaseField*> _pclOutputConnectors;
161
164
167};
168
170
Project global and OS specific declarations.
#define MLPCLSUPPORT_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:797
Field to encapsulate an enumerated value.
Definition mlFields.h:195
Base class for all fields used in the ML.
Definition mlField.h:73
Base class for an image processing module of the ML.
Definition mlModule.h:151
Field without value for notifications.
Definition mlFields.h:659
Base object containing pointers (as MLPCLObjectPtrsContainer) to objects from the Point Cloud Library...
ML Module base class for algorithms from the Point Cloud Library (PCL).
Definition mlPCLModule.h:26
BaseField & getInputPCLBaseObjectField(size_t inIdx) const
Returns the base field of the idx'th input connector if it exists, accessing non existing indexes is ...
bool _needsUpdate(Field *field) const
If _updateModeFld and _updateFld settings with field require an update then true is returned,...
MLPCLObjectPtrsContainer getInputPCLObjectPtrsContainer(size_t inIdx)
Convenience function which returns an PointCloudPointers pointer for an existing input PCLBaseObject ...
NotifyField * getUpdateFieldPointer() const
Returns the update field if it has been created in the constructor, otherwise nullptr is returned.
~PCLModule() override
Destructor.
PCLBaseObject * getInputPCLBaseObject(size_t inIdx) const
Returns the PCL base object of the idx'th input connector if it exists, accessing non existing indexe...
const StringField & getStatusStringField() const
Returns a constant reference to the status string field, for example to compare to it in handle Notif...
size_t getNumInputPCLBaseObjectFields() const
Returns the number of PCLBaseObject input connectors.
BaseField & getOutputPCLBaseObjectField(size_t inIdx) const
Returns the base field of the idx'th output connector if it exists, accessing non existing indexes is...
bool hasValidInputPointCloudPointer(size_t inIdx)
Returns true if at input inIdx a valid point cloud is connected (which, however, could contain only z...
PCLModule(int numImageInputs=0, int numImageOutputs=0, int numPCLInputs=0, int numPCLOutputs=0, bool createEnumAndNotify=false)
Constructor which created numImageInputs image inputs, numImageOutputs image outputs,...
std::vector< PCLBaseObjectPtr > getNonNullConnectedInputPCLBaseObjects() const
Returns a vector of all connected non nullptr PCLBaseObjects.
void setStatusString(const std::string &statusStr)
Sets a status string in the status field.
void clearOutputPCLPointers(size_t outIdx)
Resets all point cloud pointers at outIdx to nullptr; if no output base object exists then one is cre...
void handleNotification(Field *field) override
Handles field changes of the field field.
size_t getNumOutputPCLBaseObjectFields() const
Returns the number of PCLBaseObject output connectors.
void setOutputPCLObject(size_t outIdx, PCL_OBJECT_PTR_TYPE outputPCLObjectPtr)
Sets a new PCL object at output outIdx; if no base object exists one is created (which always touches...
Definition mlPCLModule.h:81
std::string getStatusString() const
Sets a status string in the status field.
MLPCLObjectPtrsContainer getOutputPCLObjectPtrsContainer(size_t inIdx)
Convenience function which returns an PointCloudPointers container for an existing output PCLBaseObje...
virtual void _updateConnectionStatus()
If there is at least one input connector for a point cloud then this updates the status field with in...
void setOutputPCLBaseObject(size_t outIdx, PCLBaseObjectPtr baseObjPtr)
Sets the PCL base object of the idx'th output connector if it exists, using non existing indexes is n...
EnumField * getUpdateModeFieldPointer() const
Returns the update mode field if it has been created in the constructor, otherwise nullptr is returne...
PCLBaseObject * getOutputPCLBaseObject(size_t inIdx) const
Returns the PCL base object of the idx'th output connector if it exists, accessing non existing index...
bool hasValidInputPolygonMeshPointer(size_t inIdx)
Returns true if at input inIdx a valid polygon mesh is connected (which, however, could be empty!...
Field to encapsulate a string value.
Definition mlFields.h:610
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
Base object containing pointers (as MLPCLObjectPtrsContainer) to objects from the Point Cloud Library...
A container with pointers from the PCL (Point Cloud Library) passed in BaseObjects between PCL module...
#define ML_PCL_TEST_INTERFACE_NO_OVERRIDE(BASE_OBJECT_NAME)
Implements a dedicated interface for PCL related modules which is required in automatic tests.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
pcl::PointCloud< pcl::PointXYZ >::Ptr MLPointCloudXYZPtr
The basic pointer type of a point cloud type used in the PCL MeVisLab binding.
Definition mlPCLTypes.h:86
A container with pointers from the PCL (Point Cloud Library) passed in BaseObjects between PCL module...