39 #ifndef PCL_PCL_HISTOGRAM_VISUALIZER_IMPL_H_
40 #define PCL_PCL_HISTOGRAM_VISUALIZER_IMPL_H_
42 #include <vtkDoubleArray.h>
45 template <
typename Po
intT>
bool
48 const std::string &
id,
int win_width,
int win_height)
50 RenWinInteractMap::iterator am_it = wins_.find (
id);
51 if (am_it != wins_.end ())
53 PCL_WARN (
"[addFeatureHistogram] A window with id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
58 xy_array->SetNumberOfComponents (2);
59 xy_array->SetNumberOfTuples (hsize);
63 for (
int d = 0; d < hsize; ++d)
66 xy[1] = cloud.
points[0].histogram[d];
67 xy_array->SetTuple (d, xy);
70 createActor (xy_array, renwinint,
id, win_width, win_height);
73 wins_[id] = renwinint;
79 template <
typename Po
intT>
bool
82 const std::string &field_name,
84 const std::string &
id,
int win_width,
int win_height)
86 if (index < 0 || index >= cloud.
points.size ())
88 PCL_ERROR (
"[addFeatureHistogram] Invalid point index (%d) given!\n", index);
93 std::vector<pcl::PCLPointField> fields;
95 int field_idx = pcl::getFieldIndex<PointT> (cloud, field_name, fields);
98 PCL_ERROR (
"[addFeatureHistogram] The specified field <%s> does not exist!\n", field_name.c_str ());
102 RenWinInteractMap::iterator am_it = wins_.find (
id);
103 if (am_it != wins_.end ())
105 PCL_WARN (
"[addFeatureHistogram] A window with id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
110 xy_array->SetNumberOfComponents (2);
111 xy_array->SetNumberOfTuples (fields[field_idx].count);
115 for (std::uint32_t d = 0; d < fields[field_idx].count; ++d)
120 memcpy (&data,
reinterpret_cast<const char*
> (&cloud.
points[index]) + fields[field_idx].offset + d * sizeof (
float),
sizeof (
float));
122 xy_array->SetTuple (d, xy);
125 createActor (xy_array, renwinint,
id, win_width, win_height);
128 wins_[id] = renwinint;
133 template <
typename Po
intT>
bool
136 const std::string &
id)
138 RenWinInteractMap::iterator am_it = wins_.find (
id);
139 if (am_it == wins_.end ())
141 PCL_WARN (
"[updateFeatureHistogram] A window with id <%s> does not exists!.\n",
id.c_str ());
147 xy_array->SetNumberOfComponents (2);
148 xy_array->SetNumberOfTuples (hsize);
152 for (
int d = 0; d < hsize; ++d)
155 xy[1] = cloud.
points[0].histogram[d];
156 xy_array->SetTuple (d, xy);
158 reCreateActor (xy_array, renwinupd, hsize);
163 template <
typename Po
intT>
bool
166 const std::string &
id)
168 if (index < 0 || index >= cloud.
points.size ())
170 PCL_ERROR (
"[updateFeatureHistogram] Invalid point index (%d) given!\n", index);
175 std::vector<pcl::PCLPointField> fields;
177 int field_idx = pcl::getFieldIndex<PointT> (cloud, field_name, fields);
180 PCL_ERROR (
"[updateFeatureHistogram] The specified field <%s> does not exist!\n", field_name.c_str ());
184 RenWinInteractMap::iterator am_it = wins_.find (
id);
185 if (am_it == wins_.end ())
187 PCL_WARN (
"[updateFeatureHistogram] A window with id <%s> does not exists!.\n",
id.c_str ());
193 xy_array->SetNumberOfComponents (2);
194 xy_array->SetNumberOfTuples (fields[field_idx].count);
198 for (std::uint32_t d = 0; d < fields[field_idx].count; ++d)
203 memcpy (&data,
reinterpret_cast<const char*
> (&cloud.
points[index]) + fields[field_idx].offset + d * sizeof (
float),
sizeof (
float));
205 xy_array->SetTuple (d, xy);
208 reCreateActor (xy_array, renwinupd, cloud.fields[field_idx].count - 1);