ResampleElastic2d
Resamples an image after applying a transformation described by a displacement field.
Access to parameter description
For an introduction: section Image Registration.
This algorithm generates a new image in accordance with the elastic transformation defined by a displacement field, for instance given by the ElasticRegistration2d algorithm.
This resampling can be performed by controlling several parameters such has the output resolution, calibration or the policy for filling undefined values.
Figure 1. Elastic resampling: (a) the image to resample (artificially distorted image),
(b) the displacement field magnitude, (c) the resampled image
See also
Access to parameter description
For an introduction: section Image Registration.
This algorithm generates a new image in accordance with the elastic transformation defined by a displacement field, for instance given by the ElasticRegistration2d algorithm.
This resampling can be performed by controlling several parameters such has the output resolution, calibration or the policy for filling undefined values.
(a) |
(b) |
(c) |
(b) the displacement field magnitude, (c) the resampled image
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > resampleElastic2d( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputDisplacementField, ResampleElastic2d::ExtrapolationType extrapolationType, ResampleElastic2d::InterpolationType interpolationType, iolink::Vector2d origin, iolink::Vector2d voxelSize, iolink::Vector2u32 imageDimensions, double paddingValue, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. resample_elastic_2d(input_image: idt.ImageType, input_displacement_field: idt.ImageType, extrapolation_type: ResampleElastic2d.ExtrapolationType = ResampleElastic2d.ExtrapolationType.PADDING_VALUE, interpolation_type: ResampleElastic2d.InterpolationType = ResampleElastic2d.InterpolationType.LINEAR, origin: Union[Iterable[int], Iterable[float]] = [0, 0], voxel_size: Union[Iterable[int], Iterable[float]] = [1, 1], image_dimensions: Iterable[int] = [100, 100], padding_value: float = 0, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView ResampleElastic2d( IOLink.ImageView inputImage, IOLink.ImageView inputDisplacementField, ResampleElastic2d.ExtrapolationType extrapolationType = ImageDev.ResampleElastic2d.ExtrapolationType.PADDING_VALUE, ResampleElastic2d.InterpolationType interpolationType = ImageDev.ResampleElastic2d.InterpolationType.LINEAR, double[] origin = null, double[] voxelSize = null, uint[] imageDimensions = null, double paddingValue = 0, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImage |
The grayscale input image to resample. It can have integer or floating point data type and several spectral channels. | Image | Grayscale | nullptr | |||||
inputDisplacementField |
The displacement field mapping the output pixels to the input pixels. It must have exactly two channels and 32-bit float data type. Each pixel of this image image contains two values: a displacement in the X direction (first channel) and one in the Y direction (second channel). | Image | Multispectral | nullptr | |||||
extrapolationType |
The type of extrapolation used to fill areas with no antecedent in the input image.
|
Enumeration | PADDING_VALUE | ||||||
interpolationType |
The type of interpolation used.
|
Enumeration | LINEAR | ||||||
origin |
The origin of the output image, in world coordinates. | Vector2d | Any value | {0.f, 0.f} | |||||
voxelSize |
The pixel size in world coordinates for the X and Y directions of the output image. | Vector2d | >0 | {1.f, 1.f} | |||||
imageDimensions |
The size in pixels of the output image in the X and Y directions. | Vector2u32 | != 0 | {100, 100} | |||||
paddingValue |
The padding value used to fill areas with no antecedent in the input image. This parameter is ignored if extrapolation type is not set to PADDING_VALUE. | Float64 | Any value | 0 | |||||
outputImage |
The resampled output image. Its resolution and bounding box are defined by the origin, voxelSize, and imageDimensions parameters. Its type is forced to floating point precision (32-bit). | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
input_image |
The grayscale input image to resample. It can have integer or floating point data type and several spectral channels. | image | Grayscale | None | |||||
input_displacement_field |
The displacement field mapping the output pixels to the input pixels. It must have exactly two channels and 32-bit float data type. Each pixel of this image image contains two values: a displacement in the X direction (first channel) and one in the Y direction (second channel). | image | Multispectral | None | |||||
extrapolation_type |
The type of extrapolation used to fill areas with no antecedent in the input image.
|
enumeration | PADDING_VALUE | ||||||
interpolation_type |
The type of interpolation used.
|
enumeration | LINEAR | ||||||
origin |
The origin of the output image, in world coordinates. | vector2d | Any value | [0, 0] | |||||
voxel_size |
The pixel size in world coordinates for the X and Y directions of the output image. | vector2d | >0 | [1, 1] | |||||
image_dimensions |
The size in pixels of the output image in the X and Y directions. | vector2u32 | != 0 | [100, 100] | |||||
padding_value |
The padding value used to fill areas with no antecedent in the input image. This parameter is ignored if extrapolation type is not set to PADDING_VALUE. | float64 | Any value | 0 | |||||
output_image |
The resampled output image. Its resolution and bounding box are defined by the origin, voxelSize, and imageDimensions parameters. Its type is forced to floating point precision (32-bit). | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImage |
The grayscale input image to resample. It can have integer or floating point data type and several spectral channels. | Image | Grayscale | null | |||||
inputDisplacementField |
The displacement field mapping the output pixels to the input pixels. It must have exactly two channels and 32-bit float data type. Each pixel of this image image contains two values: a displacement in the X direction (first channel) and one in the Y direction (second channel). | Image | Multispectral | null | |||||
extrapolationType |
The type of extrapolation used to fill areas with no antecedent in the input image.
|
Enumeration | PADDING_VALUE | ||||||
interpolationType |
The type of interpolation used.
|
Enumeration | LINEAR | ||||||
origin |
The origin of the output image, in world coordinates. | Vector2d | Any value | {0f, 0f} | |||||
voxelSize |
The pixel size in world coordinates for the X and Y directions of the output image. | Vector2d | >0 | {1f, 1f} | |||||
imageDimensions |
The size in pixels of the output image in the X and Y directions. | Vector2u32 | != 0 | {100, 100} | |||||
paddingValue |
The padding value used to fill areas with no antecedent in the input image. This parameter is ignored if extrapolation type is not set to PADDING_VALUE. | Float64 | Any value | 0 | |||||
outputImage |
The resampled output image. Its resolution and bounding box are defined by the origin, voxelSize, and imageDimensions parameters. Its type is forced to floating point precision (32-bit). | Image | null |
Object Examples
auto retina = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "retina.vip" ); auto retina_eigenvalues = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "retina_eigenvalues.vip" ); ResampleElastic2d resampleElastic2dAlgo; resampleElastic2dAlgo.setInputImage( retina ); resampleElastic2dAlgo.setInputDisplacementField( retina_eigenvalues ); resampleElastic2dAlgo.setExtrapolationType( ResampleElastic2d::ExtrapolationType::PADDING_VALUE ); resampleElastic2dAlgo.setInterpolationType( ResampleElastic2d::InterpolationType::LINEAR ); resampleElastic2dAlgo.setOrigin( {0.0, 0.0} ); resampleElastic2dAlgo.setVoxelSize( {1.0, 1.0} ); resampleElastic2dAlgo.setImageDimensions( {100, 100} ); resampleElastic2dAlgo.setPaddingValue( 0 ); resampleElastic2dAlgo.execute(); std::cout << "outputImage:" << resampleElastic2dAlgo.outputImage()->toString();
retina = imagedev.read_vip_image(imagedev_data.get_image_path("retina.vip")) retina_eigenvalues = imagedev.read_vip_image(imagedev_data.get_image_path("retina_eigenvalues.vip")) resample_elastic_2d_algo = imagedev.ResampleElastic2d() resample_elastic_2d_algo.input_image = retina resample_elastic_2d_algo.input_displacement_field = retina_eigenvalues resample_elastic_2d_algo.extrapolation_type = imagedev.ResampleElastic2d.PADDING_VALUE resample_elastic_2d_algo.interpolation_type = imagedev.ResampleElastic2d.LINEAR resample_elastic_2d_algo.origin = [0.0, 0.0] resample_elastic_2d_algo.voxel_size = [1.0, 1.0] resample_elastic_2d_algo.image_dimensions = [100, 100] resample_elastic_2d_algo.padding_value = 0 resample_elastic_2d_algo.execute() print("output_image:", str(resample_elastic_2d_algo.output_image))
ImageView retina = Data.ReadVipImage( @"Data/images/retina.vip" ); ImageView retina_eigenvalues = Data.ReadVipImage( @"Data/images/retina_eigenvalues.vip" ); ResampleElastic2d resampleElastic2dAlgo = new ResampleElastic2d { inputImage = retina, inputDisplacementField = retina_eigenvalues, extrapolationType = ResampleElastic2d.ExtrapolationType.PADDING_VALUE, interpolationType = ResampleElastic2d.InterpolationType.LINEAR, origin = new double[]{0.0, 0.0}, voxelSize = new double[]{1.0, 1.0}, imageDimensions = new uint[]{100, 100}, paddingValue = 0 }; resampleElastic2dAlgo.Execute(); Console.WriteLine( "outputImage:" + resampleElastic2dAlgo.outputImage.ToString() );
Function Examples
auto retina = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "retina.vip" ); auto retina_eigenvalues = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "retina_eigenvalues.vip" ); auto result = resampleElastic2d( retina, retina_eigenvalues, ResampleElastic2d::ExtrapolationType::PADDING_VALUE, ResampleElastic2d::InterpolationType::LINEAR, {0.0, 0.0}, {1.0, 1.0}, {100, 100}, 0 ); std::cout << "outputImage:" << result->toString();
retina = imagedev.read_vip_image(imagedev_data.get_image_path("retina.vip")) retina_eigenvalues = imagedev.read_vip_image(imagedev_data.get_image_path("retina_eigenvalues.vip")) result = imagedev.resample_elastic_2d(retina, retina_eigenvalues, imagedev.ResampleElastic2d.PADDING_VALUE, imagedev.ResampleElastic2d.LINEAR, [0.0, 0.0], [1.0, 1.0], [100, 100], 0) print("output_image:", str(result))
ImageView retina = Data.ReadVipImage( @"Data/images/retina.vip" ); ImageView retina_eigenvalues = Data.ReadVipImage( @"Data/images/retina_eigenvalues.vip" ); IOLink.ImageView result = Processing.ResampleElastic2d( retina, retina_eigenvalues, ResampleElastic2d.ExtrapolationType.PADDING_VALUE, ResampleElastic2d.InterpolationType.LINEAR, new double[]{0.0, 0.0}, new double[]{1.0, 1.0}, new uint[]{100, 100}, 0 ); Console.WriteLine( "outputImage:" + result.ToString() );