#include <Filesystem.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 165 of file ImageCSVFileGenerator.cpp.
167 CommandLineProcessor cmdline;
168 if (!cmdline.ProcessCommandLine(argc, argv))
173 const std::string fileFormat(
".raw");
175 const std::string rawDirectory(cmdline.GetInputDirectory());
176 const std::string outputPath(cmdline.GetOutputFileName());
177 const std::string bindingId(cmdline.GetInputBindingId());
179 std::vector<fs::path> rawFiles;
180 for (
auto& entry : boost::make_iterator_range(fs::directory_iterator(rawDirectory), {}))
182 if (entry.path().extension().c_str() == fileFormat)
184 rawFiles.push_back(entry.path());
188 if (!rawFiles.empty())
190 unsigned int pass = 0;
191 std::ofstream refinementData;
192 refinementData.open(outputPath, std::ofstream::out);
193 if (refinementData.is_open())
195 for (
auto const& raw : rawFiles)
197 refinementData << pass <<
", " << bindingId <<
", " << raw.c_str() <<
"\n";
200 std::cerr <<
"Failed to write to output file: " << outputPath << std::endl;
205 refinementData.close();
209 std::cerr <<
"Failed to open output file: " << outputPath << std::endl;
215 std::cerr <<
"No matching files with the \".raw\" extension found in the directory: " 216 << rawDirectory << std::endl;