ImFusion C++ SDK 4.4.0
ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation > Class Template Reference

#include <ImFusion/ImageMath/Tpl/ResampleTpl.h>

Resample an ImageMath operand to a different coordinate system, optionally including a deformation. More...

Inheritance diagram for ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >:

Detailed Description

template<typename OperandT, bool includeDeformation = false>
class ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >

Resample an ImageMath operand to a different coordinate system, optionally including a deformation.

Parameters
includeDeformation- deformation and resampling is combined into a single leaf to avoid clamping artifacts. If this parameter is set to false, deformations are not considered even if the associated images have them.
Warning
the CPU mode performs nearest-neighbor interpolation, whereas the GPU mode may use linear interpolation if the leaves support this This will yield different results in the CPU implementation relative to the GPU implementation. The CPU implementation currently only supports "edge" rounding.

Public Types

using expr_type = typename OperandT::expr_type
using imf_img_type = typename OperandT::imf_img_type
using decayed_imf_img_type = std::decay_t<imf_img_type>
using var_type = typename OperandT::var_type

Public Member Functions

 ResampleTpl (const OperandT &operand, std::vector< ImageDescriptorWorld > operandDesc, std::vector< ImageDescriptorWorld > resultDesc, std::vector< std::shared_ptr< Deformation > > deformations={}, std::vector< std::reference_wrapper< SharedImage > > sharedImagesForDeformations={})
 Constructor where ImageDescriptors may vary between images.
 ResampleTpl (const OperandT &operand, const ImageDescriptorWorld &operandDesc, const ImageDescriptorWorld &resultDesc, std::optional< std::pair< std::shared_ptr< Deformation >, std::reference_wrapper< SharedImage > > > deformationArgs=std::nullopt)
 Constructor.
 ResampleTpl (const ResampleTpl &other)
template<typename T = decayed_imf_img_type>
 ResampleTpl (const OperandT &operand, SharedImage &operandImg, SharedImage &resultImg, std::enable_if_t< std::is_same_v< T, SharedImage > > *=nullptr)
template<typename T = decayed_imf_img_type>
 ResampleTpl (const OperandT &operand, SharedImageSet &operandImg, SharedImageSet &resultImg, std::enable_if_t< std::is_same_v< T, SharedImageSet > > *=nullptr)
IMFUSION_STRONG_INLINE expr_type eval (const std::size_t i, const vec4i &coord) const
template<typename ImgT>
auto convertToMemImgExpr () const noexcept
auto convertToSharedImgExpr (std::size_t index) const
template<typename SubOperandT>
auto substituteVariable (const SubOperandT &operand) const
 Substitutes any Variable leaf.
DeviceStrategy deviceStrategy () const override
 Return DeviceStrategy of this expression.
int numImgs () const override
 Return number of images of this expression.
ImageDescriptor imgDesc () const override
 Return ImageDescriptor of this expression. This reference is expected to remain the same while the class exists.
GlExprInterfaceoperand () override
const GlExprInterfaceoperand () const override
const std::vector< ImageDescriptorWorld > & operandDesc () const override
const std::vector< ImageDescriptorWorld > & resultDesc () const override
const std::vector< std::shared_ptr< Deformation > > & deformations () const override
const std::vector< std::reference_wrapper< SharedImage > > & sharedImagesForDeformation () const override
Public Member Functions inherited from ImFusion::ImageMath::ExprBaseTpl< ResampleTpl< OperandT, false > >
const auto & get () const
 get a const reference to this with the actual type
auto polyWrapper () const
auto uniquePolyWrapper () const
auto sharedPolyWrapper () const
auto binaryOp (const ExprBaseTpl< RhsT > &rhs, const Op &func=Op()) const
auto unaryOp (const Op &func=Op()) const
reduction_type reduce (std::vector< vec4i > *arg=nullptr) const
auto forceCPU () const
 Forces CPU execution.
auto forceGPU () const
 Forces GPU execution.
auto channelSwizzle (const std::vector< std::size_t > &indices) const
auto head ()
 ADD_SPECIAL_SWIZZLE (x, {0})
