37#ifndef PCL_PCL_IMPL_BASE_HPP_
38#define PCL_PCL_IMPL_BASE_HPP_
40#include <pcl/pcl_base.h>
41#include <pcl/console/print.h>
45template <
typename Po
intT>
54template <
typename Po
intT>
64template <
typename Po
intT>
void
71template <
typename Po
intT>
void
80template <
typename Po
intT>
void
89template <
typename Po
intT>
void
98template <
typename Po
intT>
void
101 if ((nb_rows >
input_->height) || (row_start >
input_->height))
103 PCL_ERROR (
"[PCLBase::setIndices] cloud is only %d height\n",
input_->height);
107 if ((nb_cols > input_->width) || (col_start > input_->width))
109 PCL_ERROR (
"[PCLBase::setIndices] cloud is only %d width\n", input_->width);
113 std::size_t row_end = row_start + nb_rows;
114 if (row_end > input_->height)
116 PCL_ERROR (
"[PCLBase::setIndices] %d is out of rows range %d\n", row_end, input_->height);
120 std::size_t col_end = col_start + nb_cols;
121 if (col_end > input_->width)
123 PCL_ERROR (
"[PCLBase::setIndices] %d is out of columns range %d\n", col_end, input_->width);
128 indices_->reserve (nb_cols * nb_rows);
129 for(std::size_t i = row_start; i < row_end; i++)
130 for(std::size_t j = col_start; j < col_end; j++)
131 indices_->push_back (
static_cast<int> ((i * input_->width) + j));
132 fake_indices_ =
false;
137template <
typename Po
intT>
bool
143 PCL_ERROR (
"[initCompute] No input set.\n");
157 const auto indices_size =
indices_->size ();
162 catch (
const std::bad_alloc&)
164 PCL_ERROR (
"[initCompute] Failed to allocate %lu indices.\n",
input_->size ());
167 for (
auto i = indices_size; i <
indices_->size (); ++i) { (*indices_)[i] =
static_cast<int>(i); }
174template <
typename Po
intT>
bool
180#define PCL_INSTANTIATE_PCLBase(T) template class PCL_EXPORTS pcl::PCLBase<T>;
PointCloudConstPtr input_
The input point cloud dataset.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
typename PointCloud::ConstPtr PointCloudConstPtr
IndicesPtr indices_
A pointer to the vector of point indices to use.
virtual void setIndices(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represents the input data.
bool initCompute()
This method should get called before starting the actual computation.
bool use_indices_
Set to true if point indices are used.
bool fake_indices_
If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud.
PointIndices::ConstPtr PointIndicesConstPtr
PCLBase()
Empty constructor.
bool deinitCompute()
This method should get called after finishing the actual computation.
shared_ptr< Indices > IndicesPtr
IndicesAllocator<> Indices
Type used for indices in PCL.
shared_ptr< const Indices > IndicesConstPtr