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());
 
   33         std::istringstream is;
 
   34   std::ostringstream os;
 
   78   pts = IO::loadCSV(is);
 
   98   pts = IO::loadCSV(is);
 
  118   pts = IO::loadCSV(is);
 
  129   "x, y, z, nx, ny, nz\n" 
  138   pts = IO::loadCSV(is);
 
  147   int64_t time0 = 1410264593275569438;
 
  148   int64_t time1 = 1410264593325569391;
 
  149   int64_t time2 = 1410264593425569295;
 
  150   int64_t time3 = 1410264593522569417;
 
  156         "1, 1, 1, " << time0 << 
"\n" 
  157         "2, 1, 1, " << time1 << 
"\n" 
  158         "3, 1, 1, " << time2 << 
"\n" 
  159         "4, 1, 1, " << time3 << 
"\n" 
  165   pts = IO::loadCSV(is);
 
  184         std::istringstream is;
 
  195         "format binary_big_endian 1.0\n" 
  225         "property float grrrr\n"  
  226         "property float nz\n"  
  227         "property float ny\n" 
  228         "property float nx\n" 
  230         "3 2 1 99 33 22 11\n" 
  231         "3 2 1 99 33 22 11\n" 
  233         "3 2 1 99 33 22 11 3 2 1 99 33 22 11\n"  
  234         "3 2 1 99 33 22 11\n" 
  238         DP pointCloud = IO::loadPLY(is);
 
  258         std::istringstream is;
 
  270         "# .PCD v.7 - Point Cloud Data file format\n" 
  279         "# .PCD v.7 - Point Cloud Data file format\n" 
  287         "VIEWPOINT 0 0 0 1 0 0 0\n" 
  297         "# .PCD v.7 - Point Cloud Data file format\n" 
  299         "FIELDS x y z grrr\n" 
  305         "VIEWPOINT 0 0 0 1 0 0 0\n" 
  308         "0.44912094 0.49084857 1.153 22\n" 
  309         "0.34907714 0.48914573 1.149 22\n" 
  310         "0.33813429 0.48914573 1.149 22\n" 
  311         "0.32833049 0.49084857 1.153 22\n" 
  312         "0.24395333 0.42856666 0.98900002 22\n" 
  313         "0.20816095 0.42856666 0.98900002 22\n" 
  314         "0.1987419 0.42291525 0.98900002 22\n" 
  315         "0.18178761 0.42291525 0.98900002 22\n" 
  316         "0.17990381 0.42291525 0.98900002 22\n" 
  317         "-0.035590474 0.42997143 1.01 22\n" 
  318         "-0.035907622 0.43962574 1.0190001 22\n" 
  319         "-0.043542858 0.43639618 1.016 22\n" 
  320         "-0.15246001 0.36058003 0.84700006 22\n" 
  321         "0.21956001 0.44007048 0.99800003 22\n" 
  322         "-0.16635144 0.3699457 0.86900002 22\n" 
  323         "-0.33879143 0.36143145 0.84900004 22\n" 
  324         "-0.35055432 0.36853144 0.85800004 22\n" 
  325         "-0.39932001 0.38058859 0.89400005 22\n" 
  328         DP pointCloud = IO::loadPCD(is);
 
  350                 addRandomFeature(
"x", 1);
 
  351                 addRandomFeature(
"y", 1);
 
  352                 addRandomFeature(
"z", 1);
 
  353                 ptCloud.addFeature(
"pad", PM::Matrix::Ones(1, nbPts));
 
  355                 addRandomDescriptor(
"normals",3);
 
  356                 addRandomDescriptor(
"eigValues",3);
 
  357                 addRandomDescriptor(
"eigVectors",9);
 
  358                 addRandomDescriptor(
"color",4);
 
  363                 ptCloud.addFeature(featureName,PM::Matrix::Random(rows, nbPts));
 
  368                 ptCloud.addDescriptor(descriptorName, PM::Matrix::Random(rows, nbPts));
 
  371         virtual void loadSaveTest(
const string& testFileName, 
bool plyFormat = 
false, 
const int nbPts = 10, 
bool binary = 
false)
 
  373                 this->testFileName = testFileName;
 
  375                 if (plyFormat || binary) {
 
  377                         int pointCount(ptCloud.features.cols());
 
  378                         int descRows(ptCloud.descriptors.rows());
 
  379                         bool datawithColor = ptCloud.descriptorExists(
"color");
 
  380                         int colorStartingRow = ptCloud.getDescriptorStartingRow(
"color");
 
  381                         int colorEndRow = colorStartingRow + ptCloud.getDescriptorDimension(
"color");
 
  382                         for (
int p = 0; p < pointCount; ++p)
 
  384                                 for (
int d = 0; 
d < descRows; ++
d)
 
  386                                         if (datawithColor && 
d >= colorStartingRow && 
d < colorEndRow) {
 
  387                                                 if (ptCloud.descriptors(
d, p) < 0) { ptCloud.descriptors.coeffRef(
d, p) = -(ptCloud.descriptors(
d, p)); }
 
  388                                                 ptCloud.descriptors.coeffRef(
d, p) = (
static_cast<unsigned>(ptCloud.descriptors(
d, p) * 255.0)) / 255.0;
 
  394                 ptCloud.save(testFileName, binary);
 
  396                 ptCloudFromFile = 
DP::load(testFileName);
 
  398                 EXPECT_TRUE(ptCloudFromFile.features.cols() == ptCloud.features.cols());
 
  399                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"normals",3));
 
  400                 EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"normals").isApprox(ptCloud.getDescriptorViewByName(
"normals")));
 
  401                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"eigValues",3));
 
  402                 EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"eigValues").isApprox(ptCloud.getDescriptorViewByName(
"eigValues")));
 
  403                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"eigVectors",9));
 
  404                 EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"eigVectors").isApprox(ptCloud.getDescriptorViewByName(
"eigVectors")));
 
  405                 EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"color",4));
 
  406                 if (plyFormat || binary) {
 
  407                         EXPECT_TRUE(((ptCloudFromFile.getDescriptorViewByName(
"color") * 255.0)).isApprox((ptCloud.getDescriptorViewByName(
"color") * 255.0), 1.0));
 
  409                         EXPECT_TRUE(ptCloudFromFile.getDescriptorViewByName(
"color").isApprox(ptCloud.getDescriptorViewByName(
"color")));
 
  412                 EXPECT_TRUE(ptCloudFromFile.features.isApprox(ptCloud.features));
 
  418                 EXPECT_TRUE(boost::filesystem::remove(boost::filesystem::path(testFileName)));
 
  433         ptCloud.addDescriptor(
"genericScalar", PM::Matrix::Random(1, nbPts));
 
  434         ptCloud.addDescriptor(
"genericVector", PM::Matrix::Random(3, nbPts));
 
  435         ptCloud.addTime(
"genericTime", PM::Int64Matrix::Random(1, nbPts));
 
  437         loadSaveTest(
dataPath + 
"unit_test.vtk");
 
  439         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericScalar",1));
 
  440         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericVector",3));
 
  441         EXPECT_TRUE(ptCloudFromFile.timeExists(
"genericTime",1));
 
  447         ptCloud.addDescriptor(
"genericScalar", PM::Matrix::Random(1, nbPts));
 
  448         ptCloud.addDescriptor(
"genericVector", PM::Matrix::Random(3, nbPts));
 
  449         ptCloud.addTime(
"genericTime", PM::Int64Matrix::Random(1, nbPts));
 
  451         loadSaveTest(
dataPath + 
"unit_test.bin.vtk", 
false, 10, 
true);
 
  453         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericScalar",1));
 
  454         EXPECT_TRUE(ptCloudFromFile.descriptorExists(
"genericVector",3));
 
  455         EXPECT_TRUE(ptCloudFromFile.timeExists(
"genericTime",1));
 
  460         loadSaveTest(
dataPath + 
"unit_test.ply", 
true);
 
  465         loadSaveTest(
dataPath + 
"unit_test.pcd");
 
  470         loadSaveTest(
dataPath + 
"unit_test.csv");