auto streamChannels (int numStreamedChannels) const
auto substituteVariableWithImg (T &img) const
auto operator- () const
auto cast () const
auto storageToOriginal (const ImageDescriptor &desc)
 Apply shift/scale to the operand,.
auto originalToStorage (const ImageDescriptor &desc)
 Apply shift/scale to the operand,.
auto channelReduction ()
 ADD_CHANNEL_REDUCTION_OPERATOR (channelSum, add)
auto channelMean ()
auto squaredLength () const
auto channelDistance (const ExprBaseTpl< RhsT > &other) const
auto dot (const ExprBaseTpl< RhsT > &other) const
auto stashThenApply (const ExprBaseTpl< VariableT > &varExpr) const
auto hnormalized () const
auto normalized () const
auto homogeneous () const
auto appendZero () const
auto select (const ExprBaseTpl< LhsT > &lhs, const ExprBaseTpl< RhsT > &rhs) const
 Ternary (condition.x ? if_true : if_false) operator.
 ADD_REDUCTION_OPERATOR (sum, add)
 ADD_ARG_REDUCTION_OPERATOR (min, min)
Eigen::Matrix< double, Eigen::Dynamic, 1 > mean () const
Eigen::Matrix< double, Eigen::Dynamic, 1 > l1Norm () const
Eigen::Matrix< double, Eigen::Dynamic, 1 > squaredl2Norm () const
Eigen::Matrix< double, Eigen::Dynamic, 1 > l2Norm () const
Eigen::Matrix< double, Eigen::Dynamic, 1 > lpNorm (double p) const
Eigen::Matrix< double, Eigen::Dynamic, 1 > lInfNorm () const
auto evaluateIntoImage (bool clearShiftScale=false) const
 Create an empty image and evaluate this expression into it.
auto toMask () const
auto toDeformation (const ImageDescriptorWorld imgDesc) const
auto resample (const ImageDescriptorWorld &inputDesc, const ImageDescriptorWorld &outputDesc) const
Public Member Functions inherited from ImFusion::ImageMath::internal::ResampleGl
 ResampleGl (const ResampleGl &other)
 ResampleGl (ResampleGl &&other)
ResampleGl & operator= (const ResampleGl &other)=delete
ResampleGl & operator= (ResampleGl &&other)=delete
std::string evalString (bool tagAndAssign=true) const override
 Print expression.
void tagAndAssignNames (std::unordered_map< internal::TaggingIndex, const void * > &taggedLeaves, std::unordered_map< std::type_index, int > &countPerLeafType, const std::string &prefix) const override
 We need to tag leaves and tell unique leaves that they are responsible to define the uniforms and set the shader arguments.
void getUniformDefinitionList (std::string &definitionList, const std::vector< int > &indices, const std::string &prefix) const override
 Collect uniform/sampler definitions.
void getVariableDefinitionList (std::string &definitionList, const std::vector< int > &indices, const std::string &prefix) const override
 Collect variable definitions.
int setArguments (GL::Program &p, const std::vector< int > &indices, const std::string &prefix) const override
 Set uniform/sampler arguments.
Public Member Functions inherited from ImFusion::ImageMath::internal::GlExprInterface
ExprInterfaceexprInterface ()
 Get image descriptor of the wrapped expression.
const ExprInterfaceexprInterface () const
virtual bool setMagFilter (ImageMath::MagFilter mag)
 Set interpolation behaviour of the current leaf (only).
virtual bool setWrap (ImageMath::Wrap wrap)
 Set interpolation behaviour of the current leaf (only).
bool setMagFilterRecursive (ImageMath::MagFilter mag)
 Set interpolation behaviour of the current leaf and all of its children.
bool setWrapRecursive (ImageMath::Wrap wrap)
 Set wrap behaviour of the current leaf and all of its children.

Static Public Attributes

static constexpr bool has_variable = OperandT::has_variable

Additional Inherited Members

