ImageDev

CudaDilation2d

Performs a two-dimensional dilation using a structuring element matching with a square or a cross.

Access to parameter description

This command is experimental, his signature may be modified between now and his final version.

For an introduction: The dilation is performed by an iterative method in which each step dilates the result of the previous step. The kernelRadius parameter tunes the number of iterations, which sets the kernel size.
This algorithm uses a basic structuring element with either 8 neighbors, or 4 neighbors, according to the neighborhood parameter.

<b> Figure 1.</b> Structuring elements
Figure 1. Structuring elements
See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > cudaDilation2d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, CudaDilation2d::Neighborhood neighborhood, CudaContext::Ptr cudaContext, std::shared_ptr< iolink::ImageView > outputImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. The image type can be integer or float. Image Binary, Label, Grayscale or Multispectral nullptr
input
kernelRadius
The number of iterations (the half size of the structuring element, in pixels). A square structuring element always has an odd side length (3x3, 5x5, etc.) which is defined by twice the kernel radius + 1. UInt32 >=1 3
input
neighborhood
The 2D neighborhood configuration.
CONNECTIVITY_4 The structuring element is a cross.
CONNECTIVITY_8 The structuring element is a square.
Enumeration CONNECTIVITY_8
input
cudaContext
CUDA context information. CudaContext nullptr
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input image. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

CudaDilation2d cudaDilation2dAlgo;
cudaDilation2dAlgo.setInputImage( polystyrene );
cudaDilation2dAlgo.setKernelRadius( 3 );
cudaDilation2dAlgo.setNeighborhood( CudaDilation2d::Neighborhood::CONNECTIVITY_8 );
cudaDilation2dAlgo.setCudaContext( nullptr );
cudaDilation2dAlgo.execute();

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

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = cudaDilation2d( polystyrene, 3, CudaDilation2d::Neighborhood::CONNECTIVITY_8, nullptr );

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