40 #ifndef PCL_IO_PLY_IO_H_
41 #define PCL_IO_PLY_IO_H_
45 #include <boost/bind.hpp>
89 , origin_ (Eigen::Vector4f::Zero ())
90 , orientation_ (Eigen::Matrix3f::Zero ())
93 , vertex_properties_counter_ (0)
94 , vertex_offset_before_ (0)
97 , range_grid_vertex_indices_element_index_ (0)
98 , rgb_offset_before_ (0)
103 , origin_ (Eigen::Vector4f::Zero ())
104 , orientation_ (Eigen::Matrix3f::Zero ())
107 , vertex_properties_counter_ (0)
108 , vertex_offset_before_ (0)
111 , range_grid_vertex_indices_element_index_ (0)
112 , rgb_offset_before_ (0)
121 orientation_ = p.orientation_;
122 range_grid_ = p.range_grid_;
151 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
152 int &ply_version,
int &data_type,
unsigned int &data_idx,
const int offset = 0);
168 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation,
int& ply_version,
const int offset = 0);
188 Eigen::Vector4f origin;
189 Eigen::Quaternionf orientation;
191 return read (file_name, cloud, origin, orientation, ply_version, offset);
203 template<
typename Po
intT>
inline int
209 ply_version, offset);
222 parse (
const std::string& istream_filename);
230 infoCallback (
const std::string& filename, std::size_t line_number,
const std::string& message)
232 PCL_DEBUG (
"[pcl::PLYReader] %s:%lu: %s\n", filename.c_str (), line_number, message.c_str ());
241 warningCallback (
const std::string& filename, std::size_t line_number,
const std::string& message)
243 PCL_WARN (
"[pcl::PLYReader] %s:%lu: %s\n", filename.c_str (), line_number, message.c_str ());
252 errorCallback (
const std::string& filename, std::size_t line_number,
const std::string& message)
254 PCL_ERROR (
"[pcl::PLYReader] %s:%lu: %s\n", filename.c_str (), line_number, message.c_str ());
261 boost::tuple<boost::function<void ()>, boost::function<void ()> >
262 elementDefinitionCallback (
const std::string& element_name, std::size_t count);
265 endHeaderCallback ();
271 template <
typename ScalarType> boost::function<void (ScalarType)>
272 scalarPropertyDefinitionCallback (
const std::string& element_name,
const std::string& property_name);
278 template <
typename SizeType,
typename ScalarType>
279 boost::tuple<boost::function<void (SizeType)>, boost::function<void (ScalarType)>, boost::function<void ()> >
280 listPropertyDefinitionCallback (
const std::string& element_name,
const std::string& property_name);
309 originXCallback (
const float& value) { origin_[0] = value; }
315 originYCallback (
const float& value) { origin_[1] = value; }
321 originZCallback (
const float& value) { origin_[2] = value; }
327 orientationXaxisXCallback (
const float& value) { orientation_ (0,0) = value; }
333 orientationXaxisYCallback (
const float& value) { orientation_ (0,1) = value; }
339 orientationXaxisZCallback (
const float& value) { orientation_ (0,2) = value; }
345 orientationYaxisXCallback (
const float& value) { orientation_ (1,0) = value; }
351 orientationYaxisYCallback (
const float& value) { orientation_ (1,1) = value; }
357 orientationYaxisZCallback (
const float& value) { orientation_ (1,2) = value; }
363 orientationZaxisXCallback (
const float& value) { orientation_ (2,0) = value; }
369 orientationZaxisYCallback (
const float& value) { orientation_ (2,1) = value; }
375 orientationZaxisZCallback (
const float& value) { orientation_ (2,2) = value; }
381 cloudHeightCallback (
const int &height) { cloud_->height = height; }
387 cloudWidthCallback (
const int &width) { cloud_->width = width; }
395 appendFloatProperty (
const std::string& name,
const size_t& count = 1);
399 vertexBeginCallback ();
403 vertexEndCallback ();
407 rangeGridBeginCallback ();
423 rangeGridVertexIndicesEndCallback ();
427 rangeGridEndCallback ();
431 objInfoCallback (
const std::string& line);
434 Eigen::Vector4f origin_;
437 Eigen::Matrix3f orientation_;
441 size_t vertex_count_, vertex_properties_counter_;
442 int vertex_offset_before_;
444 std::vector<std::vector <int> > *range_grid_;
445 size_t range_count_, range_grid_vertex_indices_element_index_;
446 size_t rgb_offset_before_;
449 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
476 const Eigen::Vector4f &origin,
477 const Eigen::Quaternionf &orientation,
479 bool use_camera =
true)
481 return (generateHeader (cloud, origin, orientation,
true, use_camera, valid_points));
495 const Eigen::Vector4f &origin,
496 const Eigen::Quaternionf &orientation,
498 bool use_camera =
true)
500 return (generateHeader (cloud, origin, orientation,
false, use_camera, valid_points));
514 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
515 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
517 bool use_camera =
true);
527 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
528 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity ());
540 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
541 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
542 const bool binary =
false)
545 return (this->writeBinary (file_name, cloud, origin, orientation));
547 return (this->writeASCII (file_name, cloud, origin, orientation, 8,
true));
562 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
563 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
565 bool use_camera =
true)
568 return (this->writeBinary (file_name, cloud, origin, orientation));
570 return (this->writeASCII (file_name, cloud, origin, orientation, 8, use_camera));
585 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
586 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
588 bool use_camera =
true)
590 return (write (file_name, *cloud, origin, orientation, binary, use_camera));
601 template<
typename Po
intT>
inline int
602 write (
const std::string &file_name,
605 bool use_camera =
true)
614 return (this->write (file_name, blob, origin, orientation, binary, use_camera));
624 const Eigen::Vector4f &origin,
625 const Eigen::Quaternionf &orientation,
631 writeContentWithCameraASCII (
int nr_points,
634 const Eigen::Vector4f &origin,
635 const Eigen::Quaternionf &orientation,
639 writeContentWithRangeGridASCII (
int nr_points,
642 std::ostringstream& fs,
643 int& nb_valid_points);
661 return (p.
read (file_name, cloud));
674 Eigen::Vector4f &origin, Eigen::Quaternionf &orientation)
678 return (p.
read (file_name, cloud, origin, orientation, ply_version));
686 template<
typename Po
intT>
inline int
690 return (p.
read (file_name, cloud));
703 const Eigen::Vector4f &origin = Eigen::Vector4f::Zero (),
704 const Eigen::Quaternionf &orientation = Eigen::Quaternionf::Identity (),
705 bool binary_mode =
false,
bool use_camera =
true)
708 return (w.
write (file_name, cloud, origin, orientation, binary_mode, use_camera));
718 template<
typename Po
intT>
inline int
722 return (w.
write<
PointT> (file_name, cloud, binary_mode));
731 template<
typename Po
intT>
inline int
735 return (w.
write<
PointT> (file_name, cloud,
false));
743 template<
typename Po
intT>
inline int
757 template<
typename Po
intT>
int
759 const std::vector<int> &indices,
bool binary_mode =
false)
766 return (w.
write<
PointT> (file_name, cloud_out, binary_mode));
780 #endif //#ifndef PCL_IO_PLY_IO_H_