Protected Member Functions inherited from ImFusion::ImageMath::internal::ResampleGl
void init ()
std::vector< GlExprInterface * > children () override
 Used for traversing the expression tree. Contains the immediate children of node.
std::vector< const GlExprInterface * > children () const override
 Used for traversing the expression tree. Contains the immediate children of node.

Constructor & Destructor Documentation

◆ ResampleTpl() [1/2]

template<typename OperandT, bool includeDeformation = false>
ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::ResampleTpl ( const OperandT & operand,
std::vector< ImageDescriptorWorld > operandDesc,
std::vector< ImageDescriptorWorld > resultDesc,
std::vector< std::shared_ptr< Deformation > > deformations = {},
std::vector< std::reference_wrapper< SharedImage > > sharedImagesForDeformations = {} )
inline

Constructor where ImageDescriptors may vary between images.

Parameters
resultDescthe ImageDescriptorWorld of the final expression for each image in the SharedImageSet
operandDescthe ImageDescriptorWorld of the operand, for each image in the SharedImageSet
deformationsthe deformations for each image in the SharedImageSet. Is only considered if the template argument includeDeformation is true.
sharedImagesForDeformationsthe SharedImages for each deformation. Is only considered if the template argument includeDeformation is true. Required for technical reasons related to deformations.

◆ ResampleTpl() [2/2]

template<typename OperandT, bool includeDeformation = false>
ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::ResampleTpl ( const OperandT & operand,
const ImageDescriptorWorld & operandDesc,
const ImageDescriptorWorld & resultDesc,
std::optional< std::pair< std::shared_ptr< Deformation >, std::reference_wrapper< SharedImage > > > deformationArgs = std::nullopt )
inline

Constructor.

Parameters
resultDescthe ImageDescriptorWorld of the result
operandDescthe ImageDescriptorWorld of the operand.
deformationArgsthe deformation and SharedImage for the deformation. Is only considered if the template argument includeDeformation is true.

Member Function Documentation

◆ deviceStrategy()

template<typename OperandT, bool includeDeformation = false>
DeviceStrategy ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::deviceStrategy ( ) const
inlineoverridevirtual

Return DeviceStrategy of this expression.

Implements ImFusion::ImageMath::ExprInterface.

◆ numImgs()

template<typename OperandT, bool includeDeformation = false>
int ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::numImgs ( ) const
inlineoverridevirtual

Return number of images of this expression.

Implements ImFusion::ImageMath::ExprInterface.

◆ imgDesc()

template<typename OperandT, bool includeDeformation = false>
ImageDescriptor ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::imgDesc ( ) const
inlineoverridevirtual

Return ImageDescriptor of this expression. This reference is expected to remain the same while the class exists.

Implements ImFusion::ImageMath::ExprInterface.

◆ operand() [1/2]

template<typename OperandT, bool includeDeformation = false>
GlExprInterface & ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::operand ( )
inlineoverridevirtual

◆ operand() [2/2]

template<typename OperandT, bool includeDeformation = false>
const GlExprInterface & ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::operand ( ) const
inlineoverridevirtual

◆ operandDesc()

template<typename OperandT, bool includeDeformation = false>
const std::vector< ImageDescriptorWorld > & ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::operandDesc ( ) const
inlineoverridevirtual

◆ resultDesc()

template<typename OperandT, bool includeDeformation = false>
const std::vector< ImageDescriptorWorld > & ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::resultDesc ( ) const
inlineoverridevirtual

◆ deformations()

template<typename OperandT, bool includeDeformation = false>
const std::vector< std::shared_ptr< Deformation > > & ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::deformations ( ) const
inlineoverridevirtual

◆ sharedImagesForDeformation()

template<typename OperandT, bool includeDeformation = false>
const std::vector< std::reference_wrapper< SharedImage > > & ImFusion::ImageMath::internal::ResampleTpl< OperandT, includeDeformation >::sharedImagesForDeformation ( ) const
inlineoverridevirtual

The documentation for this class was generated from the following file:
  • ImFusion/ImageMath/Tpl/ResampleTpl.h
Search Tab / S to search, Esc to close