40#ifndef PCL_FILTERS_IMPL_EXTRACT_INDICES_HPP_
41#define PCL_FILTERS_IMPL_EXTRACT_INDICES_HPP_
43#include <pcl/filters/extract_indices.h>
47template <
typename Po
intT>
void
57 std::vector<pcl::PCLPointField>
fields;
61 auto pt_index =
static_cast<uindex_t>(rii);
62 if (pt_index >=
input_->size ())
64 PCL_ERROR (
"[pcl::%s::filterDirectly] The index exceeds the size of the input. Do nothing.\n",
69 auto* pt_data =
reinterpret_cast<std::uint8_t*
> (&(*cloud)[pt_index]);
70 for (
const auto &field :
fields)
74 cloud->is_dense =
false;
78template <
typename Po
intT>
void
90 std::vector<pcl::PCLPointField>
fields;
94 auto pt_index =
static_cast<std::size_t
>(ri);
95 if (pt_index >=
input_->size ())
97 PCL_ERROR (
"[pcl::%s::applyFilter] The index exceeds the size of the input. Do nothing.\n",
102 auto* pt_data =
reinterpret_cast<std::uint8_t*
> (&output[pt_index]);
103 for (
const auto &field :
fields)
104 memcpy (pt_data + field.offset, &user_filter_value_, sizeof (
float));
106 if (!std::isfinite (user_filter_value_))
107 output.is_dense =
false;
111 applyFilterIndices (indices);
117template <
typename Po
intT>
void
122 PCL_ERROR (
"[pcl::%s::applyFilter] The indices size exceeds the size of the input.\n",
getClassName ().c_str ());
136 std::iota (full_indices.begin (), full_indices.end (),
static_cast<index_t> (0));
140 std::sort (sorted_input_indices.begin (), sorted_input_indices.end ());
144 set_difference (full_indices.begin (), full_indices.end (), sorted_input_indices.begin (), sorted_input_indices.end (), inserter (*
removed_indices_,
removed_indices_->begin ()));
150 Indices full_indices (input_->size ());
151 std::iota (full_indices.begin (), full_indices.end (),
static_cast<index_t
> (0));
154 Indices sorted_input_indices = *indices_;
155 std::sort (sorted_input_indices.begin (), sorted_input_indices.end ());
159 set_difference (full_indices.begin (), full_indices.end (), sorted_input_indices.begin (), sorted_input_indices.end (), inserter (indices, indices.begin ()));
161 if (extract_removed_indices_)
162 removed_indices_ = indices_;
166#define PCL_INSTANTIATE_ExtractIndices(T) template class PCL_EXPORTS pcl::ExtractIndices<T>;
IndicesPtr removed_indices_
Indices of the points that are removed.
bool extract_removed_indices_
Set to true if we want to return the indices of the removed points.
const std::string & getClassName() const
Get a string representation of the name of this class.
IndicesPtr removed_indices_
Indices of the points that are removed.
float user_filter_value_
The user given value that the filtered point dimensions should be set to (default = NaN).
bool keep_organized_
False = remove points (default), true = redefine points, keep structure.
bool negative_
False = normal filter behavior (default), true = inverted behavior.
PCLPointCloud2ConstPtr input_
The input point cloud dataset.
IndicesPtr indices_
A pointer to the vector of point indices to use.
PointCloudConstPtr input_
The input point cloud dataset.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
IndicesPtr indices_
A pointer to the vector of point indices to use.
void copyPointCloud(const pcl::PointCloud< PointInT > &cloud_in, pcl::PointCloud< PointOutT > &cloud_out)
Copy all the fields from a given point cloud into a new point cloud.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
IndicesAllocator<> Indices
Type used for indices in PCL.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.