ImageDev

ClosestBoundaryPoints3d

Computes the Chamfer distance map of the background of a three-dimensional image and the coordinates of the associated boundary points.

Access to parameter description

This algorithm is like the DistanceMap3d algorithm, applied on the background of the input image, and indicates the distance to the closest object boundary point.
It also stores the X, Y, and Z coordinates of the corresponding point in three additional output images.

Note: This algorithm does not take into account the input image calibration. The output values are systematically indicating distance in voxel units.

See also

Function Syntax

This function returns a ClosestBoundaryPoints3dOutput structure containing the outputMapImage, outputImageX, outputImageY and outputImageZ output parameters.
// Output structure.
struct ClosestBoundaryPoints3dOutput
{
    std::shared_ptr< iolink::ImageView > outputMapImage;
    std::shared_ptr< iolink::ImageView > outputImageX;
    std::shared_ptr< iolink::ImageView > outputImageY;
    std::shared_ptr< iolink::ImageView > outputImageZ;
};

// Function prototype.
ClosestBoundaryPoints3dOutput
closestBoundaryPoints3d( std::shared_ptr< iolink::ImageView > inputBinaryImage,
                         std::shared_ptr< iolink::ImageView > outputMapImage = NULL,
                         std::shared_ptr< iolink::ImageView > outputImageX = NULL,
                         std::shared_ptr< iolink::ImageView > outputImageY = NULL,
                         std::shared_ptr< iolink::ImageView > outputImageZ = NULL );
This function returns a tuple containing the output_map_image, output_image_x, output_image_y and output_image_z output parameters.
// Function prototype.
closest_boundary_points_3d( input_binary_image,
                            output_map_image = None,
                            output_image_x = None,
                            output_image_y = None,
                            output_image_z = None )
This function returns a ClosestBoundaryPoints3dOutput structure containing the outputMapImage, outputImageX, outputImageY and outputImageZ output parameters.
/// Output structure of the ClosestBoundaryPoints3d function.
public struct ClosestBoundaryPoints3dOutput
{
    public IOLink.ImageView outputMapImage;
    public IOLink.ImageView outputImageX;
    public IOLink.ImageView outputImageY;
    public IOLink.ImageView outputImageZ;
};

// Function prototype.
public static ClosestBoundaryPoints3dOutput
ClosestBoundaryPoints3d( IOLink.ImageView inputBinaryImage,
                         IOLink.ImageView outputMapImage = null,
                         IOLink.ImageView outputImageX = null,
                         IOLink.ImageView outputImageY = null,
                         IOLink.ImageView outputImageZ = null );

Class Syntax

Parameters

Class Name ClosestBoundaryPoints3d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary nullptr
output
outputMapImage
The output background distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. Image nullptr
output
outputImageX
The X coordinate image of the closest boundary point, in voxel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. Image nullptr
output
outputImageY
The Y coordinate image of the closest boundary point, in voxel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. Image nullptr
output
outputImageZ
The Z coordinate image of the closest boundary point, in voxel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. Image nullptr

Object Examples

auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" );

ClosestBoundaryPoints3d closestBoundaryPoints3dAlgo;
closestBoundaryPoints3dAlgo.setInputBinaryImage( foam_sep );
closestBoundaryPoints3dAlgo.execute();

std::cout << "outputMapImage:" << closestBoundaryPoints3dAlgo.outputMapImage()->toString();
std::cout << "outputImageX:" << closestBoundaryPoints3dAlgo.outputImageX()->toString();
std::cout << "outputImageY:" << closestBoundaryPoints3dAlgo.outputImageY()->toString();
std::cout << "outputImageZ:" << closestBoundaryPoints3dAlgo.outputImageZ()->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

closest_boundary_points_3d_algo = imagedev.ClosestBoundaryPoints3d()
closest_boundary_points_3d_algo.input_binary_image = foam_sep
closest_boundary_points_3d_algo.execute()

print( "output_map_image:", str( closest_boundary_points_3d_algo.output_map_image ) );
print( "output_image_x:", str( closest_boundary_points_3d_algo.output_image_x ) );
print( "output_image_y:", str( closest_boundary_points_3d_algo.output_image_y ) );
print( "output_image_z:", str( closest_boundary_points_3d_algo.output_image_z ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

ClosestBoundaryPoints3d closestBoundaryPoints3dAlgo = new ClosestBoundaryPoints3d
{
    inputBinaryImage = foam_sep
};
closestBoundaryPoints3dAlgo.Execute();

Console.WriteLine( "outputMapImage:" + closestBoundaryPoints3dAlgo.outputMapImage.ToString() );
Console.WriteLine( "outputImageX:" + closestBoundaryPoints3dAlgo.outputImageX.ToString() );
Console.WriteLine( "outputImageY:" + closestBoundaryPoints3dAlgo.outputImageY.ToString() );
Console.WriteLine( "outputImageZ:" + closestBoundaryPoints3dAlgo.outputImageZ.ToString() );

Function Examples

auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" );

auto result = closestBoundaryPoints3d( foam_sep );

std::cout << "outputMapImage:" << result.outputMapImage->toString();
std::cout << "outputImageX:" << result.outputImageX->toString();
std::cout << "outputImageY:" << result.outputImageY->toString();
std::cout << "outputImageZ:" << result.outputImageZ->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

result_output_map_image, result_output_image_x, result_output_image_y, result_output_image_z = imagedev.closest_boundary_points_3d( foam_sep )

print( "output_map_image:", str( result_output_map_image ) );
print( "output_image_x:", str( result_output_image_x ) );
print( "output_image_y:", str( result_output_image_y ) );
print( "output_image_z:", str( result_output_image_z ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

Processing.ClosestBoundaryPoints3dOutput result = Processing.ClosestBoundaryPoints3d( foam_sep );

Console.WriteLine( "outputMapImage:" + result.outputMapImage.ToString() );
Console.WriteLine( "outputImageX:" + result.outputImageX.ToString() );
Console.WriteLine( "outputImageY:" + result.outputImageY.ToString() );
Console.WriteLine( "outputImageZ:" + result.outputImageZ.ToString() );