ImageDev

RescaleImage2d

Generates a two-dimensional image with a new size using a user-defined interpolation mode.

Access to parameter description

This command is deprecated, it will be removed in ImageDev 2024.2.
You can use Resize2d instead.

This algorithm resamples a 2D image to generate a new image with a different size by applying a user-defined interpolation mode.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > rescaleImage2d( std::shared_ptr< iolink::ImageView > inputImage, int32_t imageSizeX, int32_t imageSizeY, RescaleImage2d::InterpolationType interpolationType, std::shared_ptr< iolink::ImageView > outputImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
imageSizeX
The X size of the new image, in pixels. Int32 >=1 1024
input
imageSizeY
The Y size of the new image, in pixels. Int32 >=1 1024
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
interpolationType
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
NEAREST_NEIGHBOR Assign the gray level of the nearest pixel.
LINEAR Assign the bilinear interpolation from the four nearest pixels.
SPLINE Assign the cubic interpolation from the nearest pixels.
Enumeration NEAREST_NEIGHBOR
output
outputImage
The output image. Its type is forced to the same value as the input. Its dimensions depend on the image size parameters. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

RescaleImage2d rescaleImage2dAlgo;
rescaleImage2dAlgo.setInputImage( polystyrene );
rescaleImage2dAlgo.setImageSizeX( 256 );
rescaleImage2dAlgo.setImageSizeY( 256 );
rescaleImage2dAlgo.setInterpolationType( RescaleImage2d::InterpolationType::NEAREST_NEIGHBOR );
rescaleImage2dAlgo.execute();

std::cout << "outputImage:" << rescaleImage2dAlgo.outputImage()->toString();

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = rescaleImage2d( polystyrene, 256, 256, RescaleImage2d::InterpolationType::NEAREST_NEIGHBOR );

std::cout << "outputImage:" << result->toString();