MeVisLab Toolbox Reference
mlPCLSampleConsensusModels.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 
16 #include <mlPCLModule.h>
18 #include <pcl/sample_consensus/sac_model.h>
20 
21 // Define this to compile the experimental output for the samples point cloud,
22 // which, however, still does not work as expected.
23 // #define _COMPILE_SAC_MODEL_PCL_SAMPLE_OUTPUT
24 
25 
26 ML_START_NAMESPACE
27 
28 //----------------------------------------------------------------------------------
30 //----------------------------------------------------------------------------------
32 {
33 public:
36 
43  pcl::SampleConsensusModel<pcl::PointXYZ>::Ptr createModelT(pcl::PointCloud<pcl::PointXYZ>::Ptr &cloudPtr, std::string &msg);
44  pcl::SampleConsensusModel<pcl::PointXYZLNormal>::Ptr createModelT(pcl::PointCloud<pcl::PointXYZLNormal>::Ptr &cloudPtr, std::string &msg);
45  pcl::SampleConsensusModel<pcl::PointXYZRGBNormal>::Ptr createModelT(pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr &cloudPtr, std::string &msg);
46  pcl::SampleConsensusModel<pcl::PointXYZINormal>::Ptr createModelT(pcl::PointCloud<pcl::PointXYZINormal>::Ptr &cloudPtr, std::string &msg);
48 
50  bool needsNormalsInPoints() const;
51 
52 protected:
54  void activateAttachments() override;
55 
57  void handleNotification (Field* field) override;
58 
59 private:
60 
66  template <typename POINT_CLOUD_TYPE_PTR>
67  typename pcl::SampleConsensusModel<typename POINT_CLOUD_TYPE_PTR::element_type::PointType>::Ptr
68  _createModelTWithNormals(POINT_CLOUD_TYPE_PTR &cloudPtr, std::string &msg);
69 
76  template <typename POINT_CLOUD_TYPE_PTR>
77  typename pcl::SampleConsensusModel<typename POINT_CLOUD_TYPE_PTR::element_type::PointType>::Ptr
78  _createModelTWithoutNormals(POINT_CLOUD_TYPE_PTR &cloudPtr, std::string &msg);
79 
85  template <typename POINT_CLOUD_TYPE_PTR>
86  typename pcl::SampleConsensusModel<typename POINT_CLOUD_TYPE_PTR::element_type::PointType>::Ptr
87  _createRegistrationModel(POINT_CLOUD_TYPE_PTR &cloudPtr,
88  std::string &msg);
89 
91  DoubleField *_epsAngleFld;
92 
94  DoubleField *_epsDistFld;
95 
97  DoubleField *_normalDistanceWeightFld;
98 
101  Vector3Field *_axisFld;
102 
104  DoubleField *_minOpeningAngleFld;
105 
107  DoubleField *_maxOpeningAngleFld;
108 
110  EnumField *_modelTypeFld;
111 
113  BaseField *_outputSacMLModuleBaseFld;
114 
115 #ifdef _COMPILE_SAC_MODEL_PCL_SAMPLE_OUTPUT
118  void _createSampleAndSetOutput();
119 
121  template <typename POINT_CLOUD_PTR_TYPE>
122  void _createSampleAndSetOutputT(const POINT_CLOUD_PTR_TYPE /*inputPointCloudPtr*/);
123 
125  IntField *_sampleXFld;
126 
128  IntField *_sampleYFld;
129 
131  IntField *_sampleZFld;
132 
134  DoubleField *_distanceThresholdFld;
135 
137  FloatField *_fillValueFld;
138 
140  NotifyField *_createSampleModelFld;
141 
143  EnumField *_outputPointCloudTypeFld;
144 #endif
145 
148 
151 };
152 
153 ML_END_NAMESPACE
154 
Project global and OS specific declarations.
#define MLPCL_SampleConsensus_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Disables warnings from PCL headers which otherwise cannot be avoided.
Restores disabled warnings from PCL headers which otherwise cannot be avoided.
Field to encapsulate a pointer to an ML base object.
Definition: mlFields.h:1187
Field to encapsulate a double value.
Definition: mlFields.h:806
Field to encapsulate an enumerated value.
Definition: mlFields.h:363
Base class for all fields used in the ML.
Definition: mlField.h:73
Field to encapsulate a float value.
Definition: mlFields.h:627
Field to encapsulate an integer value.
Definition: mlFields.h:161
Field without value for notifications.
Definition: mlFields.h:1049
ML Module base class for algorithms from the Point Cloud Library (PCL).
Definition: mlPCLModule.h:26
ML Module class wrapping the pcl::SampleConsensusModel model classes of the PCL.
pcl::SampleConsensusModel< pcl::PointXYZ >::Ptr createModelT(pcl::PointCloud< pcl::PointXYZ >::Ptr &cloudPtr, std::string &msg)
Public function for all compiled point types to return a newly created model of the selected model ty...
pcl::SampleConsensusModel< pcl::PointXYZRGBNormal >::Ptr createModelT(pcl::PointCloud< pcl::PointXYZRGBNormal >::Ptr &cloudPtr, std::string &msg)
pcl::SampleConsensusModel< pcl::PointXYZLNormal >::Ptr createModelT(pcl::PointCloud< pcl::PointXYZLNormal >::Ptr &cloudPtr, std::string &msg)
bool needsNormalsInPoints() const
Returns true if the currently selected model type needs normals in points, otherwise false.
void activateAttachments() override
Updates internal state after changes of fields without field notifications.
PCLSampleConsensusModels()
Initializes an ML module wrapping a pcl::SampleConsensusModel classes.
pcl::SampleConsensusModel< pcl::PointXYZINormal >::Ptr createModelT(pcl::PointCloud< pcl::PointXYZINormal >::Ptr &cloudPtr, std::string &msg)
void handleNotification(Field *field) override
Handles field changes of the field field.
Field to encapsulate a vector of 3 double values.
Definition: mlFields.h:1538
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
ML Module base class for algorithms from the Point Cloud Library (PCL).
#define ML_PCL_TEST_INTERFACE(BASE_OBJECT_NAME)
Implements a dedicated interface for PCL related modules which is required in automatic tests.