ImFusion SDK 4.3
LinearOperator Class Referenceabstract

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

Abstract linear operator interface with adjoint. More...

+ Inheritance diagram for LinearOperator:

Detailed Description

Abstract linear operator interface with adjoint.

Represents a linear operator A that can be written as a matrix with both forward and adjoint operations. Forms the basis for projection and backprojection operators in tomographic reconstruction. Supports large-scale implementations with on-the-fly execution to avoid storing matrices in memory. May run modified versions of input expressions to set interpolation modes and other parameters.

Note
There are practically no use-cases where a user should derive directly from this class. This is because this class provides both an ImageMath and a SharedImageSet input version of its main functions, and each of these can be obtained from the other. The two template specializations of the LinearOperatorEvalInputExpr template provide for each of the cases where only one implementation is provided by a user.

Public Types

using ExprBase = ImageMath::ExprBase
 
- Public Types inherited from Block
using Input = DataList
 
using Output = DataList
 

Public Member Functions

 LinearOperator (const SharedImageSet *domainRef, const SharedImageSet *rangeRef=nullptr)
 Constructor with optional references for the domain and codomain (i.e. range) of the operator.
 
 ~LinearOperator () override=0
 Destructor.
 
virtual Status apply (const ExprBase &exprIn, const SharedImageSet &in, SharedImageSet &out, const ExprBase *exprOut=nullptr) const =0
 Applies a linear operator \(A\), optionally pre/post-composing with an ImageMath expression.
 
virtual Status apply (const SharedImageSet &in, SharedImageSet &out, const ExprBase *exprOut=nullptr) const =0
 
template<typename ImplType, typename ImplTypeOut>
Status apply (const ImageMath::ExprBaseTpl< ImplType > &exprIn, const SharedImageSet &in, SharedImageSet &out, const ImageMath::ExprBaseTpl< ImplTypeOut > *exprOut=nullptr) const
 
template<typename ImplType>
Status apply (const ImageMath::ExprBaseTpl< ImplType > &exprIn, const SharedImageSet &in, SharedImageSet &out, const ExprBase *exprOut=nullptr) const
 
virtual Status applyAdjoint (const ExprBase &exprIn, const SharedImageSet &in, SharedImageSet &out, const ExprBase *exprOut=nullptr) const =0
 Applies the adjoint of a linear operator \(A\), optionally pre/post-composing with an ImageMath expression.
 
virtual Status applyAdjoint (const SharedImageSet &in, SharedImageSet &out, const ExprBase *exprOut=nullptr) const =0
 
template<typename ImplType, typename ImplTypeOut>
Status applyAdjoint (const ImageMath::ExprBaseTpl< ImplType > &exprIn, const SharedImageSet &in, SharedImageSet &out, const ImageMath::ExprBaseTpl< ImplTypeOut > *exprOut=nullptr) const
 
template<typename ImplType>
Status applyAdjoint (const ImageMath::ExprBaseTpl< ImplType > &exprIn, const SharedImageSet &in, SharedImageSet &out, const ExprBase *exprOut=nullptr) const
 
Status runBlock (Input &input, Output &output) override
 Applies the operator to the first element of input.
 
virtual std::unique_ptr< LinearOperatorclone () const =0
 Factory method.
 
std::unique_ptr< LinearOperatorAdjointWrapperadjoint () const
 Creates an adjoint operator of this.
 
const SharedImageSetdomainRef () const
 Getter for m_domainRef, can be nullptr if this is implicitly defined by the operator.
 
const SharedImageSetrangeRef () const
 Getter for m_rangeRef, can be nullptr if this is implicitly defined by the operator.
 
virtual std::unique_ptr< SharedImageSetcreateDomainSis () const
 Creates a SharedImageSet which is in the range of the operator.
 
virtual std::unique_ptr< SharedImageSetcreateRangeSis () const
 Creates a SharedImageSet which is in the range of the operator.
 
Eigen::MatrixXf extractApplyMatrix () const
 Extracts a dense matrix representing this operator.
 
Eigen::MatrixXf extractApplyAdjointMatrix () const
 Extracts a dense matrix representing this operator.
 
- Public Member Functions inherited from Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
 
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
 
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 Attributes

const SharedImageSetm_domainRef = nullptr
 
const SharedImageSetm_rangeRef = nullptr
 
- 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

◆ apply() [1/4]

virtual Status apply ( const ExprBase & exprIn,
const SharedImageSet & in,
SharedImageSet & out,
const ExprBase * exprOut = nullptr ) const
pure virtual

Applies a linear operator \(A\), optionally pre/post-composing with an ImageMath expression.

Computes \(exprOut(A * exprIn(in))\).

As \(A\) is linear, it can in principle be represented as a matrix. However we aim at large-scale implementations meaning that the corresponding matrix is typically to large to be kept in memory. We therefore only require an implementation of the matrix-vector product as opposed to an explicit representation.

Parameters
[in]exprInExpression to which the linear operator is applied
[in]inReference input to define the domain of the operator (this is neccessary as exprIn could be scalar).
[in,out]outIs overwritten with result of \(exprOut(A * exprIn(in))\).
[in]exprOutIf set, this expression will be applied to the results after the operator was applied. If not set, treated as identity. out must contain ImageMath::Variable which will be substituted with the result of \(A * exprIn(in)\). In principle, this expression may contain out even if the values of out are then overwritten by this function. However, an operator may split up \(A\) into blocks, in which case the implemented LinearOperator must use checkOutExprAndCreateUpdateExprAndTmpOut to accumulate the result correctly.
Note
This method must be selection aware.

