LCOV - code coverage report
Current view: top level - projectors - BoundingBox.cpp (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 0 26 0.0 %
Date: 2022-08-04 03:43:28 Functions: 0 6 0.0 %

          Line data    Source code
       1             : #include "BoundingBox.h"
       2             : 
       3             : #include <stdexcept>
       4             : 
       5             : #include "Error.h"
       6             : 
       7             : namespace elsa
       8             : {
       9           0 :     BoundingBox::BoundingBox(const IndexVector_t& volumeDimensions) : _dim(volumeDimensions.size())
      10             :     {
      11             :         // sanity check
      12           0 :         if (volumeDimensions.size() < 2 || volumeDimensions.size() > 3)
      13           0 :             throw InvalidArgumentError("BoundingBox: can only deal with the 2d/3d cases");
      14             : 
      15           0 :         _min.setZero();
      16           0 :         _max = volumeDimensions.template cast<real_t>();
      17             : 
      18           0 :         _voxelCoordToIndexVector[0] = 1;
      19           0 :         _voxelCoordToIndexVector[1] = volumeDimensions[1];
      20           0 :         if (_dim == 3)
      21           0 :             _voxelCoordToIndexVector[2] = volumeDimensions[2] * volumeDimensions[2];
      22           0 :     }
      23             : 
      24           0 :     RealVector_t BoundingBox::center() const { return (_max - _min).array() / 2; }
      25             : 
      26           0 :     void BoundingBox::recomputeBounds()
      27             :     {
      28           0 :         RealVector_t min = _min.cwiseMin(_max);
      29           0 :         RealVector_t max = _min.cwiseMax(_max);
      30             : 
      31           0 :         _min = min;
      32           0 :         _max = max;
      33           0 :     }
      34             : 
      35           0 :     bool operator==(const BoundingBox& box1, const BoundingBox& box2)
      36             :     {
      37           0 :         return box1._min == box2._min && box1._max == box2._max;
      38             :     }
      39             : 
      40           0 :     bool operator!=(const BoundingBox& box1, const BoundingBox& box2) { return !(box1 == box2); }
      41             : 
      42           0 :     std::ostream& operator<<(std::ostream& stream, const BoundingBox& aabb)
      43             :     {
      44           0 :         Eigen::IOFormat fmt(4, 0, ", ", ", ", "", "", "[", "]");
      45           0 :         stream << "AABB { min = " << aabb._min.format(fmt) << ", max = " << aabb._max.format(fmt)
      46           0 :                << " }";
      47             : 
      48           0 :         return stream;
      49           0 :     }
      50             : 
      51             : } // namespace elsa

Generated by: LCOV version 1.14