Point Cloud Data (PLY) file format reader. More...
#include <ply_io.h>

Public Types | |
| enum | { PLY_V0 = 0, PLY_V1 = 1 } |
Public Member Functions | |
| PLYReader & | operator= (const PLYReader &p) |
| PLYReader () | |
| PLYReader (const PLYReader &p) | |
| int | read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &ply_version, const int offset=0) |
| Read a point cloud data from a PLY file and store it into a pcl/PCLPointCloud2. | |
| int | read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, const int offset=0) |
| Read a point cloud data from a PLY file (PLY_V6 only!) and store it into a pcl/PCLPointCloud2. | |
| template<typename PointT > | |
| int | read (const std::string &file_name, pcl::PointCloud< PointT > &cloud, const int offset=0) |
| Read a point cloud data from any PLY file, and convert it to the given template format. | |
| int | readHeader (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &ply_version, int &data_type, unsigned int &data_idx, const int offset=0) |
| Read a point cloud data header from a PLY file. | |
| ~PLYReader () | |
Private Member Functions | |
| void | amendProperty (const std::string &old_name, const std::string &new_name, uint8_t datatype=0) |
| void | appendCharProperty (const std::string &name, const size_t &count=1) |
| void | appendDoubleProperty (const std::string &name, const size_t &count=1) |
| void | appendFloatProperty (const std::string &name, const size_t &count=1) |
| void | appendIntProperty (const std::string &name, const size_t &count=1) |
| void | appendShortProperty (const std::string &name, const size_t &count=1) |
| void | appendUnsignedCharProperty (const std::string &name, const size_t &count=1) |
| void | appendUnsignedIntProperty (const std::string &name, const size_t &count=1) |
| void | appendUnsignedShortProperty (const std::string &name, const size_t &count=1) |
| void | cloudHeightCallback (const int &height) |
| void | cloudWidthCallback (const int &width) |
| boost::tuple< boost::function < void()>, boost::function < void()> > | elementDefinitionCallback (const std::string &element_name, std::size_t count) |
| function called when the keyword element is parsed | |
| bool | endHeaderCallback () |
| void | errorCallback (const std::string &filename, std::size_t line_number, const std::string &message) |
| Error callback function. | |
| void | infoCallback (const std::string &filename, std::size_t line_number, const std::string &message) |
| Info callback function. | |
| template<typename SizeType , typename ScalarType > | |
| boost::tuple< boost::function < void(SizeType)> , boost::function< void(ScalarType)> , boost::function< void()> > | listPropertyDefinitionCallback (const std::string &element_name, const std::string &property_name) |
| function called when a list property is parsed | |
| void | objInfoCallback (const std::string &line) |
| void | orientationXaxisXCallback (const float &value) |
| void | orientationXaxisYCallback (const float &value) |
| void | orientationXaxisZCallback (const float &value) |
| void | orientationYaxisXCallback (const float &value) |
| void | orientationYaxisYCallback (const float &value) |
| void | orientationYaxisZCallback (const float &value) |
| void | orientationZaxisXCallback (const float &value) |
| void | orientationZaxisYCallback (const float &value) |
| void | orientationZaxisZCallback (const float &value) |
| void | originXCallback (const float &value) |
| void | originYCallback (const float &value) |
| void | originZCallback (const float &value) |
| bool | parse (const std::string &istream_filename) |
| void | rangeGridBeginCallback () |
| void | rangeGridEndCallback () |
| void | rangeGridVertexIndicesBeginCallback (pcl::io::ply::uint8 size) |
| void | rangeGridVertexIndicesElementCallback (pcl::io::ply::int32 vertex_index) |
| void | rangeGridVertexIndicesEndCallback () |
| template<typename ScalarType > | |
| boost::function< void(ScalarType)> | scalarPropertyDefinitionCallback (const std::string &element_name, const std::string &property_name) |
| function called when a scalar property is parsed | |
| void | vertexAlphaCallback (pcl::io::ply::uint8 alpha) |
| void | vertexBeginCallback () |
| void | vertexCharPropertyCallback (pcl::io::ply::int8 value) |
| void | vertexColorCallback (const std::string &color_name, pcl::io::ply::uint8 color) |
| void | vertexDoublePropertyCallback (pcl::io::ply::float64 value) |
| void | vertexEndCallback () |
| void | vertexFloatPropertyCallback (pcl::io::ply::float32 value) |
| void | vertexIntensityCallback (pcl::io::ply::uint8 intensity) |
| void | vertexIntPropertyCallback (pcl::io::ply::int32 value) |
| template<typename SizeType > | |
| void | vertexListPropertyBeginCallback (const std::string &property_name, SizeType size) |
| function called at the beginning of a list property parsing. | |
| template<typename ContentType > | |
| void | vertexListPropertyContentCallback (ContentType value) |
| function called when a list element is parsed. | |
| void | vertexListPropertyEndCallback () |
| function called at the end of a list property parsing | |
| void | vertexShortPropertyCallback (pcl::io::ply::int16 value) |
| void | vertexUnsignedCharPropertyCallback (pcl::io::ply::uint8 value) |
| void | vertexUnsignedIntPropertyCallback (pcl::io::ply::uint32 value) |
| void | vertexUnsignedShortPropertyCallback (pcl::io::ply::uint16 value) |
| void | warningCallback (const std::string &filename, std::size_t line_number, const std::string &message) |
| Warning callback function. | |
Private Attributes | |
| pcl::PCLPointCloud2 * | cloud_ |
| bool | do_resize_ |
| Eigen::Matrix3f | orientation_ |
| orientation | |
| Eigen::Vector4f | origin_ |
| origin | |
| ::pcl::io::ply::ply_parser | parser_ |
| size_t | range_count_ |
| std::vector< std::vector< int > > * | range_grid_ |
| size_t | range_grid_vertex_indices_element_index_ |
| size_t | rgb_offset_before_ |
| size_t | vertex_count_ |
| int | vertex_offset_before_ |
| size_t | vertex_properties_counter_ |
Point Cloud Data (PLY) file format reader.
The PLY data format is organized in the following way: lines beginning with "comment" are treated as comments
| pcl::PLYReader::PLYReader | ( | ) | [inline] |
| pcl::PLYReader::PLYReader | ( | const PLYReader & | p | ) | [inline] |
| pcl::PLYReader::~PLYReader | ( | ) | [inline] |
| void pcl::PLYReader::amendProperty | ( | const std::string & | old_name, |
| const std::string & | new_name, | ||
| uint8_t | datatype = 0 |
||
| ) | [private] |
Amend property from cloud fields identified by old_name renaming it new_name. param[in] old_name property old name param[in] new_name property new name
Definition at line 115 of file ply_io.cpp.
| void pcl::PLYReader::appendCharProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append a char property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 176 of file ply_io.cpp.
| void pcl::PLYReader::appendDoubleProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append a double property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 152 of file ply_io.cpp.
| void pcl::PLYReader::appendFloatProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append a float property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 103 of file ply_io.cpp.
| void pcl::PLYReader::appendIntProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append an unsigned int property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 140 of file ply_io.cpp.
| void pcl::PLYReader::appendShortProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append a short property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 200 of file ply_io.cpp.
| void pcl::PLYReader::appendUnsignedCharProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append a char property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 164 of file ply_io.cpp.
| void pcl::PLYReader::appendUnsignedIntProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append an unsigned int property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 128 of file ply_io.cpp.
| void pcl::PLYReader::appendUnsignedShortProperty | ( | const std::string & | name, |
| const size_t & | count = 1 |
||
| ) | [private] |
Append a short property to the cloud fields. param[in] name property name param[in] count property count: 1 for scalar properties and higher for a list property.
Definition at line 188 of file ply_io.cpp.
| void pcl::PLYReader::cloudHeightCallback | ( | const int & | height | ) | [inline, private] |
| void pcl::PLYReader::cloudWidthCallback | ( | const int & | width | ) | [inline, private] |
| boost::tuple< boost::function< void()>, boost::function< void()> > pcl::PLYReader::elementDefinitionCallback | ( | const std::string & | element_name, |
| std::size_t | count | ||
| ) | [private] |
function called when the keyword element is parsed
| [in] | element_name | element name |
| [in] | count | number of instances |
Definition at line 50 of file ply_io.cpp.
| bool pcl::PLYReader::endHeaderCallback | ( | ) | [private] |
Definition at line 96 of file ply_io.cpp.
| void pcl::PLYReader::errorCallback | ( | const std::string & | filename, |
| std::size_t | line_number, | ||
| const std::string & | message | ||
| ) | [inline, private] |
| void pcl::PLYReader::infoCallback | ( | const std::string & | filename, |
| std::size_t | line_number, | ||
| const std::string & | message | ||
| ) | [inline, private] |
| boost::tuple< boost::function< void(SizeType)>, boost::function< void(ContentType)>, boost::function< void()> > pcl::PLYReader::listPropertyDefinitionCallback | ( | const std::string & | element_name, |
| const std::string & | property_name | ||
| ) | [private] |
function called when a list property is parsed
| [in] | element_name | element name to which the property belongs |
| [in] | property_name | list property name |
Definition at line 425 of file ply_io.cpp.
| void pcl::PLYReader::objInfoCallback | ( | const std::string & | line | ) | [private] |
Callback function for obj_info
Definition at line 657 of file ply_io.cpp.
| void pcl::PLYReader::orientationXaxisXCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationXaxisYCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationXaxisZCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationYaxisXCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationYaxisYCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationYaxisZCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationZaxisXCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationZaxisYCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::orientationZaxisZCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::originXCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::originYCallback | ( | const float & | value | ) | [inline, private] |
| void pcl::PLYReader::originZCallback | ( | const float & | value | ) | [inline, private] |
| bool pcl::PLYReader::parse | ( | const std::string & | istream_filename | ) | [private] |
Definition at line 683 of file ply_io.cpp.
| void pcl::PLYReader::rangeGridBeginCallback | ( | ) | [private] |
Callback function for the begin of range_grid line
Definition at line 634 of file ply_io.cpp.
| void pcl::PLYReader::rangeGridEndCallback | ( | ) | [private] |
Callback function for the end of a range_grid element end
Definition at line 651 of file ply_io.cpp.
| void pcl::PLYReader::rangeGridVertexIndicesBeginCallback | ( | pcl::io::ply::uint8 | size | ) | [private] |
Callback function for the begin of range_grid vertex_indices property param[in] size vertex_indices list size
Definition at line 637 of file ply_io.cpp.
| void pcl::PLYReader::rangeGridVertexIndicesElementCallback | ( | pcl::io::ply::int32 | vertex_index | ) | [private] |
Callback function for each range_grid vertex_indices element param[in] vertex_index index of the vertex in vertex_indices
Definition at line 642 of file ply_io.cpp.
| void pcl::PLYReader::rangeGridVertexIndicesEndCallback | ( | ) | [private] |
Callback function for the end of a range_grid vertex_indices property
Definition at line 648 of file ply_io.cpp.
| int pcl::PLYReader::read | ( | const std::string & | file_name, |
| pcl::PCLPointCloud2 & | cloud, | ||
| Eigen::Vector4f & | origin, | ||
| Eigen::Quaternionf & | orientation, | ||
| int & | ply_version, | ||
| const int | offset = 0 |
||
| ) | [virtual] |
Read a point cloud data from a PLY file and store it into a pcl/PCLPointCloud2.
| [in] | file_name | the name of the file containing the actual PointCloud data |
| [out] | cloud | the resultant PointCloud message read from disk |
| [in] | origin | the sensor data acquisition origin (translation) |
| [in] | orientation | the sensor data acquisition origin (rotation) |
| [out] | ply_version | the PLY version read from the file |
| [in] | offset | the offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple files: TAR files always add a 512 byte header in front of the actual file, so set the offset to the next byte after the header (e.g., 513). |
Implements pcl::FileReader.
Definition at line 743 of file ply_io.cpp.
| int pcl::PLYReader::read | ( | const std::string & | file_name, |
| pcl::PCLPointCloud2 & | cloud, | ||
| const int | offset = 0 |
||
| ) | [inline] |
Read a point cloud data from a PLY file (PLY_V6 only!) and store it into a pcl/PCLPointCloud2.
| [in] | file_name | the name of the file containing the actual PointCloud data |
| [out] | cloud | the resultant PointCloud message read from disk |
| [in] | offset | the offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple files: TAR files always add a 512 byte header in front of the actual file, so set the offset to the next byte after the header (e.g., 513). |
Reimplemented from pcl::FileReader.
| int pcl::PLYReader::read | ( | const std::string & | file_name, |
| pcl::PointCloud< PointT > & | cloud, | ||
| const int | offset = 0 |
||
| ) | [inline] |
Read a point cloud data from any PLY file, and convert it to the given template format.
| [in] | file_name | the name of the file containing the actual PointCloud data |
| [out] | cloud | the resultant PointCloud message read from disk |
| [in] | offset | the offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple files: TAR files always add a 512 byte header in front of the actual file, so set the offset to the next byte after the header (e.g., 513). |
Reimplemented from pcl::FileReader.
| int pcl::PLYReader::readHeader | ( | const std::string & | file_name, |
| pcl::PCLPointCloud2 & | cloud, | ||
| Eigen::Vector4f & | origin, | ||
| Eigen::Quaternionf & | orientation, | ||
| int & | ply_version, | ||
| int & | data_type, | ||
| unsigned int & | data_idx, | ||
| const int | offset = 0 |
||
| ) | [virtual] |
Read a point cloud data header from a PLY file.
Load only the meta information (number of points, their types, etc), and not the points themselves, from a given PLY file. Useful for fast evaluation of the underlying data structure.
Returns: * < 0 (-1) on error * > 0 on success
| [in] | file_name | the name of the file to load |
| [out] | cloud | the resultant point cloud dataset (only the header will be filled) |
| [in] | origin | the sensor data acquisition origin (translation) |
| [in] | orientation | the sensor data acquisition origin (rotation) |
| [out] | ply_version | the PLY version read from the file |
| [out] | data_type | the type of PLY data stored in the file |
| [out] | data_idx | the data index |
| [in] | offset | the offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple files: TAR files always add a 512 byte header in front of the actual file, so set the offset to the next byte after the header (e.g., 513). |
Implements pcl::FileReader.
Definition at line 724 of file ply_io.cpp.
| boost::function< void(pcl::io::ply::int8)> pcl::PLYReader::scalarPropertyDefinitionCallback | ( | const std::string & | element_name, |
| const std::string & | property_name | ||
| ) | [private] |
function called when a scalar property is parsed
| [in] | element_name | element name to which the property belongs |
| [in] | property_name | property name |
Definition at line 215 of file ply_io.cpp.
| void pcl::PLYReader::vertexAlphaCallback | ( | pcl::io::ply::uint8 | alpha | ) | [inline, private] |
Callback function for vertex alpha. extracts RGB value, append alpha and put it back param[in] alpha
Definition at line 588 of file ply_io.cpp.
| void pcl::PLYReader::vertexBeginCallback | ( | ) | [private] |
Callback function for the begin of vertex line
Definition at line 615 of file ply_io.cpp.
| void pcl::PLYReader::vertexCharPropertyCallback | ( | pcl::io::ply::int8 | value | ) | [inline, private] |
Callback function for an anonymous vertex char property. Writes down a char value in cloud data. param[in] value char value parsed
Definition at line 555 of file ply_io.cpp.
| void pcl::PLYReader::vertexColorCallback | ( | const std::string & | color_name, |
| pcl::io::ply::uint8 | color | ||
| ) | [inline, private] |
Callback function for vertex RGB color. This callback is in charge of packing red green and blue in a single int before writing it down in cloud data. param[in] color_name color name in {red, green, blue} param[in] color value of {red, green, blue} property
Definition at line 564 of file ply_io.cpp.
| void pcl::PLYReader::vertexDoublePropertyCallback | ( | pcl::io::ply::float64 | value | ) | [inline, private] |
Callback function for an anonymous vertex double property. Writes down a double value in cloud data. param[in] value double value parsed
Definition at line 501 of file ply_io.cpp.
| void pcl::PLYReader::vertexEndCallback | ( | ) | [private] |
Callback function for the end of vertex line
Definition at line 621 of file ply_io.cpp.
| void pcl::PLYReader::vertexFloatPropertyCallback | ( | pcl::io::ply::float32 | value | ) | [inline, private] |
Callback function for an anonymous vertex float property. Writes down a float value in cloud data. param[in] value float value parsed
Definition at line 492 of file ply_io.cpp.
| void pcl::PLYReader::vertexIntensityCallback | ( | pcl::io::ply::uint8 | intensity | ) | [inline, private] |
Callback function for vertex intensity. converts intensity from int to float before writing it down in cloud data. param[in] intensity
Definition at line 605 of file ply_io.cpp.
| void pcl::PLYReader::vertexIntPropertyCallback | ( | pcl::io::ply::int32 | value | ) | [inline, private] |
Callback function for an anonymous vertex int property. Writes down a int value in cloud data. param[in] value int value parsed
Definition at line 519 of file ply_io.cpp.
| void pcl::PLYReader::vertexListPropertyBeginCallback | ( | const std::string & | property_name, |
| SizeType | size | ||
| ) | [private] |
function called at the beginning of a list property parsing.
| [in] | size | number of elements in the list |
Definition at line 400 of file ply_io.cpp.
| void pcl::PLYReader::vertexListPropertyContentCallback | ( | ContentType | value | ) | [private] |
function called when a list element is parsed.
| [in] | value | the list's element value |
Definition at line 415 of file ply_io.cpp.
| void pcl::PLYReader::vertexListPropertyEndCallback | ( | ) | [inline, private] |
function called at the end of a list property parsing
Definition at line 680 of file ply_io.cpp.
| void pcl::PLYReader::vertexShortPropertyCallback | ( | pcl::io::ply::int16 | value | ) | [inline, private] |
Callback function for an anonymous vertex short property. Writes down a short value in cloud data. param[in] value short value parsed
Definition at line 537 of file ply_io.cpp.
| void pcl::PLYReader::vertexUnsignedCharPropertyCallback | ( | pcl::io::ply::uint8 | value | ) | [inline, private] |
Callback function for an anonymous vertex uchar property. Writes down a uchar value in cloud data. param[in] value uchar value parsed
Definition at line 546 of file ply_io.cpp.
| void pcl::PLYReader::vertexUnsignedIntPropertyCallback | ( | pcl::io::ply::uint32 | value | ) | [inline, private] |
Callback function for an anonymous vertex uint property. Writes down a uint value in cloud data. param[in] value uint value parsed
Definition at line 510 of file ply_io.cpp.
| void pcl::PLYReader::vertexUnsignedShortPropertyCallback | ( | pcl::io::ply::uint16 | value | ) | [inline, private] |
Callback function for an anonymous vertex ushort property. Writes down a ushort value in cloud data. param[in] value ushort value parsed
Definition at line 528 of file ply_io.cpp.
| void pcl::PLYReader::warningCallback | ( | const std::string & | filename, |
| std::size_t | line_number, | ||
| const std::string & | message | ||
| ) | [inline, private] |
pcl::PCLPointCloud2* pcl::PLYReader::cloud_ [private] |
bool pcl::PLYReader::do_resize_ [private] |
Eigen::Matrix3f pcl::PLYReader::orientation_ [private] |
Eigen::Vector4f pcl::PLYReader::origin_ [private] |
::pcl::io::ply::ply_parser pcl::PLYReader::parser_ [private] |
size_t pcl::PLYReader::range_count_ [private] |
std::vector<std::vector <int> >* pcl::PLYReader::range_grid_ [private] |
size_t pcl::PLYReader::range_grid_vertex_indices_element_index_ [private] |
size_t pcl::PLYReader::rgb_offset_before_ [private] |
size_t pcl::PLYReader::vertex_count_ [private] |
int pcl::PLYReader::vertex_offset_before_ [private] |
size_t pcl::PLYReader::vertex_properties_counter_ [private] |