![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Reg/SimilarityMeasureWrapper.h>
Wrapper for safe and configurable use of various similarity measures. More...
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. | |
SimilarityMeasureImpl * | measure (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. | |
![]() | |
SimilarityMeasureImpl (SharedImage *img1, SharedImage *img2) | |
Sets the two images that should be compared. Does not transfer ownership. | |
virtual SharedImage * | image1 () const |
virtual SharedImage * | image2 () 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. | |
![]() | |
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 |
Additional Inherited Members | |
![]() | |
static void | defaultConfiguration (Properties *p) |
Retrieve the default properties of this class. | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
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. | |
![]() | |
SharedImage * | m_img1 |
SharedImage * | m_img2 |
bool | m_useImg1Mask |
bool | m_useImg2Mask |
std::shared_ptr< GlMask::MultiIncludeType > | m_maskImg1 |
std::shared_ptr< GlMask::MultiIncludeType > | m_maskImg2 |
const SharedImage * | m_weights1 |
const SharedImage * | m_weights2 |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
|
overridevirtual |
Set or change the first image (if incompatible, similarity measure is cleared)
Reimplemented from SimilarityMeasureImpl.
|
overridevirtual |
Set or change the second image (if incompatible, similarity measure is cleared)
Reimplemented from SimilarityMeasureImpl.
|
overridevirtual |
Compute the similarity measure, automatically creating it if needed.
Implements SimilarityMeasureImpl.
|
overridevirtual |
Configure the similarity measure, creating it to configure custom properties.
Reimplemented from SimilarityMeasureImpl.
|
overridevirtual |
Retrieve the configuration of the similarity measure.
Reimplemented from SimilarityMeasureImpl.
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.
|
overridevirtual |
Returns the state of weights-support of the wrapped similarity measure.
Implements SimilarityMeasureImpl.
|
overridevirtual |
Sets the weights for the wrapped similarity measure. Call just before compute, since this will initialize the actual measure.
Reimplemented from SimilarityMeasureImpl.