#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/program_options.hpp>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 167 of file ImageCSVFileGenerator.cpp.
169 CommandLineProcessor cmdline;
170 if (!cmdline.ProcessCommandLine(argc, argv))
175 namespace fs = boost::filesystem;
177 const std::string fileFormat(
".raw");
179 const std::string rawDirectory(cmdline.GetInputDirectory());
180 const std::string outputPath(cmdline.GetOutputFileName());
181 const std::string bindingId(cmdline.GetInputBindingId());
183 std::vector<fs::path> rawFiles;
184 for (
auto& entry : boost::make_iterator_range(fs::directory_iterator(rawDirectory), {}))
186 if (entry.path().extension().c_str() == fileFormat)
188 rawFiles.push_back(entry.path());
192 if (!rawFiles.empty())
194 unsigned int pass = 0;
195 std::ofstream refinementData;
196 refinementData.open(outputPath, std::ofstream::out);
197 if (refinementData.is_open())
199 for (
auto const& raw : rawFiles)
201 refinementData << pass <<
", " << bindingId <<
", " << raw.c_str() <<
"\n";
204 std::cerr <<
"Failed to write to output file: " << outputPath << std::endl;
209 refinementData.close();
213 std::cerr <<
"Failed to open output file: " << outputPath << std::endl;
219 std::cerr <<
"No matching files with the \".raw\" extension found in the directory: " 220 << rawDirectory << std::endl;