Line data Source code
1 : #pragma once 2 : 3 : #include "SphericalCoefficientsDescriptor.h" 4 : #include "LinearOperator.h" 5 : #include "elsaDefines.h" 6 : 7 : namespace elsa::axdt 8 : { 9 : 10 : /** 11 : * @brief Evaluates the spherical harmonics up to a given order for a list of directions. 12 : * 13 : * @tparam data_t 14 : * @param symmetry 15 : * @param maxL 16 : * @param dirs 17 : * @return Matrix_t<data_t> 18 : */ 19 : template <typename data_t> 20 : Matrix_t<data_t> evalSphericalHarmonics(const Symmetry symmetry, const index_t maxL, 21 : const DirVecList<data_t>& dirs); 22 : 23 : /** 24 : * @brief Linear Operator representing the basis change from the spherical harmonics basis to 25 : * function values on a list of sampling directions. The domain is therefore to be described by 26 : * a SphericalCoefficientsDescriptor, while the range has a shape encoded by an 27 : * IdenticalBlocksDescriptor with the underlying volume repeated for each direction. 28 : * 29 : * @tparam data_t 30 : * @author Cederik Höfs 31 : */ 32 : template <typename data_t> 33 : class SphericalHarmonicsTransform : public LinearOperator<data_t> 34 : { 35 : public: 36 : /** 37 : * @brief Construct a new Spherical Function Transform object 38 : * 39 : * @param domainDescriptor 40 : * @param samplingDirections 41 : */ 42 : SphericalHarmonicsTransform(const SphericalCoefficientsDescriptor& domainDescriptor, 43 : const DirVecList<data_t>& samplingDirections); 44 : 45 30 : ~SphericalHarmonicsTransform() override = default; 46 : 47 : protected: 48 : /// protected copy constructor; used for cloning 49 : SphericalHarmonicsTransform(const SphericalHarmonicsTransform& other); 50 : 51 : /// implement the polymorphic clone operation 52 : SphericalHarmonicsTransform<data_t>* cloneImpl() const override; 53 : 54 : /// implement the polymorphic comparison operation 55 : bool isEqual(const LinearOperator<data_t>& other) const override; 56 : 57 : /// apply the AXDT operator 58 : void applyImpl(const DataContainer<data_t>& x, DataContainer<data_t>& Ax) const override; 59 : 60 : /// apply the adjoint of the AXDT operator 61 : void applyAdjointImpl(const DataContainer<data_t>& y, 62 : DataContainer<data_t>& Aty) const override; 63 : 64 : private: 65 : const DirVecList<data_t> _samplingDirections; 66 : 67 : // shape volSize×#coeffs 68 : const Matrix_t<data_t> _basis; 69 : }; 70 : 71 : } // namespace elsa::axdt