template<typename T, typename ImgType, bool BlockAccessEnabled = false>
class ImFusion::ImageMath::Array< T, ImgType, BlockAccessEnabled >
Specialization of ExprBase for a image leaf, i.e.
an TypedImage, SharedImage and SharedImageSet
- Note
- The overload for SharedImageSet assumes that all images in the set have the same type and size. If this is not the case you need to run the expression for each ShareImage involved individually.
This class offers an expression leaf which wraps an existing, SharedImage, SharedImageSet, or TypedImage. Such an object can be used as leaf within an expression or as l-value in order to evaluate an expression into an image. This class has two template parameters, T and ImgType. T needs to be either SharedImage, or SharedImageSet, or TypedImage. ImgType can either be void or any type that is supported by our image classes. In the case of void the type is deduced at runtime from the expression, however this requires that all leaves within the expression need to have the same type as the l-value the expression is assigned to. In any other case, i.e. mixed types, you need to hint the type by providing an ImgType. For convenience we provide a builder method which deduces the type directly in the case of TypedImage and offers one template parameter in the case of SharedImage or SharedImageSet. In addition, on construction you need to provide a unique name which will be used as variable name/prefix in e.g. GLSL shaders. The class also provides block access.
- Note
- The pixel value will always be considered float (GPU) or double (CPU) as due to shift and scale the image type is not sufficient. If you want to use e.g. integer type in the expression you need to use the casting operator.
auto sharedImgExprNonTyped =
makeArray(sharedImg);
Image shared on multiple devices.
Definition SharedImage.h:86
Concrete implementation of a MemImage for a given pixel type.
Definition KinectAzureStreamPlaybackAlgorithm.h:23
auto makeArray(TypedImage< T > &img, bool ignoreShiftAndScale, MagFilter magFilter, Wrap wrap, const vec4f &borderColor)
Convenience function to create an array leaf (needed as until c++17 there is no template type deducti...
Definition Array.h:657
|
| | Array (T &img, bool ignoreShiftAndScale=false, MagFilter magFilter=MagFilter::Nearest, Wrap wrap=Wrap::ClampToEdge, const vec4f &borderColor=vec4f::Zero()) |
| | Constructor.
|
| |
|
| Array (const Array &other) |
| |
| ImageDescriptor | imgDesc () const override final |
| | Return ImageDescriptor of this expression. This reference is expected to remain the same while the class exists.
|
| |
|
ImageMath::MagFilter | getMagFilter () |
| |
|
ImageMath::Wrap | getWrap () |
| |
| int | numImgs () const override |
| | Number of images (i.e. the number of image in the SharedImageSets and 1 for MemImage or SharedImage)
|
| |
| auto | block (const vec3i &offset, const vec3i &blockSize) const |
| |
| DeviceStrategy | deviceStrategy () const override |
| | Return DeviceStrategy of this expression.
|
| |
|
template<typename otherT, typename otherImgType> |
| auto | cloneLeaf (otherT &img) const |
| | create Array with different image type but same properties
|
| |
|
T & | img () |
| |
|
const T & | img () const |
| |
|
void | setDeviceStrategy (DeviceStrategy deviceStrategy) |
| | manually override the deviceStrategy
|
| |
|
const auto & | get () const |
| | get a const reference to this with the actual type
|
| |
|
auto & | get () |
| | get a 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 | binaryOp (RhsT rhs, const Op &func=Op(), typename std::enable_if< std::is_arithmetic_v< RhsT > >::type *=nullptr) const |
| |
|
auto | binaryOp (Eigen::Matrix< RhsT, Dim, 1, Options, MaxRows, MaxCols > rhs, const Op &func=Op(), typename std::enable_if< std::is_arithmetic_v< RhsT > >::type *=nullptr) const |
| |
| auto | binaryOp (const ExprBaseTpl< RhsT > &rhs, const Op &func, const StringOp &stringFunc) const |
| |
|
auto | binaryOp (RhsT rhs, const Op &func, const StringOp &stringFunc, typename std::enable_if< std::is_arithmetic_v< RhsT > >::type *=nullptr) const |
| |
|
auto | binaryOp (Eigen::Matrix< RhsT, Dim, 1, Options, MaxRows, MaxCols > rhs, const Op &func, const StringOp &stringFunc, typename std::enable_if< std::is_arithmetic_v< RhsT > >::type *=nullptr) const |
| |
| auto | unaryOp (const Op &func=Op()) const |
| |
| auto | unaryOp (const Op &func, const StringOp &stringFunc) 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}) |
| |
|
| ADD_SPECIAL_SWIZZLE (y, {1}) |
| |
|
| ADD_SPECIAL_SWIZZLE (z, {2}) |
| |
|
| ADD_SPECIAL_SWIZZLE (w, {3}) |
| |
|
| ADD_SPECIAL_SWIZZLE (r, {0}) |
| |
|
| ADD_SPECIAL_SWIZZLE (g, {1}) |
| |
|
| ADD_SPECIAL_SWIZZLE (b, {2}) |
| |
|
| ADD_SPECIAL_SWIZZLE (a, {3}) |
| |
|
| ADD_SPECIAL_SWIZZLE (xy, std::vector< size_t >({0, 1})) |
| |
|
| ADD_SPECIAL_SWIZZLE (rg, std::vector< size_t >({0, 1})) |
| |
|
| ADD_SPECIAL_SWIZZLE (xyz, std::vector< size_t >({0, 1, 2})) |
| |
|
| ADD_SPECIAL_SWIZZLE (xyzw, std::vector< size_t >({0, 1, 2, 3})) |
| |
|
| ADD_SPECIAL_SWIZZLE (rgb, std::vector< size_t >({0, 1, 2})) |
| |
|
| ADD_SPECIAL_SWIZZLE (rgba, std::vector< size_t >({0, 1, 2, 3})) |
| |
| 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) |
| |
|
| ADD_CHANNEL_REDUCTION_OPERATOR (channelProd, mult) |
| |
|
| ADD_CHANNEL_REDUCTION_OPERATOR (channelMax, max) |
| |
|
| ADD_CHANNEL_REDUCTION_OPERATOR (channelMin, min) |
| |
|
| ADD_CHANNEL_REDUCTION_OPERATOR (length, length) |
| |
|
auto | channelMean () |
| |
|
auto | squaredLength () const |
| |
|
auto | channelDistance (const ExprBaseTpl< RhsT > &other) const |
| |
|
auto | channelDistance (const Eigen::Matrix< T, Dim, 1 > c) |
| |
|
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.
|
| |
|
auto | select (LhsT lhs, RhsT rhs, typename std::enable_if< std::is_arithmetic_v< LhsT > &&std::is_arithmetic_v< RhsT > >::type *=nullptr) const |
| | Ternary (condition.x ? if_true : if_false) operator.
|
| |
|
auto | select (LhsT lhs, const ExprBaseTpl< RhsT > &rhs, typename std::enable_if< std::is_arithmetic_v< LhsT > >::type *=nullptr) const |
| | Ternary (condition.x ? if_true : if_false) operator.
|
| |
|
auto | select (const ExprBaseTpl< LhsT > &lhs, RhsT rhs, typename std::enable_if< std::is_arithmetic_v< RhsT > >::type *=nullptr) const |
| | Ternary (condition.x ? if_true : if_false) operator.
|
| |
|
| ADD_REDUCTION_OPERATOR (sum, add) |
| |
|
| ADD_REDUCTION_OPERATOR (prod, mult) |
| |
|
| ADD_ARG_REDUCTION_OPERATOR (min, min) |
| |
|
| ADD_ARG_REDUCTION_OPERATOR (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 |
| |
|
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 |
| |
|
auto | resample (SharedImage &inputDesc, SharedImage &outputDesc, std::enable_if_t< std::is_same_v< T, SharedImage > > *=nullptr) const |
| |
|
auto | resample (SharedImageSet &inputDesc, SharedImageSet &outputDesc, std::enable_if_t< std::is_same_v< T, SharedImageSet > > *=nullptr) const |
| |
| std::string | evalString (bool tagAndAssign=true) const override final |
| | 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 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.
|
| |
| bool | assignGl (const internal::GlExprInterface &expr) |
| | Evaluates expression into this ArrayGl on the GPU.
|
| |
| std::vector< internal::GlExprInterface * > | children () override final |
| | Used for traversing the expression tree. Contains the immediate children of node.
|
| |
| std::vector< const internal::GlExprInterface * > | children () const override final |
| | Used for traversing the expression tree. Contains the immediate children of node.
|
| |
| bool | setMagFilter (ImageMath::MagFilter m) override final |
| | Set interpolation behaviour of the current leaf (only)
|
| |
| bool | setWrap (ImageMath::Wrap w) override final |
| | Set interpolation behaviour of the current leaf (only)
|
| |
|
ExprInterface & | exprInterface () |
| | Get image descriptor of the wrapped expression.
|
| |
|
const ExprInterface & | exprInterface () const |
| |
| 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.
|
| |