ImFusion SDK 4.3
ImFusion::CT::detail Namespace Reference

Internal implementation details for CT utilities. More...

Detailed Description

Internal implementation details for CT utilities.

Classes

class  Creator
 Base class for factory "create" functionality. More...
 
class  CreatorImpl
 Wrapper around a pair of std::functions used for constructing an item Derived from Base. More...
 
class  GlobalTransformationGeneratorBase
 Base class for global transformation generators. More...
 
class  PerFrameTransformationGeneratorBase
 Base class for per-frame transformation generators. More...
 
class  RelativeGeneratorMixin
 Template mixin for relative geometry generators. More...
 
struct  RelativeTransformationSetupWrapperBase
 Base class for RelativeTransformationSetupWrapper which requires customer move and copy semantics due to signal connections it creates. More...
 
struct  SparseSharedImageSet
 Representation of a SharedImageSet with N images with the same descriptor of which only M (<N) are used at the same time. More...
 
class  TrivialConfigurable
 Helper class for storing arbitrary Properties in a Configurable instance. More...
 

Functions

std::unique_ptr< SharedImageSetcloneContainer (const SharedImageSet &sis, std::optional< PixelType > pixelType, int channels=0)
 Creates a copy of sis without cloning the image content.
 
SparseSharedImageSet createSparseSharedImageSetContainer (const SharedImageSet &sis, int numImgs, std::optional< PixelType > pixelType, int channels=0)
 Creates a ring buffer SharedImageSet with effectively numImgs SharedImages but used in a ring fashion such that the SharedImageSet has as many frames as sis.
 
void updateSparseSharedImageSet (const SparseSharedImageSet &buffer)
 Updates buffer such that the M images in the SparseSharedImageSet are moved to the currently selected images.
 
bool hasLinearGradient (const OptimizationProblem &problem)
 Returns true if the problem has a linear gradient.
 
bool isIsotropicTV (const OptimizationProblem &problem)
 Returns true if the problem is a Least-Squares problem with an Isotropic TV regularization.
 
std::pair< std::shared_ptr< ImageMath::ExprBase >, std::unique_ptr< SharedImageSet > > checkOutExprAndCreateUpdateExprAndTmpOut (const ImageMath::ExprBase *exprOut, SharedImageSet &out, int varChannels, bool forceRequired=false)
 The function checkOutExprAndCreateUpdateExprAndTmpOut is intended to correctly deal in apply() and applyAdjoint() with the case where the outExpr parameter contains the parameter out.
 
auto scopedSelection (const SharedImageSet *sis, const Selection &sel, bool silentClear, bool silentSet)
 The resulting ScopeGuard sets the selection to the provided one, and resets it on destruction.
 
auto scopedSelection (const SharedImageSet *sis, bool silentClear)
 The resulting ScopeGuard sets the selection to one present at construction at destruction.
 
int numSelected (const SharedImageSet *sis, Selection::NonePolicy pol=Selection::NonePolicy::All)
 

Function Documentation

◆ cloneContainer()

std::unique_ptr< SharedImageSet > cloneContainer ( const SharedImageSet & sis,
std::optional< PixelType > pixelType,
int channels = 0 )

Creates a copy of sis without cloning the image content.

Parameters
[in]sisReference image
[in]pixelTypeImage type
[in]channelsIf bigger than 0 the number of channels in the reference will be replaced with this value

◆ createSparseSharedImageSetContainer()

SparseSharedImageSet createSparseSharedImageSetContainer ( const SharedImageSet & sis,
int numImgs,
std::optional< PixelType > pixelType,
int channels = 0 )

Creates a ring buffer SharedImageSet with effectively numImgs SharedImages but used in a ring fashion such that the SharedImageSet has as many frames as sis.

Parameters
[in]sisReference image
[in]pixelTypeImage type
[in]numImgsNumber of active images (M in SparseSharedImageSet)
[in]channelsIf bigger than 0 the number of channels in the reference will be replaced with this value

◆ updateSparseSharedImageSet()

void updateSparseSharedImageSet ( const SparseSharedImageSet & buffer)

Updates buffer such that the M images in the SparseSharedImageSet are moved to the currently selected images.

Size of the selection of buffer.sis needs to match the size of buffer.imgs

◆ checkOutExprAndCreateUpdateExprAndTmpOut()

std::pair< std::shared_ptr< ImageMath::ExprBase >, std::unique_ptr< SharedImageSet > > checkOutExprAndCreateUpdateExprAndTmpOut ( const ImageMath::ExprBase * exprOut,
SharedImageSet & out,
int varChannels,
bool forceRequired = false )

The function checkOutExprAndCreateUpdateExprAndTmpOut is intended to correctly deal in apply() and applyAdjoint() with the case where the outExpr parameter contains the parameter out.

The values used from out are those from before the operator is applied. This is nontrivial given the fact that some operators – including backprojection operators used in CT reconstruction – additively split their computation into blocks and thus the previous values of out have been overwritten by the time the final result is available. Note: If the operator does NOT split up the computation into such blocks, exprOut can be used directly, i.e. no temp is needed. The restrictions that otherwise also apply to ImageMath operators remain unchanged in this case.

On a more technical level, this function checks if the outExpr has the format 'out + scalar * var'. In this case, the expression encodes the operation \(out += scalar*A(in)\) This format is suitable without modification for use within additive blocks. If not, an output expression containing a temporary variable with the initial values from the out parameter is returned.

Parameters
varChannels- the number of channels in the variable, this is typically the number of channels in the shader output If this does not match the number of channels in out, a temporary is always required.
Returns
An update expression (if needed) and a temp image in case the operator needs to act if it splits the operator in blocks. There are the following cases which affect how a LinearOperator needs to treat exprOut in case the operator splits up the computation by dividing the operator in blocks (here var is the result of the computation on the current subset).
  • exprOut == nullptr: This case is equivalent to the case exprOut = var, see below in "\p exprOut does not contain \p out".
  • exprOut != nullptr:
    • exprOut does not contain out: In this case, a temporary is not required. An update expression of the form \(out = out + var\) is created. The operator needs to use this expression to accumulate the result in all but the first and last blocks. On the last block, the original exprOut must be applied to the result, i.e. \(out = exprOut(out + var)\).
    • exprOut does contain out:
      • exprOut has the form \(out + \alpha var\), and \( \alpha \) does not contain out. In this case, a temporary is not required, as the expression distributes over the splitting. exprOut can be directly used also to accumulate the results from the individual blocks. exprOut must be applied for all blocks INCLUDING the first one.
      • exprOut has any other form: As the expr involves out, i.e. inplace modification of out, we first need to accumulate the blocks. In this case we create a temp copy of out and the update expression is setup as \(outTemp = outTemp + var\). The operator needs to use this expression for any except for the first block and the last block. At the very last block exprOut needs to be applied and the variable in it needs to be substituted with outTemp.
      • If forceRequired is set to true the previous case will be used whenever exprOut contains out.
Search Tab / S to search, Esc to close