CudaOpening2d
Performs a two-dimensional opening using a structuring element matching with a square or a cross. The calculations are performed on the GPU.
Access to parameter description
This command is experimental, his signature may be modified between now and his final version.
For an introduction:
See also
Access to parameter description
This command is experimental, his signature may be modified between now and his final version.
For an introduction:
- section Mathematical Morphology
- section Introduction To Opening
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > cudaOpening2d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, CudaOpening2d::Neighborhood neighborhood, CudaOpening2d::TilingMode tilingMode, iolink::Vector2u32 tileSize, CudaContext::Ptr cudaContext, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. The image type can be integer or float. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||
![]() |
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 | ||||
![]() |
neighborhood |
The 2D neighborhood configuration.
|
Enumeration | CONNECTIVITY_8 | |||||
![]() |
tilingMode |
The way to manage the GPU memory.
|
Enumeration | NONE | |||||
![]() |
tileSize |
The tile width and height in pixels. This parameter is used only in USER_DEFINED tiling mode. | Vector2u32 | >=5 | {1024, 1024} | ||||
![]() |
cudaContext |
CUDA context information. | CudaContext | nullptr | |||||
![]() |
outputImage |
The output image. Its dimensions and type are forced to the same values as the input image. | Image | nullptr |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); CudaOpening2d cudaOpening2dAlgo; cudaOpening2dAlgo.setInputImage( polystyrene ); cudaOpening2dAlgo.setKernelRadius( 3 ); cudaOpening2dAlgo.setNeighborhood( CudaOpening2d::Neighborhood::CONNECTIVITY_8 ); cudaOpening2dAlgo.setTilingMode( CudaOpening2d::TilingMode::NONE ); cudaOpening2dAlgo.setTileSize( {264, 264} ); cudaOpening2dAlgo.setCudaContext( nullptr ); cudaOpening2dAlgo.setOutputImage( iolink::ImageViewFactory::allocate( iolink::VectorXu64( { 1, 1 } ), iolink::DataTypeId::UINT8 ) ); cudaOpening2dAlgo.execute(); std::cout << "outputImage:" << cudaOpening2dAlgo.outputImage()->toString();
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = cudaOpening2d( polystyrene, 3, CudaOpening2d::Neighborhood::CONNECTIVITY_8, CudaOpening2d::TilingMode::NONE, {264, 264}, nullptr , iolink::ImageViewFactory::allocate( iolink::VectorXu64( { 1, 1 } ), iolink::DataTypeId::UINT8 )); std::cout << "outputImage:" << result->toString();