![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Reg/PolyRigidImageRegistration.h>
Registers two images with a non-linear poly-rigid deformation. More...
Registers two images with a non-linear poly-rigid deformation.
The algorithm modifies the GlPolyRigidDeformation object attached to the moving image
Public Member Functions | |
PolyRigidImageRegistration (SharedImageSet *image1, SharedImageSet *image2, SharedImageSet *labelMap=nullptr) | |
void | initializeTransformationModel () override |
void | compute () override |
Starts the registration. | |
void | setDownsamplingLayers (int v) |
Sets the number of times a volume should be successively downsampled during registration This multiresolution approach is intended to avoid local optima in the registration. | |
void | configure (const Properties *p) override |
Configures the registration. | |
void | configuration (Properties *p) const override |
Gets the configuration of the registration. | |
![]() | |
ParametricDeformableRegistration (SharedImageSet *image1, SharedImageSet *image2) | |
double | evaluate (int n, const double *x, double *dx=0) override |
Assembles the parameters and returns similarity of images. | |
int | numberOfParameters () const final |
Returns the number of parameters of the deformation model. Since it is called in the constructor it is defined final. | |
void | reset () override |
Resets the deformation of moving to its initial deformation. | |
std::shared_ptr< ParametricDeformation > | deformation () const |
Returns the deformation object that is currently modified. | |
bool | isDeformable () const override |
Returns if the registration is non-linear or not. | |
void | setUseLinear (bool flag) |
Specify whether linear transformation parameters should be used in addition to the deformable ones. | |
bool | useLinear () const |
Returns whether linear transformation parameters are used. | |
![]() | |
ParametricImageRegistration (SharedImageSet *image1, SharedImageSet *image2, int numberOfParameters) | |
Creates a registration that keeps image1 fixed and moves image2. | |
virtual void | setProgress (Progress *progress) override |
Sets a Progress interface the algorithm can use to notify observers about its computing progress. | |
virtual void | setOptimizer (std::shared_ptr< Optimizer > opt) |
Sets an optimizer. | |
virtual std::shared_ptr< Optimizer > | optimizer () |
virtual bool | setReference (SharedImageSet *img) |
Specifies which of the two images will be used as a reference in the similarity measure. | |
SharedImageSet * | reference () const override |
Returns the image that will be iterated during the registration. | |
virtual SimilarityMeasureFactory & | similarityMeasureFactory () |
Returns the factory that creates the SimilarityMeasureImpl instance during the registration. | |
virtual const SimilarityMeasureFactory & | similarityMeasureFactory () const |
PreProcessingFilter | requiredPreprocessingFilter () const override |
Returns LC2_GradientMagnitude if the similarity measure is LC2 or None otherwise. | |
virtual void | setPreApplyTransformation (bool enable) |
If set the transformation will be pre-applied before computing the similarity. | |
virtual bool | preApplyTransformation () const |
void | setSimilarityMeasure (SimilarityMeasureFactory::Mode mode) |
Convenient method to set the similarity measure. | |
SimilarityMeasureFactory::Mode | similarityMeasure () const |
void | setPointCorrespondences (PointCorr *pc) |
Set a point correspondences class instance to use as error function or clear it (ownership not transferred) | |
void | setReInitialize (bool flag) |
Specify whether similarity measure and transformation shaders shall be re-initialized every time compute is called (on by default) | |
void | setRelativeToWorld (bool flag) |
Sets whether the relative transformation is applied in world or image coordinates. | |
bool | isRelativeToWorld () const |
Returns whether the relative transformation is applied in world (true) or image coordinates (false) | |
bool | isAffine () const |
Returns true if the optimizer uses affine parameters or false otherwise. | |
void | setAffine (bool affine) |
void | setReferenceCoordinateSystem (const mat4 &mat) |
Set a reference coordinate system to use with the linear transformation. | |
void | setWeights (const SharedImage *weights1, const SharedImage *weights2) |
Set optional weight images which will be passed on to the similarity measure class. | |
void | setErrorFunction (ErrorFunction *ef) |
Set an optional error function that is also used to penalize the image similarity during registration. | |
int | numberOfLinearParameters () const |
Return the number of parameters for the linear transformation model. | |
double | overlap () const |
Return the last overlap computed by the similarity measure (0..1), i.e. the fraction of used pixels/voxels wrt. the fixed image. | |
virtual double | bestSimilarityValue () const override |
Returns the best value of the similarity measure after optimization (may return NaN if algorithm is not intialized) | |
void | setDefaultOptimizer () |
Sets the optimizer to the optimizer created by createDefaultOptimizer | |
![]() | |
AbstractImageRegistration (SharedImageSet *image1, SharedImageSet *image2) | |
virtual SharedImageSet * | image1 () const |
virtual SharedImageSet * | image2 () const |
virtual void | setImage1 (SharedImageSet *img) |
virtual void | setImage2 (SharedImageSet *img) |
![]() | |
Algorithm () | |
Default constructor will registers a single "compute" action that calls compute() and returns status(). | |
virtual OwningDataList | takeOutput () |
Return any new Data that was created by the Algorithm during the last call to compute(). | |
Progress * | progress () const |
Returns the progress interface if set. | |
virtual int | status () const |
Indicates the status of the last call to compute(). | |
virtual bool | survivesDataDeletion (const Data *) const |
Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list. | |
const FactoryInfo & | factoryInfo () const |
Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory. | |
void | setFactoryInfo (const FactoryInfo &value) |
Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory. | |
Status | runAction (const std::string &id) |
Run the action with name id if it exists. | |
const std::vector< Action > & | actions () |
Get a mapping from Action id to Action as registered in this algorithm. | |
![]() | |
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 bool | createCompatible (const DataList &data, Algorithm **a=0) |
Expects two Volumes/Images. | |
![]() | |
static bool | createCompatible (const DataList &data, Algorithm **a=nullptr) |
Factory function to check algorithm compatibility with input data and optionally instantiate it. | |
Additional Inherited Members | |
![]() | |
enum | PreProcessingFilter { None , LC2_GradientMagnitude } |
![]() | |
enum | Status { Unknown = -1 , Success = 0 , Error = 1 , InvalidInput , IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU , UnknownAction , AbortedByUser , User = 1000 } |
Status codes. More... | |
![]() | |
Signal | signalOutputChanged |
Signal should be emitted by Algorithms when their output/result has changed. | |
Signal | signalParametersChanged |
Signal should be emitted by Algorithms when their parameter configuration has changed. | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
std::shared_ptr< Optimizer > | createDefaultOptimizer (int numParameters) const |
Returns a default optimizer with the given number if parameters. | |
mat4 | updateLinearTransform (int n, const double *x) |
Compute the linear homogenous moving image transformation from optimization parameters. | |
![]() | |
bool | complainAboutDeformationOnFixedImage () |
![]() | |
void | loadDefaults () |
void | registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action) |
Register an action to be run via runAction. | |
template<typename D> | |
void | registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void)) |
Template version of runAction that can be used with a pointer to a member function. | |
void | registerAction (const Action &action) |
Register an action. | |
![]() | |
template<class T, class U> | |
static bool | createCompatible (const DataList &data, Algorithm **a) |
Auxiliary factory method to create specialized registration instance Is used by DemonsImageRegistration. | |
![]() | |
Properties * | m_resetProperties |
used to reset the deformation grid to its pre-registration state (if there was such a state) | |
std::vector< double > | m_initialPars |
inner displacements when the registration was started, only available during registration | |
bool | m_useLinear |
If true, linear transformation parameters are used in addition to the deformable ones. | |
![]() | |
std::shared_ptr< Optimizer > | m_opt |
NOTE: A default optimizer will be created by configure if no instance is already set. | |
SimilarityMeasureFactory | m_smFactory |
SimilarityMeasureImpl * | m_sm |
Actual similarity measure instance, only set during compute. | |
bool | m_smIterate1 |
bool | m_preApplyTransformation |
bool | m_reInit |
Re-initialize transformation and similarity measure every time compute is called. | |
double | m_overlap |
const SharedImage * | m_weights1 |
const SharedImage * | m_weights2 |
SharedImage * | m_resampled |
the moving image with pre-applied transformation, only set during compute and if m_preApplyTransformation is true | |
ImageTransformer * | m_transformer |
capsulates the transformation, only set during compute | |
PointCorr * | m_pointCorr |
Point correspondences instance if available. | |
ErrorFunction * | m_errorFunc |
Optional error function also used to penalize similarity. | |
mat4 | m_initMat |
Initial registration matrix for linear transformation model. | |
mat4 | m_resetMat |
Unmodified matrix of the moving image for reseting. | |
mat4 | m_refCoord |
Reference coordinate system to use with linear transformation. | |
bool | m_relWorld |
Apply relative transformation wrt. world coordinates for linear model. | |
int | m_affine |
0=rigid, 1=affine, 2=rigid then affine (2 only supported through configurable interface) | |
![]() | |
SharedImageSet * | m_image1 |
First image of the registration. | |
SharedImageSet * | m_image2 |
Second image of the registration. | |
PointCorrAlgorithm * | m_pcAlg |
Optional point correspondences for evaluation. | |
![]() | |
std::string | m_name |
Algorithm name. | |
Progress * | m_progress = nullptr |
Non-owing pointer to a progress interface. May be a nullptr. | |
FactoryInfo | m_factoryInfo = {} |
Record describing how this algorithm was instantiated by the AlgorithmFactory. | |
int | m_status = Status::Unknown |
Algorithm status after last call to compute() | |
std::vector< Action > | m_actions |
Map of key given by the id of the action, of the available actions of this algorithm. | |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
|
overridevirtual |
Implements AbstractImageRegistration.
|
overridevirtual |
Starts the registration.
A optimizer has to be set before hand. During the registration the deformation of the moving image will be updated with temporary results. Upon return the deformation of the moving image is one that maximises the similarity measure.
Reimplemented from ParametricDeformableRegistration.
|
overridevirtual |
Configures the registration.
A sub-property with the name "Optimizer" can be used to create and initialize an optimizer The sub-property "SimilarityMeasure" can be used to set the configuration for the SimilarityMeasure
Reimplemented from ParametricDeformableRegistration.
|
overridevirtual |
Gets the configuration of the registration.
If an optimizer is set, the sub-property "Optimizer" contains its configuration. The sub-property "SimilarityMeasure" contains the properties of the SimilarityMeasure
Reimplemented from ParametricDeformableRegistration.