LCOV - code coverage report
Current view: top level - elsa/functionals - AnisotropicTV.cpp (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 20 21 95.2 %
Date: 2024-05-16 04:22:26 Functions: 24 24 100.0 %

          Line data    Source code
       1             : #include "AnisotropicTV.h"
       2             : #include "FiniteDifferences.h"
       3             : 
       4             : namespace elsa
       5             : {
       6             :     template <typename data_t>
       7             :     AnisotropicTV<data_t>::AnisotropicTV(const DataDescriptor& domainDescriptor)
       8             :         : Functional<data_t>(domainDescriptor)
       9          64 :     {
      10          64 :     }
      11             : 
      12             :     template <typename data_t>
      13             :     data_t AnisotropicTV<data_t>::evaluateImpl(const DataContainer<data_t>& Rx) const
      14          16 :     {
      15          16 :         FiniteDifferences<data_t> fdOperator{Rx.getDataDescriptor()};
      16          16 :         auto gradient = fdOperator.apply(Rx);
      17          16 :         return gradient.l1Norm();
      18          16 :     }
      19             : 
      20             :     template <typename data_t>
      21             :     void AnisotropicTV<data_t>::getGradientImpl(const DataContainer<data_t>&,
      22             :                                                 DataContainer<data_t>&) const
      23          16 :     {
      24          16 :         throw LogicError("IsotropicTV: not differentiable, so no gradient! (busted!)");
      25          16 :     }
      26             :     template <typename data_t>
      27             :     LinearOperator<data_t> AnisotropicTV<data_t>::getHessianImpl(const DataContainer<data_t>&) const
      28          16 :     {
      29          16 :         throw LogicError("IsotropicTV: not differentiable, so no hessian! (busted!)");
      30          16 :     }
      31             : 
      32             :     template <typename data_t>
      33             :     AnisotropicTV<data_t>* AnisotropicTV<data_t>::cloneImpl() const
      34          16 :     {
      35          16 :         return new AnisotropicTV(this->getDomainDescriptor());
      36          16 :     }
      37             :     template <typename data_t>
      38             :     bool AnisotropicTV<data_t>::isEqual(const Functional<data_t>& other) const
      39          16 :     {
      40          16 :         if (!Functional<data_t>::isEqual(other))
      41           0 :             return false;
      42             : 
      43          16 :         return is<AnisotropicTV>(other);
      44          16 :     }
      45             : 
      46             :     // ------------------------------------------
      47             :     // explicit template instantiation
      48             :     template class AnisotropicTV<float>;
      49             :     template class AnisotropicTV<double>;
      50             :     template class AnisotropicTV<complex<float>>;
      51             :     template class AnisotropicTV<complex<double>>;
      52             : 
      53             : } // namespace elsa

Generated by: LCOV version 1.14