MeVisLab Toolbox Reference
mlPCLObjectPtrsContainer.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 <mlPCLTypes.h>
17
19
22
25 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
29
37
45
53
57
60
63 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
70
73 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
80
83 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
84 inline void getPCLObjectPointer(MLPointCloudXYZPtr &pcPtr) const { pcPtr = pointCloudXYZ ; };
85 inline void getPCLObjectPointer(MLPointCloudXYZLNormalPtr &pcPtr) const { pcPtr = pointCloudXYZLNormal ; };
86 inline void getPCLObjectPointer(MLPointCloudXYZRGBNormalPtr &pcPtr) const { pcPtr = pointCloudXYZRGBNormal; };
87 inline void getPCLObjectPointer(MLPointCloudXYZINormalPtr &pcPtr) const { pcPtr = pointCloudXYZINormal ; };
89
91 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
93
95 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
97
100
103
107 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
108 std::string getScalarMemberValueAsString(size_t pointIdx, size_t memberIdx) const;
109
113 // Adapt this if a new PCL point type is integrated in the MeVisLab binding.
114 std::string getScalarMemberNameAsString(size_t memberIdx) const;
115};
116
118// Adapt this if a new PCL point type is integrated in the MeVisLab binding.
119#define ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES(CODE, PTR_CONTAINER, FUNC, MULTI_PURPOSE_ARG) \
120 CODE(PTR_CONTAINER, pointCloudXYZ , FUNC, MULTI_PURPOSE_ARG) \
121 CODE(PTR_CONTAINER, pointCloudXYZLNormal , FUNC, MULTI_PURPOSE_ARG) \
122 CODE(PTR_CONTAINER, pointCloudXYZRGBNormal, FUNC, MULTI_PURPOSE_ARG) \
123 CODE(PTR_CONTAINER, pointCloudXYZINormal , FUNC, MULTI_PURPOSE_ARG)
124
125// Includes dedicated implementations for the macros defined below.
126#include <mlPCLTypesPrivate.h>
127
128
132
137
141#define ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES_0(FUNC, POINT_CLOUD_POINTERS) \
142{ ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES(_CODE_FOR_0_ARGS, POINT_CLOUD_POINTERS, FUNC, ML_EMPTY_PARAM) }
143
144
147
153
157#define ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES_0_CONST_REF(FUNC, POINT_CLOUD_POINTERS) \
158{ ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES(_CODE_FOR_0_ARGS_CONST_REF, POINT_CLOUD_POINTERS, FUNC, ML_EMPTY_PARAM) }
159
160
164
171
175#define ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES_0_AND_CALL_FOR_SELECTED_TYPE(FUNC, POINT_CLOUD_POINTERS, ENUM_SELECTOR) \
176{ ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES(_CODE_FOR_0_ARGS_AND_CALL_FOR_SELECTED_TYPE, POINT_CLOUD_POINTERS, FUNC, ENUM_SELECTOR) }
177
178
181
190
196#define ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPE_COMBINATIONS(FUNC, POINT_CLOUD_POINTERS1, POINT_CLOUD_POINTERS2) \
197{ \
198 ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES(_ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPE_COMBINATIONS, POINT_CLOUD_POINTERS1, FUNC, POINT_CLOUD_POINTERS2) \
199}
200
203
212
218#define ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPE_COMBINATIONS_CONST_REF(FUNC, POINT_CLOUD_POINTERS1, POINT_CLOUD_POINTERS2) \
219{ \
220 ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPES(_ML_IMPLEMENT_FOR_SUPPORTED_POINT_TYPE_COMBINATIONS_CONST_REF, POINT_CLOUD_POINTERS1, FUNC, POINT_CLOUD_POINTERS2) \
221}
222
223
225
234
244// Adapt this if a new PCL point type is integrated in the MeVisLab binding.
245template <class MODULE_TYPE>
246inline std::string callSameTyped_filterT(MODULE_TYPE &mod,
247 const std::string &successfullCalledFilterMessage="",
248 const std::string &noValidPointCloudMessage="No input point clouds",
249 const std::string &noInput1PointCloudMessage="No input 1 point cloud",
250 const std::string &noInput2PointCloudMessage="No input 2 point cloud",
251 const std::string &differentPointCloudMessage="Input point clouds do not have same point type")
252{
253 std::string statusString = "";
254 MLPCLObjectPtrsContainer inputPointCloudPtrs1 = mod.getInputPCLObjectPtrsContainer(0);
255 MLPCLObjectPtrsContainer inputPointCloudPtrs2 = mod.getInputPCLObjectPtrsContainer(1);
256 if (inputPointCloudPtrs1.pointCloudXYZ && inputPointCloudPtrs2.pointCloudXYZ){
257 mod._filterT(inputPointCloudPtrs1.pointCloudXYZ, inputPointCloudPtrs2.pointCloudXYZ);
258 statusString = successfullCalledFilterMessage;
259 }
260 else if (inputPointCloudPtrs1.pointCloudXYZINormal && inputPointCloudPtrs2.pointCloudXYZINormal){
261 mod._filterT(inputPointCloudPtrs1.pointCloudXYZINormal, inputPointCloudPtrs2.pointCloudXYZINormal);
262 statusString = successfullCalledFilterMessage;
263 }
264 else if (inputPointCloudPtrs1.pointCloudXYZLNormal && inputPointCloudPtrs2.pointCloudXYZLNormal){
265 mod._filterT(inputPointCloudPtrs1.pointCloudXYZLNormal, inputPointCloudPtrs2.pointCloudXYZLNormal);
266 statusString = successfullCalledFilterMessage;
267 }
268 else if (inputPointCloudPtrs1.pointCloudXYZRGBNormal && inputPointCloudPtrs2.pointCloudXYZRGBNormal){
269 mod._filterT(inputPointCloudPtrs1.pointCloudXYZRGBNormal, inputPointCloudPtrs2.pointCloudXYZRGBNormal);
270 statusString = successfullCalledFilterMessage;
271 }
272 else if (!inputPointCloudPtrs1.hasValidPointCloudPointer() && !inputPointCloudPtrs2.hasValidPointCloudPointer()){
273 statusString = noValidPointCloudMessage;
274 }
275 else if (!inputPointCloudPtrs1.hasValidPointCloudPointer()){
276 statusString = noInput1PointCloudMessage;
277 }
278 else if (!inputPointCloudPtrs2.hasValidPointCloudPointer()){
279 statusString = noInput2PointCloudMessage;
280 }
281 else if (inputPointCloudPtrs1.hasValidPointCloudPointer() && inputPointCloudPtrs2.hasValidPointCloudPointer()){
282 statusString = differentPointCloudMessage;
283 }
284 return statusString;
285}
286
287//----------------------------------------------------------------------------------
293//----------------------------------------------------------------------------------
294#if PCL_VERSION_COMPARE(<, 1, 12, 0)
295template <typename POINT_CLOUD_TYPE>
296inline typename boost::shared_ptr<const POINT_CLOUD_TYPE> PCLMakeLocalNonDeletingSharedConstPtr(const POINT_CLOUD_TYPE &pntCloud)
297{
298 typename boost::shared_ptr<const POINT_CLOUD_TYPE> ptr(&pntCloud, _MLPCLNoObjectDeleter<POINT_CLOUD_TYPE>);
299 return ptr;
300}
301#else
302template <typename POINT_CLOUD_TYPE>
303inline typename std::shared_ptr<const POINT_CLOUD_TYPE> PCLMakeLocalNonDeletingSharedConstPtr(const POINT_CLOUD_TYPE &pntCloud)
304{
305 typename std::shared_ptr<const POINT_CLOUD_TYPE> ptr(&pntCloud, _MLPCLNoObjectDeleter<POINT_CLOUD_TYPE>);
306 return ptr;
307}
308#endif
309
310//----------------------------------------------------------------------------------
312//----------------------------------------------------------------------------------
313#define ML_PCL_TEST_INTERFACE_NO_OVERRIDE(BASE_OBJECT_NAME) \
314public:\
315 virtual inline void selfTestPCLBaseClass(bool alsoCallDestroyClass=false) \
316 { \
317 PCLBaseObject::_checkRuntimeInterfaceResults(getClassTypeId(), \
318 getTypeId(), \
319 getTypeIdName(), \
320 alsoCallDestroyClass); \
321 }
322
323//----------------------------------------------------------------------------------
325//----------------------------------------------------------------------------------
326#define ML_PCL_TEST_INTERFACE(BASE_OBJECT_NAME) \
327public:\
328 inline void selfTestPCLBaseClass(bool alsoCallDestroyClass=false) override \
329 { \
330 PCLBaseObject::_checkRuntimeInterfaceResults(getClassTypeId(), \
331 getTypeId(), \
332 getTypeIdName(), \
333 alsoCallDestroyClass); \
334 }
335
337
Project global and OS specific declarations.
#define MLPCLSUPPORT_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Internal macro implementations for specific type instantiations.
Basic types used in the MeVislab binding of the Point Cloud Library(PCL).
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
std::shared_ptr< const POINT_CLOUD_TYPE > PCLMakeLocalNonDeletingSharedConstPtr(const POINT_CLOUD_TYPE &pntCloud)
Many pcl filters and classes require a boost shared pointer to the point cloud to be processed,...
pcl::PointCloud< pcl::PointXYZRGBNormal >::Ptr MLPointCloudXYZRGBNormalPtr
The basic pointer type of a point cloud type used in the PCL MeVisLab binding.
Definition mlPCLTypes.h:100
pcl::PointCloud< pcl::PointXYZLNormal >::Ptr MLPointCloudXYZLNormalPtr
The basic pointer type of a point cloud type used in the PCL MeVisLab binding.
Definition mlPCLTypes.h:93
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
std::string callSameTyped_filterT(MODULE_TYPE &mod, const std::string &successfullCalledFilterMessage="", const std::string &noValidPointCloudMessage="No input point clouds", const std::string &noInput1PointCloudMessage="No input 1 point cloud", const std::string &noInput2PointCloudMessage="No input 2 point cloud", const std::string &differentPointCloudMessage="Input point clouds do not have same point type")
Helper function to call.
pcl::PolygonMesh::Ptr MLPolygonMeshPtr
The basic pointer type of a pcl::PolygonMesh in the PCL MeVisLab binding.
Definition mlPCLTypes.h:114
pcl::PointCloud< pcl::PointXYZINormal >::Ptr MLPointCloudXYZINormalPtr
The basic pointer type of a point cloud type used in the PCL MeVisLab binding.
Definition mlPCLTypes.h:107
A container with pointers from the PCL (Point Cloud Library) passed in BaseObjects between PCL module...
void setPCLObjectPointer(MLPointCloudXYZLNormalPtr pcPtr)
bool hasValidPCLObjectPointer() const
Returns true if at least one of all PCL object pointer is valid.
MLPCLObjectPtrsContainer(MLPointCloudXYZRGBNormalPtr pcPtr)
MLPCLObjectPtrsContainer()
Default constructor initializing all pointers to defaults.
void setPCLObjectPointer(MLPointCloudXYZRGBNormalPtr pcPtr)
MLPolygonMeshPtr polygonMesh
Pointer to a pcl::Polygon mesh, see pcl::Polygon for details.
void setPCLObjectPointer(MLPointCloudXYZPtr pcPtr)
Setting a new container object clearing all other ones.
bool hasValidPolygonMeshPointer() const
Returns true if at least one of all polygon mesh pointers is valid.
MLPCLObjectPtrsContainer(MLPointCloudXYZPtr pcPtr)
Specific constructor for the given object type setting all other objects to nullptr.
void getPCLObjectPointer(MLPointCloudXYZPtr &pcPtr) const
Method returning the cloud pointer matching the given pointer type.
void setPCLObjectPointer(MLPolygonMeshPtr pMeshPtr)
void getPCLObjectPointer(MLPointCloudXYZRGBNormalPtr &pcPtr) const
MLPCLObjectPtrsContainer(MLPointCloudXYZINormalPtr pcPtr)
MLPCLObjectPtrsContainer(MLPointCloudXYZLNormalPtr pcPtr)
void getPCLObjectPointer(MLPointCloudXYZINormalPtr &pcPtr) const
MLPointCloudXYZRGBNormalPtr pointCloudXYZRGBNormal
Cloud with four floats x,y,z,data[3], or alternatively data[0]-data[3], and a normal of four floats n...
std::string getScalarMemberNameAsString(size_t memberIdx) const
From the first valid member pointer the memberIdx'th scalar member is returned as string,...
void clearPCLObjectPointers()
Sets all pointers to nullptr.
bool hasValidPointCloudPointer() const
Returns true if at least one of all point cloud pointers is valid.
MLPCLObjectPtrsContainer(MLPolygonMeshPtr pMeshPtr)
std::string getScalarMemberValueAsString(size_t pointIdx, size_t memberIdx) const
From the first valid pointer return the memberIdx'th scalar member as string, regardless of its types...
void setPCLObjectPointer(MLPointCloudXYZINormalPtr pcPtr)
MLPointCloudXYZPtr pointCloudXYZ
Cloud with four floats x,y,z,data[3], or alternatively data[0]-data[3], data[3] should usually be 1,...
MLPointCloudXYZLNormalPtr pointCloudXYZLNormal
Cloud with four floats x,y,z,data[3], or alternatively data[0]-data[3], and a normal of four floats n...
void getPCLObjectPointer(MLPointCloudXYZLNormalPtr &pcPtr) const
MLPointCloudXYZINormalPtr pointCloudXYZINormal
Cloud with four floats x,y,z,data[3], or alternatively data[0]-data[3], and a normal of four floats n...