ImageDev

RescaleImage3d

Generates a three-dimensional image with a new size 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.

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
rescaleImage3d( std::shared_ptr< iolink::ImageView > inputImage,
                int32_t imageSizeX,
                int32_t imageSizeY,
                int32_t imageSizeZ,
                RescaleImage3d::InterpolationType interpolationType,
                std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
rescale_image_3d( input_image,
                  image_size_x = 1024,
                  image_size_y = 1024,
                  image_size_z = 256,
                  interpolation_type = RescaleImage3d.InterpolationType.NEAREST_NEIGHBOR,
                  output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
RescaleImage3d( IOLink.ImageView inputImage,
                Int32 imageSizeX = 1024,
                Int32 imageSizeY = 1024,
                Int32 imageSizeZ = 256,
                RescaleImage3d.InterpolationType interpolationType = ImageDev.RescaleImage3d.InterpolationType.NEAREST_NEIGHBOR,
                IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name RescaleImage3d

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
imageSizeZ
The Z size of the new image, in pixels. Int32 >=1 256
input
inputImage
The input grayscale image. Image Binary, Label, Grayscale or Multispectral nullptr
input
interpolationType
The interpolation mode. Method used to calculate the intensity of each result pixel
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

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

RescaleImage3d rescaleImage3dAlgo;
rescaleImage3dAlgo.setInputImage( foam );
rescaleImage3dAlgo.setImageSizeX( 128 );
rescaleImage3dAlgo.setImageSizeY( 128 );
rescaleImage3dAlgo.setImageSizeZ( 128 );
rescaleImage3dAlgo.setInterpolationType( RescaleImage3d::InterpolationType::NEAREST_NEIGHBOR );
rescaleImage3dAlgo.execute();

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

rescale_image_3d_algo = imagedev.RescaleImage3d()
rescale_image_3d_algo.input_image = foam
rescale_image_3d_algo.image_size_x = 128
rescale_image_3d_algo.image_size_y = 128
rescale_image_3d_algo.image_size_z = 128
rescale_image_3d_algo.interpolation_type = imagedev.RescaleImage3d.NEAREST_NEIGHBOR
rescale_image_3d_algo.execute()

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

RescaleImage3d rescaleImage3dAlgo = new RescaleImage3d
{
    inputImage = foam,
    imageSizeX = 128,
    imageSizeY = 128,
    imageSizeZ = 128,
    interpolationType = RescaleImage3d.InterpolationType.NEAREST_NEIGHBOR
};
rescaleImage3dAlgo.Execute();

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

Function Examples

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

auto result = rescaleImage3d( foam, 128, 128, 128, RescaleImage3d::InterpolationType::NEAREST_NEIGHBOR );

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

result = imagedev.rescale_image_3d( foam, 128, 128, 128, imagedev.RescaleImage3d.NEAREST_NEIGHBOR )

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

IOLink.ImageView result = Processing.RescaleImage3d( foam, 128, 128, 128, RescaleImage3d.InterpolationType.NEAREST_NEIGHBOR );

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