ImFusion SDK 4.3
ParametricDeformation Class Reference

#include <ImFusion/GL/ParametricDeformation.h>

Base interface for a parametric deformation in 2D or 3D. More...

+ Inheritance diagram for ParametricDeformation:

Detailed Description

Base interface for a parametric deformation in 2D or 3D.

Derived classes will implement actual parametric deformation models. Additionally to the displacement method, the shader include is expected to have the following two methods:

// Returns the control point with the index i
vec3 controlPointLocation(int i);
// Returns the displacement of the control point with index i
vec3 controlPointDisplacement(int i);

Public Member Functions

 ParametricDeformation (const std::string &shaderPath)
 Initializes the parametric deformation with path to the GlInclude file.
 
 ~ParametricDeformation () override
 Destructor.
 
virtual void setParameters (const std::vector< double > &pars)
 Set the parameters of the deformation.
 
virtual void parameters (std::vector< double > &parsOut) const
 Retrieve the current parameters of the deformation.
 
virtual void setDisplacement (const std::vector< vec3f > &d)
 Set displacement in mm for all control points if applicable For 2D images the z-coordinate of the displacement is ignored.
 
virtual std::vector< vec3f > displacements () const
 Get displacement in mm of all control points if applicable.
 
virtual std::vector< vec3 > controlPoints () const
 Returns a list of all control points in world coordinates (might be empty for certain models)
 
virtual int numberOfControlPoints () const
 Returns the number of control points (may be zero for certain deformations)
 
virtual int numberOfParameters () const
 Returns the number of parameters e.g. for optimization.
 
- Public Member Functions inherited from Deformation
 Deformation (const std::string &shaderPath)
 Initializes the Deformation with path to the GlInclude file.
 
virtual Deformationclone () const =0
 Returns a copy of the deformation.
 
virtual vec3 displacement (const vec3 &pos) const =0
 Returns the displacement for pos (in world coordinates).
 
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.
 
virtual bool isIdentity () const =0
 Returns if the current state of the deformation transformations the image or not.
 
virtual void setIdentity ()=0
 Sets all displacements to 0.
 
int setIncludeArguments (GL::Program &p, const SharedImage *img=nullptr, const std::string &prefix="deform") const override=0
 Override default arguments for GlMask includes.
 
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 int dimension () const =0
 Returns the dimension of the deformation.
 
virtual std::string id () const =0
 Returns a unique string identifier for this type of deformation.
 
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 std::vector< AbstractInclude * > dependentIncludes () const
 Returns a list of dependent abstract includes that need to be included as well.
 
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

◆ setParameters()

virtual void setParameters ( const std::vector< double > & pars)
virtual

Set the parameters of the deformation.

Reimplemented in GlPolyRigidDeformation, GlProbeDeformation, and GlSweepStretchDeformation.

◆ parameters()

virtual void parameters ( std::vector< double > & parsOut) const
virtual

Retrieve the current parameters of the deformation.

Reimplemented in GlPolyRigidDeformation, GlProbeDeformation, and GlSweepStretchDeformation.

◆ setDisplacement()

virtual void setDisplacement ( const std::vector< vec3f > & d)
virtual

Set displacement in mm for all control points if applicable For 2D images the z-coordinate of the displacement is ignored.

Reimplemented in FreeFormDeformation, and GlTPSDeformation.

◆ displacements()

virtual std::vector< vec3f > displacements ( ) const
virtual

Get displacement in mm of all control points if applicable.

Reimplemented in FreeFormDeformation, and GlTPSDeformation.

◆ controlPoints()

virtual std::vector< vec3 > controlPoints ( ) const
virtual

Returns a list of all control points in world coordinates (might be empty for certain models)

Reimplemented in FreeFormDeformation, and GlTPSDeformation.

◆ numberOfControlPoints()

virtual int numberOfControlPoints ( ) const
inlinevirtual

Returns the number of control points (may be zero for certain deformations)

Reimplemented in FreeFormDeformation, and GlTPSDeformation.

◆ numberOfParameters()

virtual int numberOfParameters ( ) const
inlinevirtual

Returns the number of parameters e.g. for optimization.

Reimplemented in GlPolyRigidDeformation, GlProbeDeformation, and GlSweepStretchDeformation.


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