ImFusion SDK 4.3
ImageRegistration Class Reference

#include <ImFusion/Reg/ImageRegistration.h>

High-level interface for image registration. More...

+ Inheritance diagram for ImageRegistration:

Detailed Description

High-level interface for image registration.

The image registration algorithm wraps several concrete image registration algorithms (e.g. linear and deformable) and extends them with pre-processing techniques. Available pre-processing options include downsampling and gradient-magnitude used for LC2. On creation, the algorithm tries to find the best settings for the registration problem depending on the modality, size and other properties of the input images. The image registration comes with a default set of different transformation models but new ones can be registered on runtime.

Public Types

enum  TransformationModel {
  Linear = 0 , FFD = 1 , TPS = 2 , Demons = 3 ,
  GreedyDemons = 4 , PolyRigid = 5 , DisaDemons = 6 , Gated4D = 7 ,
  UserDefined = 100
}
 Available registration models. Each one correlates to a certain AbstractImageRegistration subclass. More...
 
enum  PreprocessingOptions {
  NoPreprocessing = 0 , RestrictMemory = 1 , AdjustSpacing = 2 , IgnoreFiltering = 4 ,
  CacheResults = 16 , Normalize = 32
}
 Flags to enable/disable certain preprocessing options. More...
 
- Public Types inherited from Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
 

Public Member Functions

 ImageRegistration (SharedImageSet *image1, SharedImageSet *image2, TransformationModel dof=Linear, bool image2IsMoving=true)
 
virtual bool computePreprocessing ()
 Applies the pre-processing options on the input images.
 
void compute () override
 Starts the registration.
 
virtual void reset ()
 Resets the transformation of moving to its initial transformation.
 
void setTransformationModel (TransformationModel dof)
 Sets the transformation model for the registration.
 
TransformationModel transformationModel () const
 
const AbstractImageRegistrationregistrationObject () const
 Returns the internal registration object that performs the actual registration.
 
AbstractImageRegistrationregistrationObject ()
 
const ParametricImageRegistrationparametric () const
 
ParametricImageRegistrationparametric ()
 
bool isDeformable () const
 Returns true if the registration is based on Deformation object.
 
void setOptimizer (std::shared_ptr< Optimizer > opt)
 Sets an optimizer.
 
std::shared_ptr< Optimizeroptimizer ()
 
SharedImageSetimage1 () const
 
SharedImageSetimage2 () const
 
void setMoving (SharedImageSet *moving)
 Sets the image which will be modified.
 
void setFixed (SharedImageSet *fixed)
 Sets the image which will be fixed.
 
SharedImageSetfixed () const
 
SharedImageSetmoving () const
 
SharedImageSetimage1Preprocessed () const
 Returns the preprocessed version of image1 or 0 if the preprocessing has not been applied yet.
 
SharedImageSetimage2Preprocessed () const
 Returns the preprocessed version of image2 or 0 if the preprocessing has not been applied yet.
 
void setPreprocessingOptions (PreprocessingOptions options)
 Sets which options should be enabled for preprocessing.
 
PreprocessingOptions preprocessingOptions () const
 Returns the current preprocessing options as a bitwise OR combination.
 
PreprocessingOptions defaultPreprocessingOptions () const
 Returns the default options for the current configuration.
 
void setMaximumMemory (int sizeInMB)
 Restrict the memory used by the registration to the given amount in mebibyte.
 
int maximumMemory () const
 Returns the current memory limit of the registration in mebibyte.
 
bool verbose () const
 Returns whether info logs are enabled for this instance.
 
void setVerbose (bool flag)
 Sets whether info logs are enabled for this instance.
 
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 
double bestSimilarityValue () const
 Returns the best value of the similarity measure after optimization.
 
- Public Member Functions inherited from Algorithm
 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().
 
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
 
Progressprogress () 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 FactoryInfofactoryInfo () 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.
 
- 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
 
- Public Member Functions inherited from FactoryBase
 FactoryBase ()
 No license check is performed for the module instantiated with this constructor.
 
 FactoryBase (std::string module, bool checkLicense=true)
 
std::string moduleName () const
 Returns the module name of the factory.
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=0)
 If data is compatible with algorithm return true. If a is not zero, create algorithm with input data.
 
template<typename T>
static bool registerTransformationModel (TransformationModel id, const std::string &name)
 Registers a AbstractImageRegistration subclass to the avaiable transformation models.
 
static bool registerTransformationModel (TransformationModel id, const std::string &name, std::function< AbstractImageRegistration *(SharedImageSet *, SharedImageSet *)> createFunc, std::function< bool(SharedImageSet *, SharedImageSet *)> compatibleFunc)
 Registers a AbstractImageRegistration subclass to the available transformation models.
 
static bool unregisterTransformationModel (TransformationModel id)
 Unregisteres a transformation model.
 
static std::vector< TransformationModelregisteredTransformationModels ()
 Returns a list of all registered transformation models.
 
static std::string transformationModelName (TransformationModel model)
 Returns the name for the given model or an empty string if the model is unknown.
 
static bool isTransformationModelCompatible (TransformationModel model, SharedImageSet *img1, SharedImageSet *img2)
 Returns true if the transformation model can work with the given images.
 
static void setErodedZeroMask (SharedImageSet *img, int erosionSize=1)
 Sets a zero-intensity mask onto the given image, eroded by one or more pixels to avoid numerical stepping problems.
 
