Commit 41d5b1d2 authored by Andi Braimllari's avatar Andi Braimllari

Documentation addition and improvement

parent e459aa55
Pipeline #368626 passed with stages
in 22 minutes and 4 seconds
......@@ -624,6 +624,15 @@ namespace elsa
using SinogramData2D = SinogramData<2>; ///< 2D sinogram data alias for 2D geometry
using SinogramData3D = SinogramData<3>; ///< 3D sinogram data alias for 3D geometry
/**
* @brief Strong type for a single value of type data_t used in proximity operators.
* Comparison, addition, subtraction are overridden by utilizing the private member
* _threshold.
* N.B. The threshold value is expected to be strictly greater than 0, otherwise an
* exception is thrown
*
* @tparam data_t data type of the threshold
*/
template <typename data_t = real_t>
class Threshold
{
......@@ -635,12 +644,16 @@ namespace elsa
}
}
/// return computed comparison
auto operator<(const data_t t) const -> bool { return this->_threshold < t; };
/// return computed comparison
auto operator>(const data_t t) const -> bool { return this->_threshold > t; };
/// return computed subtraction
auto operator-(const data_t t) const -> data_t { return this->_threshold - t; };
/// return computed addition
auto operator+(const data_t t) const -> data_t { return this->_threshold + t; };
private:
......
......@@ -2,10 +2,26 @@
namespace elsa
{
/**
* \brief Class representing the proximity operator of the l1 norm
*
* \tparam data_t data type for the values of the operator, defaulting to real_t
*
* This class represents the soft thresholding operator, expressed by its apply method
* through the function i.e. \f$ prox(v) = v·1_{\{|v| > t\}}. \f$
*
* References:
* http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/xlghtmlnode93.html
*/
template <typename data_t = real_t>
class HardThresholding : public ProximityOperator<data_t>
{
public:
/**
* \brief Construct a HardThresholding operator from the given DataDescriptor
*
* \param[in] descriptor DataDescriptor describing the operator values
*/
HardThresholding(const DataDescriptor& descriptor);
/// default destructor
......@@ -13,7 +29,7 @@ namespace elsa
protected:
/**
* \brief apply the proximity operator of the 0 norm to an element in the operator's domain
* \brief apply the proximity operator of the l0 norm to an element in the operator's domain
*
* \param[in] x input DataContainer
* \param[in] t input Threshold
......
......@@ -11,11 +11,12 @@ namespace elsa
/**
* \brief Base class representing a proximity operator prox.
*
* \tparam data_t data type for the domain and range of the operator, defaulting to real_t
* \tparam data_t data type for the values of the operator, defaulting to real_t
*
* This class represents a proximity operator prox, expressed through its apply methods,
* which implement the proximity operator of f with penalty ρ i.e.
* prox<SUB>f,ρ</SUB>(v) = argmin<SUB>x</SUB>(f(x) + (ρ/2)(||x - v||<SUP>2</SUP><SUB>2</SUB>)).
* which implement the proximity operator of f with penalty r i.e.
* \f$ prox_{f,r}(v) = argmin_x(f(x) + (r/2)·(\| Ax - b \|^2_2)). \f$
*
* Concrete implementations of proximity operators will derive from this class and override the
* applyImpl method.
*/
......@@ -23,14 +24,24 @@ namespace elsa
class ProximityOperator : public Cloneable<ProximityOperator<data_t>>
{
public:
/// delete no-args constructor to prevent creation of an object without a DataDescriptor
ProximityOperator() = delete;
/**
* \brief Override to construct an actual proximity operator for one of the derived classes
* from the given DataDescriptor descriptor
*
* \param[in] descriptor DataDescriptor describing the operator values
*/
ProximityOperator(const DataDescriptor& descriptor);
/// delete copy construction
ProximityOperator(const ProximityOperator<data_t>&) = delete;
/// default destructor
~ProximityOperator() override = default;
/// return the DataDescriptor
auto getRangeDescriptor() const -> const DataDescriptor&;
/**
......@@ -61,6 +72,7 @@ namespace elsa
void apply(const DataContainer<data_t>& v, geometry::Threshold<data_t> t,
DataContainer<data_t>& prox) const;
/// delete implicitly declared copy assignment to prevent copy assignment
auto operator=(const ProximityOperator&) -> ProximityOperator& = delete;
protected:
......@@ -70,6 +82,7 @@ namespace elsa
virtual void applyImpl(const DataContainer<data_t>& v, geometry::Threshold<data_t> t,
DataContainer<data_t>& prox) const = 0;
/// overridden comparison method based on the DataDescriptor
auto isEqual(const ProximityOperator<data_t>& other) const -> bool override;
};
} // namespace elsa
......@@ -2,10 +2,26 @@
namespace elsa
{
/**
* \brief Class representing the proximity operator of the l1 norm
*
* \tparam data_t data type for the values of the operator, defaulting to real_t
*
* This class represents the soft thresholding operator, expressed by its apply method
* through the function i.e. \f$ prox(v) = sign(v)·(|v| - t)_+. \f$
*
* References:
* http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/xlghtmlnode93.html
*/
template <typename data_t = real_t>
class SoftThresholding : public ProximityOperator<data_t>
{
public:
/**
* \brief Construct a SoftThresholding operator from the given DataDescriptor
*
* \param[in] descriptor DataDescriptor describing the operator values
*/
SoftThresholding(const DataDescriptor& descriptor);
/// default destructor
......@@ -13,7 +29,7 @@ namespace elsa
protected:
/**
* \brief apply the proximity operator of the 1 norm to an element in the operator's domain
* \brief apply the proximity operator of the l1 norm to an element in the operator's domain
*
* \param[in] x input DataContainer
* \param[in] t input Threshold
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment