Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoImageRegistrationTransform Class Reference

ImageViz SoImageRegistrationTransform image filter More...

#include <ImageViz/Engines/GeometryAndMatching/Registration/SoImageRegistrationTransform.h>

+ Inheritance diagram for SoImageRegistrationTransform:

Classes

struct  RegistrationEvent
 This event describes the evolution of the registration process. More...
 

Public Types

enum  RangeMode {
  MIN_MAX = 0 ,
  OTHER = 1
}
 
enum  TransformationType {
  TRANSLATION = 4 ,
  RIGID = 0 ,
  RIGID_ISOTROPIC_SCALING = 1 ,
  RIGID_ANISOTROPIC_SCALING = 2 ,
  AFFINE = 3
}
 This enum defines the types of transforms that can be computed. More...
 
enum  MetricType {
  EUCLIDIAN = 0 ,
  CORRELATION ,
  NORMALIZED_MUTUAL_INFORMATION
}
 This enum defines the different types of metric used to compute the similarity value. More...
 
- Public Types inherited from SoImageVizEngine
enum  ComputeMode {
  MODE_2D = 0 ,
  MODE_3D = 1 ,
  MODE_AUTO = 2
}
 Compute Mode This enum specifies whether the main input will be interpreted as a 3D volume or a stack of 2D images for processing. More...
 
enum  Neighborhood3d {
  CONNECTIVITY_6 = 0 ,
  CONNECTIVITY_18 = 1 ,
  CONNECTIVITY_26 = 2
}
 Neighborhood Connectivity 3D. More...
 

Public Member Functions

 SoImageRegistrationTransform ()
 Constructor.
 
SbMatrix getOutputTransformation ()
 return the output transform matrix that aligns the model image to the reference image.
 
- Public Member Functions inherited from SoImageVizEngine
virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
virtual void startEvaluate ()
 Evaluate engine and dependencies in another thread without blocking the current one.
 
virtual void waitEvaluate ()
 Wait for the end of engine evaluation.
 
virtual void abortEvaluate ()
 Abort current processing as soon as possible.
 
virtual bool isEvaluating ()
 Returns true if the engine evaluation is in progress.
 
- Public Member Functions inherited from SoEngine
virtual int getOutputs (SoEngineOutputList &list) const
 Returns a list of outputs in this engine.
 
SoEngineOutputgetOutput (const SbName &outputName) const
 Returns a reference to the engine output with the given name.
 
SbBool getOutputName (const SoEngineOutput *output, SbName &outputName) const
 Returns (in outputName) the name of the engine output (output).
 
SoEnginecopy () const
 Creates and returns an exact copy of the engine.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Public Attributes

SbEventHandler< RegistrationEvent & > onProgressRegistration
 Specific event handler for registration.
 
SoSFEnum computeMode
 Select the compute Mode (2D or 3D or AUTO) Use enum ComputeMode.
 
SoSFImageDataAdapter inMovingImage
 The input model image.
 
SoSFImageDataAdapter inFixedImage
 The input reference image.
 
SoSFMatrix initialTransform
 The initial transformation that pre-aligns the model onto the reference.
 
SoSFBool autoParameterMode
 The way to determine the coarsestResampling and optimizerStep parameters.
 
SoSFVec2f optimizerStep
 The step sizes, in world coordinates, used by the optimizer at coarsest and finest scales.
 
SoSFVec2f intensityRangeReference
 The range [a,b] of gray values for the reference data set.
 
SoSFVec2f intensityRangeModel
 The range [a,b] of gray values for the model data set.
 
SoSFVec3i32 coarsestResampling
 The sub-sampling factor along each axis.
 
SoSFEnum rangeModeReference
 The way to define the intensity range to be considered by the algorithm in the reference (fixed) image.
 
SoSFEnum rangeModeModel
 The way to define the intensity range to be considered by the algorithm in the model (moving) image.
 
