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

Generated by: LCOV version 1.14