Implemented in ConvolutionFilter, DiagonalOperatorTpl< OperandT >, GlCBCTProjector, IdentityOperator, LinearOperatorAdjointWrapper, LinearOperatorEvalInputExpr< false >, LinearOperatorEvalInputExpr< true >, and LinearOperatorTreeNode.

◆ apply() [2/4]

virtual Status apply ( const SharedImageSet & in,
SharedImageSet & out,
const ExprBase * exprOut = nullptr ) const
pure virtual
See also
LinearOperator::apply(const ExprBase&, SharedImageSet&, SharedImageSet&, const ExprBase*) with the input expression set to the identity applied to in.

Implemented in ConvolutionFilter, FiniteDifferences, LaplaceOperator, LinearOperatorAdjointWrapper, LinearOperatorEvalInputExpr< false >, LinearOperatorEvalInputExpr< true >, and MatrixLinearOperator.

◆ apply() [3/4]

template<typename ImplType, typename ImplTypeOut>
Status apply ( const ImageMath::ExprBaseTpl< ImplType > & exprIn,
const SharedImageSet & in,
SharedImageSet & out,
const ImageMath::ExprBaseTpl< ImplTypeOut > * exprOut = nullptr ) const
inline
See also
LinearOperator::apply(const ExprBase&, SharedImageSet&, SharedImageSet&, const ExprBase*) with the input expression

◆ apply() [4/4]

template<typename ImplType>
Status apply ( const ImageMath::ExprBaseTpl< ImplType > & exprIn,
const SharedImageSet & in,
SharedImageSet & out,
const ExprBase * exprOut = nullptr ) const
inline
See also
LinearOperator::apply(const ExprBase&, SharedImageSet&, SharedImageSet&, const ExprBase*) with the input expression

◆ applyAdjoint() [1/3]

virtual Status applyAdjoint ( const ExprBase & exprIn,
const SharedImageSet & in,
SharedImageSet & out,
const ExprBase * exprOut = nullptr ) const
pure virtual

Applies the adjoint of a linear operator \(A\), optionally pre/post-composing with an ImageMath expression.

Computes \(exprOut(A^\top * exprIn(in))\).

Parameters
[in]exprInExpression to which the adjoint operator is applied.
[in]inReference input defining the domain of the operator (this is neccessary, as exprIn can be a scalar expression).
[in,out]outIs overwritten with result of \(exprOut(A * exprIn(in))\).
[in]exprOutIf set, this expression will be applied to the results after the operator was applied. If not set, treated as identity. out is expected to contain ImageMath::Variable which will be substituted with the result of \(A * exprIn(in)\). In principle, this expression may contain out even though out is overwritten by this function. However, an operator may split up \(A\) into blocks, in which case the implemented LinearOperator must use checkOutExprAndCreateUpdateExprAndTmpOut to accumulate the result correctly.
Note
This method must be selection aware.

Implemented in ConvolutionFilter, DiagonalOperatorTpl< OperandT >, GlCBCTProjector, IdentityOperator, LinearOperatorAdjointWrapper, LinearOperatorEvalInputExpr< false >, LinearOperatorEvalInputExpr< true >, and LinearOperatorTreeNode.

◆ applyAdjoint() [2/3]

virtual Status applyAdjoint ( const SharedImageSet & in,
SharedImageSet & out,
const ExprBase * exprOut = nullptr ) const
pure virtual
See also
LinearOperator::applyAdjoint(const ExprBase&, SharedImageSet&, SharedImageSet&, const ExprBase*) with the input expression set to the identity applied to in.

Implemented in FiniteDifferences, LaplaceOperator, LinearOperatorAdjointWrapper, LinearOperatorEvalInputExpr< false >, LinearOperatorEvalInputExpr< true >, and MatrixLinearOperator.

◆ applyAdjoint() [3/3]

template<typename ImplType, typename ImplTypeOut>
Status applyAdjoint ( const ImageMath::ExprBaseTpl< ImplType > & exprIn,
const SharedImageSet & in,
SharedImageSet & out,
const ImageMath::ExprBaseTpl< ImplTypeOut > * exprOut = nullptr ) const
inline
See also
LinearOperator::apply(const ExprBase&, SharedImageSet&, SharedImageSet&, const ExprBase*) with the input expression

◆ runBlock()

Status runBlock ( Input & input,
Output & output )
overridevirtual

Applies the operator to the first element of input.

Reimplemented from Block.

◆ clone()

◆ createDomainSis()

virtual std::unique_ptr< SharedImageSet > createDomainSis ( ) const
virtual

Creates a SharedImageSet which is in the range of the operator.

Reimplemented in LinearOperatorTreeNode.

◆ createRangeSis()

virtual std::unique_ptr< SharedImageSet > createRangeSis ( ) const
virtual

Creates a SharedImageSet which is in the range of the operator.

Reimplemented in FiniteDifferences, and LinearOperatorTreeNode.

◆ extractApplyMatrix()

Eigen::MatrixXf extractApplyMatrix ( ) const

Extracts a dense matrix representing this operator.

Note
The method executes the operator on each single pixel in the domain. It is only advised for small operators. Also be aware of the space requirement.

◆ extractApplyAdjointMatrix()

Eigen::MatrixXf extractApplyAdjointMatrix ( ) const

Extracts a dense matrix representing this operator.

Note
The method executes the adjoint of this operator on each single pixel in the domain. It is only advised for small operators. Also be aware of the space requirement.

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