11 #pragma warning(disable : 4996)
14 #include <pcl/point_cloud.h>
15 #include <pcl/point_types.h>
16 #include <pcl/visualization/point_cloud_color_handlers.h>
17 #include <vtkDataArray.h>
18 #include <vtkSmartPointer.h>
19 #include <vtkUnsignedCharArray.h>
23 using pcl::visualization::PointCloudColorHandler;
25 template <
typename Po
intT>
32 typedef std::shared_ptr<PclPointCloudColorHandlerLUT<PointT>>
Ptr;
33 typedef std::shared_ptr<const PclPointCloudColorHandlerLUT<PointT>>
43 : PointCloudColorHandler<
PointT>(cloud) {
52 inline bool isCapable()
const {
return (capable_); }
55 virtual std::string
getName()
const {
return ""; };
67 if (!capable_ || !cloud_)
return (
false);
70 scalars->SetNumberOfComponents(3);
72 vtkIdType nr_points = cloud_->points.size();
73 reinterpret_cast<vtkUnsignedCharArray*
>(&(*scalars))
74 ->SetNumberOfTuples(nr_points);
76 reinterpret_cast<vtkUnsignedCharArray*
>(&(*scalars))
80 for (vtkIdType cp = 0; cp < nr_points; ++cp) {
81 if (pcl::isFinite(cloud_->points[cp])) {
96 if (!capable_ || !cloud_)
return nullptr;
100 scalars->SetNumberOfComponents(3);
102 vtkIdType nr_points = cloud_->points.size();
103 reinterpret_cast<vtkUnsignedCharArray*
>(&(*scalars))
104 ->SetNumberOfTuples(nr_points);
106 reinterpret_cast<vtkUnsignedCharArray*
>(&(*scalars))
110 for (vtkIdType cp = 0; cp < nr_points; ++cp) {
111 if (pcl::isFinite(cloud_->points[cp])) {
143 using PointCloudColorHandler<PointT>::cloud_;
144 using PointCloudColorHandler<PointT>::capable_;
145 using PointCloudColorHandler<PointT>::field_idx_;
146 using PointCloudColorHandler<PointT>::fields_;
static pcl::RGB at(int color_id)
virtual std::string getName() const
Abstract getName method.
virtual vtkSmartPointer< vtkDataArray > getColor() const
PclPointCloudColorHandlerLUT(const PointCloudConstPtr &cloud)
Constructor.
void setLabel(int *value)
std::shared_ptr< PclPointCloudColorHandlerLUT< PointT > > Ptr
PointCloud::ConstPtr PointCloudConstPtr
PointCloud::Ptr PointCloudPtr
virtual bool getColor(vtkSmartPointer< vtkDataArray > &scalars) const
Obtain the actual color for the input dataset as vtk scalars.
virtual ~PclPointCloudColorHandlerLUT()
Destructor.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
pcl::PointCloud< PointT > PointCloud
std::shared_ptr< const PclPointCloudColorHandlerLUT< PointT > > ConstPtr
virtual std::string getFieldName() const
Abstract getFieldName method.
PclPointCloudColorHandlerLUT()
Constructor.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.