39#ifndef PCL_PCL_HISTOGRAM_VISUALIZER_IMPL_H_
40#define PCL_PCL_HISTOGRAM_VISUALIZER_IMPL_H_
42#include <vtkDoubleArray.h>
48namespace visualization
51template <
typename Po
intT>
bool
56 RenWinInteractMap::iterator
am_it = wins_.find (
id);
57 if (
am_it != wins_.end ())
59 PCL_WARN (
"[addFeatureHistogram] A window with id <%s> already exists! Please choose a different id and retry.\n",
id.
c_str ());
69 for (
int d = 0; d <
hsize; ++d)
72 xy[1] = cloud[0].histogram[d];
85template <
typename Po
intT>
bool
94 PCL_ERROR (
"[addFeatureHistogram] Invalid point index (%d) given!\n", index);
99 std::vector<pcl::PCLPointField> fields;
104 PCL_ERROR (
"[addFeatureHistogram] The specified field <%s> does not exist!\n",
field_name.c_str ());
108 RenWinInteractMap::iterator
am_it = wins_.find (
id);
109 if (
am_it != wins_.end ())
111 PCL_WARN (
"[addFeatureHistogram] A window with id <%s> already exists! Please choose a different id and retry.\n",
id.
c_str ());
116 xy_array->SetNumberOfComponents (2);
126 memcpy (&data,
reinterpret_cast<const char*
> (&cloud[index]) + fields[
field_idx].offset + d *
sizeof (
float),
sizeof (
float));
139template <
typename Po
intT>
bool
142 const std::string &
id)
144 RenWinInteractMap::iterator
am_it = wins_.find (
id);
145 if (
am_it == wins_.end ())
147 PCL_WARN (
"[updateFeatureHistogram] A window with id <%s> does not exists!.\n",
id.
c_str ());
153 xy_array->SetNumberOfComponents (2);
158 for (
int d = 0; d <
hsize; ++d)
161 xy[1] = cloud[0].histogram[d];
169template <
typename Po
intT>
bool
172 const std::string &
id)
176 PCL_ERROR (
"[updateFeatureHistogram] Invalid point index (%d) given!\n", index);
181 std::vector<pcl::PCLPointField> fields;
186 PCL_ERROR (
"[updateFeatureHistogram] The specified field <%s> does not exist!\n",
field_name.c_str ());
190 RenWinInteractMap::iterator
am_it = wins_.find (
id);
191 if (
am_it == wins_.end ())
193 PCL_WARN (
"[updateFeatureHistogram] A window with id <%s> does not exists!.\n",
id.
c_str ());
199 xy_array->SetNumberOfComponents (2);
204 for (std::uint32_t d = 0; d < fields[
field_idx].count; ++d)
209 memcpy (&data,
reinterpret_cast<const char*
> (&cloud[index]) + fields[
field_idx].offset + d *
sizeof (
float),
sizeof (
float));
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
bool addFeatureHistogram(const pcl::PointCloud< PointT > &cloud, int hsize, const std::string &id="cloud", int win_width=640, int win_height=200)
Add a histogram feature to screen as a separate window, from a cloud containing a single histogram.
bool updateFeatureHistogram(const pcl::PointCloud< PointT > &cloud, int hsize, const std::string &id="cloud")
Update a histogram feature that is already on screen, with a cloud containing a single histogram.
void createActor(const vtkSmartPointer< vtkDoubleArray > &xy_array, RenWinInteract &renwinint, const std::string &id, const int win_width, const int win_height)
Create a 2D actor from the given vtkDoubleArray histogram and add it to the screen.
void reCreateActor(const vtkSmartPointer< vtkDoubleArray > &xy_array, RenWinInteract *renwinupd, const int hsize)
Remove the current 2d actor and create a new 2D actor from the given vtkDoubleArray histogram and add...
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.