37 #ifndef PCL_POINT_CLOUD_GEOMETRY_HANDLERS_H_ 38 #define PCL_POINT_CLOUD_GEOMETRY_HANDLERS_H_ 41 #pragma GCC system_header 45 #include <pcl/point_cloud.h> 46 #include <pcl/common/io.h> 48 #include <vtkSmartPointer.h> 49 #include <vtkPoints.h> 50 #include <vtkFloatArray.h> 54 namespace visualization
60 template <
typename Po
intT>
68 typedef typename boost::shared_ptr<PointCloudGeometryHandler<PointT> >
Ptr;
69 typedef typename boost::shared_ptr<const PointCloudGeometryHandler<PointT> >
ConstPtr;
138 template <
typename Po
intT>
146 typedef typename boost::shared_ptr<PointCloudGeometryHandlerXYZ<PointT> >
Ptr;
147 typedef typename boost::shared_ptr<const PointCloudGeometryHandlerXYZ<PointT> >
ConstPtr;
157 getName ()
const {
return (
"PointCloudGeometryHandlerXYZ"); }
186 template <
typename Po
intT>
194 typedef typename boost::shared_ptr<PointCloudGeometryHandlerSurfaceNormal<PointT> >
Ptr;
195 typedef typename boost::shared_ptr<const PointCloudGeometryHandlerSurfaceNormal<PointT> >
ConstPtr;
202 getName ()
const {
return (
"PointCloudGeometryHandlerSurfaceNormal"); }
231 template <
typename Po
intT>
239 typedef typename boost::shared_ptr<PointCloudGeometryHandlerCustom<PointT> >
Ptr;
240 typedef typename boost::shared_ptr<const PointCloudGeometryHandlerCustom<PointT> >
ConstPtr;
244 const std::string &x_field_name,
245 const std::string &y_field_name,
246 const std::string &z_field_name)
257 field_name_ = x_field_name + y_field_name + z_field_name;
263 getName ()
const {
return (
"PointCloudGeometryHandlerCustom"); }
280 points->SetDataTypeToFloat ();
281 points->SetNumberOfPoints (
cloud_->points.size ());
286 for (vtkIdType i = 0; i < static_cast<vtkIdType> (
cloud_->points.size ()); ++i)
289 const uint8_t* pt_data = reinterpret_cast<const uint8_t*> (&
cloud_->points[i]);
299 points->SetPoint (i, p);
313 std::string field_name_;
329 typedef boost::shared_ptr<PointCloudGeometryHandler<PointCloud> >
Ptr;
330 typedef boost::shared_ptr<const PointCloudGeometryHandler<PointCloud> >
ConstPtr;
339 , fields_ (cloud_->fields)
348 getName ()
const = 0;
352 getFieldName ()
const = 0;
409 typedef boost::shared_ptr<PointCloudGeometryHandlerXYZ<PointCloud> >
Ptr;
410 typedef boost::shared_ptr<const PointCloudGeometryHandlerXYZ<PointCloud> >
ConstPtr;
420 getName ()
const {
return (
"PointCloudGeometryHandlerXYZ"); }
442 typedef boost::shared_ptr<PointCloudGeometryHandlerSurfaceNormal<PointCloud> >
Ptr;
443 typedef boost::shared_ptr<const PointCloudGeometryHandlerSurfaceNormal<PointCloud> >
ConstPtr;
450 getName ()
const {
return (
"PointCloudGeometryHandlerSurfaceNormal"); }
474 const std::string &x_field_name,
475 const std::string &y_field_name,
476 const std::string &z_field_name);
483 getName ()
const {
return (
"PointCloudGeometryHandlerCustom"); }
491 std::string field_name_;
496 #ifdef PCL_NO_PRECOMPILE 497 #include <pcl/visualization/impl/point_cloud_geometry_handlers.hpp> 500 #endif // PCL_POINT_CLOUD_GEOMETRY_HANDLERS_H_ boost::shared_ptr< PointCloudGeometryHandlerCustom< PointT > > Ptr
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
XYZ handler class for PointCloud geometry.
PointCloud::Ptr PointCloudPtr
bool isCapable() const
Check if this handler is capable of handling the input data or not.
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
PointCloudConstPtr cloud_
A pointer to the input dataset.
Custom handler class for PointCloud geometry.
boost::shared_ptr< const PointCloudGeometryHandlerXYZ< PointT > > ConstPtr
boost::shared_ptr< PointCloudGeometryHandler< PointT > > Ptr
PointCloud::ConstPtr PointCloudConstPtr
int getFieldIndex(const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
Get the index of a specified field (i.e., dimension/channel)
pcl::PCLPointCloud2 PointCloud
virtual std::string getName() const
Class getName method.
PointCloudGeometryHandler< PointT >::PointCloud PointCloud
virtual std::string getFieldName() const
Get the name of the field used.
boost::shared_ptr< PointCloudGeometryHandlerSurfaceNormal< PointCloud > > Ptr
bool capable_
True if this handler is capable of handling the input data, false otherwise.
PointCloud::Ptr PointCloudPtr
boost::shared_ptr< const PointCloudGeometryHandlerSurfaceNormal< PointCloud > > ConstPtr
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const =0
Obtain the actual point geometry for the input dataset in VTK format.
boost::shared_ptr< const PointCloudGeometryHandler< PointCloud > > ConstPtr
pcl::PointCloud< PointT > PointCloud
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
Surface normal handler class for PointCloud geometry.
virtual std::string getName() const
Class getName method.
PointCloudGeometryHandler(const PointCloudConstPtr &cloud, const Eigen::Vector4f &=Eigen::Vector4f::Zero())
Constructor.
PointCloudGeometryHandler(const PointCloudConstPtr &cloud)
Constructor.
PointCloudGeometryHandler< PointT >::PointCloud PointCloud
boost::shared_ptr< const PointCloudGeometryHandlerSurfaceNormal< PointT > > ConstPtr
virtual ~PointCloudGeometryHandlerCustom()
Destructor.
boost::shared_ptr< PointCloudGeometryHandlerXYZ< PointCloud > > Ptr
int field_y_idx_
The index of the field holding the Y data.
boost::shared_ptr< ::pcl::PCLPointCloud2 > Ptr
int field_x_idx_
The index of the field holding the X data.
PointCloudGeometryHandler< pcl::PCLPointCloud2 >::PointCloud PointCloud
virtual std::string getFieldName() const
Get the name of the field used.
boost::shared_ptr< PointCloudGeometryHandlerSurfaceNormal< PointT > > Ptr
bool isCapable() const
Checl if this handler is capable of handling the input data or not.
boost::shared_ptr< const PointCloudGeometryHandlerCustom< PointT > > ConstPtr
boost::shared_ptr< PointCloud< PointT > > Ptr
boost::shared_ptr< const PointCloudGeometryHandlerXYZ< PointCloud > > ConstPtr
int field_z_idx_
The index of the field holding the Z data.
PointCloud::Ptr PointCloudPtr
PointCloudGeometryHandler< PointT >::PointCloud PointCloud
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
PointCloud::Ptr PointCloudPtr
PointCloud::Ptr PointCloudPtr
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
PointCloudGeometryHandler< pcl::PCLPointCloud2 >::PointCloud PointCloud
virtual ~PointCloudGeometryHandlerXYZ()
Destructor.
int field_y_idx_
The index of the field holding the Y data.
boost::shared_ptr< PointCloudGeometryHandlerXYZ< PointT > > Ptr
boost::shared_ptr< PointCloudGeometryHandler< PointCloud > > Ptr
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
virtual std::string getName() const
Class getName method.
PointCloudGeometryHandlerCustom(const PointCloudConstPtr &cloud, const std::string &x_field_name, const std::string &y_field_name, const std::string &z_field_name)
Constructor.
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloud::ConstPtr PointCloudConstPtr
boost::shared_ptr< ::pcl::PCLPointCloud2 const > ConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
PointCloudGeometryHandler< pcl::PCLPointCloud2 >::PointCloud PointCloud
int field_z_idx_
The index of the field holding the Z data.
virtual std::string getName() const
Class getName method.
virtual ~PointCloudGeometryHandler()
Destructor.
virtual std::string getName() const
Class getName method.
PointCloud::Ptr PointCloudPtr
PointCloud::ConstPtr PointCloudConstPtr
virtual ~PointCloudGeometryHandler()
Destructor.
Base handler class for PointCloud geometry.
virtual std::string getFieldName() const =0
Abstract getFieldName method.
virtual std::string getName() const =0
Abstract getName method.
PointCloud::ConstPtr PointCloudConstPtr
virtual std::string getFieldName() const
Get the name of the field used.
virtual ~PointCloudGeometryHandlerXYZ()
Destructor.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
PointCloud::ConstPtr PointCloudConstPtr
PointCloud::ConstPtr PointCloudConstPtr
int field_x_idx_
The index of the field holding the X data.
PointCloud::Ptr PointCloudPtr
PointCloud::ConstPtr PointCloudConstPtr
PointCloudConstPtr cloud_
A pointer to the input dataset.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
PointCloud::ConstPtr PointCloudConstPtr
boost::shared_ptr< const PointCloudGeometryHandler< PointT > > ConstPtr
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloud::Ptr PointCloudPtr