ImFusion SDK 4.3
OperandDeformation< T > Class Template Reference

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

Use an ImageMath expression as a Deformation. More...

+ Inheritance diagram for OperandDeformation< T >:

Detailed Description

template<typename T>
class ImFusion::ImageMath::OperandDeformation< T >

Use an ImageMath expression as a Deformation.

The expression must have 3 channels and is interpreted as the displacement in world coordinates. Example, here si is a SharedImage object:

auto deformationExpr = ImageMath::makeChannelWiseScalar(vec3(0.0,10.,2.0));
auto deformation = deformationExpr.toDeformation(si.descriptorWorld());
si->setDeformation(deformation);
ChannelWiseScalar< T, Dim > makeChannelWiseScalar(Eigen::Matrix< T, Dim, 1 > val)
Convenience function to create a channel wise scalar leaf (needed as until c++17 there is no template...
Definition ChannelWiseScalar.h:73
Warning
All Array leaves occurring in the expression must be typed, i.e. no Array<void>.

Public Member Functions

 OperandDeformation (const OperandT operand, ImageDescriptorWorld descriptorWorld)
 
vec3 displacement (const vec3 &pos) const override
 Deformation interface Here pos is in world coordinates, and the result is expected to be in world coordinates also.
 
std::vector< GL::AbstractInclude * > dependentIncludes () const override
 Returns a list of dependent abstract includes that need to be included as well.
 
int setIncludeArguments (GL::Program &p, const SharedImage *img, const std::string &prefix="deform") const override
 Override default arguments for GlMask includes.
 
Deformationclone () const override
 Returns a copy of the deformation.
 
int dimension () const override
 Returns the dimension of the deformation.
 
virtual bool isIdentity () const override
 Returns if the current state of the deformation transformations the image or not.
 
virtual void setIdentity () override
 This function is not supported by OperandDeformation.
 
std::string id () const override
 Returns a unique string identifier for this type of deformation.
 
- Public Member Functions inherited from Deformation
 Deformation (const std::string &shaderPath)
 Initializes the Deformation with path to the GlInclude file.
 
virtual vec3 displacement (const vec2 &pos) const
 Returns the displacement at the world position pos.
 
virtual vec3 displacePoint (const vec3 &point) const
 Returns the displaced position of the given point in world-coordinates.
 
void setDisabled (bool flag)
 Set a disabled flag in order to hide the visualization of this deformation.
 
bool disabled () const
 Return whether the deformation was set to disabled.
 
virtual std::unique_ptr< SharedImageSetsupportingImages () const
 Returns the images that, together with the configuration, defines the deformation.
 
- Public Member Functions inherited from AbstractInclude
 AbstractInclude (const std::string &defineName, const std::string &includePath)
 Creates a AbstractInclude for the given define and with the corresponding GLSL file at includePath.
 
const std::stringdefineName () const
 Returns the name of define used by this include.
 
const std::stringincludePath () const
 Returns the path to the included shader file.
 
virtual std::function< std::string(const std::string &)> includeCodeSubstitution () const
 Optionally the abstract include can provide a function to change the shader code.
 
virtual Fingerprint fingerprint () const
 Provides a finger print of the include.
 
- Public Member Functions inherited from MultiIncludable< Deformation, const SharedImage * >
std::shared_ptr< MultiIncludeTypecreateMultiInclude (const std::string &replacementToken)
 Instantiates a new AbstractInclude instance where all occurrences of baseToken provided during construction are replaces with replacementToken according to the specified replacementScheme.
 
virtual int setIncludeArguments (Program &prog, IncludeArgumentsTypes... includeArgs, const std::string &token) const=0
 Interface that multi includes should use to configure the shader include (such as setting uniforms, binding textures, etc).
 
- Public Member Functions inherited from Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
 
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
 
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Additional Inherited Members

- Public Types inherited from MultiIncludable< Deformation, const SharedImage * >
using MultiIncludeType
 Alias for type of a multi-include instance of the original include.
 
- Static Public Member Functions inherited from Deformation
static std::string defineName ()
 Returns the define name of GlAbstractInclude for all deformations.
 
static std::string defineSuffix ()
 Returns "DEFORM".
 
static std::string multiIncludeDefine (const std::string &replacementToken)
 Returns "IMAGE_" + toUpper(replacementToken)
 
- Public Attributes inherited from Deformation
Signal< const DeformationEvent & > signalChanged
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from Deformation
void notifyListeners (const DeformationEvent &event) const
 convenience function to call signalChanged.emitSignal(event).
 
- Protected Member Functions inherited from MultiIncludable< Deformation, const SharedImage * >
 MultiIncludable (Deformation *crtpInstance, const std::string &baseToken, Flags< ShaderTextReplacement > replacementScheme)
 Instantiate and configure the MultiIncludable interface.
 
- Protected Attributes inherited from Deformation
bool m_disabled
 Disabled flag for visualization.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ displacement()

template<typename T>
vec3 displacement ( const vec3 & pos) const
inlineoverridevirtual

Deformation interface Here pos is in world coordinates, and the result is expected to be in world coordinates also.

Implements Deformation.

◆ dependentIncludes()

template<typename T>
std::vector< GL::AbstractInclude * > dependentIncludes ( ) const
inlineoverridevirtual

Returns a list of dependent abstract includes that need to be included as well.

The default implementation returns an empty vector, you may override this method to your needs. The returned vector must be empty or contain valid pointers.

Reimplemented from AbstractInclude.

◆ setIncludeArguments()

template<typename T>
int setIncludeArguments ( GL::Program & p,
const SharedImage * img,
const std::string & prefix = "deform" ) const
inlineoverridevirtual

Override default arguments for GlMask includes.

Implements Deformation.

◆ clone()

template<typename T>
Deformation * clone ( ) const
inlineoverridevirtual

Returns a copy of the deformation.

Implements Deformation.

◆ dimension()

template<typename T>
int dimension ( ) const
inlineoverridevirtual

Returns the dimension of the deformation.

Implements Deformation.

◆ isIdentity()

template<typename T>
virtual bool isIdentity ( ) const
inlineoverridevirtual

Returns if the current state of the deformation transformations the image or not.

Implements Deformation.

◆ setIdentity()

template<typename T>
virtual void setIdentity ( )
inlineoverridevirtual

This function is not supported by OperandDeformation.

Implements Deformation.

◆ id()

template<typename T>
std::string id ( ) const
inlineoverridevirtual

Returns a unique string identifier for this type of deformation.

Usually the name of the class.

Note
To avoid conflicts make sure to include potential plugin names into this ID. Due to the modular architecture of the ImFusion library, uniqueness of IDs cannot be checked at compile time. However, DeformationFactory will check the uniqueness of the ID during registration.
See also
DeformationFactory

Implements Deformation.


The documentation for this class was generated from the following files:
Search Tab / S to search, Esc to close