41#pragma GCC system_header
45#include <pcl/pcl_base.h>
46#include <pcl/point_cloud.h>
47#include <pcl/common/io.h>
49#include <vtkSmartPointer.h>
51#include <vtkFloatArray.h>
61 template <
typename Po
intT>
69 using Ptr = shared_ptr<PointCloudGeometryHandler<PointT> >;
70 using ConstPtr = shared_ptr<const PointCloudGeometryHandler<PointT> >;
139 template <
typename Po
intT>
147 using Ptr = shared_ptr<PointCloudGeometryHandlerXYZ<PointT> >;
148 using ConstPtr = shared_ptr<const PointCloudGeometryHandlerXYZ<PointT> >;
155 getName ()
const {
return (
"PointCloudGeometryHandlerXYZ"); }
184 template <
typename Po
intT>
192 using Ptr = shared_ptr<PointCloudGeometryHandlerSurfaceNormal<PointT> >;
193 using ConstPtr = shared_ptr<const PointCloudGeometryHandlerSurfaceNormal<PointT> >;
200 getName ()
const {
return (
"PointCloudGeometryHandlerSurfaceNormal"); }
229 template <
typename Po
intT>
237 using Ptr = shared_ptr<PointCloudGeometryHandlerCustom<PointT> >;
238 using ConstPtr = shared_ptr<const PointCloudGeometryHandlerCustom<PointT> >;
242 const std::string &x_field_name,
243 const std::string &y_field_name,
244 const std::string &z_field_name)
256 field_name_ = x_field_name + y_field_name + z_field_name;
262 getName ()
const {
return (
"PointCloudGeometryHandlerCustom"); }
279 points->SetDataTypeToFloat ();
280 points->SetNumberOfPoints (
cloud_->size ());
285 for (vtkIdType i = 0; i < static_cast<vtkIdType> (
cloud_->size ()); ++i)
288 const std::uint8_t* pt_data =
reinterpret_cast<const std::uint8_t*
> (&(*cloud_)[i]);
298 points->SetPoint (i, p);
312 std::string field_name_;
328 using Ptr = shared_ptr<PointCloudGeometryHandler<PointCloud> >;
329 using ConstPtr = shared_ptr<const PointCloudGeometryHandler<PointCloud> >;
332 PointCloudGeometryHandler (
const PointCloudConstPtr &cloud,
const Eigen::Vector4f & = Eigen::Vector4f::Zero ())
338 , fields_ (cloud_->
fields)
343 virtual ~PointCloudGeometryHandler() =
default;
347 getName ()
const = 0;
351 getFieldName ()
const = 0;
355 isCapable ()
const {
return (capable_); }
361 getGeometry (vtkSmartPointer<vtkPoints> &points)
const;
367 setInputCloud (
const PointCloudConstPtr &cloud)
374 PointCloudConstPtr cloud_;
391 std::vector<pcl::PCLPointField> fields_;
408 using Ptr = shared_ptr<PointCloudGeometryHandlerXYZ<PointCloud> >;
409 using ConstPtr = shared_ptr<const PointCloudGeometryHandlerXYZ<PointCloud> >;
416 getName ()
const {
return (
"PointCloudGeometryHandlerXYZ"); }
438 using Ptr = shared_ptr<PointCloudGeometryHandlerSurfaceNormal<PointCloud> >;
439 using ConstPtr = shared_ptr<const PointCloudGeometryHandlerSurfaceNormal<PointCloud> >;
446 getName ()
const {
return (
"PointCloudGeometryHandlerSurfaceNormal"); }
470 const std::string &x_field_name,
471 const std::string &y_field_name,
472 const std::string &z_field_name);
476 getName ()
const {
return (
"PointCloudGeometryHandlerCustom"); }
484 std::string field_name_;
489#ifdef PCL_NO_PRECOMPILE
490#include <pcl/visualization/impl/point_cloud_geometry_handlers.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
PointCloudGeometryHandler< pcl::PCLPointCloud2 >::PointCloud PointCloud
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloud::Ptr PointCloudPtr
PointCloud::ConstPtr PointCloudConstPtr
PointCloudGeometryHandlerCustom(const PointCloudConstPtr &cloud, const std::string &x_field_name, const std::string &y_field_name, const std::string &z_field_name)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
typename PointCloudGeometryHandler< PointT >::PointCloud PointCloud
typename PointCloud::Ptr PointCloudPtr
shared_ptr< PointCloudGeometryHandlerCustom< PointT > > Ptr
shared_ptr< const PointCloudGeometryHandlerCustom< PointT > > ConstPtr
virtual std::string getName() const
Class getName method.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
PointCloudGeometryHandlerCustom(const PointCloudConstPtr &cloud, const std::string &x_field_name, const std::string &y_field_name, const std::string &z_field_name)
Constructor.
typename PointCloud::ConstPtr PointCloudConstPtr
Base handler class for PointCloud geometry.
std::vector< pcl::PCLPointField > fields_
virtual std::string getName() const =0
Abstract getName method.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
shared_ptr< const PointCloudGeometryHandler< PointT > > ConstPtr
PointCloudGeometryHandler(const PointCloudConstPtr &cloud)
Constructor.
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
pcl::PointCloud< PointT > PointCloud
PointCloudConstPtr cloud_
virtual std::string getFieldName() const =0
Abstract getFieldName method.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const =0
Obtain the actual point geometry for the input dataset in VTK format.
virtual ~PointCloudGeometryHandler()=default
Destructor.
shared_ptr< PointCloudGeometryHandler< PointT > > Ptr
virtual std::string getFieldName() const
Get the name of the field used.
shared_ptr< PointCloudGeometryHandlerSurfaceNormal< PointCloud > > Ptr
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
PointCloud::ConstPtr PointCloudConstPtr
virtual std::string getName() const
Class getName method.
shared_ptr< const PointCloudGeometryHandlerSurfaceNormal< PointCloud > > ConstPtr
PointCloudGeometryHandler< pcl::PCLPointCloud2 >::PointCloud PointCloud
PointCloud::Ptr PointCloudPtr
shared_ptr< PointCloudGeometryHandlerSurfaceNormal< PointT > > Ptr
typename PointCloud::Ptr PointCloudPtr
typename PointCloudGeometryHandler< PointT >::PointCloud PointCloud
virtual std::string getFieldName() const
Get the name of the field used.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
shared_ptr< const PointCloudGeometryHandlerSurfaceNormal< PointT > > ConstPtr
virtual std::string getName() const
Class getName method.
typename PointCloud::ConstPtr PointCloudConstPtr
virtual std::string getFieldName() const
Get the name of the field used.
PointCloud::ConstPtr PointCloudConstPtr
shared_ptr< const PointCloudGeometryHandlerXYZ< PointCloud > > ConstPtr
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
PointCloudGeometryHandler< pcl::PCLPointCloud2 >::PointCloud PointCloud
PointCloud::Ptr PointCloudPtr
shared_ptr< PointCloudGeometryHandlerXYZ< PointCloud > > Ptr
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
typename PointCloud::Ptr PointCloudPtr
typename PointCloudGeometryHandler< PointT >::PointCloud PointCloud
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
typename PointCloud::ConstPtr PointCloudConstPtr
shared_ptr< const PointCloudGeometryHandlerXYZ< PointT > > ConstPtr
virtual std::string getFieldName() const
Get the name of the field used.
shared_ptr< PointCloudGeometryHandlerXYZ< PointT > > Ptr
virtual std::string getName() const
Class getName method.
int getFieldIndex(const pcl::PointCloud< PointT > &, const std::string &field_name, std::vector< pcl::PCLPointField > &fields)
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
static constexpr index_t UNAVAILABLE