+ std::ofstream landmarksFile(fileName.c_str());
+
+ landmarksFile << "LANDMARKS1" << std::endl;
+ for (size_t i = 0; i < points.size(); i++)
+ landmarksFile << data[i][0] << " " << points[i][0] << " " << points[i][1] << " " << points[i][2] << " " << data[i][1] << " " << std::endl;
+}
+
+void read_points_pts(const std::string& fileName, PointArrayType& points)
+{
+ std::ifstream landmarksFile(fileName.c_str());
+ if (landmarksFile.fail()) {
+ std::cerr << "ERROR: could not open '" << fileName << "'" << std::endl;
+ exit(-2);
+ }
+
+ std::string line;
+ std::getline(landmarksFile, line);
+ if (line.find("#X") != 0) {
+ std::cerr << "ERROR: invalid landmarks file '" << fileName << "'" << std::endl;
+ exit(-3);
+ }
+
+ PointType p;
+ p.Fill(1);
+
+ while (!landmarksFile.eof()) {
+ // read id, x, y, z, d1, d2
+ landmarksFile >> p[0] >> p[1] >> p[2];
+ if (landmarksFile.fail())
+ break;
+
+ if (verbose){
+ std::cout << "point " << p << std::endl;
+ }
+
+ points.push_back(p);