ImageDev

RescaleByFactor

Rescales the dimensions of a two-dimensional or three-dimensional image.

Access to parameter description

This algorithm generates a resampled image in accordance with a user-defined scale factor and interpolation mode.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > rescaleByFactor( std::shared_ptr< iolink::ImageView > inputImage, double scale, RescaleByFactor::InterpolationType interpolationType, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
rescale_by_factor(input_image: idt.ImageType,
                  scale: float = 2,
                  interpolation_type: RescaleByFactor.InterpolationType = RescaleByFactor.InterpolationType.NEAREST_NEIGHBOR,
                  output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
RescaleByFactor( IOLink.ImageView inputImage,
                 double scale = 2,
                 RescaleByFactor.InterpolationType interpolationType = ImageDev.RescaleByFactor.InterpolationType.NEAREST_NEIGHBOR,
                 IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
scale
The zoom factor. Float64 >=0.0001 2
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 on a two-dimensional image or from the eight nearest pixels on a three-dimensional image.
Enumeration NEAREST_NEIGHBOR
output
outputImage
The output image. Its type is forced to the same value as the input. Its dimensions depend on the scale factor parameter. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. image Binary, Label, Grayscale or Multispectral None
input
scale
The zoom factor. float64 >=0.0001 2
input
interpolation_type
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 on a two-dimensional image or from the eight nearest pixels on a three-dimensional image.
enumeration NEAREST_NEIGHBOR
output
output_image
The output image. Its type is forced to the same value as the input. Its dimensions depend on the scale factor parameter. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral null
input
scale
The zoom factor. Float64 >=0.0001 2
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 on a two-dimensional image or from the eight nearest pixels on a three-dimensional image.
Enumeration NEAREST_NEIGHBOR
output
outputImage
The output image. Its type is forced to the same value as the input. Its dimensions depend on the scale factor parameter. Image null

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

RescaleByFactor rescaleByFactorAlgo;
rescaleByFactorAlgo.setInputImage( foam );
rescaleByFactorAlgo.setScale( 2.0 );
rescaleByFactorAlgo.setInterpolationType( RescaleByFactor::InterpolationType::NEAREST_NEIGHBOR );
rescaleByFactorAlgo.execute();

std::cout << "outputImage:" << rescaleByFactorAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

rescale_by_factor_algo = imagedev.RescaleByFactor()
rescale_by_factor_algo.input_image = foam
rescale_by_factor_algo.scale = 2.0
rescale_by_factor_algo.interpolation_type = imagedev.RescaleByFactor.NEAREST_NEIGHBOR
rescale_by_factor_algo.execute()

print("output_image:", str(rescale_by_factor_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

RescaleByFactor rescaleByFactorAlgo = new RescaleByFactor
{
    inputImage = foam,
    scale = 2.0,
    interpolationType = RescaleByFactor.InterpolationType.NEAREST_NEIGHBOR
};
rescaleByFactorAlgo.Execute();

Console.WriteLine( "outputImage:" + rescaleByFactorAlgo.outputImage.ToString() );

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = rescaleByFactor( foam, 2.0, RescaleByFactor::InterpolationType::NEAREST_NEIGHBOR );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.rescale_by_factor(foam, 2.0, imagedev.RescaleByFactor.NEAREST_NEIGHBOR)

print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.RescaleByFactor( foam, 2.0, RescaleByFactor.InterpolationType.NEAREST_NEIGHBOR );

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





© 2025 Thermo Fisher Scientific Inc. All rights reserved.