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>
50 #include <vtkPoints.h>
51 #include <vtkFloatArray.h>
55 namespace visualization
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> >;
338 , fields_ (cloud_->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
virtual ~PointCloudGeometryHandler()=default
Destructor.
virtual std::string getName() const =0
Abstract getName method.
shared_ptr< PointCloudGeometryHandler< PointCloud > > Ptr
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
shared_ptr< const PointCloudGeometryHandler< PointCloud > > ConstPtr
PointCloud::Ptr PointCloudPtr
PointCloudConstPtr cloud_
A pointer to the input dataset.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
index_t field_z_idx_
The index of the field holding the Z data.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
PointCloud::ConstPtr PointCloudConstPtr
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
index_t field_y_idx_
The index of the field holding the Y data.
PointCloudGeometryHandler(const PointCloudConstPtr &cloud, const Eigen::Vector4f &=Eigen::Vector4f::Zero())
Constructor.
index_t field_x_idx_
The index of the field holding the X data.
virtual std::string getFieldName() const =0
Abstract getFieldName method.
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudGeometryHandlerCustom(const PointCloudConstPtr &cloud, const std::string &x_field_name, const std::string &y_field_name, const std::string &z_field_name)
Constructor.
Custom handler class for PointCloud geometry.
virtual std::string getFieldName() const
Get the name of the field used.
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.
Base handler class for PointCloud geometry.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
index_t field_y_idx_
The index of the field holding the Y data.
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.
index_t field_z_idx_
The index of the field holding the Z data.
shared_ptr< const PointCloudGeometryHandler< PointT > > ConstPtr
PointCloudGeometryHandler(const PointCloudConstPtr &cloud)
Constructor.
typename PointCloud::Ptr PointCloudPtr
bool capable_
True if this handler is capable of handling the input data, false otherwise.
typename PointCloud::ConstPtr PointCloudConstPtr
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloudConstPtr cloud_
A pointer to the input dataset.
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
index_t field_x_idx_
The index of the field holding the X data.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
Surface normal handler class for PointCloud geometry.
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.
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
XYZ handler class for PointCloud geometry.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getName() const
Class getName method.
static constexpr index_t UNAVAILABLE
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
A point structure representing Euclidean xyz coordinates, and the RGB color.