LCOV - code coverage report
Current view: top level - generators - TrajectoryGenerator.cpp (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 0 14 0.0 %
Date: 2022-08-04 03:43:28 Functions: 0 1 0.0 %

          Line data    Source code
       1             : #include "TrajectoryGenerator.h"
       2             : #include "VolumeDescriptor.h"
       3             : 
       4             : namespace elsa
       5             : {
       6             : 
       7             :     std::pair<IndexVector_t, RealVector_t>
       8           0 :         TrajectoryGenerator::calculateSizeAndSpacingPerGeometry(const DataDescriptor& volDescr,
       9             :                                                                 index_t numberOfPoses)
      10             :     {
      11           0 :         const auto dim = volDescr.getNumberOfDimensions();
      12             : 
      13           0 :         IndexVector_t coeffs(dim);
      14           0 :         RealVector_t spacing(dim);
      15             : 
      16             :         // Scale coeffsPerDim by sqrt(2), this reduces undersampling of the corners, as the
      17             :         // detector is larger than the volume. Cast back and forthe to reduce warnings...
      18             :         // This has to be a RealVector_t, most likely that the cast happens, anyway we get
      19             :         // errors down the line see #86 in Gitlab
      20             :         const RealVector_t coeffsPerDim =
      21           0 :             volDescr.getNumberOfCoefficientsPerDimension().template cast<real_t>();
      22           0 :         const real_t sqrt2 = std::sqrt(2.f);
      23           0 :         const auto coeffsPerDimScaled = (coeffsPerDim * sqrt2).template cast<index_t>();
      24             : 
      25           0 :         const auto spacingPerDim = volDescr.getSpacingPerDimension();
      26             : 
      27           0 :         coeffs.head(dim - 1) = coeffsPerDimScaled.head(dim - 1);
      28           0 :         coeffs[dim - 1] = numberOfPoses; // TODO: with eigen 3.4: `coeffs(Eigen::last) = 1`
      29             : 
      30           0 :         spacing.head(dim - 1) = spacingPerDim.head(dim - 1);
      31           0 :         spacing[dim - 1] = 1; // TODO: same as coeffs
      32             : 
      33             :         // return a pair, then split it using structured bindings
      34           0 :         return std::pair{coeffs, spacing};
      35           0 :     }
      36             : } // namespace elsa

Generated by: LCOV version 1.14