ImFusion C++ SDK 4.4.0
ImFusion::ImageMath::internal::BinaryOp< Op > Class Template Reference

#include <ImFusion/ImageMath/Poly/BinaryOp.h>

Specialization of ExprBase for binary operators (non template optimization). More...

Inheritance diagram for ImFusion::ImageMath::internal::BinaryOp< Op >:

Detailed Description

template<typename Op>
class ImFusion::ImageMath::internal::BinaryOp< Op >

Specialization of ExprBase for binary operators (non template optimization).

Template Parameters
OpA struct representing a binary expression examples can be found in SharedImageSetArithmeticOperators.h

Example for Op:

struct add
{
template <typename LhsT, typename RhsT>
IMFUSION_STRONG_INLINE auto operator()(LhsT lhs, RhsT rhs) const -> decltype(std::declval<LhsT>() + std::declval<RhsT>())
{
return lhs + rhs;
}
std::string evalString(const std::string& lhsStr, const std::string& rhsStr) const
{
str.reserve(5 + lhsStr.size() + rhsStr.size());
str += "(";
str += lhsStr;
str += ")+(";
str += rhsStr;
str += ")";
return str;
}
};
T declval(T... args)
T reserve(T... args)
T size(T... args)

Public Member Functions

 BinaryOp (std::shared_ptr< ExprBase > lhs, std::shared_ptr< ExprBase > rhs, const Op &func=Op())
std::unique_ptr< ExprBaseclone () const override
 Clone the current expression. May not return nullptr.
std::unique_ptr< ExprBasesubstituteVariableWithImg (const SharedImage &variable) const override
std::unique_ptr< ExprBasesubstituteVariableWithImg (const SharedImageSet &variable) const override
 Substitute all variables with variable.
void evalImpl (Array< SharedImage, void > &img) const override
void evalImpl (Array< SharedImageSet, void > &img) const override
 Implementation functionality used in eval().
GlExprInterfacelhs () override
const GlExprInterfacelhs () const override
GlExprInterfacerhs () override
const GlExprInterfacerhs () const override
const ImgOps::BinaryImgOpGlop () const override
std::unique_ptr< ExprBaseconvertToSharedImgExpr (std::size_t index) const override
 Convert a SharedImageSet expression to a SharedImage expression.
int numImgs () const override
 Return number of images of this expression.
ExprType exprType () const override
 Return the ImFusion image type, i.e. NoImage, SharedImage, SharedImageSet.
DeviceStrategy deviceStrategy () const override
 Return DeviceStrategy of this expression.
Public Member Functions inherited from ImFusion::ImageMath::ExprBase
ImageDescriptor imgDesc () const
 Return ImageDescriptor of the expression (forwards to the ExprInterface).
int numImgs () const
 Return the number of images of the expression (forwards to the ExprInterface).
template<typename T, typename ImgType = void>
auto evaluateIntoImage (bool clearShiftScale=false) const
 Evaluate expression into an image.
void eval (Array< SharedImage, void > &img, const SharedImage *variable) const
void eval (Array< SharedImage, void > &img) const
 Evaluate into SharedImage.
void eval (Array< SharedImageSet, void > &img, const SharedImageSet *variable) const
 Evaluate into SharedImageSet. Variable leafs will be substituted with variable.
void eval (Array< SharedImageSet, void > &img) const
 Evaluate into SharedImageSet.
internal::GlExprInterfaceglExprInterface ()
const internal::GlExprInterfaceglExprInterface () const
ExprInterfaceexprInterface ()
const ExprInterfaceexprInterface () const
template<typename Op>
reduction_type reduce (std::vector< vec4i > *arg=nullptr) const
std::unique_ptr< ExprBaseforceCPU () const
 Forces CPU execution.
std::unique_ptr< ExprBaseforceGPU () const
 Forces GPU execution.
std::unique_ptr< ExprBasechannelSwizzle (const std::vector< std::size_t > &indices) const
template<typename CastT>
std::unique_ptr< ExprBasecast () const
 ADD_REDUCTION_OP_DEF (sum, add)
 ADD_REDUCTION_OP_DEF (prod, mult)
 ADD_ARG_REDUCTION_OP_DEF (min, min)
 ADD_ARG_REDUCTION_OP_DEF (max, max)
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
Public Member Functions inherited from ImFusion::ImageMath::internal::BinaryOpBase
 BinaryOpBase (PixelType pixelType)
ImageDescriptor imgDesc () const override final
 Return ImageDescriptor of this expression. This reference is expected to remain the same while the class exists.
Public Member Functions inherited from ImFusion::ImageMath::internal::BinaryOpGl
std::string evalString (bool tagAndAssign=true) const override final
 Evaluate the operator as applied to lhs and rhs Overrides the behaviour of (in)equality operators for the single-channel case.
