Pruning3d
Point detector removing spurs from a three-dimensional binary image.
Access to parameter description
For an introduction:
It can be applied either specifying a number of iterations or until convergence.
This filter can be used for removing terminal branches from a skeleton, also known as spurs.
The skeleton is very sensitive to small distortions on the edges of the objects, generating artifacts. The pruning algorithm eliminates these artifacts by thinning with the following structuring element until convergence or for a predefined number of iterations.
The skeleton is first detected, and then this algorithm performs a thinning transform with the following configuration and its 25 associated rotations: $$ \begin{array}{ccc} 0 & 0 & 0\\ 0 & \times & 0\\ 0 & 0 & 0 \end{array} ~~~~~~~~~~~~ \begin{array}{ccc} 0 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 0 \end{array} ~~~~~~~~~~~~ \begin{array}{ccc} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{array} $$ Where $\times$ means "don't care".
It is generally tedious to determine the number of iterations for the pruning and thinning until convergence removes all the skeletons except loops and branches intersecting the frame of the image in permissive mode.
The strict mode stops when an intersection or a right angle is encountered.
See also
Access to parameter description
For an introduction:
- section Mathematical Morphology
- section Point Detectors
It can be applied either specifying a number of iterations or until convergence.
This filter can be used for removing terminal branches from a skeleton, also known as spurs.
The skeleton is very sensitive to small distortions on the edges of the objects, generating artifacts. The pruning algorithm eliminates these artifacts by thinning with the following structuring element until convergence or for a predefined number of iterations.
The skeleton is first detected, and then this algorithm performs a thinning transform with the following configuration and its 25 associated rotations: $$ \begin{array}{ccc} 0 & 0 & 0\\ 0 & \times & 0\\ 0 & 0 & 0 \end{array} ~~~~~~~~~~~~ \begin{array}{ccc} 0 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 0 \end{array} ~~~~~~~~~~~~ \begin{array}{ccc} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{array} $$ Where $\times$ means "don't care".
It is generally tedious to determine the number of iterations for the pruning and thinning until convergence removes all the skeletons except loops and branches intersecting the frame of the image in permissive mode.
The strict mode stops when an intersection or a right angle is encountered.
See also
Function Syntax
This function returns the outputBinaryImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > pruning3d( std::shared_ptr< iolink::ImageView > inputBinaryImage, Pruning3d::PruningMode pruningMode, int32_t numberOfIterations, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns the outputBinaryImage output parameter.
// Function prototype. pruning_3d( input_binary_image, pruning_mode = Pruning3d.PruningMode.RIGOROUS, number_of_iterations = 1, output_binary_image = None )
This function returns the outputBinaryImage output parameter.
// Function prototype. public static IOLink.ImageView Pruning3d( IOLink.ImageView inputBinaryImage, Pruning3d.PruningMode pruningMode = ImageDev.Pruning3d.PruningMode.RIGOROUS, Int32 numberOfIterations = 1, IOLink.ImageView outputBinaryImage = null );
Class Syntax
Parameters
Class Name | Pruning3d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputBinaryImage |
The binary input image. | Image | Binary | nullptr | |||||
pruningMode |
The mode for removing end points.
|
Enumeration | RIGOROUS | ||||||
numberOfIterations |
The number of iterations. If equal to 0, the algorithm is run until convergence. | Int32 | >=0 | 1 | |||||
outputBinaryImage |
The binary output image. Its size and type are forced to the same values as the input. | Image | nullptr |
Object Examples
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" ); Pruning3d pruning3dAlgo; pruning3dAlgo.setInputBinaryImage( foam_sep ); pruning3dAlgo.setPruningMode( Pruning3d::PruningMode::RIGOROUS ); pruning3dAlgo.setNumberOfIterations( 1 ); pruning3dAlgo.execute(); std::cout << "outputBinaryImage:" << pruning3dAlgo.outputBinaryImage()->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip")) pruning_3d_algo = imagedev.Pruning3d() pruning_3d_algo.input_binary_image = foam_sep pruning_3d_algo.pruning_mode = imagedev.Pruning3d.RIGOROUS pruning_3d_algo.number_of_iterations = 1 pruning_3d_algo.execute() print( "output_binary_image:", str( pruning_3d_algo.output_binary_image ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" ); Pruning3d pruning3dAlgo = new Pruning3d { inputBinaryImage = foam_sep, pruningMode = Pruning3d.PruningMode.RIGOROUS, numberOfIterations = 1 }; pruning3dAlgo.Execute(); Console.WriteLine( "outputBinaryImage:" + pruning3dAlgo.outputBinaryImage.ToString() );
Function Examples
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" ); auto result = pruning3d( foam_sep, Pruning3d::PruningMode::RIGOROUS, 1 ); std::cout << "outputBinaryImage:" << result->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip")) result = imagedev.pruning_3d( foam_sep, imagedev.Pruning3d.RIGOROUS, 1 ) print( "output_binary_image:", str( result ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" ); IOLink.ImageView result = Processing.Pruning3d( foam_sep, Pruning3d.PruningMode.RIGOROUS, 1 ); Console.WriteLine( "outputBinaryImage:" + result.ToString() );