ImFusion C++ SDK 4.4.0
ImFusion::ImageMath::Coordinates< imf_img_typeT > Class Template Referencefinal

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

ImageMath leaf for using world coordinates in ImageMath expressions. More...

Inheritance diagram for ImFusion::ImageMath::Coordinates< imf_img_typeT >:

Detailed Description

template<typename imf_img_typeT>
class ImFusion::ImageMath::Coordinates< imf_img_typeT >

ImageMath leaf for using world coordinates in ImageMath expressions.

The resulting expression has either

  • The value of the world, image, pixel or texture coordinate, as a 3-dimensional vector or
  • The scalar (dot) product of a scalar multiple of a homogeneous representation of the this coordinate with a provided vec4 value Which option is used depends on whether a vec4 value was provided in the constructor.
    Warning
    { When ImageMath evaluates expressions, the texture (resp. pixel) coordinate used in shaders (resp. evaluation programs) comes from the image it evaluates into. If these do not match the image provided at construction to this class, the calculated world coordinates will be incorrect. } As C++ does not deduce constructor template arguments until C++17, the makeCoordinates convenience functions are also included in this file.

Public Types

using expr_type = double
 The expr_type value gives the result of each component of this expression.
using var_type = void
using imf_img_type = imf_img_typeT

Public Member Functions

 Coordinates (const std::vector< ImageDescriptorWorld > descWorld, CoordinateType coordType=CoordinateType::World, vec4 normal=vec4::Zero(), bool useNormal=false)
 Create a Coordinates constructor using vector of ImageDescriptorWorld objects.
 Coordinates (const ImageDescriptorWorld &descWorld, CoordinateType coordType=CoordinateType::World)
 Create a Coordinates constructor using ImageDescriptorWorld objects.
 Coordinates (const imf_img_type &referenceImage, CoordinateType coordType=CoordinateType::World)
 Coordinates constructor using matrix from referenceImage The matrix is saved by this class, and hence changes to the pose of this image do not propagate to it.
 Coordinates (const imf_img_type &referenceImage, vec4 normal, CoordinateType coordType=CoordinateType::World)
 Use texture to world matrix from image referenceImage The matrix is saved by this class, and hence changes to the pose of this image do not propagate to it.
template<typename ImgT>
auto convertToMemImgExpr () const noexcept
auto convertToSharedImgExpr (std::size_t index) const
IMFUSION_STRONG_INLINE expr_type eval (const std::size_t, const vec4i &coord) const
 CPU implementation.
int numImgs () const override
 Return number of images of this expression.
ImageMath::DeviceStrategy deviceStrategy () const override
 Return DeviceStrategy of this expression.
ImageDescriptor imgDesc () const override
 Return ImageDescriptor of this expression. This reference is expected to remain the same while the class exists.
Public Member Functions inherited from ImFusion::ImageMath::ExprBaseTpl< Coordinates< imf_img_typeT > >
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::CoordinatesGl
void tagAndAssignNames (std::unordered_map< ImageMath::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 > &indicesIn, const std::string &prefix) const override
 Set uniform/sampler arguments.
std::string evalString (bool tagAndAssign=true) const override
 Implementation of GlExprInterface interface.
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 = false

Additional Inherited Members

Protected Member Functions inherited from ImFusion::ImageMath::internal::CoordinatesImpl
 CoordinatesImpl (const std::vector< ImageDescriptorWorld > descWorld, CoordinateType coordType=CoordinateType::World, vec4 normal=vec4::Zero(), bool useNormal=false)
 Create a Coordinates constructor using vector of ImageDescriptorWorld objects.
 CoordinatesImpl (const SharedImage &referenceImage, CoordinateType coordType=CoordinateType::World)
 Coordinates constructor using matrix from referenceImage The matrix is saved by this class, and hence changes to the pose of this image do not propagate to it.
 CoordinatesImpl (const SharedImageSet &referenceImage, CoordinateType coordType=CoordinateType::World)
 CoordinatesImpl (const SharedImage &referenceImage, vec4 normal, CoordinateType coordType=CoordinateType::World)
 Use texture to world matrix from image referenceImage The matrix is saved by this class, and hence changes to the pose of this image do not propagate to it.
 CoordinatesImpl (const SharedImageSet &referenceImage, vec4 normal, CoordinateType coordType=CoordinateType::World)
 CoordinatesImpl (std::vector< ImageDescriptor > imageDescriptor, std::vector< mat4 > matrixToWorld, std::vector< mat4 > textureToWorld, vec4 normal, bool useNormal, CoordinateType coordType)
Protected Member Functions inherited from ImFusion::ImageMath::internal::CoordinatesGl
CoordinatesImplgetImpl ()
const CoordinatesImplgetImpl () const
Protected Attributes inherited from ImFusion::ImageMath::internal::CoordinatesImpl
const std::vector< ImageDescriptorm_imageDescriptor
const CoordinateType m_coordinateType
const std::vector< mat4 > m_matrixToWorld
const std::vector< mat4 > m_textureToWorld
const vec3 m_reciprocalDim
const std::vector< vec4 > m_normalPixel
const vec4 m_normal
const bool m_useNormal = false
Protected Attributes inherited from ImFusion::ImageMath::internal::CoordinatesGl
std::string m_name = "uninitialized"
bool m_tagged = false

Constructor & Destructor Documentation

◆ Coordinates()

template<typename imf_img_typeT>
ImFusion::ImageMath::Coordinates< imf_img_typeT >::Coordinates ( const imf_img_type & referenceImage,
CoordinateType coordType = CoordinateType::World )
inline

Coordinates constructor using matrix from referenceImage The matrix is saved by this class, and hence changes to the pose of this image do not propagate to it.

As TypedImage/MemImage objects do not carry a to-world matrix, these are not supported here.

Member Function Documentation

◆ numImgs()

template<typename imf_img_typeT>
int ImFusion::ImageMath::Coordinates< imf_img_typeT >::numImgs ( ) const
inlineoverridevirtual

Return number of images of this expression.

Implements ImFusion::ImageMath::ExprInterface.

◆ deviceStrategy()

template<typename imf_img_typeT>
ImageMath::DeviceStrategy ImFusion::ImageMath::Coordinates< imf_img_typeT >::deviceStrategy ( ) const
inlineoverridevirtual

Return DeviceStrategy of this expression.

Implements ImFusion::ImageMath::ExprInterface.

◆ imgDesc()

template<typename imf_img_typeT>
ImageDescriptor ImFusion::ImageMath::Coordinates< imf_img_typeT >::imgDesc ( ) const
inlineoverridevirtual

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

Implements ImFusion::ImageMath::ExprInterface.


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