LCOV - code coverage report
Current view: top level - elsa/generators - Sphere.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 12 12 100.0 %
Date: 2024-05-16 04:22:26 Functions: 7 8 87.5 %

          Line data    Source code
       1             : #pragma once
       2             : #include "PhantomDefines.h"
       3             : 
       4             : namespace elsa::phantoms
       5             : {
       6             :     template <typename data_t = double>
       7             :     class Sphere
       8             :     {
       9             : 
      10             :     private:
      11             :         data_t _amplit;
      12             :         Vec3i _center;
      13             :         data_t _radius;
      14             : 
      15             :     public:
      16             :         Sphere(data_t amplit, Vec3i center, data_t radius);
      17             :         /**
      18             :          * @brief returns the center of the sphere
      19             :          */
      20          86 :         const Vec3i& getCenter() const { return _center; };
      21             :         /**
      22             :          * @brief returns the center of the sphere
      23             :          */
      24         174 :         const data_t getRadius() const { return _radius; };
      25             :         /**
      26             :          * @brief returns the amplitude to color the voxel
      27             :          */
      28          86 :         const data_t getAmplitude() const { return _amplit; };
      29             :     };
      30             : 
      31             :     /**
      32             :      * @brief Rasterizes the given sphere in the given data container.
      33             :      */
      34             :     template <Blending b, typename data_t>
      35             :     void rasterize(Sphere<data_t>& el, VolumeDescriptor& dd, DataContainer<data_t>& dc);
      36             : 
      37             : } // namespace elsa::phantoms
      38             : 
      39             : /**
      40             :  * @brief Sphere formatter to use the Logger.h functions
      41             :  */
      42             : template <typename data_t>
      43             : struct fmt::formatter<elsa::phantoms::Sphere<data_t>> : fmt::formatter<std::string> {
      44             :     auto format(elsa::phantoms::Sphere<data_t> ell, format_context& ctx) -> decltype(ctx.out())
      45          42 :     {
      46          42 :         auto _center = ell.getCenter();
      47          42 :         auto _amplit = ell.getAmplitude();
      48          42 :         auto _radius = ell.getRadius();
      49             : 
      50          42 :         return format_to(ctx.out(), "Sphere with amplitude {}, center ({},{},{}) and radius {}",
      51          42 :                          _amplit, _center[elsa::phantoms::INDEX_X],
      52          42 :                          _center[elsa::phantoms::INDEX_Y], _center[elsa::phantoms::INDEX_Z],
      53          42 :                          _radius);
      54          42 :     }
      55             : };

Generated by: LCOV version 1.14