ImageDev

FractalDimension

Measures the fractal dimension represented by objects of a binary image.

Access to parameter description

For an introduction: section Image Analysis.

This algorithm is intended to characterize images whose content is known to be potentially fractal. This is the case of complex and irregular curves that cannot be easily described with traditional geometric tools, and/or of curves that are very similar to a part of themselves at different scales.

The fractal dimension is a statistical quantity that gives an indication of how completely a fractal appears to fill space, as one zooms down to finer and finer scales. A fractal is a rough or fragmented geometric shape that can be split into parts, each of which is (at least approximately) a reduced-size copy of the whole.

This algorithm measures the fractal dimension based on a box counting method. The sizes of the boxes are taken as all the power of 2, from 1 to the lower dimension of the dataset. For instance, for a 1000x1000x81 dataset, the different box lengths will be: 1, 2, 4, 8, 16, 32 and 64. For a given box size, the algorithm considers all adjacent, non-overlapping boxes inside the dataset. The fractal dimension is measured as the slope of the array indicating the number of non-void boxes at each resolution in logarithmic scale.
Notices:

2D definition

The 2D fractal dimension is a number larger than 1 and strictly lower than 2.
The result is 1 in the case of standard geometric features (straight lines, broken lines, circles,...). Applied to 2D images, the fractal dimension is quite an effective indicator to measure and compare the irregularity and the fragmentation at different magnifications. It is also a good indicator to evaluate how the curve fills the space. The less smooth the curve is, the bigger the fractal dimension.

Caution: This algorithm should not be applied on surfaces but on contours, according to the fractal definition. The useOnlyBorders option should be enabled if the input image is filled.

3D definition

The 3D fractal dimension is a number larger than 2 and strictly lower than 3.
The result is 2 in case of standard geometric surfaces (cubes, planes, ellipsoids,...). Applied to 3D images, the fractal dimension is quite an effective indicator to measure and compare the roughness of a surface. It is also a good indicator to evaluate how the curve fills the space. The less smooth the surface, the bigger the fractal dimension. It also can be interpreted as a quantification of how complex the surface is and how it fills the space.

Caution: This algorithm should not be applied on volumes but on surfaces, according to the fractal definition. The useOnlyBorders option should be enabled if the input image is filled.

References See also

Function Syntax

This function returns outputMeasurement.
// Function prototype
FractalMsr::Ptr fractalDimension( std::shared_ptr< iolink::ImageView > inputBinaryImage, FractalDimension::UseOnlyBorders useOnlyBorders, FractalMsr::Ptr outputMeasurement = NULL );
This function returns outputMeasurement.
// Function prototype.
fractal_dimension( input_binary_image, use_only_borders = FractalDimension.UseOnlyBorders.YES, output_measurement = None )
This function returns outputMeasurement.
// Function prototype.
public static FractalMsr
FractalDimension( IOLink.ImageView inputBinaryImage,
                  FractalDimension.UseOnlyBorders useOnlyBorders = ImageDev.FractalDimension.UseOnlyBorders.YES,
                  FractalMsr outputMeasurement = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary nullptr
input
useOnlyBorders
The way to apply the algorithm, considering all point or only object boundaries.
NO All foreground points (that is, having a 1-value) are considered by the algorithm.
YES Only foreground points having a 0-value neighbor are considered by the algorithm.
Enumeration YES
output
outputMeasurement
The output measurement result. FractalMsr nullptr
Parameter Name Description Type Supported Values Default Value
input
input_binary_image
The input binary image. image Binary None
input
use_only_borders
The way to apply the algorithm, considering all point or only object boundaries.
NO All foreground points (that is, having a 1-value) are considered by the algorithm.
YES Only foreground points having a 0-value neighbor are considered by the algorithm.
enumeration YES
output
output_measurement
The output measurement result. FractalMsr None
Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary null
input
useOnlyBorders
The way to apply the algorithm, considering all point or only object boundaries.
NO All foreground points (that is, having a 1-value) are considered by the algorithm.
YES Only foreground points having a 0-value neighbor are considered by the algorithm.
Enumeration YES
output
outputMeasurement
The output measurement result. FractalMsr null

Object Examples

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

FractalDimension fractalDimensionAlgo;
fractalDimensionAlgo.setInputBinaryImage( polystyrene_sep );
fractalDimensionAlgo.setUseOnlyBorders( FractalDimension::UseOnlyBorders::YES );
fractalDimensionAlgo.execute();

std::cout << "fractalDimension: " << fractalDimensionAlgo.outputMeasurement()->fractalDimension( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

fractal_dimension_algo = imagedev.FractalDimension()
fractal_dimension_algo.input_binary_image = polystyrene_sep
fractal_dimension_algo.use_only_borders = imagedev.FractalDimension.YES
fractal_dimension_algo.execute()

print( "fractalDimension: ", str( fractal_dimension_algo.output_measurement.fractal_dimension( 0 ) ) )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

FractalDimension fractalDimensionAlgo = new FractalDimension
{
    inputBinaryImage = polystyrene_sep,
    useOnlyBorders = FractalDimension.UseOnlyBorders.YES
};
fractalDimensionAlgo.Execute();

Console.WriteLine( "fractalDimension: " + fractalDimensionAlgo.outputMeasurement.fractalDimension( 0 ) );

Function Examples

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

auto result = fractalDimension( polystyrene_sep, FractalDimension::UseOnlyBorders::YES );

std::cout << "fractalDimension: " << result->fractalDimension( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

result = imagedev.fractal_dimension( polystyrene_sep, imagedev.FractalDimension.YES )

print( "fractalDimension: ", str( result.fractal_dimension( 0 ) )  )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

FractalMsr result = Processing.FractalDimension( polystyrene_sep, FractalDimension.UseOnlyBorders.YES );

Console.WriteLine(  "fractalDimension: " + result.fractalDimension( 0 )  );