ImFusion SDK 4.3
SimilarityMeasureWrapper Class Reference

#include <ImFusion/Reg/SimilarityMeasureWrapper.h>

Wrapper for safe and configurable use of various similarity measures. More...

+ Inheritance diagram for SimilarityMeasureWrapper:

Detailed Description

Wrapper for safe and configurable use of various similarity measures.

An actual similarity measure implementation class will only be instantiated upon call of either compute, or configure. Any exceptions occuring during initialization or computation are caught, and zero returned as measure.

Public Member Functions

 SimilarityMeasureWrapper (SharedImage *img1, SharedImage *img2, int mode)
 Constructor which does not create an actual similarity measure yet.
 
 ~SimilarityMeasureWrapper () override
 Destructor, deleting similarity measure instance hosted here.
 
void setMode (int mode)
 Set similarity measure mode as defined in factory enumeration.
 
void setUseGPU (bool flag)
 Specify if the OpenGL GPU implementation shall be used (true by default)
 
void enableMasks (bool enableMask1, bool enableMask2)
 Set mask to implicit zero-mask, explicit, or disabled for either image.
 
bool setImage1 (SharedImage *img1) override
 Set or change the first image (if incompatible, similarity measure is cleared)
 
bool setImage2 (SharedImage *img2) override
 Set or change the second image (if incompatible, similarity measure is cleared)
 
void setPatchSize (int patchSize, int weighting=1, int absCorr=1)
 Specify patch size and further options for the LNCC similarity measure.
 
int mode () const
 Return current similarity measure mode.
 
bool useGPU () const
 Return current GPU flag.
 
int patchSize () const
 Return the current patch size.
 
int patchWeighting () const
 Return the current patch variance weighting mode.
 
int patchAbsCorr () const
 Return the patch absolute value option.
 
double compute (const ImageTransformer *t, size_t *overlap=nullptr) override
 Compute the similarity measure, automatically creating it if needed.
 
void configure (const Properties *p) override
 Configure the similarity measure, creating it to configure custom properties.
 
void configuration (Properties *p) const override
 Retrieve the configuration of the similarity measure.
 
SimilarityMeasureImplmeasure (bool init=false)
 Return the actual measure implementation class instance if available.
 
bool supportsWeights () const override
 Returns the state of weights-support of the wrapped similarity measure.
 
void setWeights (const SharedImage *weights1, const SharedImage *weights2) override
 Sets the weights for the wrapped similarity measure. Call just before compute, since this will initialize the actual measure.
 
- Public Member Functions inherited from SimilarityMeasureImpl
 SimilarityMeasureImpl (SharedImage *img1, SharedImage *img2)
 Sets the two images that should be compared. Does not transfer ownership.
 
virtual SharedImageimage1 () const
 
virtual SharedImageimage2 () const
 
void enableImage1Mask (bool enable)
 Specify whether a mask on the first image shall be used if available (true by default)
 
void enableImage2Mask (bool enable)
 Specify whether a mask on the second image shall be used if available (true by default)
 
bool image1MaskEnabled () const
 Return the flag for using the mask of the first image.
 
bool image2MaskEnabled () const
 Return the flag for using the mask of the second image.
 
- 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
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from SimilarityMeasureImpl
static void defaultConfiguration (Properties *p)
 Retrieve the default properties of this class.
 
- 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 SimilarityMeasureImpl
template<typename T>
double callTyped (T *obj, const MemImage &img1, const MemImage &img2, const ImageTransformer *t, size_t *overlap=nullptr)
 Helper method to transform the MemImages to TypedImages.
 
void setMaskIncludeArguments (GL::Program *program)
 Sets all uniforms for SimilarityMeasureMask.glh.
 
void initMaskInclude (GL::Program *program)
 Initializes the code for the SimilarityMeasureMask.glh code.
 
std::string glDefines (bool patchBased) const
 Return shared GL program defines for patch-based and weights, used in LNCC and LC2 OpenGL subclasses.
 
- Protected Attributes inherited from SimilarityMeasureImpl
SharedImagem_img1
 
SharedImagem_img2
 
bool m_useImg1Mask
 
bool m_useImg2Mask
 
std::shared_ptr< GlMask::MultiIncludeTypem_maskImg1
 
std::shared_ptr< GlMask::MultiIncludeTypem_maskImg2
 
const SharedImagem_weights1
 
const SharedImagem_weights2
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ setImage1()

bool setImage1 ( SharedImage * img1)
overridevirtual

Set or change the first image (if incompatible, similarity measure is cleared)

Reimplemented from SimilarityMeasureImpl.

◆ setImage2()

bool setImage2 ( SharedImage * img2)
overridevirtual

Set or change the second image (if incompatible, similarity measure is cleared)

Reimplemented from SimilarityMeasureImpl.

◆ compute()

double compute ( const ImageTransformer * t,
size_t * overlap = nullptr )
overridevirtual

Compute the similarity measure, automatically creating it if needed.

Implements SimilarityMeasureImpl.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure the similarity measure, creating it to configure custom properties.

Reimplemented from SimilarityMeasureImpl.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Retrieve the configuration of the similarity measure.

Reimplemented from SimilarityMeasureImpl.

◆ measure()

SimilarityMeasureImpl * measure ( bool init = false)

Return the actual measure implementation class instance if available.

If the optional init parameter is true, the actual implementation instance is created if necessary.

◆ supportsWeights()

bool supportsWeights ( ) const
overridevirtual

Returns the state of weights-support of the wrapped similarity measure.

Implements SimilarityMeasureImpl.

◆ setWeights()

void setWeights ( const SharedImage * weights1,
const SharedImage * weights2 )
overridevirtual

Sets the weights for the wrapped similarity measure. Call just before compute, since this will initialize the actual measure.

Reimplemented from SimilarityMeasureImpl.


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