Opening3d
Performs a three-dimensional opening using a structuring element matching with a with a full or partial cube.
Access to parameter description
For an introduction:
The kernelRadius parameter tunes the number of iterations of each operation, which sets the kernel size.
This algorithm uses a basic structuring element with 6, 18 or 26 neighbors, according to the neighborhood parameter.
Figure 1. Structuring elements: 6, 18 and 26 neighbors
With a classic implementation, morphological opening systematically considers areas out of the image as a replication of the image borders at each step of the algorithm. Therefore, when applying an opening, some thin object parts cut by the image borders may be removed at the erosion step and not be restored after the dilation, while one would expect to keep them. The borderPolicy parameter manages this case. The default mode, LIMITED, corresponds to the classic behavior. The EXTENDED mode properly manages image borders by extending them by a size equal to the structuring element's. Therefore, this mode can be slower and more memory consuming, especially when the structuring element size is high.
This option is illustrated in the Opening2d documentation (Figure 2).
See also
Access to parameter description
For an introduction:
- section Mathematical Morphology
- section Introduction To Opening
The kernelRadius parameter tunes the number of iterations of each operation, which sets the kernel size.
This algorithm uses a basic structuring element with 6, 18 or 26 neighbors, according to the neighborhood parameter.
Figure 1. Structuring elements: 6, 18 and 26 neighbors
With a classic implementation, morphological opening systematically considers areas out of the image as a replication of the image borders at each step of the algorithm. Therefore, when applying an opening, some thin object parts cut by the image borders may be removed at the erosion step and not be restored after the dilation, while one would expect to keep them. The borderPolicy parameter manages this case. The default mode, LIMITED, corresponds to the classic behavior. The EXTENDED mode properly manages image borders by extending them by a size equal to the structuring element's. Therefore, this mode can be slower and more memory consuming, especially when the structuring element size is high.
This option is illustrated in the Opening2d documentation (Figure 2).
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > opening3d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, Opening3d::Neighborhood neighborhood, Opening3d::BorderPolicy borderPolicy, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype. opening_3d( input_image, kernel_radius = 3, neighborhood = Opening3d.Neighborhood.CONNECTIVITY_26, border_policy = Opening3d.BorderPolicy.LIMITED, output_image = None )
This function returns outputImage.
// Function prototype. public static IOLink.ImageView Opening3d( IOLink.ImageView inputImage, UInt32 kernelRadius = 3, Opening3d.Neighborhood neighborhood = ImageDev.Opening3d.Neighborhood.CONNECTIVITY_26, Opening3d.BorderPolicy borderPolicy = ImageDev.Opening3d.BorderPolicy.LIMITED, IOLink.ImageView outputImage = null );
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 | |||||||
borderPolicy |
The border policy to apply.
|
Enumeration | LIMITED | ||||||||
kernelRadius |
The number of iterations (the half size of the structuring element, in voxels). A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1. | UInt32 | >=1 | 3 | |||||||
neighborhood |
The 3D neighborhood configuration.
|
Enumeration | CONNECTIVITY_26 | ||||||||
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_image |
The input image. The image type can be integer or float. | image | Binary, Label, Grayscale or Multispectral | None | |||||||
border_policy |
The border policy to apply.
|
enumeration | LIMITED | ||||||||
kernel_radius |
The number of iterations (the half size of the structuring element, in voxels). A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1. | uint32 | >=1 | 3 | |||||||
neighborhood |
The 3D neighborhood configuration.
|
enumeration | CONNECTIVITY_26 | ||||||||
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 | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
inputImage |
The input image. The image type can be integer or float. | Image | Binary, Label, Grayscale or Multispectral | null | |||||||
borderPolicy |
The border policy to apply.
|
Enumeration | LIMITED | ||||||||
kernelRadius |
The number of iterations (the half size of the structuring element, in voxels). A cube structuring element always has an odd side length (3x3x3, 5x5x5, etc.) which is defined by twice the kernel radius + 1. | UInt32 | >=1 | 3 | |||||||
neighborhood |
The 3D neighborhood configuration.
|
Enumeration | CONNECTIVITY_26 | ||||||||
outputImage |
The output image. Its dimensions and type are forced to the same values as the input image. | Image | null |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); Opening3d opening3dAlgo; opening3dAlgo.setInputImage( foam ); opening3dAlgo.setKernelRadius( 3 ); opening3dAlgo.setNeighborhood( Opening3d::Neighborhood::CONNECTIVITY_26 ); opening3dAlgo.setBorderPolicy( Opening3d::BorderPolicy::EXTENDED ); opening3dAlgo.execute(); std::cout << "outputImage:" << opening3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) opening_3d_algo = imagedev.Opening3d() opening_3d_algo.input_image = foam opening_3d_algo.kernel_radius = 3 opening_3d_algo.neighborhood = imagedev.Opening3d.CONNECTIVITY_26 opening_3d_algo.border_policy = imagedev.Opening3d.EXTENDED opening_3d_algo.execute() print( "output_image:", str( opening_3d_algo.output_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); Opening3d opening3dAlgo = new Opening3d { inputImage = foam, kernelRadius = 3, neighborhood = Opening3d.Neighborhood.CONNECTIVITY_26, borderPolicy = Opening3d.BorderPolicy.EXTENDED }; opening3dAlgo.Execute(); Console.WriteLine( "outputImage:" + opening3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = opening3d( foam, 3, Opening3d::Neighborhood::CONNECTIVITY_26, Opening3d::BorderPolicy::EXTENDED ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.opening_3d( foam, 3, imagedev.Opening3d.CONNECTIVITY_26, imagedev.Opening3d.EXTENDED ) print( "output_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.Opening3d( foam, 3, Opening3d.Neighborhood.CONNECTIVITY_26, Opening3d.BorderPolicy.EXTENDED ); Console.WriteLine( "outputImage:" + result.ToString() );