Class SoImageRegistrationTransform
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.engines.SoEngine
-
- com.openinventor.imageviz.engines.SoImageVizEngine
-
- com.openinventor.imageviz.engines.geometryandmatching.registration.SoImageRegistrationTransform
-
- All Implemented Interfaces:
SafeDisposable
public class SoImageRegistrationTransform extends SoImageVizEngine
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). 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 - maxMemory parameter of the
SbImageDataAdapterHelper.getAppropriateAdapter
function - maxMemory attribute of the
SoFileDataAdapter
class
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoImageRegistrationTransform.MetricTypes
This enum defines the different types of metric used to compute the similarity value.static class
SoImageRegistrationTransform.RangeModes
static class
SoImageRegistrationTransform.RegistrationEvent
This event describes the evolution of the registration process.static class
SoImageRegistrationTransform.TransformationTypes
This enum defines the types of transforms that can be computed.-
Nested classes/interfaces inherited from class com.openinventor.imageviz.engines.SoImageVizEngine
SoImageVizEngine.ComputeModes, SoImageVizEngine.EventArg, SoImageVizEngine.Neighborhood3ds
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFBool
autoParameterMode
The way to determine the coarsestResampling and optimizerStep parameters.SoSFVec3i32
coarsestResampling
The sub-sampling factor along each axis.SoSFEnum<SoImageVizEngine.ComputeModes>
computeMode
Select the compute Mode (2D or 3D or AUTO) .SoSFBool
ignoreFinestLevel
Skip the finest level of the pyramid.SoSFImageDataAdapter
inFixedImage
The input reference image.SoSFMatrix
initialTransform
The initial transformation that pre-aligns the model onto the reference.SoSFImageDataAdapter
inMovingImage
The input model image.SoSFVec2f
intensityRangeModel
The range [a,b] of gray values for the model data set.SoSFVec2f
intensityRangeReference
The range [a,b] of gray values for the reference data set.SoSFEnum<SoImageRegistrationTransform.MetricTypes>
metricType
Select the metric type.SbEventHandler<SoImageRegistrationTransform.RegistrationEvent>
onProgressRegistration
Specific event handler for registration.SoSFVec2f
optimizerStep
The step sizes, in world coordinates, used by the optimizer at coarsest and finest scales.SoImageVizEngineOutput<SoSFFieldContainer,SoRegistrationResult>
outTransform
Output structure storing registration results.SoSFEnum<SoImageRegistrationTransform.RangeModes>
rangeModeModel
The way to define the intensity range to be considered by the algorithm in the model (moving) image.SoSFEnum<SoImageRegistrationTransform.RangeModes>
rangeModeReference
The way to define the intensity range to be considered by the algorithm in the reference (fixed) image.SoSFEnum<SoImageRegistrationTransform.TransformationTypes>
transformType
Select the type of transform.-
Fields inherited from class com.openinventor.imageviz.engines.SoImageVizEngine
onBegin, onEnd, onProgress
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoImageRegistrationTransform()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SbMatrix
getOutputTransformation()
return the output transform matrix that aligns the model image to the reference image.-
Methods inherited from class com.openinventor.imageviz.engines.SoImageVizEngine
abortEvaluate, isEvaluating, startEvaluate, waitEvaluate
-
Methods inherited from class com.openinventor.inventor.engines.SoEngine
copy, getByName, getOutput, getOutputName
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
onProgressRegistration
public final SbEventHandler<SoImageRegistrationTransform.RegistrationEvent> onProgressRegistration
Specific event handler for registration.
-
computeMode
public final SoSFEnum<SoImageVizEngine.ComputeModes> computeMode
Select the compute Mode (2D or 3D or AUTO) . Default is MODE_AUTO
-
inMovingImage
public final SoSFImageDataAdapter inMovingImage
The input model image. Default value is NULL. Supported types include: grayscale binary label.
-
inFixedImage
public final SoSFImageDataAdapter inFixedImage
The input reference image. Default value is NULL. Supported types include: grayscale binary label.
-
initialTransform
public final SoSFMatrix initialTransform
The initial transformation that pre-aligns the model onto the reference. Default value isSbMatrix.identity()
. TheSoImagePreAlignmentTransform3d
engine can be used to compute an initial transform.
-
autoParameterMode
public final SoSFBool 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.
-
optimizerStep
public final SoSFVec2f 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 ) ).
-
intensityRangeReference
public final SoSFVec2f 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 ).- Since:
- Open Inventor 10.9
-
intensityRangeModel
public final SoSFVec2f 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_MAXDefault value is
SbVec2f
( 0.0f, 65535.0f ).- Since:
- Open Inventor 10.9
-
coarsestResampling
public final SoSFVec3i32 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 )
.
-
rangeModeReference
public final SoSFEnum<SoImageRegistrationTransform.RangeModes> rangeModeReference
The way to define the intensity range to be considered by the algorithm in the reference (fixed) image. Default is MIN_MAX- Since:
- Open Inventor 10.9
-
rangeModeModel
public final SoSFEnum<SoImageRegistrationTransform.RangeModes> rangeModeModel
The way to define the intensity range to be considered by the algorithm in the model (moving) image. Default is MIN_MAX- Since:
- Open Inventor 10.9
-
transformType
public final SoSFEnum<SoImageRegistrationTransform.TransformationTypes> transformType
Select the type of transform. . Default is RIGID
-
ignoreFinestLevel
public final SoSFBool ignoreFinestLevel
Skip the finest level of the pyramid. Default value is false.
-
metricType
public final SoSFEnum<SoImageRegistrationTransform.MetricTypes> metricType
Select the metric type. . Default is CORRELATION
-
outTransform
public final SoImageVizEngineOutput<SoSFFieldContainer,SoRegistrationResult> outTransform
Output structure storing registration results.
-
-
Method Detail
-
getOutputTransformation
public SbMatrix getOutputTransformation()
return the output transform matrix that aligns the model image to the reference image.
-
-