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

          Line data    Source code
       1             : #include "SoftThresholding.h"
       2             : #include "Error.h"
       3             : #include "TypeCasts.hpp"
       4             : 
       5             : namespace elsa
       6             : {
       7             :     template <typename data_t>
       8           0 :     SoftThresholding<data_t>::SoftThresholding(const DataDescriptor& descriptor)
       9           0 :         : ProximityOperator<data_t>(descriptor)
      10             :     {
      11           0 :     }
      12             : 
      13             :     template <typename data_t>
      14           0 :     void SoftThresholding<data_t>::applyImpl(const DataContainer<data_t>& v,
      15             :                                              geometry::Threshold<data_t> t,
      16             :                                              DataContainer<data_t>& prox) const
      17             :     {
      18           0 :         if (v.getSize() != prox.getSize()) {
      19           0 :             throw LogicError("SoftThresholding: sizes of v and prox must match");
      20             :         }
      21             : 
      22           0 :         auto vIter = v.begin();
      23           0 :         auto proxIter = prox.begin();
      24             : 
      25           0 :         for (; vIter != v.end() && proxIter != prox.end(); vIter++, proxIter++) {
      26           0 :             if (*vIter > t) {
      27           0 :                 *proxIter = *vIter - t;
      28           0 :             } else if (*vIter < -t) {
      29           0 :                 *proxIter = *vIter + t;
      30             :             } else {
      31           0 :                 *proxIter = 0;
      32             :             }
      33             :         }
      34           0 :     }
      35             : 
      36             :     template <typename data_t>
      37           0 :     auto SoftThresholding<data_t>::cloneImpl() const -> SoftThresholding<data_t>*
      38             :     {
      39           0 :         return new SoftThresholding<data_t>(this->getRangeDescriptor());
      40             :     }
      41             : 
      42             :     template <typename data_t>
      43           0 :     auto SoftThresholding<data_t>::isEqual(const ProximityOperator<data_t>& other) const -> bool
      44             :     {
      45           0 :         if (!ProximityOperator<data_t>::isEqual(other)) {
      46           0 :             return false;
      47             :         }
      48             : 
      49           0 :         auto otherDerived = downcast_safe<SoftThresholding<data_t>>(&other);
      50             : 
      51           0 :         return static_cast<bool>(otherDerived);
      52             :     }
      53             : 
      54             :     // ------------------------------------------
      55             :     // explicit template instantiation
      56             :     template class SoftThresholding<float>;
      57             :     template class SoftThresholding<double>;
      58             : } // namespace elsa

Generated by: LCOV version 1.14