ImageDev

CudaClosing2d

Performs a two-dimensional closing 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: This algorithm successively runs a Dilation2d and an Erosion2d with the same kernel.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > cudaClosing2d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, CudaClosing2d::Neighborhood neighborhood, CudaContext::Ptr cudaContext, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
cuda_closing_2d( input_image,
                 kernel_radius = 3,
                 neighborhood = CudaClosing2d.Neighborhood.CONNECTIVITY_8,
                 cuda_context = None,
                 output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
CudaClosing2d( IOLink.ImageView inputImage,
               UInt32 kernelRadius = 3,
               CudaClosing2d.Neighborhood neighborhood = ImageDev.CudaClosing2d.Neighborhood.CONNECTIVITY_8,
               Data.CudaContext cudaContext = null,
               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
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. The image type can be integer or float. image Binary, Label, Grayscale or Multispectral None
input
kernel_radius
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
cuda_context
CUDA context information. cuda_context None
output
output_image
The output image. Its dimensions and type are forced to the same values as the input image. image None
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 null
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 null
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input image. Image null

Object Examples

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

CudaClosing2d cudaClosing2dAlgo;
cudaClosing2dAlgo.setInputImage( polystyrene );
cudaClosing2dAlgo.setKernelRadius( 3 );
cudaClosing2dAlgo.setNeighborhood( CudaClosing2d::Neighborhood::CONNECTIVITY_8 );
cudaClosing2dAlgo.setCudaContext( nullptr );
cudaClosing2dAlgo.execute();

std::cout << "outputImage:" << cudaClosing2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

cuda_closing_2d_algo = imagedev.CudaClosing2d()
cuda_closing_2d_algo.input_image = polystyrene
cuda_closing_2d_algo.kernel_radius = 3
cuda_closing_2d_algo.neighborhood = imagedev.CudaClosing2d.CONNECTIVITY_8
cuda_closing_2d_algo.cuda_context = None
cuda_closing_2d_algo.execute()

print( "output_image:", str( cuda_closing_2d_algo.output_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

CudaClosing2d cudaClosing2dAlgo = new CudaClosing2d
{
    inputImage = polystyrene,
    kernelRadius = 3,
    neighborhood = CudaClosing2d.Neighborhood.CONNECTIVITY_8,
    cudaContext = null
};
cudaClosing2dAlgo.Execute();

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

Function Examples

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

auto result = cudaClosing2d( polystyrene, 3, CudaClosing2d::Neighborhood::CONNECTIVITY_8, nullptr );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.cuda_closing_2d( polystyrene, 3, imagedev.CudaClosing2d.CONNECTIVITY_8, None )

print( "output_image:", str( result ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.ImageView result = Processing.CudaClosing2d( polystyrene, 3, CudaClosing2d.Neighborhood.CONNECTIVITY_8, null );

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