LCOV - code coverage report
Current view: top level - elsa/core/Descriptors - XGIDetectorDescriptor.cpp (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 20 30 66.7 %
Date: 2024-05-16 04:22:26 Functions: 5 7 71.4 %

          Line data    Source code
       1             : #include "XGIDetectorDescriptor.h"
       2             : #include "TypeCasts.hpp"
       3             : 
       4             : namespace elsa
       5             : {
       6             :     XGIDetectorDescriptor::XGIDetectorDescriptor(const IndexVector_t& numOfCoeffsPerDim,
       7             :                                                  const RealVector_t& spacingPerDim,
       8             :                                                  const std::vector<Geometry>& geometryList,
       9             :                                                  const XGIDetectorDescriptor::DirVec& sensDir,
      10             :                                                  bool isParallelBeam)
      11             :         : DetectorDescriptor(numOfCoeffsPerDim, spacingPerDim, geometryList),
      12             :           _sensDir(sensDir.normalized()),
      13             :           _isParallelBeam(isParallelBeam)
      14       37364 :     {
      15       37364 :     }
      16             : 
      17             :     const XGIDetectorDescriptor::DirVec& XGIDetectorDescriptor::getSensDir() const
      18       58542 :     {
      19       58542 :         return _sensDir;
      20       58542 :     }
      21             : 
      22             :     bool XGIDetectorDescriptor::isParallelBeam() const
      23       36492 :     {
      24       36492 :         return _isParallelBeam;
      25       36492 :     }
      26             : 
      27             :     RealRay_t XGIDetectorDescriptor::computeRayFromDetectorCoord(const RealVector_t& detectorCoord,
      28             :                                                                  const index_t poseIndex) const
      29           0 :     {
      30           0 :         return DetectorDescriptor::computeRayFromDetectorCoord(detectorCoord, poseIndex);
      31           0 :     }
      32             : 
      33             :     bool XGIDetectorDescriptor::isEqual(const DataDescriptor& other) const
      34          56 :     {
      35          56 :         const XGIDetectorDescriptor* otherPtr{
      36          56 :             downcast_safe<const XGIDetectorDescriptor, const DataDescriptor>(&other)};
      37             : 
      38          56 :         return (otherPtr != nullptr && _sensDir == otherPtr->_sensDir
      39          56 :                 && _isParallelBeam == otherPtr->_isParallelBeam
      40          56 :                 && DetectorDescriptor::isEqual(other));
      41          56 :     }
      42             : 
      43             :     XGIDetectorDescriptor* XGIDetectorDescriptor::cloneImpl() const
      44       37661 :     {
      45       37661 :         return new XGIDetectorDescriptor(getNumberOfCoefficientsPerDimension(),
      46       37661 :                                          getSpacingPerDimension(), getGeometry(), getSensDir(),
      47       37661 :                                          isParallelBeam());
      48       37661 :     }
      49             : 
      50             :     std::unique_ptr<DetectorDescriptor>
      51             :         XGIDetectorDescriptor::cloneWithGeometry(std::vector<Geometry> geometries) const
      52           0 :     {
      53           0 :         auto coeff = getNumberOfCoefficientsPerDimension();
      54           0 :         auto dim = coeff.size();
      55           0 :         coeff[dim - 1] = geometries.size();
      56           0 :         return std::make_unique<XGIDetectorDescriptor>(coeff, getSpacingPerDimension(), geometries,
      57           0 :                                                        getSensDir(), isParallelBeam());
      58           0 :     }
      59             : 
      60             : } // namespace elsa

Generated by: LCOV version 1.14