Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef PCL_FILTERS_IMPL_FILTER_H_
00039 #define PCL_FILTERS_IMPL_FILTER_H_
00040
00041 #include <pcl/pcl_macros.h>
00042 #include <pcl/filters/filter.h>
00043
00045 template <typename PointT> void
00046 pcl::removeNaNFromPointCloud (const pcl::PointCloud<PointT> &cloud_in,
00047 pcl::PointCloud<PointT> &cloud_out,
00048 std::vector<int> &index)
00049 {
00050
00051 if (&cloud_in != &cloud_out)
00052 {
00053 cloud_out.header = cloud_in.header;
00054 cloud_out.points.resize (cloud_in.points.size ());
00055 }
00056
00057 index.resize (cloud_in.points.size ());
00058 size_t j = 0;
00059
00060
00061 if (cloud_in.is_dense)
00062 {
00063
00064 cloud_out = cloud_in;
00065 for (j = 0; j < cloud_out.points.size (); ++j)
00066 index[j] = static_cast<int>(j);
00067 }
00068 else
00069 {
00070 for (size_t i = 0; i < cloud_in.points.size (); ++i)
00071 {
00072 if (!pcl_isfinite (cloud_in.points[i].x) ||
00073 !pcl_isfinite (cloud_in.points[i].y) ||
00074 !pcl_isfinite (cloud_in.points[i].z))
00075 continue;
00076 cloud_out.points[j] = cloud_in.points[i];
00077 index[j] = static_cast<int>(i);
00078 j++;
00079 }
00080 if (j != cloud_in.points.size ())
00081 {
00082
00083 cloud_out.points.resize (j);
00084 index.resize (j);
00085 }
00086
00087 cloud_out.height = 1;
00088 cloud_out.width = static_cast<uint32_t>(j);
00089
00090
00091 cloud_out.is_dense = true;
00092 }
00093 }
00094
00096 template <typename PointT> void
00097 pcl::removeNaNNormalsFromPointCloud (const pcl::PointCloud<PointT> &cloud_in,
00098 pcl::PointCloud<PointT> &cloud_out,
00099 std::vector<int> &index)
00100 {
00101
00102 if (&cloud_in != &cloud_out)
00103 {
00104 cloud_out.header = cloud_in.header;
00105 cloud_out.points.resize (cloud_in.points.size ());
00106 }
00107
00108 index.resize (cloud_in.points.size ());
00109 size_t j = 0;
00110
00111 for (size_t i = 0; i < cloud_in.points.size (); ++i)
00112 {
00113 if (!pcl_isfinite (cloud_in.points[i].normal_x) ||
00114 !pcl_isfinite (cloud_in.points[i].normal_y) ||
00115 !pcl_isfinite (cloud_in.points[i].normal_z))
00116 continue;
00117 cloud_out.points[j] = cloud_in.points[i];
00118 index[j] = static_cast<int>(i);
00119 j++;
00120 }
00121 if (j != cloud_in.points.size ())
00122 {
00123
00124 cloud_out.points.resize (j);
00125 index.resize (j);
00126 }
00127
00128 cloud_out.height = 1;
00129 cloud_out.width = static_cast<uint32_t>(j);
00130 }
00131
00132
00133 #define PCL_INSTANTIATE_removeNaNFromPointCloud(T) template PCL_EXPORTS void pcl::removeNaNFromPointCloud<T>(const pcl::PointCloud<T>&, pcl::PointCloud<T>&, std::vector<int>&);
00134 #define PCL_INSTANTIATE_removeNaNNormalsFromPointCloud(T) template PCL_EXPORTS void pcl::removeNaNNormalsFromPointCloud<T>(const pcl::PointCloud<T>&, pcl::PointCloud<T>&, std::vector<int>&);
00135
00136 #endif // PCL_FILTERS_IMPL_FILTER_H_
00137