Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject > Class Template Reference

Filter point clouds and indices based on a function object passed in the ctor. More...

#include <functor_filter.h>

Inheritance diagram for pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >:
Inheritance graph
Collaboration diagram for pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >:
Collaboration graph

Public Types

using FunctionObjectT = FunctionObject
 

Public Member Functions

 FunctorFilter (FunctionObjectT function_object, bool extract_removed_indices=false)
 Constructor. More...
 
const FunctionObjectTgetFunctionObject () const noexcept
 
FunctionObjectTgetFunctionObject () noexcept
 
void applyFilter (Indices &indices) override
 Filtered results are indexed by an indices array. More...
 
void applyFilter (PointCloud< PointT > &output) override
 

Protected Member Functions

 FunctorFilter (bool extract_removed_indices=false)
 ctor to be used by derived classes with member function as FilterFunction More...
 
void setFunctionObject (FunctionObjectT function_object) const noexcept
 utility function for derived class More...
 

Protected Attributes

bool keep_organized_ = false
 
float user_filter_value_ = std::numeric_limits<float>::quiet_NaN()
 

Private Types

using Base = FilterIndices< PointT >
 
using PCL_Base = PCLBase< PointT >
 

Private Attributes

FunctionObjectT functionObject_
 

Detailed Description

template<typename PointT, typename FunctionObject>
class pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >

Filter point clouds and indices based on a function object passed in the ctor.

The function object can be anything (lambda, std::function, invocable class, etc.) that can be moved into the class. Additionally, it must satisfy the condition is_function_object_for_filter_v

Definition at line 45 of file functor_filter.h.

Member Typedef Documentation

◆ Base

template<typename PointT , typename FunctionObject >
using pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::Base = FilterIndices<PointT>
private

Definition at line 46 of file functor_filter.h.

◆ FunctionObjectT

template<typename PointT , typename FunctionObject >
using pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::FunctionObjectT = FunctionObject

Definition at line 50 of file functor_filter.h.

◆ PCL_Base

template<typename PointT , typename FunctionObject >
using pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::PCL_Base = PCLBase<PointT>
private

Definition at line 47 of file functor_filter.h.

Constructor & Destructor Documentation

◆ FunctorFilter() [1/2]

template<typename PointT , typename FunctionObject >
pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::FunctorFilter ( FunctionObjectT  function_object,
bool  extract_removed_indices = false 
)
inline

Constructor.

Parameters
[in]function_objectObject of effective type FilterFunction in order to filter out the indices for which it returns false
[in]extract_removed_indicesSet to true if you want to be able to extract the indices of points being removed (default = false).

Definition at line 77 of file functor_filter.h.

78 : Base(extract_removed_indices), functionObject_(std::move(function_object))
79 {
80 filter_name_ = "functor_filter";
81 }

◆ FunctorFilter() [2/2]

template<typename PointT , typename FunctionObject >
pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::FunctorFilter ( bool  extract_removed_indices = false)
inlineprotected

ctor to be used by derived classes with member function as FilterFunction

Parameters
[in]extract_removed_indicesSet to true if you want to be able to extract the indices of points being removed (default = false).
Note
The class would be ill-defined until setFunctionObject has been called Do not call any filter routine until then

Definition at line 160 of file functor_filter.h.

160 : Base(extract_removed_indices)
161 {
162 filter_name_ = "functor_filter";
163 }

Member Function Documentation

◆ applyFilter() [1/2]

template<typename PointT , typename FunctionObject >
void pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::applyFilter ( Indices &  indices)
inlineoverride

Filtered results are indexed by an indices array.

Parameters
[out]indicesThe resultant indices.

Definition at line 100 of file functor_filter.h.

101 {
102 indices.clear();
103 indices.reserve(indices_->size());
104 if (extract_removed_indices_) {
105 removed_indices_->clear();
106 removed_indices_->reserve(indices_->size());
107 }
108
109 for (const auto index : *indices_) {
110 // function object returns true for points that should be selected
111 if (negative_ != functionObject_(*input_, index)) {
112 indices.push_back(index);
113 }
114 else if (extract_removed_indices_) {
115 removed_indices_->push_back(index);
116 }
117 }
118 }

References pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::functionObject_.

Referenced by pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::applyFilter().

Here is the caller graph for this function:

◆ applyFilter() [2/2]

template<typename PointT , typename FunctionObject >
void pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::applyFilter ( PointCloud< PointT > &  output)
inlineoverride

Definition at line 120 of file functor_filter.h.

121 {
122 Indices indices;
123 if (keep_organized_)
124 {
125 if (!extract_removed_indices_)
126 {
127 PCL_WARN ("[pcl::FilterIndices<PointT>::applyFilter] extract_removed_indices_ was set to 'true' to keep the point cloud organized.\n");
128 extract_removed_indices_ = true;
129 }
130 applyFilter (indices);
131
132 output = *input_;
133
134 // To preserve legacy behavior, only coordinates xyz are filtered.
135 // Copying a PointXYZ initialized with the user_filter_value_ into a generic
136 // PointT, ensures only the xyz coordinates, if they exist at destination,
137 // are overwritten.
139 for (const auto ri : *removed_indices_) // ri = removed index
140 copyPoint(ufv, output[ri]);
141 if (!std::isfinite (user_filter_value_))
142 output.is_dense = false;
143 }
144 else
145 {
146 output.is_dense = true;
147 applyFilter (indices);
148 pcl::copyPointCloud (*input_, indices, output);
149 }
150 }
void applyFilter(Indices &indices) override
Filtered results are indexed by an indices array.

References pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::applyFilter(), pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::keep_organized_, and pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::user_filter_value_.

Here is the call graph for this function:

◆ getFunctionObject() [1/2]

template<typename PointT , typename FunctionObject >
const FunctionObjectT & pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::getFunctionObject ( ) const
inlinenoexcept

◆ getFunctionObject() [2/2]

template<typename PointT , typename FunctionObject >
FunctionObjectT & pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::getFunctionObject ( )
inlinenoexcept

◆ setFunctionObject()

template<typename PointT , typename FunctionObject >
void pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::setFunctionObject ( FunctionObjectT  function_object) const
inlineprotectednoexcept

utility function for derived class

Parameters
[in]function_objectObject of effective type FilterFunction in order to filter out the indices for which it returns false

Definition at line 171 of file functor_filter.h.

172 {
173 functionObject_ = std::move(function_object);
174 }

References pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::functionObject_.

Member Data Documentation

◆ functionObject_

◆ keep_organized_

template<typename PointT , typename FunctionObject >
bool pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::keep_organized_ = false
protected

◆ user_filter_value_

template<typename PointT , typename FunctionObject >
float pcl::experimental::advanced::FunctorFilter< PointT, FunctionObject >::user_filter_value_ = std::numeric_limits<float>::quiet_NaN()
protected

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