![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GL/GlDenseDeformation.h>
The GlDenseDeformation class represents dense deformations based on a displacement map. More...
Inheritance diagram for GlDenseDeformation:The GlDenseDeformation class represents dense deformations based on a displacement map.
Public Member Functions | |
| GlDenseDeformation (int width, int height, int slices) | |
| Creates a deformation field of the given size. | |
| GlDenseDeformation (const SharedImage *img) | |
| Creates a deformation field with the same size as img. | |
| GlDenseDeformation (const Image &img) | |
| Creates a deformation field with the same size as img. | |
| GlDenseDeformation (const ImageDescriptor &desc) | |
| GlDenseDeformation (const GlDenseDeformation &other) | |
| Copy constructor. | |
| Deformation * | clone () const override |
| Returns a copy of the deformation. | |
| bool | isIdentity () const override |
| Returns if the current state of the deformation transformations the image or not. | |
| void | setIdentity () override |
| Sets all displacements to 0. | |
| void | setChanged () |
| Causes listeners to be notified because the deformation field was changed. | |
| void | copyFrom (const Deformation &other, const SharedImage &image) |
| vec3 | displacement (const vec3 &pos) const override |
| Returns the displacement for pos (in world coordinates). | |
| int | setIncludeArguments (GL::Program &p, const SharedImage *img=nullptr, const std::string &prefix="deform") const override |
| Initializes the DenseDeformation shader header to deform the given image. | |
| int | dimension () const override |
| Dimension of the displacement field, either 2 or 3. | |
| mat4 | transformation () const |
| The world transformation of the displacement field. | |
| void | setTransformation (const mat4 &matrix) |
| void | setDisplacement (const SharedImage &d) |
| Set displacement in mm. | |
| const SharedImage & | displacementField () const |
| Returns the complete displacement field. | |
| SharedImage & | displacementField () |
| void | configure (const Properties *p) override |
| Set one or multiple properties. | |
| void | configuration (Properties *p) const override |
| Retrieve the properties of this object. | |
| std::string | id () const override |
| Returns a unique string identifier for this type of deformation. | |
| std::unique_ptr< SharedImageSet > | supportingImages () const override |
| Returns the images that, together with the configuration, defines the deformation. | |
| virtual vec3 | displacement (const vec2 &pos) const |
| Returns the displacement at the world position pos. | |
Public Member Functions inherited from Deformation | |
| Deformation (const std::string &shaderPath) | |
| Initializes the Deformation with path to the GlInclude file. | |
| 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. | |
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::string & | defineName () const |
| Returns the name of define used by this include. | |
| const std::string & | includePath () 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< MultiIncludeType > | createMultiInclude (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 | 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 | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Static Public Member Functions | |
| static std::unique_ptr< GlDenseDeformation > | createFrom (const Deformation &other, const SharedImage &image, std::optional< ImageDescriptorWorld > domain=std::nullopt) |
| Create a new dense deformation field based on a given deformation and image. | |
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) | |
Protected Attributes | |
| std::unique_ptr< SharedImage > | m_disp |
| Displacement field. | |
| std::unique_ptr< GL::Sampler > | m_sampler |
Protected Attributes inherited from Deformation | |
| bool | m_disabled |
| Disabled flag for visualization. | |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
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. | |
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. | |
|
static |
Create a new dense deformation field based on a given deformation and image.
| other | Deformation to use as source, will be evaluated for every voxel of the new dense deformation field. |
| image | Image to use as reference for size, spacing and transformation of the old deformation field. |
| domain | Domain of the new deformation field. If nullptr, then image is used. |
|
overridevirtual |
Returns a copy of the deformation.
Implements Deformation.
|
overridevirtual |
Returns if the current state of the deformation transformations the image or not.
Implements Deformation.
|
overridevirtual |
Sets all displacements to 0.
Implements Deformation.
|
overridevirtual |
Returns the displacement for pos (in world coordinates).
The returned displacement is also in world coordinates. The displacement indicates where pos originated from before applying the deformation.
Implements Deformation.
|
overridevirtual |
Initializes the DenseDeformation shader header to deform the given image.
Inside the shader the deformDisplacement function returns the displacement in texture coordinates. If you need them in world coordinates, transform them with SharedImage::textureToWorldMatrix.
Implements Deformation.
|
overridevirtual |
Dimension of the displacement field, either 2 or 3.
Implements Deformation.
| mat4 transformation | ( | ) | const |
The world transformation of the displacement field.
This is the same as displacementField().matrix().
| void setDisplacement | ( | const SharedImage & | d | ) |
Set displacement in mm.
The given image must be a 3 channel FLOAT image.
| const SharedImage & displacementField | ( | ) | const |
Returns the complete displacement field.
The returned image is always 3 channel FLOAT. Each pixel is a 3D displacement vector in mm (world coordinates). Use SharedImage::texture/pixelToWorld and SharedImage::worldToTexture/Pixel to convert between coordinates.
|
overridevirtual |
Set one or multiple properties.
Reimplemented from Configurable.
|
overridevirtual |
Retrieve the properties of this object.
Reimplemented from Configurable.
|
inlineoverridevirtual |
Returns a unique string identifier for this type of deformation.
Usually the name of the class.
Implements Deformation.
|
overridevirtual |
Returns the images that, together with the configuration, defines the deformation.
Reimplemented from Deformation.
|
virtual |
Returns the displacement at the world position pos.
The base implementation just calls displacement(vec3(pos,0.0))
Reimplemented from Deformation.