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 );

Class Syntax

Parameters

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();

Function Examples

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

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

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