Line data Source code
1 : #pragma once 2 : 3 : #include "elsaDefines.h" 4 : #include "DataDescriptor.h" 5 : #include "Geometry.h" 6 : 7 : #include <optional> 8 : #include "Eigen/Geometry" 9 : 10 : namespace elsa 11 : { 12 : /** 13 : * @brief Class representing metadata for lineraized n-dimensional signal stored in memory. It 14 : * is a base class for different type signals caputred by some kind of detectors (i.e. a planar 15 : * detector, curved or some other shaped detector). Is additionally stored information about the 16 : * different poses of a trajectory. 17 : */ 18 : class DetectorDescriptor : public DataDescriptor 19 : { 20 : public: 21 : /// There is not default signal 22 : DetectorDescriptor() = delete; 23 : 24 : /// Default destructor 25 4293 : ~DetectorDescriptor() override = default; 26 : 27 : /** 28 : * @brief Construct a DetectorDescriptor with a number of coefficients for each dimension 29 : * and a list of geometry poses 30 : */ 31 : DetectorDescriptor(const IndexVector_t& numOfCoeffsPerDim, 32 : const std::vector<Geometry>& geometryList); 33 : /** 34 : * @brief Construct a DetectorDescriptor with a number of coefficients and spacing for each 35 : * dimension and a list of geometry poses 36 : */ 37 : DetectorDescriptor(const IndexVector_t& numOfCoeffsPerDim, 38 : const RealVector_t& spacingPerDim, 39 : const std::vector<Geometry>& geometryList); 40 : 41 : /** 42 : * @brief Overload of computeRayToDetector with a single detectorIndex. Compute the pose and 43 : * coord index using getCoordinateFromIndex and call overload 44 : */ 45 : RealRay_t computeRayFromDetectorCoord(const index_t detectorIndex) const; 46 : 47 : /** 48 : * @brief Overload of computeRayToDetector with a single coord vector. This vector encodes 49 : * the pose index and the detector coordinate. So for a 1D detector, this will be 2D and the 50 : * second dimension, will reference the pose index 51 : */ 52 : RealRay_t computeRayFromDetectorCoord(const IndexVector_t coord) const; 53 : 54 : /** 55 : * @brief Compute a ray from the source from a pose to the given detector coordinate 56 : * 57 : * @param[in] detectorCoord Vector of size dim - 1, specifying the coordinate the ray should 58 : * hit 59 : * @param[in] poseIndex index into geometryList array, which pose to use for ray computation 60 : * 61 : */ 62 : virtual RealRay_t computeRayFromDetectorCoord(const RealVector_t& detectorCoord, 63 : const index_t poseIndex) const = 0; 64 : 65 : /** 66 : * @brief Compute a ray from the source to trougth a pixel/voxel 67 : */ 68 : virtual RealVector_t computeDetectorCoordFromRay(const RealRay_t& ray, 69 : const index_t poseIndex) const = 0; 70 : 71 : /// Get the number of poses used in the geometry 72 : index_t getNumberOfGeometryPoses() const; 73 : 74 : /// Get the list of geometry poses 75 : std::vector<Geometry> getGeometry() const; 76 : 77 : /// Get the i-th geometry in the trajectory. 78 : std::optional<Geometry> getGeometryAt(const index_t index) const; 79 : 80 : protected: 81 : /// implement the polymorphic comparison operation 82 : bool isEqual(const DataDescriptor& other) const override; 83 : 84 : /// List of geometry poses 85 : std::vector<Geometry> _geometry; 86 : }; 87 : } // namespace elsa