void tagAndAssignNames (std::unordered_map< internal::TaggingIndex, const void * > &taggedLeaves, std::unordered_map< std::type_index, int > &countPerLeafType, const std::string &prefix) const override final
 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 final
 Collect uniform/sampler definitions.
void getVariableDefinitionList (std::string &definitionList, const std::vector< int > &indices, const std::string &prefix) const override final
 Collect variable definitions.
int setArguments (GL::Program &p, const std::vector< int > &indices, const std::string &prefix) const override final
 Set uniform/sampler arguments.
std::vector< GlExprInterface * > children () override final
 Used for traversing the expression tree. Contains the immediate children of node.
std::vector< const GlExprInterface * > children () const override final
 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.

Additional Inherited Members

Public Types inherited from ImFusion::ImageMath::ExprBase
enum class  ExprType { Scalar = 0 , SharedImage = 1 , SharedImageSet = 2 , Variable = 3 }
Protected Attributes inherited from ImFusion::ImageMath::internal::BinaryOpBase
const PixelType m_pixelType
 PixelType.

Member Function Documentation

◆ clone()

template<typename Op>
std::unique_ptr< ExprBase > ImFusion::ImageMath::internal::BinaryOp< Op >::clone ( ) const
inlineoverridevirtual

Clone the current expression. May not return nullptr.

Implements ImFusion::ImageMath::ExprBase.

◆ substituteVariableWithImg() [1/2]

template<typename Op>
std::unique_ptr< ExprBase > ImFusion::ImageMath::internal::BinaryOp< Op >::substituteVariableWithImg ( const SharedImage & variable) const
inlineoverridevirtual

Substitute all variables with variable

Implements ImFusion::ImageMath::ExprBase.

◆ substituteVariableWithImg() [2/2]

template<typename Op>
std::unique_ptr< ExprBase > ImFusion::ImageMath::internal::BinaryOp< Op >::substituteVariableWithImg ( const SharedImageSet & variable) const
inlineoverridevirtual

Substitute all variables with variable.

Implements ImFusion::ImageMath::ExprBase.

◆ evalImpl() [1/2]

template<typename Op>
void ImFusion::ImageMath::internal::BinaryOp< Op >::evalImpl ( Array< SharedImage, void > & img) const
inlineoverridevirtual

Implementation functionality used in eval()

Implements ImFusion::ImageMath::ExprBase.

◆ evalImpl() [2/2]

template<typename Op>
void ImFusion::ImageMath::internal::BinaryOp< Op >::evalImpl ( Array< SharedImageSet, void > & img) const
inlineoverridevirtual

Implementation functionality used in eval().

Implements ImFusion::ImageMath::ExprBase.

◆ lhs() [1/2]

template<typename Op>
GlExprInterface & ImFusion::ImageMath::internal::BinaryOp< Op >::lhs ( )
inlineoverridevirtual

◆ lhs() [2/2]

template<typename Op>
const GlExprInterface & ImFusion::ImageMath::internal::BinaryOp< Op >::lhs ( ) const
inlineoverridevirtual

◆ rhs() [1/2]

template<typename Op>
GlExprInterface & ImFusion::ImageMath::internal::BinaryOp< Op >::rhs ( )
inlineoverridevirtual

◆ rhs() [2/2]

template<typename Op>
const GlExprInterface & ImFusion::ImageMath::internal::BinaryOp< Op >::rhs ( ) const
inlineoverridevirtual

◆ op()

template<typename Op>
const ImgOps::BinaryImgOpGl & ImFusion::ImageMath::internal::BinaryOp< Op >::op ( ) const
inlineoverridevirtual

◆ convertToSharedImgExpr()

template<typename Op>
std::unique_ptr< ExprBase > ImFusion::ImageMath::internal::BinaryOp< Op >::convertToSharedImgExpr ( std::size_t index) const
inlineoverridevirtual

Convert a SharedImageSet expression to a SharedImage expression.

Implements ImFusion::ImageMath::ExprBase.

◆ numImgs()

template<typename Op>
int ImFusion::ImageMath::internal::BinaryOp< Op >::numImgs ( ) const
inlineoverridevirtual

Return number of images of this expression.

Implements ImFusion::ImageMath::ExprInterface.

◆ exprType()

template<typename Op>
ExprType ImFusion::ImageMath::internal::BinaryOp< Op >::exprType ( ) const
inlineoverridevirtual

Return the ImFusion image type, i.e. NoImage, SharedImage, SharedImageSet.

Implements ImFusion::ImageMath::ExprBase.

◆ deviceStrategy()

template<typename Op>
DeviceStrategy ImFusion::ImageMath::internal::BinaryOp< Op >::deviceStrategy ( ) const
inlineoverridevirtual

Return DeviceStrategy of this expression.

Implements ImFusion::ImageMath::ExprInterface.


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