LCOV - code coverage report
Current view: top level - elsa/generators - CylinderFree.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 20 20 100.0 %
Date: 2024-12-21 07:37:52 Functions: 11 12 91.7 %

          Line data    Source code
       1             : #pragma once
       2             : #include "PhantomDefines.h"
       3             : 
       4             : namespace elsa::phantoms
       5             : {
       6             : 
       7             :     template <typename data_t = double>
       8             :     class CylinderFree
       9             :     {
      10             : 
      11             :     private:
      12             :         data_t _amplit;
      13             :         Vec3i _center;
      14             :         data_t _radius;
      15             :         data_t _length;
      16             :         Vec3X<data_t> _eulers;
      17             : 
      18             :     public:
      19             :         /**
      20             :          * @param amlpit amplitude wich is added to the voxel on rasterization
      21             :          * @param center center of the object
      22             :          * @param radius radius of the circle in the cross section
      23             :          * @param length the length from one side throught the center to the other side
      24             :          * @param eulers euler angels
      25             :          *
      26             :          */
      27             :         CylinderFree(data_t amplit, Vec3i center, data_t radius, data_t length,
      28             :                      Vec3X<data_t> eulers);
      29             : 
      30             :         /**
      31             :          * @brief returns the amplitude to color the voxel
      32             :          */
      33         372 :         const data_t getAmplitude() const { return _amplit; };
      34             :         /**
      35             :          * @brief returns the center of the CylinderFree
      36             :          */
      37         372 :         const Vec3i& getCenter() const { return _center; };
      38             :         /**
      39             :          * @brief returns the center of the CylinderFree
      40             :          */
      41         559 :         const data_t getRadius() const { return _radius; };
      42             :         /**
      43             :          * @brief returns the length of the CylinderFree
      44             :          */
      45         372 :         const data_t getLength() const { return _length; };
      46             :         /**
      47             :          * @brief returns the euler angels of the CylinderFree
      48             :          */
      49         372 :         const Vec3X<data_t>& getEulerAngels() const { return _eulers; };
      50             :     };
      51             : 
      52             :     /**
      53             :      * @brief Rasterizes the given CylinderFree in the given data container.
      54             :      */
      55             :     template <Blending b, typename data_t>
      56             :     void rasterize(CylinderFree<data_t>& el, VolumeDescriptor& dd, DataContainer<data_t>& dc);
      57             : 
      58             : } // namespace elsa::phantoms
      59             : 
      60             : template <typename data_t>
      61             : struct fmt::formatter<elsa::phantoms::CylinderFree<data_t>> : fmt::formatter<std::string> {
      62             :     auto format(elsa::phantoms::CylinderFree<data_t> cylFree, format_context& ctx)
      63             :         -> decltype(ctx.out())
      64         185 :     {
      65         185 :         auto _center = cylFree.getCenter();
      66         185 :         auto _amplit = cylFree.getAmplitude();
      67         185 :         auto _radius = cylFree.getRadius();
      68         185 :         auto _length = cylFree.getLength();
      69         185 :         auto _eulers = cylFree.getEulerAngels();
      70             : 
      71         185 :         return format_to(ctx.out(),
      72         185 :                          "CylinderFree with amplitude {}, Center ({},{},{}) ,radius ({}), "
      73         185 :                          "length "
      74         185 :                          "{} , euler angels ({},{},{}) ",
      75         185 :                          _amplit, _center[elsa::phantoms::INDEX_X],
      76         185 :                          _center[elsa::phantoms::INDEX_Y], _center[elsa::phantoms::INDEX_Z],
      77         185 :                          _radius, _length, _eulers[elsa::phantoms::INDEX_X],
      78         185 :                          _eulers[elsa::phantoms::INDEX_Y], _eulers[elsa::phantoms::INDEX_Z]);
      79         185 :     }
      80             : };

Generated by: LCOV version 1.14