14         std::ifstream ifs0((
dataPath + 
"default-convert.yaml").c_str());
 
   20         std::ifstream ifs1((
dataPath + 
"default.yaml").c_str());
 
   23         std::ifstream ifs2((
dataPath + 
"unit_tests/badIcpConfig_InvalidParameter.yaml").c_str());
 
   26         std::ifstream ifs3((
dataPath + 
"unit_tests/badIcpConfig_InvalidModuleType.yaml").c_str());
 
   29         std::ifstream ifs4((
dataPath + 
"add_descriptor_config.yaml").c_str());
 
   36         std::istringstream is;
 
   37   std::ostringstream os;
 
   81   pts = IO::loadCSV(is);
 
  101   pts = IO::loadCSV(is);
 
  121   pts = IO::loadCSV(is);
 
  132   "x, y, z, nx, ny, nz\n" 
  141   pts = IO::loadCSV(is);
 
  150   int64_t time0 = 1410264593275569438;
 
  151   int64_t time1 = 1410264593325569391;
 
  152   int64_t time2 = 1410264593425569295;
 
  153   int64_t time3 = 1410264593522569417;
 
  159         "1, 1, 1, " << time0 << 
"\n" 
  160         "2, 1, 1, " << time1 << 
"\n" 
  161         "3, 1, 1, " << time2 << 
"\n" 
  162         "4, 1, 1, " << time3 << 
