Description Usage Arguments Details Value Note References See Also Examples
This function calculates the fractal dimension of a black area in a bidimensional image using the method of box-counting.
1 |
dir |
Specify a folder containing 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. |
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. |
The fuction calculates the fractal dimension (D) 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 squares of different size (box.size), with minimun box size that is equal to the resolution of the image. Then, for each box size step the function keep track of the number of squares occupied by the black area into the image. Finally, fractal dimension (D) is estimated by linear regression of log(n°boxes) on log(box.size).
fract2D
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).
The function analyze the fractal dimension of a black area into an image. Then, the images must be converted in black and white before analysis.
Usually, the box sizes should change as a function of a power of two so that they will be evenly spaced in the log space. However, this can result in too few points to fit linear regression. Therefore, according to Dubuc et al. (1989) the function allow to use box.size from 1 to +inf not necessarly with dyadic step.
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° 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° 3. doi: https://doi.org/10.1103/PhysRevA.39.1500
fract3D
to estimate the fractal dimension of a 3D (sliced) image/s.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
# The example below calculates the fractal dimension
# of image/s contained in the folder "source.dir".
# Then, a file named "res.rds" is saved into the "output" folder.
fct2D <- fract2D(dir = "source.dir",
box.size = c(1,2,4,8,16,32,64,128,256,512),
save.dir = "output/",
save.name = "res")
fct2D$D # a data frame with the estimated fractal dimension
fct2D$raw.dat # the raw data from which fractal dimension was calculated
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.