ImageDev

ImagePrealignment3d

Estimates a transformation (translation and rotation) that roughly aligns a moving image with a fixed image based on their intensity values.

Access to parameter description

This estimate can be used as the initial transformation of the AffineRegistration algorithm.

ImagePrealignment3d first computes the centers of gravity and (optionally) the moments of inertia of both images (model and reference) using the image intensity.
In a second step, the translation and the rotation that align the centers of gravity and the principal axes (corresponding to the principal moments of inertia) of both images are estimated.

Notices: See also

Function Syntax

This function returns outputTransform.
// Function prototype
iolink::Matrix4d imagePrealignment3d( std::shared_ptr< iolink::ImageView > inputMovingImage, std::shared_ptr< iolink::ImageView > inputFixedImage, ImagePrealignment3d::AlignmentMode alignmentMode );
This function returns outputTransform.
// Function prototype.
image_prealignment_3d(input_moving_image: idt.ImageType,
                      input_fixed_image: idt.ImageType,
                      alignment_mode: ImagePrealignment3d.AlignmentMode = ImagePrealignment3d.AlignmentMode.CENTERS) -> Union[idt.NDArrayFloat, None]
This function returns outputTransform.
// Function prototype.
public static IOLink.Matrix4d
ImagePrealignment3d( IOLink.ImageView inputMovingImage,
                     IOLink.ImageView inputFixedImage,
                     ImagePrealignment3d.AlignmentMode alignmentMode = ImageDev.ImagePrealignment3d.AlignmentMode.CENTERS );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputMovingImage
The input moving image, also known as the model image. Image Grayscale nullptr
input
inputFixedImage
The input fixed image, also known as the reference image. Image Grayscale nullptr
input
alignmentMode
The type of prealignment to perform.
CENTERS In this mode, the centers of gravity of the input images are aligned.
PRINCIPAL_AXES In this mode, the centers of gravity and the principal axes of the input images are aligned.
Enumeration CENTERS
output
outputTransform
The output transformation prealigning both input data sets (a 4x4 matrix). Matrix4d IDENTITY
Parameter Name Description Type Supported Values Default Value
input
input_moving_image
The input moving image, also known as the model image. image Grayscale None
input
input_fixed_image
The input fixed image, also known as the reference image. image Grayscale None
input
alignment_mode
The type of prealignment to perform.
CENTERS In this mode, the centers of gravity of the input images are aligned.
PRINCIPAL_AXES In this mode, the centers of gravity and the principal axes of the input images are aligned.
enumeration CENTERS
output
output_transform
The output transformation prealigning both input data sets (a 4x4 matrix). matrix _np.identity(4)
Parameter Name Description Type Supported Values Default Value
input
inputMovingImage
The input moving image, also known as the model image. Image Grayscale null
input
inputFixedImage
The input fixed image, also known as the reference image. Image Grayscale null
input
alignmentMode
The type of prealignment to perform.
CENTERS In this mode, the centers of gravity of the input images are aligned.
PRINCIPAL_AXES In this mode, the centers of gravity and the principal axes of the input images are aligned.
Enumeration CENTERS
output
outputTransform
The output transformation prealigning both input data sets (a 4x4 matrix). Matrix4d IDENTITY

Object Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

ImagePrealignment3d imagePrealignment3dAlgo;
imagePrealignment3dAlgo.setInputMovingImage( polystyrene );
imagePrealignment3dAlgo.setInputFixedImage( polystyrene );
imagePrealignment3dAlgo.setAlignmentMode( ImagePrealignment3d::AlignmentMode::CENTERS );
imagePrealignment3dAlgo.execute();

std::cout << "outputTransform:" << imagePrealignment3dAlgo.outputTransform().toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

image_prealignment_3d_algo = imagedev.ImagePrealignment3d()
image_prealignment_3d_algo.input_moving_image = polystyrene
image_prealignment_3d_algo.input_fixed_image = polystyrene
image_prealignment_3d_algo.alignment_mode = imagedev.ImagePrealignment3d.CENTERS
image_prealignment_3d_algo.execute()

print("output_transform:", str(image_prealignment_3d_algo.output_transform))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

ImagePrealignment3d imagePrealignment3dAlgo = new ImagePrealignment3d
{
    inputMovingImage = polystyrene,
    inputFixedImage = polystyrene,
    alignmentMode = ImagePrealignment3d.AlignmentMode.CENTERS
};
imagePrealignment3dAlgo.Execute();

Console.WriteLine( "outputTransform:" + imagePrealignment3dAlgo.outputTransform.ToString() );

Function Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = imagePrealignment3d( polystyrene, polystyrene, ImagePrealignment3d::AlignmentMode::CENTERS );

std::cout << "outputTransform:" << result.toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.image_prealignment_3d(polystyrene, polystyrene, imagedev.ImagePrealignment3d.CENTERS)

print("output_transform:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.Matrix4d result = Processing.ImagePrealignment3d( polystyrene, polystyrene, ImagePrealignment3d.AlignmentMode.CENTERS );

Console.WriteLine( "outputTransform:" + result.ToString() );