Line data Source code
1 : #pragma once 2 : 3 : #include "IdenticalBlocksDescriptor.h" 4 : #include "elsaDefines.h" 5 : 6 : namespace elsa 7 : { 8 : 9 : /** 10 : * @brief A descriptor representing e.g. a volume descriptor of spherical harmonics 11 : * coefficients. These get stored as identical blocks, alongside with a symmetry hint 12 : * (oftentimes we only store even harmonics) and the maximum degree of the spherical harmonics. 13 : * @author Cederik Höfs 14 : */ 15 : class SphericalCoefficientsDescriptor : public IdenticalBlocksDescriptor 16 : { 17 : using Symmetry = axdt::Symmetry; 18 : 19 : public: 20 : /** 21 : * @brief Constructs a SphericalCoefficientsDescriptor object. 22 : * 23 : * @param blockDescriptor The data descriptor for the block. 24 : * @param symmetry The symmetry of the spherical coefficients. 25 : * @param degree The degree of the spherical coefficients. 26 : */ 27 : SphericalCoefficientsDescriptor(const DataDescriptor& blockDescriptor, 28 : const Symmetry symmetry, const index_t degree); 29 : 30 : /** 31 : * @brief Deleted copy constructor. 32 : * We use clone() instead. 33 : */ 34 : SphericalCoefficientsDescriptor(const SphericalCoefficientsDescriptor&) = delete; 35 : 36 : /** 37 : * @brief Default destructor. 38 : */ 39 240 : ~SphericalCoefficientsDescriptor() override = default; 40 : 41 : /** 42 : * @brief Calculates the total number of coefficients for a given symmetry and degree. 43 : * 44 : * @param symmetry The symmetry of the spherical coefficients. 45 : * @param degree The degree of the spherical coefficients. 46 : * @return The total number of coefficients. 47 : */ 48 : static inline constexpr index_t coefficientCount(const Symmetry symmetry, 49 : const index_t degree) 50 353 : { 51 353 : if (symmetry == Symmetry::even) 52 179 : return (degree + 1) * (degree / 2 + 1); 53 174 : else 54 174 : return (degree + 1) * (degree + 1); 55 353 : } 56 : 57 : const index_t degree; /**< The degree of the spherical coefficients. */ 58 : const Symmetry symmetry; /**< The symmetry of the spherical coefficients. */ 59 : 60 : protected: 61 : /** 62 : * @brief Creates a copy of the SphericalCoefficientsDescriptor object. 63 : * 64 : * @return A pointer to the cloned SphericalCoefficientsDescriptor object. 65 : */ 66 : SphericalCoefficientsDescriptor* cloneImpl() const override; 67 : 68 : /** 69 : * @brief Checks if the SphericalCoefficientsDescriptor object is equal to another 70 : * DataDescriptor object. 71 : * 72 : * @param other The other DataDescriptor object to compare with. 73 : * @return True if the objects are equal, false otherwise. 74 : */ 75 : bool isEqual(const DataDescriptor& other) const override; 76 : }; 77 : } // namespace elsa