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 = nullptr );
This function returns outputMapImage.
// Function prototype.
euclidean_distance_map_3d(input_binary_image: idt.ImageType,
                          mapping_mode: EuclideanDistanceMap3d.MappingMode = EuclideanDistanceMap3d.MappingMode.INSIDE,
                          border_condition: EuclideanDistanceMap3d.BorderCondition = EuclideanDistanceMap3d.BorderCondition.ZERO,
                          output_map_image: idt.ImageType = None) -> idt.ImageType
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

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
Parameter Name Description Type Supported Values Default Value
input
input_binary_image
The binary input image. image Binary None
input
mapping_mode
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
border_condition
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
output_map_image
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 None
Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary null
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 null

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() );