SoSFEnum transformType
 Select the type of transform.
 
SoSFBool ignoreFinestLevel
 Skip the finest level of the pyramid.
 
SoSFEnum metricType
 Select the metric type.
 
SoImageVizEngineOutput< SoSFFieldContainer, SoRegistrationResult * > outTransform
 Output structure storing registration results.
 
- Public Attributes inherited from SoImageVizEngine
SbEventHandler< EventArg & > onBegin
 Event raised when the processing begins.
 
SbEventHandler< EventArg & > onEnd
 Event raised when processing ends and the result is available.
 
SbEventHandler< EventArg & > onProgress
 Event raised while processing is running.
 

Additional Inherited Members

- Static Public Member Functions inherited from SoImageVizEngine
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoEngine
static SoType getClassTypeId ()
 Returns the type identifier for the SoEngine class.
 
static SoEnginegetByName (const SbName &name)
 Looks up engine(s) by name.
 
static int getByName (const SbName &name, SoEngineList &list)
 Looks up engine(s) by name.
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

ImageViz SoImageRegistrationTransform image filter

SoImageRegistrationTransform computes the best transformation for the co-registration of two images, using an iterative optimization algorithm.

The goal of registration is to find a transformation aligning a model image, which is moving while being processed, with a reference image, which remains fixed, starting from an initial transformation and by optimizing a similarity criterion between both images.

The estimated transformation can be a single translation, rigid (translation and rotation only), rigid with scale factors (isotropic or anisotropic along axis directions) or affine (including shear transformation).

Types of transformations

A hierarchical strategy is applied, starting at a coarse resampling of the data set, and proceeding to finer resolutions later on. Different similarity measurements like Euclidean distance, mutual information, and correlation can be selected. After each iteration a similarity score is computed, and the transformation is refined according to an optimizer algorithm. If this score cannot be computed, for instance when the resampling or step parameters are not adapted, it remains at its default value -1000.

The optimizer behavior depends on the optimizerStep parameter which affects the search extent, precision and computation time. A small optimizerStep is recommended when a pre-alignment has been performed in order to be more precise and avoid sending the transformation at a wrong location.

Two different optimization strategies are used for coarsest and finest resolution levels. The Extensive Direction optimizer is used at coarse levels. This optimizer is well suited for coarse resolution levels and potentially search registration further. A Quasi Newton optimizer is used on the finest level computed excepted if there is only one level. This optimizer is more suited for finer resolution levels in order to refine the transformation.

By default, the coarsestResampling and optimizerStep parameters are automatically estimated from the reference image properties. If the model and reference have different resolution or size, for instance in multi-modality case, these settings may be inappropriate and lead the registration to fail. In this case, the autoParameterMode parameter should be set to false and both parameters should be manually set to relevant values so that the coarsest resolution level generates a representative volume (i.e., not made of too few voxels) the displacement step is precise enough to not skip the searched transformation.

The SoImagePreAlignmentTransform3d engine can be used beforehand to estimate a rough initial transformation.

If the two input images have been carefully pre-aligned, it is not recommended to perform the registration at a too low sub-resolution level. It would not only perform useless computations but could also send the transformation at a wrong location and thus miss the right transformation. Consequently, the following recommendations can be applied in this case:

  • Do not use automatic parameters, i.e., set autoParameterMode to false.
  • Set the coarsest resolution level at the half of the original resolution, i.e., set the coarsestResampling parameter to (2,2,2).
  • Set the optimizerStep parameter with half of the reference image voxel size for finest resolution and reference voxel size for coarsest resolution.

This engine can notify some information during the processing (progression, similarity) and can be interrupted. Intercepting these events slows down the algorithm execution.

References

The Correlation Ratio metric is explained in the following publication:

  • A. Roche, G. Malandain, X. Pennec, and N. Ayache. "The Correlation Ratio as a New Similarity Measure for Multimodal Image Registration". INRIA Sophia Antipolis, EPIDAURE project, 1998.

