LCOV - code coverage report
Current view: top level - elsa/generators - Cylinder.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 19 19 100.0 %
Date: 2024-05-16 04:22:26 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 Cylinder
       9             :     {
      10             : 
      11             :     private:
      12             :         Orientation _orientation;
      13             :         data_t _amplit;
      14             :         Vec3i _center;
      15             :         data_t _radius;
      16             :         data_t _length;
      17             : 
      18             :     public:
      19             :         /**
      20             :          * @param o Orientation along X_AXIS, Y_AXIS or Z_AXIS
      21             :          * @param amlpit amplitude wich is added to the voxel on rasterization
      22             :          * @param center center of the object
      23             :          * @param radius radius of the circle in the cross section
      24             :          * @param length the length from one side throught the center to the other side
      25             :          *
      26             :          */
      27             :         Cylinder(Orientation o, data_t amplit, Vec3i center, data_t radius, data_t length);
      28             : 
      29             :         /**
      30             :          * @brief returns the orientation to color the voxel
      31             :          */
      32          92 :         Orientation getOrientation() const { return _orientation; };
      33             :         /**
      34             :          * @brief returns the amplitude to color the voxel
      35             :          */
      36          92 :         const data_t getAmplitude() const { return _amplit; };
      37             :         /**
      38             :          * @brief returns the center of the Cylinder
      39             :          */
      40          92 :         const Vec3i& getCenter() const { return _center; };
      41             :         /**
      42             :          * @brief returns the center of the Cylinder
      43             :          */
      44         141 :         const data_t getRadius() const { return _radius; };
      45             :         /**
      46             :          * @brief returns the length of the Cylinder
      47             :          */
      48          92 :         const data_t getLength() const { return _length; };
      49             :     };
      50             : 
      51             :     /**
      52             :      * @brief Rasterizes the given Cylinder in the given data container. Wrapper around
      53             :      * EllipCylinder
      54             :      */
      55             :     template <Blending b, typename data_t>
      56             :     void rasterize(Cylinder<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::Cylinder<data_t>> : fmt::formatter<std::string> {
      62             :     auto format(elsa::phantoms::Cylinder<data_t> ell, format_context& ctx) -> decltype(ctx.out())
      63          43 :     {
      64          43 :         auto _center = ell.getCenter();
      65          43 :         auto _amplit = ell.getAmplitude();
      66          43 :         auto _radius = ell.getRadius();
      67          43 :         auto _length = ell.getLength();
      68          43 :         auto _orientation = ell.getOrientation();
      69             : 
      70          43 :         return format_to(ctx.out(),
      71          43 :                          "Cylinder with amplitude {}, Center ({},{},{}) ,radius ({}), "
      72          43 :                          "length "
      73          43 :                          "{} along orientation {} ",
      74          43 :                          _amplit, _center[elsa::phantoms::INDEX_X],
      75          43 :                          _center[elsa::phantoms::INDEX_Y], _center[elsa::phantoms::INDEX_Z],
      76          43 :                          _radius, _length, getString(_orientation));
      77          43 :     }
      78             : };

Generated by: LCOV version 1.14