ImageDev

SampleImage3d

Performs a subsampling of a three-dimensional image.

Access to parameter description

The SampleImage3d algorithm subsamples an image by an integer factor for the X, Y, and Z coordinates. For example, specifying integer factors of 4, 8 and 2 generates an output image retaining the value of one voxel out of four in the X axis direction, one out of eight in the Y axis direction, and one out of two in the Z axis direction.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > sampleImage3d( std::shared_ptr< iolink::ImageView > inputImage, int32_t sampleFactorX, int32_t sampleFactorY, int32_t sampleFactorZ, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
sample_image_3d( input_image,
                 sample_factor_x = 2,
                 sample_factor_y = 2,
                 sample_factor_z = 2,
                 output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
SampleImage3d( IOLink.ImageView inputImage,
               Int32 sampleFactorX = 2,
               Int32 sampleFactorY = 2,
               Int32 sampleFactorZ = 2,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name SampleImage3d

Parameter Name Description Type Supported Values Default Value
input
sampleFactorX
The X axis sampling factor. Int32 >=1 2
input
sampleFactorY
The Y axis sampling factor. Int32 >=1 2
input
sampleFactorZ
The Z axis sampling factor. Int32 >=1 2
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
output
outputImage
The output image. Its dimensions are equal to the input image dimensions divided by the sampling factor in each direction. Image nullptr

Object Examples

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

SampleImage3d sampleImage3dAlgo;
sampleImage3dAlgo.setInputImage( foam );
sampleImage3dAlgo.setSampleFactorX( 2 );
sampleImage3dAlgo.setSampleFactorY( 2 );
sampleImage3dAlgo.setSampleFactorZ( 2 );
sampleImage3dAlgo.execute();

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

sample_image_3d_algo = imagedev.SampleImage3d()
sample_image_3d_algo.input_image = foam
sample_image_3d_algo.sample_factor_x = 2
sample_image_3d_algo.sample_factor_y = 2
sample_image_3d_algo.sample_factor_z = 2
sample_image_3d_algo.execute()

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

SampleImage3d sampleImage3dAlgo = new SampleImage3d
{
    inputImage = foam,
    sampleFactorX = 2,
    sampleFactorY = 2,
    sampleFactorZ = 2
};
sampleImage3dAlgo.Execute();

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

Function Examples

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

auto result = sampleImage3d( foam, 2, 2, 2 );

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

result = imagedev.sample_image_3d( foam, 2, 2, 2 )

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

IOLink.ImageView result = Processing.SampleImage3d( foam, 2, 2, 2 );

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