The Normalized Mutual Information metric is based on the following publication:

  • C. Studholme, D. L. G. Hill, D.J. Hawkes. "An Overlap Invariant Entropy Measure of 3D Medical Image Alignment". In: Pattern Recognition vol. 32, pp. 71-86, 1999.

Further references include:

  • P. A. Viola. "Alignment by Maximization of Mutual Information". Massachusetts Institute of Technology, Diss., 1995.
  • A. Collignon, F. Maes, D. Delaere, D. Vandermeulen, P. Suetens, G. Marchal. "Automated Multi-modality Image Registration Based on Information Theory". In: IPMI. Dordrecht, Niederlande: Kluwer Academics, pp. 263-274, 1995.

FILE FORMAT/DEFAULT

    ImageRegistrationTransform3d {
    inMovingImage NULL
    inFixedImage NULL
    initialTransform SbMatrix::identity()
    autoParameterMode TRUE
    optimizerStep SbVec2f( 4.0f, 1.0f / 2.0f )
    intensityRangeReference SbVec2f( 0.0f, 65535.0f )
    intensityRangeModel SbVec2f( 0.0f, 65535.0f )
    rangeModeReference MIN_MAX
    rangeModeModel MIN_MAX
    coarsestResampling SbVec3i32( 8, 8, 8 )
    transformType RIGID
    ignoreFinestLevel FALSE
    metricType CORRELATION
    }

    Notice: This engine requires to preliminarily load the whole input data sets into memory to be computed. As a consequence, the maximum memory parameter must be either set to 0 or greater than the data set memory size:

    If this condition is not respected an exception will be raised when launching the execution of this engine: "engine cannot be computed because inputs are not in memory images."

    If the input data sets cannot fit in memory, this engine will fail during its computation.

SEE ALSO

SoImagePreAlignmentTransform3d

Definition at line 146 of file SoImageRegistrationTransform.h.

Member Enumeration Documentation

◆ MetricType

This enum defines the different types of metric used to compute the similarity value.

Enumerator
EUCLIDIAN 

Euclidean means the Euclidean distance, i.e., the mean squared difference between the gray values of model and reference.

This metric computes values between $-\infty$ and 0. Images closer to each other will have a metric closer to 0.

\[Similarity=\frac{\sum -(Image_{fixed} - Image_{moving})^2}{n}\]

where $Image$ are the individual voxels and $n$ is the voxel count.

CORRELATION 

Correlation measures the correlation ratio of the registered images.

This metric computes values between 0 and 1. The case correlation ratio = 1 corresponds to the case of two identical and registered images.

\[Similarity=\frac{\sum (Image_{moving} - \overline{Image_{moving}} ).(Image_{fixed} - \overline{Image_{fixed}} )}
{ \sqrt{\sum (Image_{moving} - \overline{Image_{moving}} )^2}.\sqrt{\sum(Image_{fixed} - \overline{Image_{fixed}} )^2}}\]

where $\overline{Image}$ is the voxel mean.

NORMALIZED_MUTUAL_INFORMATION 

The mutual information measures the information shared by both images.

This metric computes values between 0 and $\infty$. For instance, if images are independent, knowing $Image_{fixed}$ does not give any information about $Image_{moving}$ and vice versa, so their mutual information is zero.

The mutual information metrics, especially the normalized one, are recommended when images from different modalities, e.g., CT and MRT, are to be registered.

The mutual information is:

\[Similarity=\frac{H(Image_{moving})+H(Image_{fixed})}{H(Image_{moving,fixed})}\]

Where $H(Image_{moving})$ and $H(Image_{fixed})$ are the marginal entropies of the image histrograms and $H(Image_{moving,fixed})$ is the joint entropy of the image histograms.

Definition at line 384 of file SoImageRegistrationTransform.h.

◆ RangeMode

Enumerator
MIN_MAX 

