-
Notifications
You must be signed in to change notification settings - Fork 5
/
dataio.h
67 lines (49 loc) · 2.53 KB
/
dataio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// This file is used for the Reading, Writing and Displaying of Point Cloud of various formats.
// Dependent 3rd Libs: PCL (>1.7) liblas
// Author: Zhen Dong , Yue Pan et al. @ WHU LIESMARS
//
#ifndef DATAIO
#define DATAIO
//pcl
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
//liblas
#include <liblas/liblas.hpp>
#include <liblas/version.hpp>
#include <liblas/point.hpp>
#include <vector>
#include "utility.h"
using namespace utility;
using namespace std;
template <typename PointT>
class DataIo : public CloudUtility<PointT>
{
public:
/* //Constructor
DataIo(){
}*/
// Point Cloud IO for all kinds of formats;
// pc_format: 1.pcd , 2.las , 3.ply , others;
bool readCloudFile (const int pc_format, const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud);
bool writeCloudFile (const int pc_format, const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud);
// pcd IO;
bool readPcdFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud);
bool writePcdFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud);
// las IO;
bool readLasFileHeader (const string &fileName, liblas::Header& header);
bool readLasFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud); //Without translation
bool writeLasFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud); //Without translation
bool readLasFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud, double & X_origin, double & Y_origin); //With translation @Override
bool writeLasFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud, double X_origin, double Y_origin); //With translation @Override
// ply IO;
bool readPlyFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud);
bool writePlyFile (const string &fileName, const typename pcl::PointCloud<PointT>::Ptr &pointCloud);
// txt IO;
// Display via VTK;
void display (const typename pcl::PointCloud<PointT>::Ptr &cloud1, const typename pcl::PointCloud<PointT>::Ptr &cloud2, string displayname);
void displaymulti (const typename pcl::PointCloud<PointT>::Ptr &cloud0, const typename pcl::PointCloud<PointT>::Ptr &cloud1, const typename pcl::PointCloud<PointT>::Ptr &cloud2, string displayname);
protected:
private:
};
#endif