- Static Public Member Functions inherited from Algorithm
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

- Public Attributes inherited from Algorithm
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.
 
- 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 Algorithm
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.
 
- Protected Member Functions inherited from FactoryBase
virtual ~FactoryBase ()
 Virtual destructor.
 
std::string getComponentPath (const std::string &componentName) const
 Returns the path to the component referred to by name.
 
bool isLicensed (const std::string &name)
 Return true if the license allows the use of the component referred to by name.
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 
- Static Protected Member Functions inherited from FactoryBase
static std::string getComponentPath (const std::string &moduleName, const std::string &componentName)
 Returns the path to the component referred to by name.
 
static bool isLicensed (const std::string &moduleName, const std::string &name)
 Return true if the license allows the use of the component referred to by name.
 
- Protected Attributes inherited from Algorithm
std::string m_name
 Algorithm name.
 
Progressm_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< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 
- Protected Attributes inherited from FactoryBase
std::string m_factoryModule
 
bool m_checkLicense
 

Member Enumeration Documentation

◆ TransformationModel

Available registration models. Each one correlates to a certain AbstractImageRegistration subclass.

Enumerator
Linear 

6 (rigid) or 12 (affine) DOF registration

FFD 

Registration with non-linear Free-Form deformations.

TPS 

Registration with non-linear Thin-Plate-Splines deformations.

Demons 

Registration with non-linear dense (per-pixel) deformations.

GreedyDemons 

Registration with non-linear dense (per-pixel) deformations using patch-based SimilarityMeasures.

PolyRigid 

Registration with poly-rigid (i.e. partially piecewise rigid) deformations.

DisaDemons 

Registration with non-linear dense (per-pixel) deformations, computed using DISA features (Ronchetti et al., 2023)

Gated4D 

Same as linear, but for 4D-4D registration with a GatingMetadata in either of the two models.

UserDefined 

First model that can be used for user defined transformation models (see registerTransformationModel)

◆ PreprocessingOptions

Flags to enable/disable certain preprocessing options.

Enumerator
NoPreprocessing 

Disable preprocessing completely (this cannot be ORed with other options)

RestrictMemory 

Downsamples the images so that the registration will not use more than a given maximum of (video) memory.

AdjustSpacing 

if the spacing difference of both images is large, the spacing of the adjusted to the smaller one

IgnoreFiltering 

Ignore any PreProcessingFilter required by the AbstractImageRegistration object.

CacheResults 

Store PreProcessing results and only re-compute if necessary.

Normalize 

Normalize images to float range [0.0, 1.0].

Member Function Documentation

◆ registerTransformationModel()

template<typename T>
static bool registerTransformationModel ( TransformationModel id,
const std::string & name )
inlinestatic

Registers a AbstractImageRegistration subclass to the avaiable transformation models.

The template type T must derive from AbstractImageRegistration. Each registered transformation model is a assigned to the given id. If a an id is already taken, false is returned. User defined transformation model should be assigned to ids starting from TransformationModel::UserDefined. It is up to the user to find non-overlapping ids when registering multiple models (e.g. use registeredTransformationModel to find a free id). The given name will be used to store and retrieve the configuration for the registration object.

◆ unregisterTransformationModel()

static bool unregisterTransformationModel ( TransformationModel id)
static

Unregisteres a transformation model.

Returns true if the model is registered and was successfully unregistered.

◆ computePreprocessing()

virtual bool computePreprocessing ( )
virtual

Applies the pre-processing options on the input images.

The results of the pre-processing is always stored in extra images, the input images will remain unchanged. The pre-processed images share the transformation with the input images, i.e. changing the transformation on the pre-processed images also changes it on the input ones and vice versa. If several pre-processing options are applied on the same image, their results are combined into one image. The preprocessing options are applied in the following order:

AdjustSpacing

◆ compute()

void compute ( )
overridevirtual

Starts the registration.

Implements Algorithm.

◆ setTransformationModel()

void setTransformationModel ( TransformationModel dof)

Sets the transformation model for the registration.

If the transformation model changes the current registrationObject will be deleted and a new created. The configuration of the current model will be saved and the new model will be configured with any previously saved configuration for that model. Any attached identity deformations are removed from both images.

◆ setMoving()

void setMoving ( SharedImageSet * moving)

Sets the image which will be modified.

Must be either image1 or image2. Calling this function will re-create the registration object if image1 is not fixed or image2 is not moving.

◆ setFixed()

void setFixed ( SharedImageSet * fixed)

Sets the image which will be fixed.

Must be either image1 or image2. Calling this function will re-create the registration object if image1 is not fixed or image2 is not moving.

◆ setPreprocessingOptions()

void setPreprocessingOptions ( PreprocessingOptions options)

Sets which options should be enabled for preprocessing.

The options are bitwise OR combination of PreprocessingOptions.

◆ setMaximumMemory()

void setMaximumMemory ( int sizeInMB)

Restrict the memory used by the registration to the given amount in mebibyte.

The value can be set in any case but will only have an effect if RestrictMemory is enabled. The restrict video memory as well. The mininum size is 64 MB (the value will be clamped).

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.

◆ setErodedZeroMask()

static void setErodedZeroMask ( SharedImageSet * img,
int erosionSize = 1 )
static

Sets a zero-intensity mask onto the given image, eroded by one or more pixels to avoid numerical stepping problems.

Parameters
erosionSizegives the number of pixels that are eroded.

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