10 #include <boost/filesystem.hpp> 
   24 boost::shared_array<T> 
reduceData(boost::shared_array<T> data,
 
   27                                   unsigned int reductionFactor,
 
   28                                   size_t* reducedDataCount)
 
   30     *reducedDataCount = dataCount / reductionFactor + 1;
 
   32     boost::shared_array<T> reducedData =
 
   33         boost::shared_array<T>(
new T[(*reducedDataCount) * dataWidth]);
 
   35     size_t reducedDataIdx = 0;
 
   36     for (
size_t i = 0; i < dataCount; i++)
 
   38         if (i % reductionFactor == 0)
 
   40             std::copy(data.get() + i * dataWidth,
 
   41                       data.get() + (i + 1) * dataWidth,
 
   42                       reducedData.get() + reducedDataIdx * dataWidth);
 
   66     if (!boost::filesystem::exists(inputDir))
 
   74     if (!boost::filesystem::exists(outputDir))
 
   77         if (!boost::filesystem::create_directory(outputDir))
 
   89     if (boost::filesystem::exists(outputPath))
 
   91         std::cout << 
timestamp << 
"File already exists. Expanding File..." << std::endl;
 
   94         hdf.
open(outputPath.string());
 
  100         hdf.
open(outputPath.string());
 
  106     std::cout << 
timestamp << 
"Reading ScanProject from directory" << std::endl;
 
  110     std::cout << 
timestamp << 
"Writing ScanProject to HDF5" << std::endl;
 
  115             existingScanProject->positions.push_back(scanPosPtr);
 
  117         hdf.
save(existingScanProject);
 
  121         hdf.
save(scanProject);
 
  126         for (
int i = 0; i < scanProject->positions.size(); i++)
 
  129             sprintf(buffer, 
"%08d", i);
 
  130             string nr_str(buffer);
 
  131             std::string previewGroupName = 
"/preview/" + nr_str;
 
  133             std::cout << 
timestamp << 
"Generating preview for position " << nr_str << std::endl;
 
  137             ScanPtr scanPtr = scanPositionPtr->scans[0];
 
  138             floatArr points = scanPtr->points->getPointArray();
 
  144                                                   scanPtr->points->numPoints(),
 
  149                 std::vector<size_t> previewDim = {numPreview, 3};
 
  150                 hdf.
save<
float>(previewGroupName, 
"points", previewDim, previewData);
 
  155     std::cout << 
timestamp << 
"Program finished" << std::endl;