41 #pragma GCC system_header
46 #include <pcl/point_cloud.h>
47 #include <pcl/common/io.h>
48 #include <pcl/visualization/common/common.h>
50 #include <vtkSmartPointer.h>
51 #include <vtkDataArray.h>
52 #include <vtkFloatArray.h>
53 #include <vtkUnsignedCharArray.h>
57 namespace visualization
64 template <
typename Po
intT>
72 using Ptr = shared_ptr<PointCloudColorHandler<PointT> >;
73 using ConstPtr = shared_ptr<const PointCloudColorHandler<PointT> >;
117 PCL_DEPRECATED(1, 12,
"use getColor() without parameters instead")
121 return scalars.Get() !=
nullptr;
154 template <
typename Po
intT>
162 using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointT> >;
163 using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointT> >;
181 getName ()
const {
return (
"PointCloudColorHandlerRandom"); }
204 template <
typename Po
intT>
212 using Ptr = shared_ptr<PointCloudColorHandlerCustom<PointT> >;
213 using ConstPtr = shared_ptr<const PointCloudColorHandlerCustom<PointT> >;
227 double r,
double g,
double b)
241 getName ()
const {
return (
"PointCloudColorHandlerCustom"); }
267 template <
typename Po
intT>
275 using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointT> >;
276 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointT> >;
312 getName ()
const {
return (
"PointCloudColorHandlerRGBField"); }
327 template <
typename Po
intT>
335 using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointT> >;
336 using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointT> >;
356 getName ()
const {
return (
"PointCloudColorHandlerHSVField"); }
377 template <
typename Po
intT>
385 using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointT> >;
386 using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointT> >;
390 : field_name_ (field_name)
397 const std::string &field_name)
399 , field_name_ (field_name)
424 getName ()
const {
return (
"PointCloudColorHandlerGenericField"); }
433 std::string field_name_;
443 template <
typename Po
intT>
451 using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointT> >;
452 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointT> >;
488 getName ()
const {
return (
"PointCloudColorHandlerRGBAField"); }
504 template <
typename Po
intT>
512 using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointT> >;
513 using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointT> >;
521 static_mapping_ = static_mapping;
527 const bool static_mapping =
true)
531 static_mapping_ = static_mapping;
555 getName ()
const {
return (
"PointCloudColorHandlerLabelField"); }
563 bool static_mapping_;
579 using Ptr = shared_ptr<PointCloudColorHandler<PointCloud> >;
580 using ConstPtr = shared_ptr<const PointCloudColorHandler<PointCloud> >;
584 cloud_ (cloud), capable_ (false), field_idx_ ()
619 PCL_DEPRECATED(1, 12,
"use getColor() without parameters instead")
622 scalars = getColor ();
623 return scalars.Get() !=
nullptr;
661 using Ptr = shared_ptr<PointCloudColorHandlerRandom<PointCloud> >;
662 using ConstPtr = shared_ptr<const PointCloudColorHandlerRandom<PointCloud> >;
676 getName ()
const {
return (
"PointCloudColorHandlerRandom"); }
704 double r,
double g,
double b) :
706 r_ (r), g_ (g), b_ (b)
716 getName ()
const {
return (
"PointCloudColorHandlerCustom"); }
746 using Ptr = shared_ptr<PointCloudColorHandlerRGBField<PointCloud> >;
747 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBField<PointCloud> >;
763 getName ()
const {
return (
"PointCloudColorHandlerRGBField"); }
783 using Ptr = shared_ptr<PointCloudColorHandlerHSVField<PointCloud> >;
784 using ConstPtr = shared_ptr<const PointCloudColorHandlerHSVField<PointCloud> >;
800 getName ()
const {
return (
"PointCloudColorHandlerHSVField"); }
827 using Ptr = shared_ptr<PointCloudColorHandlerGenericField<PointCloud> >;
828 using ConstPtr = shared_ptr<const PointCloudColorHandlerGenericField<PointCloud> >;
832 const std::string &field_name);
845 getName ()
const {
return (
"PointCloudColorHandlerGenericField"); }
853 std::string field_name_;
870 using Ptr = shared_ptr<PointCloudColorHandlerRGBAField<PointCloud> >;
871 using ConstPtr = shared_ptr<const PointCloudColorHandlerRGBAField<PointCloud> >;
887 getName ()
const {
return (
"PointCloudColorHandlerRGBAField"); }
908 using Ptr = shared_ptr<PointCloudColorHandlerLabelField<PointCloud> >;
909 using ConstPtr = shared_ptr<const PointCloudColorHandlerLabelField<PointCloud> >;
914 const bool static_mapping =
true);
927 getName ()
const {
return (
"PointCloudColorHandlerLabelField"); }
933 bool static_mapping_;
939 #include <pcl/visualization/impl/point_cloud_color_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
int field_idx_
The index of the field holding the data that represents the color.
bool isCapable() const
Return whether this handler is capable of handling the input data or not.
PointCloudConstPtr cloud_
A pointer to the input dataset.
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
PointCloud::ConstPtr PointCloudConstPtr
virtual std::string getFieldName() const =0
Abstract getFieldName method.
PointCloud::Ptr PointCloudPtr
void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
shared_ptr< const PointCloudColorHandler< PointCloud > > ConstPtr
virtual ~PointCloudColorHandler()
Destructor.
virtual vtkSmartPointer< vtkDataArray > getColor() const
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getName() const =0
Abstract getName method.
shared_ptr< PointCloudColorHandler< PointCloud > > Ptr
bool capable_
True if this handler is capable of handling the input data, false otherwise.
virtual ~PointCloudColorHandlerCustom()
Empty destructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getName() const
Get the name of the class.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
Handler for predefined user colors.
virtual std::string getFieldName() const
Get the name of the field used.
double r_
Internal R, G, B holding the values given by the user.
PointCloudColorHandlerCustom(const PointCloudConstPtr &cloud, double r, double g, double b)
Constructor.
PointCloudColorHandlerCustom(double r, double g, double b)
Constructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual ~PointCloudColorHandlerCustom()
Destructor.
virtual std::string getName() const
Abstract getName method.
virtual std::string getName() const
Get the name of the class.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
Constructor.
virtual std::string getFieldName() const
Get the name of the field used.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual ~PointCloudColorHandlerGenericField()
Empty destructor.
Generic field handler class for colors.
virtual std::string getFieldName() const
Get the name of the field used.
virtual ~PointCloudColorHandlerGenericField()
Destructor.
PointCloudColorHandlerGenericField(const PointCloudConstPtr &cloud, const std::string &field_name)
Constructor.
virtual std::string getName() const
Class getName method.
PointCloudColorHandlerGenericField(const std::string &field_name)
Constructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual std::string getFieldName() const
Get the name of the field used.
int s_field_idx_
The field index for "S".
PointCloudColorHandlerHSVField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Get the name of the class.
virtual ~PointCloudColorHandlerHSVField()
Empty destructor.
int v_field_idx_
The field index for "V".
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
HSV handler class for colors.
PointCloudColorHandlerHSVField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
virtual ~PointCloudColorHandlerHSVField()
Empty destructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
int v_field_idx_
The field index for "V".
int s_field_idx_
The field index for "S".
Base Handler class for PointCloud colors.
virtual vtkSmartPointer< vtkDataArray > getColor() const
Obtain the actual color for the input dataset as a VTK data array.
PointCloudColorHandler()
Constructor.
shared_ptr< const PointCloudColorHandler< PointT > > ConstPtr
virtual ~PointCloudColorHandler()
Destructor.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
PointCloudConstPtr cloud_
A pointer to the input dataset.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
virtual std::string getName() const =0
Abstract getName method.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
PointCloudColorHandler(const PointCloudConstPtr &cloud)
Constructor.
shared_ptr< PointCloudColorHandler< PointT > > Ptr
virtual std::string getFieldName() const =0
Abstract getFieldName method.
int field_idx_
The index of the field holding the data that represents the color.
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
virtual ~PointCloudColorHandlerLabelField()
Empty destructor.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getName() const
Get the name of the class.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
Label field handler class for colors.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
virtual std::string getName() const
Class getName method.
PointCloudColorHandlerLabelField(const PointCloudConstPtr &cloud, const bool static_mapping=true)
Constructor.
virtual ~PointCloudColorHandlerLabelField()
Destructor.
virtual std::string getFieldName() const
Get the name of the field used.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
PointCloudColorHandlerLabelField(const bool static_mapping=true)
Constructor.
virtual ~PointCloudColorHandlerRGBAField()
Empty destructor.
virtual std::string getName() const
Get the name of the class.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
RGBA handler class for colors.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual ~PointCloudColorHandlerRGBAField()
Destructor.
PointCloudColorHandlerRGBAField()
Constructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
PointCloudColorHandlerRGBAField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerRGBField(const PointCloudConstPtr &cloud)
Constructor.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getName() const
Get the name of the class.
virtual ~PointCloudColorHandlerRGBField()
Empty destructor.
RGB handler class for colors.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getFieldName() const
Get the name of the field used.
PointCloudColorHandlerRGBField()
Constructor.
PointCloudColorHandlerRGBField(const PointCloudConstPtr &cloud)
Constructor.
virtual std::string getName() const
Class getName method.
virtual ~PointCloudColorHandlerRGBField()
Destructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
virtual std::string getFieldName() const
Get the name of the field used.
virtual std::string getName() const
Get the name of the class.
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
virtual ~PointCloudColorHandlerRandom()
Empty destructor.
Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen)
virtual std::string getName() const
Abstract getName method.
virtual std::string getFieldName() const
Get the name of the field used.
vtkSmartPointer< vtkDataArray > getColor() const override
Obtain the actual color for the input dataset as a VTK data array.
PointCloudColorHandlerRandom(const PointCloudConstPtr &cloud)
Constructor.
PointCloudColorHandlerRandom()
Constructor.
Defines all the PCL and non-PCL macros used.
#define PCL_DEPRECATED(Major, Minor, Message)
macro for compatibility across compilers and help remove old deprecated items for the Major....
A point structure representing Euclidean xyz coordinates, and the RGB color.