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 the outputTransform output parameter.
// Function prototype.
iolink::Matrix4d
imagePrealignment3d( std::shared_ptr< iolink::ImageView > inputMovingImage,
                     std::shared_ptr< iolink::ImageView > inputFixedImage,
                     ImagePrealignment3d::AlignmentMode alignmentMode );
This function returns the outputTransform output parameter.
// Function prototype.
image_prealignment_3d( input_moving_image,
                       input_fixed_image,
                       alignment_mode = ImagePrealignment3d.AlignmentMode.CENTERS )
This function returns the outputTransform output parameter.
// Function prototype.
public static IOLink.Matrix4d
ImagePrealignment3d( IOLink.ImageView inputMovingImage,
                     IOLink.ImageView inputFixedImage,
                     ImagePrealignment3d.AlignmentMode alignmentMode = ImageDev.ImagePrealignment3d.AlignmentMode.CENTERS );

Class Syntax

Parameters

Class Name ImagePrealignment3d

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

Object Examples

std::shared_ptr< iolink::ImageView > 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

std::shared_ptr< iolink::ImageView > 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() );