ImFusion C++ SDK 4.4.0
ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT > Class Template Reference

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

Specialization of ExprBaseTpl for ternary (condition ? More...

Inheritance diagram for ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >:

Detailed Description

template<typename ConditionT, typename LhsT, typename RhsT>
class ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >

Specialization of ExprBaseTpl for ternary (condition ?

case_true : case_false) operators using template optimization

Template Parameters
ConditionTThe first component of this expression is used to determine whether to return lhs or rhs.
LhsTThe expression that is returned if condition is true
RhsTThe expression that is returned if condition is false

Please note that in addition to the CPU operator() method this also provides the evalString() method which will be used to formulate the expression in e.g. a GLSL shader.

Public Types

using expr_type = typename common_type<typename LhsT::expr_type, typename RhsT::expr_type>::type
using var_type
using imf_img_type

Public Member Functions

 SelectTpl (const ConditionT &condition, const LhsT &lhs, const RhsT &rhs)
 Constructor storing the left-hand and the right-hand side for later lazy evaluation.
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.
template<typename LhsExprT = typename LhsT::expr_type, typename RhsExprT = typename RhsT::expr_type, typename ConditionExprT = typename ConditionT::expr_type>
IMFUSION_STRONG_INLINE expr_type eval (const std::size_t i, const vec4i &coord) const
 Evaluate the expression at position i.
DeviceStrategy deviceStrategy () const override
 Return DeviceStrategy of this expression.
ImageDescriptor imgDesc () const override
 get image descriptor
int numImgs () const override
 Get number of images.
GlExprInterfacelhs () override
const GlExprInterfacelhs () const override
GlExprInterfacerhs () override
const GlExprInterfacerhs () const override
GlExprInterfacecondition () override
const GlExprInterfacecondition () const override
Public Member Functions inherited from ImFusion::ImageMath::ExprBaseTpl< SelectTpl< ConditionT, LhsT, RhsT > >
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::SelectGl
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.
std::vector< internal::GlExprInterface * > children () override
 Used for traversing the expression tree. Contains the immediate children of node.
std::vector< const internal::GlExprInterface * > children () const override
 Used for traversing the expression tree. Contains the immediate children of node.
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 = internal::any_true<LhsT::has_variable, RhsT::has_variable, ConditionT::has_variable>

Member Typedef Documentation

◆ var_type

template<typename ConditionT, typename LhsT, typename RhsT>
using ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::var_type
Initial value:
typename internal::first_non_void<typename LhsT::var_type, typename RhsT::var_type, typename ConditionT::var_type>::type

◆ imf_img_type

template<typename ConditionT, typename LhsT, typename RhsT>
using ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::imf_img_type
Initial value:
typename biggest_imf_img_type<typename LhsT::imf_img_type, typename RhsT::imf_img_type, typename ConditionT::imf_img_type>::type

Member Function Documentation

◆ deviceStrategy()

template<typename ConditionT, typename LhsT, typename RhsT>
DeviceStrategy ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::deviceStrategy ( ) const
inlineoverridevirtual

Return DeviceStrategy of this expression.

Implements ImFusion::ImageMath::ExprInterface.

◆ imgDesc()

template<typename ConditionT, typename LhsT, typename RhsT>
ImageDescriptor ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::imgDesc ( ) const
inlineoverridevirtual

get image descriptor

Implements ImFusion::ImageMath::ExprInterface.

◆ numImgs()

template<typename ConditionT, typename LhsT, typename RhsT>
int ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::numImgs ( ) const
inlineoverridevirtual

Get number of images.

Implements ImFusion::ImageMath::ExprInterface.

◆ lhs() [1/2]

template<typename ConditionT, typename LhsT, typename RhsT>
GlExprInterface & ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::lhs ( )
inlineoverridevirtual

◆ lhs() [2/2]

template<typename ConditionT, typename LhsT, typename RhsT>
const GlExprInterface & ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::lhs ( ) const
inlineoverridevirtual

◆ rhs() [1/2]

template<typename ConditionT, typename LhsT, typename RhsT>
GlExprInterface & ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::rhs ( )
inlineoverridevirtual

◆ rhs() [2/2]

template<typename ConditionT, typename LhsT, typename RhsT>
const GlExprInterface & ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::rhs ( ) const
inlineoverridevirtual

◆ condition() [1/2]

template<typename ConditionT, typename LhsT, typename RhsT>
GlExprInterface & ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::condition ( )
inlineoverridevirtual

◆ condition() [2/2]

template<typename ConditionT, typename LhsT, typename RhsT>
const GlExprInterface & ImFusion::ImageMath::internal::SelectTpl< ConditionT, LhsT, RhsT >::condition ( ) const
inlineoverridevirtual

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