The reference intensity range is between the minimum and the maximum of the image intensities.

OTHER 

The reference intensity range is between user-defined bounds [a,b].

Definition at line 314 of file SoImageRegistrationTransform.h.

◆ TransformationType

This enum defines the types of transforms that can be computed.

Default value is RIGID.

Enumerator
TRANSLATION 

Translation only.

RIGID 

Rigid transformation consisting of translation and rotation.

RIGID_ISOTROPIC_SCALING 

Transformation consisting of translation, rotation, and scale (only one scale for all dimensions).

RIGID_ANISOTROPIC_SCALING 

Transformation consisting of translation, rotation, and scales (one scale per dimension).

AFFINE 

Affine transformation consisting of translation, rotation, scale, and shear.

Definition at line 344 of file SoImageRegistrationTransform.h.

Constructor & Destructor Documentation

◆ SoImageRegistrationTransform()

SoImageRegistrationTransform::SoImageRegistrationTransform ( )

Constructor.

Member Function Documentation

◆ getOutputTransformation()

SbMatrix SoImageRegistrationTransform::getOutputTransformation ( )
inline

return the output transform matrix that aligns the model image to the reference image.


Definition at line 429 of file SoImageRegistrationTransform.h.

Member Data Documentation

◆ autoParameterMode

SoSFBool SoImageRegistrationTransform::autoParameterMode

The way to determine the coarsestResampling and optimizerStep parameters.

If true, these parameters are automatically computed.

In this case the optimizerStep, for the coarsest resolution is 1/5 of the size of the reference image bounding box and for the finest resolution it is 1/6 of the reference image voxel size.

For the coarsestResampling, if the voxels of the reference image are anisotropic, i.e., have a different size in X, Y, and Z directions, the default resampling rates are around 8 and adapted in order to achieve isotropic voxels on the coarsest level.

If the voxels of the reference image are isotropic, i.e., have a the same size in X, Y, and Z directions, the default resampling rate is computed in order to get at least 30 voxels along each direction.

Default value is true.

Definition at line 245 of file SoImageRegistrationTransform.h.

◆ coarsestResampling

SoSFVec3i32 SoImageRegistrationTransform::coarsestResampling

The sub-sampling factor along each axis.

This parameter defines the resampling rate for the coarsest resolution level where registration starts. The resampling rate refers to the reference data set.

If the voxel sizes of model and reference differ, the resampling rates for the model are adapted in order to achieve similar voxel sizes as for the reference on the same level.

A coarsest resampling factor of 8 means that one voxel at the coarsest level is equal to 8 voxels at the finest level for the related dimension.

This resampling factor is specified for each dimension of the input volume.

This parameter is ignored if autoParameterMode is set to true.

Default value is SbVec3i32( 8, 8, 8 ).

Definition at line 312 of file SoImageRegistrationTransform.h.

◆ computeMode

SoSFEnum SoImageRegistrationTransform::computeMode

Select the compute Mode (2D or 3D or AUTO) Use enum ComputeMode.

Default is MODE_AUTO

Definition at line 217 of file SoImageRegistrationTransform.h.

◆ ignoreFinestLevel

SoSFBool SoImageRegistrationTransform::ignoreFinestLevel

Skip the finest level of the pyramid.

Default value is false.

Definition at line 379 of file SoImageRegistrationTransform.h.

◆ inFixedImage

SoSFImageDataAdapter SoImageRegistrationTransform::inFixedImage

The input reference image.

Default value is NULL. Supported types include: grayscale binary label.

Definition at line 223 of file SoImageRegistrationTransform.h.

◆ initialTransform

SoSFMatrix SoImageRegistrationTransform::initialTransform

The initial transformation that pre-aligns the model onto the reference.

Default value is SbMatrix::identity(). The SoImagePreAlignmentTransform3d engine can be used to compute an initial transform.

Definition at line 227 of file SoImageRegistrationTransform.h.

◆ inMovingImage

