GeneralFilter.hpp
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include <boost/foreach.hpp>
23 #include <ros/ros.h>
24 #include <vector>
25 
28 
29 namespace next_best_view {
32 
33  class GeneralFilter : public CommonClass {
34  private:
35  GeneralFilterPtr mPreFilter;
36  GeneralFilterPtr mPostFilter;
38  public:
42  GeneralFilter() : mPreFilter(), mPostFilter() {
43  mDebugHelperPtr = DebugHelper::getInstance();
44  }
45 
50  void setPreFilter(GeneralFilterPtr &filterPtr) {
51  mPreFilter = filterPtr;
52  }
53 
58  void setPostFilter(GeneralFilterPtr &filterPtr) {
59  mPostFilter = filterPtr;
60  }
61 
66  virtual void doFiltering(IndicesPtr &indicesPtr) = 0;
67 
72  void filter(IndicesPtr &indicesPtr) {
73  // set an empty indices list.
74  indicesPtr = IndicesPtr(new Indices());
75 
76  // apply pre filter
77  if (mPreFilter != GeneralFilterPtr()) {
78  mDebugHelperPtr->write("Start pre filtering", DebugHelper::FILTER);
79  // set the working input cloud and the relevant indices to work on.
80  mPreFilter->setInputCloud(this->getInputCloud());
81  mPreFilter->setIndices(this->getIndices());
82 
83  // do the filtering
84  mPreFilter->doFiltering(indicesPtr);
85 
86  // set the indices of the filter to the already filtered indices and reset the return indices pointer.
87  this->setIndices(indicesPtr);
88  indicesPtr = IndicesPtr(new Indices());
89  mDebugHelperPtr->write("Ended pre filtering", DebugHelper::FILTER);
90  }
91 
92  // apply this filter
93  this->doFiltering(indicesPtr);
94 
95  // apply post filter
96  if (mPostFilter != GeneralFilterPtr()) {
97  mDebugHelperPtr->write("Start post filtering", DebugHelper::FILTER);
98  // set the working input cloud and the relevant indices to work on.
99  mPostFilter->setInputCloud(this->getInputCloud());
100  mPostFilter->setIndices(indicesPtr);
101 
102  indicesPtr = IndicesPtr(new Indices());
103  mPostFilter->doFiltering(indicesPtr);
104  mDebugHelperPtr->write("Ended post filtering", DebugHelper::FILTER);
105  }
106  }
107  };
108 }
void setPreFilter(GeneralFilterPtr &filterPtr)
Adding a pre filter to this filter.
virtual ObjectPointCloudPtr & getInputCloud()
Definition: CommonClass.cpp:31
void filter(IndicesPtr &indicesPtr)
Applies the filter on the indices.
boost::shared_ptr< GeneralFilter > GeneralFilterPtr
std::vector< int > Indices
Definition: typedef.hpp:117
virtual void setIndices(const IndicesPtr &indicesPtr)
setting the shared pointer to the active indices of the point cloud.
Definition: CommonClass.cpp:35
this namespace contains all generally usable classes.
void setPostFilter(GeneralFilterPtr &filterPtr)
Adding a post filter to this filter.
static boost::shared_ptr< DebugHelper > getInstance()
Definition: DebugHelper.cpp:29
boost::shared_ptr< Indices > IndicesPtr
Definition: typedef.hpp:118
virtual IndicesPtr & getIndices()
Definition: CommonClass.cpp:39
virtual void doFiltering(IndicesPtr &indicesPtr)=0
Does the filtering on the indices.


asr_next_best_view
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Thu Jan 9 2020 07:20:18