Learn R Programming

fractD (version 0.1.0)

fract3D: Calculates the fractal dimension of a 3D (sliced) image

Description

This function calculates the fractal dimension of a black area in a three-dimensional image using the method of box-counting.

Usage

fract3D(
  dir = NULL,
  box.size = NULL,
  dist.slice = NULL,
  save.dir = NULL,
  save.name = NULL
)

Arguments

dir

Specify a directory containing the folder/s with the image/s to be analysed.

box.size

A vector specifing the box size steps (in pixel) to be used to calculate fractal dimension. By default (NULL) box.size = c(1,2,4,8,16,32,64,128,256,512). Minimun box size cannot be less then 1, corresponding to 1 pixel of the image. Box size steps must be integer.

dist.slice

The distance between slices. By default (NULL) dist.slice = 1. Distance between slice must be an integer number.

save.dir

Optional. Set the name of an output folder to save the data as *.rds.

save.name

Optional. Provide a name for the output data.

Value

fract3D returns a list containing the following components:

D - A dataframe with the estimated fractal dimension.

raw.dat - A dataframe with the raw data used to calculate the fractal dimension. The data frame contains the name of the image (id), the box size steps (box.size), and the number of boxes for each box size step (box).

Details

The fuction calculates the fractal dimension (D) of a 3D image by the method of box-counting. Box-counting method is useful to calculate the fractal dimension of various sets of any dimension and patterns with or withouth self-similarity (Klinkenberg, 1994). The method overlay a series of cubes of different size (box.size x box.size x boxsize), with minimun size that is equal to the resolution of the image. Then, for each box size step the function keep track of the number of cubes occupied by the black area into the image. Finally, fractal dimension (D) is estimated by linear regression of log(n<U+00B0>boxes) on log(box.size).

References

  • Mandelbrot B.B. (1982) - The fractal Geometry of Nature. San Francisco: W.H. Freman.

  • Klinkenberg B. (1994) - A Review of methods used to determine the fractal dimension of linear features. Mathematical Geology, vol. 26, n<U+00B0> 1. doi: 10.1007/BF02065874

  • Dubuc B., Quiniou J.F., Roques-Carmes C., Tricot C., Zucker S.W. (1989) - Evaluating the fractal dimension of profiles. Physical Review A, vol. 39, n<U+00B0> 3. doi: https://doi.org/10.1103/PhysRevA.39.1500

  • Taud H and Parrot J-F (2005) - Measurement of DEM roughness using the local fractal dimension. G<U+00E9>omorphologie: relief, processus, environnement: 4, 327-338. doi: 10.4000/geomorphologie.622

See Also

fract3D to estimate the fractal dimension of a 3D (sliced) image/s.

Examples

Run this code
# NOT RUN {
# The example below calculates the fractal dimension of 3D sliced image/s
# contained into folder/s that are placed into "source.dir".
# Then, a file named "res.rds" is saved into the "output" folder.
# The distance between sliced image is 10 px.

fct3D <- fract3D(dir = "source.dir",
                 dist.slice = 10,
                 box.size = c(1,2,4,8,16,32,64,128,256,512),
                 save.dir = "output/", save.name = "res")

fct3D$D # a data frame with the estimated fractal dimension
fct3D$raw.dat # the raw data from which fractal dimension was calculated
# }

Run the code above in your browser using DataLab