SoSFImageDataAdapter SoImageRegistrationTransform::inMovingImage

The input model image.

Default value is NULL. Supported types include: grayscale binary label.

Definition at line 220 of file SoImageRegistrationTransform.h.

◆ intensityRangeModel

SoSFVec2f SoImageRegistrationTransform::intensityRangeModel

The range [a,b] of gray values for the model data set.

It works similarly to its reference data set counterpart parameter. This parameter is ignored if the rangeModeModel parameter is set to MIN_MAX

Default value is SbVec2f( 0.0f, 65535.0f ).

NOTE: field available since Open Inventor 10.9

Definition at line 293 of file SoImageRegistrationTransform.h.

◆ intensityRangeReference

SoSFVec2f SoImageRegistrationTransform::intensityRangeReference

The range [a,b] of gray values for the reference data set.

With the Mutual information metrics, gray values outside the range are sorted into the first or last histogram bin, respectively. With the Correlation metric, voxels with gray values outside the range are ignored. This parameter is ignored with the Euclidean metric or if the rangeModeReference parameter is set to MIN_MAX.

Default value is SbVec2f( 0.0f, 65535.0f ).

NOTE: field available since Open Inventor 10.9

Definition at line 281 of file SoImageRegistrationTransform.h.

◆ metricType

SoSFEnum SoImageRegistrationTransform::metricType

Select the metric type.

Use enum MetricType. Default is CORRELATION

Definition at line 421 of file SoImageRegistrationTransform.h.

◆ onProgressRegistration

SbEventHandler<RegistrationEvent&> SoImageRegistrationTransform::onProgressRegistration

Specific event handler for registration.

Definition at line 209 of file SoImageRegistrationTransform.h.

◆ optimizerStep

SoSFVec2f SoImageRegistrationTransform::optimizerStep

The step sizes, in world coordinates, used by the optimizer at coarsest and finest scales.

These step sizes refer to translations. For rotations, scalings, and shearings appropriate values are chosen accordingly. The first parameter is applied to the coarsest resolution level, the second to the finest level. Steps at intermediate levels are deduced from them. High step values cover a larger registration area but increase the risk of failure.

If the input transformation already provides a reasonable alignment, the steps can be set smaller than the values given by the automatic mode in order to reduce computation time and risk of failure.

Assuming a voxel size of (1,1,1) and a coarsestResampling of SbVec3i32(8,8,8), these parameters correspond to a displacement of half a voxel for the coarsest and finest level. As it is rarely the case, it is essential to set this parameter in relation with the reference image voxel size if the automatic mode is disabled.

This parameter is ignored if autoParameterMode is set to true.

Default value is SbVec2f( 4.0f, 1.0f / 2.0f ) ).

Definition at line 268 of file SoImageRegistrationTransform.h.

◆ outTransform

SoImageVizEngineOutput<SoSFFieldContainer, SoRegistrationResult*> SoImageRegistrationTransform::outTransform

Output structure storing registration results.

Definition at line 426 of file SoImageRegistrationTransform.h.

◆ rangeModeModel

SoSFEnum SoImageRegistrationTransform::rangeModeModel

The way to define the intensity range to be considered by the algorithm in the model (moving) image.

Default is MIN_MAX

NOTE: field available since Open Inventor 10.9

Definition at line 339 of file SoImageRegistrationTransform.h.

◆ rangeModeReference

SoSFEnum SoImageRegistrationTransform::rangeModeReference

The way to define the intensity range to be considered by the algorithm in the reference (fixed) image.

Default is MIN_MAX

NOTE: field available since Open Inventor 10.9

Definition at line 331 of file SoImageRegistrationTransform.h.

◆ transformType

SoSFEnum SoImageRegistrationTransform::transformType

Select the type of transform.

Use enum TransformationType. Default is RIGID

Definition at line 373 of file SoImageRegistrationTransform.h.


The documentation for this class was generated from the following file: