ImageDev

EuclideanDistanceMap3d

Computes the Euclidean distance map of objects in a three-dimensional binary image.

Access to parameter description

This algorithm computes a 3D distance map for a 3D object. Each voxel is assigned a value depending on the distance to the nearest object boundary.

The boundary voxels of the object are assigned a value of zero whereas the assigned value increases as the distance increases. This algorithm computes distances using the Euclidean metric.

Note: This algorithm takes into account the input image calibration. The output values are indicating distance in world units, as defined by the calibration.

See also

Function Syntax

This function returns outputMapImage.
// Function prototype
std::shared_ptr< iolink::ImageView > euclideanDistanceMap3d( std::shared_ptr< iolink::ImageView > inputBinaryImage, EuclideanDistanceMap3d::MappingMode mappingMode, EuclideanDistanceMap3d::BorderCondition borderCondition, std::shared_ptr< iolink::ImageView > outputMapImage = NULL );
This function returns outputMapImage.
// Function prototype.
euclidean_distance_map_3d( input_binary_image,
                           mapping_mode = EuclideanDistanceMap3d.MappingMode.INSIDE,
                           border_condition = EuclideanDistanceMap3d.BorderCondition.ZERO,
                           output_map_image = None )
This function returns outputMapImage.
// Function prototype.
public static IOLink.ImageView
EuclideanDistanceMap3d( IOLink.ImageView inputBinaryImage,
                        EuclideanDistanceMap3d.MappingMode mappingMode = ImageDev.EuclideanDistanceMap3d.MappingMode.INSIDE,
                        EuclideanDistanceMap3d.BorderCondition borderCondition = ImageDev.EuclideanDistanceMap3d.BorderCondition.ZERO,
                        IOLink.ImageView outputMapImage = null );

Class Syntax

Parameters

Class Name EuclideanDistanceMap3d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary nullptr
input
mappingMode
The mode defining where the distance field is computed.
INSIDE The distances are computed for voxels inside the objects (having an intensity equal to 1). Outside voxels remain at zero.
OUTSIDE The distances are computed for voxels outside of objects (having an intensity equal to 0). Inside voxels are set to zero.
Enumeration INSIDE
input
borderCondition
The mode defining the border conditions.
ZERO Voxels outside of the image are considered to have the value 0.
MIRROR Voxels outside of the image are considered as an extrapolation of the image voxels with a mirror border condition.
Enumeration ZERO
output
outputMapImage
The distance map output image. Distance map of the shape represented by the input image. Each voxel is assigned to a value depending on the distance to the nearest object boundary. Its dimensions are forced to the same values as the input. Its data type is 32-bit floating point. Image nullptr

Object Examples

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

EuclideanDistanceMap3d euclideanDistanceMap3dAlgo;
euclideanDistanceMap3dAlgo.setInputBinaryImage( foam_sep );
euclideanDistanceMap3dAlgo.setMappingMode( EuclideanDistanceMap3d::MappingMode::INSIDE );
euclideanDistanceMap3dAlgo.setBorderCondition( EuclideanDistanceMap3d::BorderCondition::ZERO );
euclideanDistanceMap3dAlgo.execute();

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

euclidean_distance_map_3d_algo = imagedev.EuclideanDistanceMap3d()
euclidean_distance_map_3d_algo.input_binary_image = foam_sep
euclidean_distance_map_3d_algo.mapping_mode = imagedev.EuclideanDistanceMap3d.INSIDE
euclidean_distance_map_3d_algo.border_condition = imagedev.EuclideanDistanceMap3d.ZERO
euclidean_distance_map_3d_algo.execute()

print( "output_map_image:", str( euclidean_distance_map_3d_algo.output_map_image ) )
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

EuclideanDistanceMap3d euclideanDistanceMap3dAlgo = new EuclideanDistanceMap3d
{
    inputBinaryImage = foam_sep,
    mappingMode = EuclideanDistanceMap3d.MappingMode.INSIDE,
    borderCondition = EuclideanDistanceMap3d.BorderCondition.ZERO
};
euclideanDistanceMap3dAlgo.Execute();

Console.WriteLine( "outputMapImage:" + euclideanDistanceMap3dAlgo.outputMapImage.ToString() );

Function Examples

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

auto result = euclideanDistanceMap3d( foam_sep, EuclideanDistanceMap3d::MappingMode::INSIDE, EuclideanDistanceMap3d::BorderCondition::ZERO );

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

result = imagedev.euclidean_distance_map_3d( foam_sep, imagedev.EuclideanDistanceMap3d.INSIDE, imagedev.EuclideanDistanceMap3d.ZERO )

print( "output_map_image:", str( result ) )
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

IOLink.ImageView result = Processing.EuclideanDistanceMap3d( foam_sep, EuclideanDistanceMap3d.MappingMode.INSIDE, EuclideanDistanceMap3d.BorderCondition.ZERO );

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