41 #ifndef PCL_COMMON_IO_H_
42 #define PCL_COMMON_IO_H_
45 #include <pcl/pcl_base.h>
46 #include <pcl/PointIndices.h>
47 #include <pcl/conversions.h>
61 for (
size_t d = 0; d < cloud.
fields.size (); ++d)
62 if (cloud.
fields[d].name == field_name)
63 return (static_cast<int>(d));
73 template <
typename Po
intT>
inline int
75 std::vector<pcl::PCLPointField> &fields);
82 template <
typename Po
intT>
inline int
84 std::vector<pcl::PCLPointField> &fields);
91 template <
typename Po
intT>
inline void
98 template <
typename Po
intT>
inline void
99 getFields (std::vector<pcl::PCLPointField> &fields);
105 template <
typename Po
intT>
inline std::string
116 for (
size_t i = 0; i < cloud.
fields.size () - 1; ++i)
117 result += cloud.
fields[i].name +
" ";
158 std::vector<int> &field_sizes);
168 type = std::toupper (type, std::locale::classic ());
247 const std::vector<int> &indices,
259 const std::vector<
int, Eigen::aligned_allocator<int> > &indices,
272 template <
typename Po
int1T,
typename Po
int2T>
inline bool
275 return (
typeid (Point1T) ==
typeid (Point2T));
285 template <
typename Po
intT>
void
287 const std::vector<int> &indices,
297 template <
typename Po
intT>
void
299 const std::vector<
int, Eigen::aligned_allocator<int> > &indices,
309 template <
typename Po
intT>
void
311 const PointIndices &indices,
321 template <
typename Po
intT>
void
323 const std::vector<pcl::PointIndices> &indices,
331 template <
typename Po
intInT,
typename Po
intOutT>
void
342 template <
typename Po
intInT,
typename Po
intOutT>
void
344 const std::vector<int> &indices,
354 template <
typename Po
intInT,
typename Po
intOutT>
void
356 const std::vector<
int, Eigen::aligned_allocator<int> > &indices,
366 template <
typename Po
intInT,
typename Po
intOutT>
void
368 const PointIndices &indices,
378 template <
typename Po
intInT,
typename Po
intOutT>
void
380 const std::vector<pcl::PointIndices> &indices,
394 template <
typename Po
intIn1T,
typename Po
intIn2T,
typename Po
intOutT>
void
438 template <std::
size_t N>
void
444 template <>
inline void
451 template <>
inline void
457 template <>
inline void
460 std::swap (bytes[0], bytes[3]);
461 std::swap (bytes[1], bytes[2]);
467 template <>
inline void
470 std::swap (bytes[0], bytes[7]);
471 std::swap (bytes[1], bytes[6]);
472 std::swap (bytes[2], bytes[5]);
473 std::swap (bytes[3], bytes[4]);
479 template <
typename T>
void
482 pcl::io::swapByte<sizeof(T)> (
reinterpret_cast<char*
> (&value));
487 #include <pcl/common/impl/io.hpp>
489 #endif //#ifndef PCL_COMMON_IO_H_
void swapByte< 2 >(char *bytes)
specialization of swapByte for dimension 2
std::string getFieldsList(const pcl::PointCloud< PointT > &cloud)
Get the list of all fields available in a given cloud.
void swapByte(char *bytes)
swap bytes order of a char array of length N
PCL_EXPORTS bool getEigenAsPointCloud(Eigen::MatrixXf &in, pcl::PCLPointCloud2 &out)
Copy the XYZ dimensions from an Eigen MatrixXf into a pcl::PCLPointCloud2 message.
PCL_EXPORTS void getFieldsSizes(const std::vector< pcl::PCLPointField > &fields, std::vector< int > &field_sizes)
Obtain a vector with the sizes of all valid fields (e.g., not "_")
void swapByte< 8 >(char *bytes)
specialization of swapByte for dimension 8
int getFieldType(const int size, char type)
Obtains the type of the PCLPointField from a specific size and type.
int getFieldIndex(const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
Get the index of a specified field (i.e., dimension/channel)
void swapByte< 4 >(char *bytes)
specialization of swapByte for dimension 4
void concatenateFields(const pcl::PointCloud< PointIn1T > &cloud1_in, const pcl::PointCloud< PointIn2T > &cloud2_in, pcl::PointCloud< PointOutT > &cloud_out)
Concatenate two datasets representing different fields.
std::vector< ::pcl::PCLPointField > fields
PCL_EXPORTS void copyPointCloud(const pcl::PCLPointCloud2 &cloud_in, const std::vector< int > &indices, pcl::PCLPointCloud2 &cloud_out)
Extract the indices of a given point cloud as a new point cloud.
void swapByte< 1 >(char *bytes)
specialization of swapByte for dimension 1
void getFields(const pcl::PointCloud< PointT > &cloud, std::vector< pcl::PCLPointField > &fields)
Get the list of available fields (i.e., dimension/channel)
PCL_EXPORTS bool concatenatePointCloud(const pcl::PCLPointCloud2 &cloud1, const pcl::PCLPointCloud2 &cloud2, pcl::PCLPointCloud2 &cloud_out)
Concatenate two pcl::PCLPointCloud2.
PCL_EXPORTS bool getPointCloudAsEigen(const pcl::PCLPointCloud2 &in, Eigen::MatrixXf &out)
Copy the XYZ dimensions of a pcl::PCLPointCloud2 into Eigen format.
int getFieldSize(const int datatype)
Obtains the size of a specific field data type in bytes.
bool isSamePointType()
Check if two given point types are the same or not.