ImFusion SDK 4.3
Functional Class Referenceabstract

#include <ImFusion/CT/Solver/Functional.h>

Abstract functional interface for optimization problems. More...

+ Inheritance diagram for Functional:

Detailed Description

Abstract functional interface for optimization problems.

Represents a (sufficiently smooth) functional on images, i.e. a (sufficiently smooth) function which takes as input images/volumes and returns a real value as output. The prototypical example of such a functional is the sum of squares of intensities in the image/volume. Functionals in CT typically arise in connection to linear residuals, i.e. if \( f\) is a functional, the derived quantity \( f( Ax - b) \) measures something like the residual of a CT reconstruction \( x \) given projections \( b \). If a linear residual is provided to this class, we pull-back values, gradients and the hessians by this residual, i.e. we provide the result for the functional \( x \mapsto f(Ax - b)\).

Public Types

using ExprBase = ImageMath::ExprBase
 

Public Member Functions

 Functional (std::unique_ptr< LinearResidual > residual, bool hessianRequiresResidualEval=true)
 Constructor with residual. This residual can be nullptr, which is taken as shorthand for the identity.
 
 Functional (std::unique_ptr< LinearOperator > A, SharedImageSet *b, bool hessianRequiresResidualEval=true)
 Constructor which implicitly constructs a residual that owns the LinearOperator.
 
virtual ~Functional ()=0
 Destructor.
 
float eval (const SharedImageSet &in) const
 Evaluates the functional \(f(in)\).
 
Status gradient (const SharedImageSet &in, SharedImageSet &out, const Selection *sel=nullptr, const ExprBase *exprOut=nullptr) const
 Evaluates the gradient \(\nabla f(in)\).
 
template<typename ImplName>
Status gradient (const SharedImageSet &in, SharedImageSet &out, const Selection *sel, const ImageMath::ExprBaseTpl< ImplName > *exprOut)
 Convenience function which wraps exprOut in sharedPolyWrapper.
 
std::unique_ptr< LinearOperatorhessian (const SharedImageSet &in) const
 Evaluates the hessian \(H_f(in)\).
 
const LinearResidualresidual () const
 Const getter for m_residual.
 
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Protected Member Functions

virtual float evalImpl (const SharedImageSet &in) const =0
 Evaluation of this functional (without residual)
 
virtual Status gradientImpl (const SharedImageSet &in, SharedImageSet &out) const =0
 Gradient of this functional (without residual). Should be selection aware.
 
virtual std::unique_ptr< LinearOperatorhessianImpl (const SharedImageSet &in) const =0
 Hessian of this functional (without residual)
 

Protected Attributes

std::unique_ptr< LinearResidualm_residual
 optional residual.
 
const bool m_hessianRequiresResidualEval = true
 if set to false the result of hessianImpl is expected not to depend on the input
 
detail::SparseSharedImageSet m_residualTempSparseSharedImageSet
 Sparse tmp image.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Additional Inherited Members

- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 

Member Function Documentation

◆ eval()

float eval ( const SharedImageSet & in) const

Evaluates the functional \(f(in)\).

Parameters
[in]inSharedImageSet at which the functional is evaluated.
Returns
value of the function at the given value.

◆ gradient()

Status gradient ( const SharedImageSet & in,
SharedImageSet & out,
const Selection * sel = nullptr,
const ExprBase * exprOut = nullptr ) const

Evaluates the gradient \(\nabla f(in)\).

Parameters
[in]inSharedImageSet at which the gradient is evaluated.
[out]outgradient at the given value.
[in]selSelection on the range of the residual. Can be used for evaluating subsets in case a residual with an operator is set. Otherwise sel MUST be nullptr.
[in]exprOutIf set, this will be applied to the result of the gradient. This can be used to implicitly perform a gradient step for instance.

◆ hessian()

std::unique_ptr< LinearOperator > hessian ( const SharedImageSet & in) const

Evaluates the hessian \(H_f(in)\).

Parameters
[in]inSharedImageSet at which the hessian is evaluated.
Returns
the Hessian as a linear operator, or nullptr if it is the identity.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.

◆ evalImpl()

virtual float evalImpl ( const SharedImageSet & in) const
protectedpure virtual

Evaluation of this functional (without residual)

Implemented in AnisotropicTV, IsotropicTV, L2Pow2, and WeightedL2Pow2< OperandT >.

◆ gradientImpl()

virtual Status gradientImpl ( const SharedImageSet & in,
SharedImageSet & out ) const
protectedpure virtual

Gradient of this functional (without residual). Should be selection aware.

Implemented in AnisotropicTV, IsotropicTV, L2Pow2, and WeightedL2Pow2< OperandT >.

◆ hessianImpl()

virtual std::unique_ptr< LinearOperator > hessianImpl ( const SharedImageSet & in) const
protectedpure virtual

Hessian of this functional (without residual)

Implemented in AnisotropicTV, IsotropicTV, L2Pow2, and WeightedL2Pow2< OperandT >.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close