LCOV - code coverage report
Current view: top level - elsa/generators - PhantomDefines.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 9 9 100.0 %
Date: 2024-05-16 04:22:26 Functions: 3 4 75.0 %

          Line data    Source code
       1             : 
       2             : #pragma once
       3             : #include "elsaDefines.h"
       4             : #include "VolumeDescriptor.h"
       5             : #include "DataContainer.h"
       6             : #include "Logger.h"
       7             : 
       8             : namespace elsa::phantoms
       9             : {
      10             : 
      11             :     /*
      12             :      *  Constant for this 3 dimensional usecase.
      13             :      *  Not in header to keep the namespace clean.
      14             :      */
      15             : 
      16             :     // INDEX of Width vector
      17             :     static const int INDEX_A{0};
      18             :     static const int INDEX_B{1};
      19             :     static const int INDEX_C{2};
      20             : 
      21             :     // INDEX of Coordinates
      22             :     static const int INDEX_X{0};
      23             :     static const int INDEX_Y{1};
      24             :     static const int INDEX_Z{2};
      25             : 
      26             :     // INDEX for eulers coordinates
      27             :     static const int INDEX_PHI{0};
      28             :     static const int INDEX_THETA{1};
      29             :     static const int INDEX_PSI{2};
      30             : 
      31             :     // Fix 3d vector
      32             :     using Vec3i = Eigen::Matrix<index_t, 3, 1>;
      33             : 
      34             :     // Fix 3d vector
      35             :     template <typename data_t = double,
      36             :               typename = std::enable_if_t<std::is_floating_point<data_t>::value>>
      37             :     using Vec3X = Eigen::Matrix<data_t, 3, 1>;
      38             : 
      39             :     template <typename data_t>
      40             :     void fillRotationMatrix(Vec3X<data_t> eulers, Eigen::Matrix<data_t, 3, 3>& rot);
      41             : 
      42             :     /**
      43             :      * @brief orientation of the cylinder along one of the axis
      44             :      */
      45             :     enum class Orientation { X_AXIS = 0, Y_AXIS = 1, Z_AXIS = 2 };
      46             : 
      47             :     std::string getString(Orientation o);
      48             : 
      49             :     enum class Blending { OVERWRITE = 0, ADDITION = 1 };
      50             : 
      51             :     template <Blending b, typename data_t>
      52             :     inline constexpr void blend(DataContainer<data_t>& dc, index_t index, data_t amplit)
      53      530741 :     {
      54             :         // TODO maybe use `data_t& d` instead of `DataContainer<data_t>$ dc`
      55      530741 :         if constexpr (b == Blending::ADDITION) {
      56      390795 :             dc[index] += amplit;
      57      390795 :         } else if constexpr (b == Blending::OVERWRITE) {
      58      390795 :             dc[index] = amplit;
      59      390795 :         } else {
      60      530741 :             throw Error("Wrong Blending");
      61      530741 :         }
      62      530741 :     }
      63             : 
      64             : } // namespace elsa::phantoms

Generated by: LCOV version 1.14