LCOV - code coverage report
Current view: top level - projectors - SiddonsMethod.h (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 1 1 100.0 %
Date: 2022-05-27 02:48:28 Functions: 2 4 50.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "LinearOperator.h"
       4             : #include "Geometry.h"
       5             : #include "BoundingBox.h"
       6             : #include "VolumeDescriptor.h"
       7             : #include "DetectorDescriptor.h"
       8             : 
       9             : #include <vector>
      10             : #include <utility>
      11             : 
      12             : #include <Eigen/Geometry>
      13             : 
      14             : namespace elsa
      15             : {
      16             :     /**
      17             :      * @brief Operator representing the discretized X-ray transform in 2d/3d using Siddon's method.
      18             :      *
      19             :      * @author David Frank - initial code
      20             :      * @author Nikola Dinev - modularization, fixes
      21             :      *
      22             :      * @tparam data_t data type for the domain and range of the operator, defaulting to real_t
      23             :      *
      24             :      * The volume is traversed along the rays as specified by the Geometry. Each ray is traversed in
      25             :      * a continguous fashion (i.e. along long voxel borders, not diagonally) and each traversed
      26             :      * voxel is counted as a hit with weight according to the length of the path of the ray through
      27             :      * the voxel.
      28             :      *
      29             :      * The geometry is represented as a list of projection matrices (see class Geometry), one for
      30             :      * each acquisition pose.
      31             :      *
      32             :      * Forward projection is accomplished using apply(), backward projection using applyAdjoint().
      33             :      * This projector is matched.
      34             :      */
      35             :     template <typename data_t = real_t>
      36             :     class SiddonsMethod : public LinearOperator<data_t>
      37             :     {
      38             :     public:
      39             :         /**
      40             :          * @brief Constructor for Siddon's method traversal.
      41             :          *
      42             :          * @param[in] domainDescriptor describing the domain of the operator (the volume)
      43             :          * @param[in] rangeDescriptor describing the range of the operator (the sinogram)
      44             :          *
      45             :          * The domain is expected to be 2 or 3 dimensional (volSizeX, volSizeY, [volSizeZ]),
      46             :          * the range is expected to be matching the domain (detSizeX, [detSizeY], acqPoses).
      47             :          */
      48             :         SiddonsMethod(const VolumeDescriptor& domainDescriptor,
      49             :                       const DetectorDescriptor& rangeDescriptor);
      50             : 
      51             :         /// default destructor
      52         643 :         ~SiddonsMethod() override = default;
      53             : 
      54             :     protected:
      55             :         /// default copy constructor, hidden from non-derived classes to prevent potential slicing
      56             :         SiddonsMethod(const SiddonsMethod<data_t>&) = default;
      57             : 
      58             :         /// apply Siddon's method (i.e. forward projection)
      59             :         void applyImpl(const DataContainer<data_t>& x, DataContainer<data_t>& Ax) const override;
      60             : 
      61             :         /// apply the adjoint of Siddon's method (i.e. backward projection)
      62             :         void applyAdjointImpl(const DataContainer<data_t>& y,
      63             :                               DataContainer<data_t>& Aty) const override;
      64             : 
      65             :         /// implement the polymorphic clone operation
      66             :         SiddonsMethod<data_t>* cloneImpl() const override;
      67             : 
      68             :         /// implement the polymorphic comparison operation
      69             :         bool isEqual(const LinearOperator<data_t>& other) const override;
      70             : 
      71             :     private:
      72             :         /// the bounding box of the volume
      73             :         BoundingBox _boundingBox;
      74             : 
      75             :         /// Reference to DetectorDescriptor stored in LinearOperator
      76             :         DetectorDescriptor& _detectorDescriptor;
      77             : 
      78             :         /// Reference to VolumeDescriptor stored in LinearOperator
      79             :         VolumeDescriptor& _volumeDescriptor;
      80             : 
      81             :         /// the traversal routine (for both apply/applyAdjoint)
      82             :         template <bool adjoint>
      83             :         void traverseVolume(const DataContainer<data_t>& vector,
      84             :                             DataContainer<data_t>& result) const;
      85             : 
      86             :         /// lift from base class
      87             :         using LinearOperator<data_t>::_domainDescriptor;
      88             :         using LinearOperator<data_t>::_rangeDescriptor;
      89             :     };
      90             : 
      91             : } // namespace elsa

Generated by: LCOV version 1.15