ResizeWithRatio3d
Generates a three-dimensional image with a new size preserving the input aspect ratio using a user-defined interpolation mode.
Access to parameter description
This algorithm resamples a 3D image to generate a new image with a different size by applying a user-defined interpolation mode. If the scaling factor is not the same for all axes, the image is padded to maintain the aspect ratio without changing the position of input pixels in the 3D space.
See also
Access to parameter description
This algorithm resamples a 3D image to generate a new image with a different size by applying a user-defined interpolation mode. If the scaling factor is not the same for all axes, the image is padded to maintain the aspect ratio without changing the position of input pixels in the 3D space.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > resizeWithRatio3d( std::shared_ptr< iolink::ImageView > inputImage, const iolink::Vector3i32& shape, ResizeWithRatio3d::InterpolationType interpolationType, double paddingValue, bool preserveCalibration, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
resize_with_ratio_3d(input_image: idt.ImageType,
shape: Iterable[int] = [512, 512, 512],
interpolation_type: Union[Literal["NEAREST_NEIGHBOR"],Literal["LINEAR"],ResizeWithRatio3d.InterpolationType] = ResizeWithRatio3d.InterpolationType.NEAREST_NEIGHBOR,
padding_value: float = 0,
preserve_calibration: bool = False,
output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
ResizeWithRatio3d( IOLink.ImageView inputImage,
int[] shape = null,
ResizeWithRatio3d.InterpolationType interpolationType = ImageDev.ResizeWithRatio3d.InterpolationType.NEAREST_NEIGHBOR,
double paddingValue = 0,
bool preserveCalibration = false,
IOLink.ImageView outputImage = null );
Class Syntax
Parameters
| Parameter Name | Description | Type | Supported Values | Default Value | |||||
|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||
![]() |
shape |
The X, Y and Z size of the new image, in pixels. | Vector3i32 | >0 | {512, 512, 512} | ||||
![]() |
interpolationType |
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
|
Enumeration | NEAREST_NEIGHBOR | |||||
![]() |
paddingValue |
Specifies the output value if an output pixel position is outside the bounding box of the input image. | Float64 | Any value | 0 | ||||
![]() |
preserveCalibration |
Defines how is managed the calibration.
If set to true the calibration is not changed. When displaying the image with respect of the calibration, if the shape is greater than the input shape, the image appears larger than initially. If set to false, the calibration is adapted respectively to the ratio between the input and output shapes. |
Bool | false | |||||
![]() |
outputImage |
The output image. Its type is forced to the same value as the input. Its dimensions are defined by the shape parameter. | Image | nullptr | |||||
| Parameter Name | Description | Type | Supported Values | Default Value | |||||
|---|---|---|---|---|---|---|---|---|---|
![]() |
input_image |
The input image. | image | Binary, Label, Grayscale or Multispectral | None | ||||
![]() |
shape |
The X, Y and Z size of the new image, in pixels. | vector3i32 | >0 | [512, 512, 512] | ||||
![]() |
interpolation_type |
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
|
enumeration | NEAREST_NEIGHBOR | |||||
![]() |
padding_value |
Specifies the output value if an output pixel position is outside the bounding box of the input image. | float64 | Any value | 0 | ||||
![]() |
preserve_calibration |
Defines how is managed the calibration.
If set to true the calibration is not changed. When displaying the image with respect of the calibration, if the shape is greater than the input shape, the image appears larger than initially. If set to false, the calibration is adapted respectively to the ratio between the input and output shapes. |
bool | False | |||||
![]() |
output_image |
The output image. Its type is forced to the same value as the input. Its dimensions are defined by the shape parameter. | image | None | |||||
| Parameter Name | Description | Type | Supported Values | Default Value | |||||
|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | null | ||||
![]() |
shape |
The X, Y and Z size of the new image, in pixels. | Vector3i32 | >0 | {512, 512, 512} | ||||
![]() |
interpolationType |
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
|
Enumeration | NEAREST_NEIGHBOR | |||||
![]() |
paddingValue |
Specifies the output value if an output pixel position is outside the bounding box of the input image. | Float64 | Any value | 0 | ||||
![]() |
preserveCalibration |
Defines how is managed the calibration.
If set to true the calibration is not changed. When displaying the image with respect of the calibration, if the shape is greater than the input shape, the image appears larger than initially. If set to false, the calibration is adapted respectively to the ratio between the input and output shapes. |
Bool | false | |||||
![]() |
outputImage |
The output image. Its type is forced to the same value as the input. Its dimensions are defined by the shape parameter. | Image | null | |||||
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );
ResizeWithRatio3d resizeWithRatio3dAlgo;
resizeWithRatio3dAlgo.setInputImage( foam );
resizeWithRatio3dAlgo.setShape( {512, 256, 60} );
resizeWithRatio3dAlgo.setInterpolationType( ResizeWithRatio3d::InterpolationType::NEAREST_NEIGHBOR );
resizeWithRatio3dAlgo.setPaddingValue( 5 );
resizeWithRatio3dAlgo.setPreserveCalibration( true );
resizeWithRatio3dAlgo.execute();
std::cout << "outputImage:" << resizeWithRatio3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
resize_with_ratio_3d_algo = imagedev.ResizeWithRatio3d()
resize_with_ratio_3d_algo.input_image = foam
resize_with_ratio_3d_algo.shape = [512, 256, 60]
resize_with_ratio_3d_algo.interpolation_type = imagedev.ResizeWithRatio3d.NEAREST_NEIGHBOR
resize_with_ratio_3d_algo.padding_value = 5
resize_with_ratio_3d_algo.preserve_calibration = True
resize_with_ratio_3d_algo.execute()
print("output_image:", str(resize_with_ratio_3d_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );
ResizeWithRatio3d resizeWithRatio3dAlgo = new ResizeWithRatio3d
{
inputImage = foam,
shape = new int[]{512, 256, 60},
interpolationType = ResizeWithRatio3d.InterpolationType.NEAREST_NEIGHBOR,
paddingValue = 5,
preserveCalibration = true
};
resizeWithRatio3dAlgo.Execute();
Console.WriteLine( "outputImage:" + resizeWithRatio3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );
auto result = resizeWithRatio3d( foam, {512, 256, 60}, ResizeWithRatio3d::InterpolationType::NEAREST_NEIGHBOR, 5, true );
std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
result = imagedev.resize_with_ratio_3d(foam, [512, 256, 60], imagedev.ResizeWithRatio3d.NEAREST_NEIGHBOR, 5, True)
print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );
IOLink.ImageView result = Processing.ResizeWithRatio3d( foam, new int[]{512, 256, 60}, ResizeWithRatio3d.InterpolationType.NEAREST_NEIGHBOR, 5, true );
Console.WriteLine( "outputImage:" + result.ToString() );
© 2026 Thermo Fisher Scientific Inc. All rights reserved.