"\n" 
  168   pts = IO::loadCSV(is);
 
  187         std::istringstream is;
 
  198         "format binary_big_endian 1.0\n" 
  228         "property float grrrr\n"  
  229         "property float nz\n"  
  230         "property float ny\n" 
  231         "property float nx\n" 
  233         "3 2 1 99 33 22 11\n" 
  234         "3 2 1 99 33 22 11\n" 
  236         "3 2 1 99 33 22 11 3 2 1 99 33 22 11\n"  
  237         "3 2 1 99 33 22 11\n" 
  241         DP pointCloud = IO::loadPLY(is);
 
  261         std::istringstream is;
 
  273         "# .PCD v.7 - Point Cloud Data file format\n" 
  282         "# .PCD v.7 - Point Cloud Data file format\n" 
  290         "VIEWPOINT 0 0 0 1 0 0 0\n" 
  300         "# .PCD v.7 - Point Cloud Data file format\n" 
  302         "FIELDS x y z grrr\n" 
  308         "VIEWPOINT 0 0 0 1 0 0 0\n" 
  311         "0.44912094 0.49084857 1.153 22\n" 
  312         "0.34907714 0.48914573 1.149 22\n" 
  313         "0.33813429 0.48914573 1.149 22\n" 
  314         "0.32833049 0.49084857 1.153 22\n" 
  315         "0.24395333 0.42856666 0.98900002 22\n" 
  316         "0.20816095 0.42856666 0.98900002 22\n" 
  317         "0.1987419 0.42291525 0.98900002 22\n" 
  318         "0.18178761 0.42291525 0.98900002 22\n" 
  319         "0.17990381 0.42291525 0.98900002 22\n" 
  320         "-0.035590474 0.42997143 1.01 22\n" 
  321         "-0.035907622 0.43962574 1.0190001 22\n" 
  322         "-0.043542858 0.43639618 1.016 22\n" 
  323         "-0.15246001 0.36058003 0.84700006 22\n" 
  324         "0.21956001 0.44007048 0.99800003 22\n" 
  325         "-0.16635144 0.3699457 0.86900002 22\n" 
  326         "-0.33879143 0.36143145 0.84900004 22\n" 
  327         "-0.35055432 0.36853144 0.85800004 22\n" 
  328         "-0.39932001 0.38058859 0.89400005 22\n" 
  331         DP pointCloud = IO::loadPCD(is);
 
  353                 addRandomFeature(
"x", 1);
 
  354                 addRandomFeature(
"y", 1);
 
  355                 addRandomFeature(
"z", 1);
 
  356                 ptCloud.addFeature(
"pad", PM::Matrix::Ones(1, nbPts));
 
  358                 addRandomDescriptor(
"normals",3);
 
  359                 addRandomDescriptor(
"eigValues",3);
 
  360                 addRandomDescriptor(
"eigVectors",9);
 
  361                 addRandomDescriptor(
"color",4);
 
  366                 ptCloud.addFeature(featureName,PM::Matrix::Random(rows, nbPts));
 
  371                 ptCloud.addDescriptor(descriptorName, PM::Matrix::Random(rows, nbPts));
 
  374         virtual void loadSaveTest(
const string& testFileName, 
bool plyFormat = 
false, 
const int nbPts = 10, 
bool binary = 
false, 
unsigned precision=12)
 
  376                 this->testFileName = testFileName;
 
  378                 if (plyFormat || binary) {
 
  380                         int pointCount(ptCloud.features.cols());
 
  381                         int descRows(ptCloud.descriptors.rows());
 
  382                         bool datawithColor = ptCloud.descriptorExists(
"color");
 
  383                         int colorStartingRow = ptCloud.getDescriptorStartingRow(
"color");
 
  384                         int colorEndRow = colorStartingRow + ptCloud.getDescriptorDimension(
"color");
 
  385                         for (
int p = 0; p < pointCount; ++p)
 
  387                                 for (
int d = 0; d < descRows; ++d)
 
  389                                         if (datawithColor && d >= colorStartingRow && d < colorEndRow) {
 
  390                                                 if (ptCloud.descriptors(d, p) < 0) { ptCloud.descriptors.coeffRef(d, p) = -(ptCloud.descriptors(d, p)); }
 
  391                                                 ptCloud.descriptors.coeffRef(d, p) = (
static_cast<unsigned>(ptCloud.descriptors(d, p) * 255.0)) / 255.0;
 
  397                 ptCloud.save(testFileName, binary, precision);
 
  399                 ptCloudFromFile = 
DP::load(testFileName);
 
  401                 EXPECT_TRUE(ptCloudFromFile.features.cols() == ptCloud.features.cols());
 
  402                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"normals",3));
 
  403                 EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"normals").isApprox(ptCloud.getDescriptorViewByName(
"normals")));
 
  404                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"eigValues",3));
 
  405                 EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"eigValues").isApprox(ptCloud.getDescriptorViewByName(
"eigValues")));
 
  406                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"eigVectors",9));
 
  407                 EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"eigVectors").isApprox(ptCloud.getDescriptorViewByName(
"eigVectors")));
 
  408                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"color",4));
 
  409                 if (plyFormat || binary) {
 
  410                         EXPECT_TRUE(((ptCloudFromFile.getDescriptorViewByName(
"color") * 255.0)).isApprox((ptCloud.getDescriptorViewByName(
"color") * 255.0), 1.0));
 
  412                         EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"color").isApprox(ptCloud.getDescriptorViewByName(
"color")));
 
  415                 EXPECT_TRUE(ptCloudFromFile.features.isApprox(ptCloud.features));
 
  421                 EXPECT_TRUE(std::filesystem::remove(std::filesystem::path(testFileName)));
 
  436         ptCloud.addDescriptor(
"genericScalar", PM::Matrix::Random(1, nbPts));
 
  437         ptCloud.addDescriptor(
"genericVector", PM::Matrix::Random(3, nbPts));
 
  438         ptCloud.addTime(
"genericTime", PM::Int64Matrix::Random(1, nbPts));
 
  440         loadSaveTest(
dataPath + 
"unit_test.vtk");
 
  442         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericScalar",1));
 
  443         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericVector",3));
 
  444         EXPECT_TRUE(ptCloudFromFile.timeExists(
"genericTime",1));
 
  450         ptCloud.addDescriptor(
"genericScalar", PM::Matrix::Random(1, nbPts));
 
  451         ptCloud.addDescriptor(
"genericVector", PM::Matrix::Random(3, nbPts));
 
  452         ptCloud.addTime(
"genericTime", PM::Int64Matrix::Random(1, nbPts));
 
  454         loadSaveTest(
dataPath + 
"unit_test.bin.vtk", 
false, 10, 
true);
 
  456         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericScalar",1));
 
  457         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericVector",3));
 
  458         EXPECT_TRUE(ptCloudFromFile.timeExists(
"genericTime",1));
 
  463         loadSaveTest(
dataPath + 
"unit_test.ply", 
true);
 
  468         loadSaveTest(
dataPath + 
"unit_test.bin.ply", 
true, 1, 
true);
 
  473         loadSaveTest(
dataPath + 
"unit_test.pcd");
 
  478         loadSaveTest(
dataPath + 
"unit_test.csv");