38 #include <pcl_cuda/filters/filter.h>
39 #include <thrust/count.h>
40 #include <thrust/remove.h>
41 #include <vector_types.h>
49 __inline__ __device__
bool
53 return (isfinite (pt.x) && isfinite (pt.y) && isfinite (pt.z));
60 __inline__ __device__
bool
63 return (isfinite (pt));
70 __inline__ __device__
bool
74 return (!isfinite (get<0> (tuple)) ||
75 !isfinite (get<1> (tuple)) ||
76 !isfinite (get<2> (tuple)));
84 template <
typename CloudT>
90 using PointCloud =
typename PCLCUDABase<CloudT>::PointCloud;
107 std::cerr <<
"applyFilter" << std::endl;
130 output.resize (input_->points.size ());
132 Device<PointXYZRGB>::type::iterator nr_points = thrust::copy_if (input_->points.begin (), input_->points.end (), output.begin (),
isFiniteAOS ());
134 output.resize (nr_points - output.begin ());
169 output.resize (input_->size ());
171 Device<float>::type::iterator nr_points = thrust::copy_if (input_->points_x.begin (), input_->points_x.end (), output.points_x.begin (),
isFiniteSOA ());
172 nr_points = thrust::copy_if (input_->points_y.begin (), input_->points_y.end (), output.points_y.begin (),
isFiniteSOA ());
173 nr_points = thrust::copy_if (input_->points_z.begin (), input_->points_z.end (), output.points_z.begin (),
isFiniteSOA ());
174 output.resize (nr_points - output.points_z.begin ());
183 PointCloud::zip_iterator result = thrust::remove_if (output.zip_begin (), output.zip_end (),
isFiniteZIPSOA ());
184 PointCloud::iterator_tuple result_tuple = result.get_iterator_tuple ();
185 PointCloud::float_iterator xiter = thrust::get<0> (result_tuple),
186 yiter = thrust::get<1> (result_tuple),
187 ziter = thrust::get<2> (result_tuple);
189 unsigned badpoints =
distance (xiter, output.points_x.end ());
190 unsigned goodpoints =
distance (output.points_x.begin (), xiter);
192 output.resize (goodpoints);
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Removes points with x, y, or z equal to NaN.
typename PointCloud::ConstPtr PointCloudConstPtr
typename PointCloud::Ptr PointCloudPtr
typename PCLCUDABase< CloudT >::PointCloud PointCloud
std::string filter_name_
The filter name.
void applyFilter(PointCloud &output)
Filter a Point Cloud.
PassThrough()
Empty constructor.
PassThrough()
Empty constructor.
void applyFilter(PointCloud &output)
Filter a Point Cloud.
PassThrough uses the base Filter class methods to pass through all data that satisfies the user given...
PassThrough()
Empty constructor.
void applyFilter(PointCloud &output)
Filter a Point Cloud.
float distance(const PointT &p1, const PointT &p2)
Check if a specific point is valid or not.
__inline__ __device__ bool operator()(const PointXYZRGB &pt)
Check if a specific point is valid or not.
__inline__ __device__ bool operator()(const float &pt)
Check if a specific point is valid or not.
__inline__ __device__ bool operator()(const PointCloudSOA< Device >::tuple_type &tuple)