Abstract

Measuring fractal dimension in general is made over edges of a figure, however this kind of calculations could be made over a 1D, 2D or even a 3D images. With the FracLac plugin of ImageJ application, it has been possible to measure both dimensions, over the area and over the edge of a Mandelbrot fractal, using the Box Counting technique.

Keywords: Box countig, Mandelbort fractal, fractal dimension, ImageJ

1. Introduction

Historical measurements with a straight line function over the England coast line made by Benoit Mandelbrot using different scales represented as “measuring rods” [1,2], which is based on a Lewis Fry Richardson's idea [3], can be calculated directly with any of the simplified data (Tables 1, and 2), shown below.

Table 1. The magnitude of scale is in kms

Scale (s) Long. (L) Ln(s) Ln(L)
200 2350 5.2983 7.7622
100 2775 4.6052 7.9284
50 3425 5.2983 8.1389


Table 2. The scale is relative to the greatest magnitude

Scale (s) Long. (L) Ln(s) Ln(L)
200/200 2350 0.0000 7.7622
100/200 2775 -6.6931 7.9284
50/200 3425 -1.3863 8.1389


Linear regression calculations from data of the first (Table 1), are made directly over the scale, while in the second data table, greatest magnitude is used as reference (Table 2).

Result of linear adjustment over data from any of both tables is the Eq.(1)

(1)

With an equation like shown (1) Mandelbrot identified the slope of as

(2)

so the fractal dimension is , here is known as Hausdorff dimension.

However there is another method to measure the same quantity and is knowing as “Box Counting Fractal” and is based on the idea of using “boxes” (squares) of the same size to fill the edge of entire figure and counting the number of boxes, then the longitude is given by , where is the size of one side o a box, change size of a generic box () and measure again, doing this procedure by “practically” six or seven times, there are enough data to make a linear approximation [3]. But if an area is measured the relation is and if a volume is measured, the rule now is given by , based on this ideas there is a power law for any dimension [2]:

And by analogy with the fractal dimension, that is generally called “capacity” or “box dimension” is defined by the relation (Eq.(3)) [4]

(3)

If the box counting technique is utilized to calculate again the fractal dimension of the England coast line, (Table 3) must be used [5].

Table 3. Data to calculate fractal dimension using “Box Counting” technique

Scale ()
1 2350 0.0000 7.7622
0.5 5550 0.6931 8.6216
0.25 13700 1.3863 9.5252


The result of applying the linear adjustment over the data (Table 3) is the equation shown below (Eq.(4))

(4)

and it could be seen that the fractal dimension is given directly form the slope of the equation .

So there are two methods to calculate the fractal dimension, but if “measuring rods” are used, some additional operations must be made to obtain the result. In the “Box Counting Fractal” technique the result is directly the slope of straight line (Eq.(4)) [6].

2. ImageJ application

The “ImageJ” app is a free software from the project “SciJava OSS” used to images processing, with this powerful tool we can manipulate and measure any graphic file, and in conjunction with the FracLac plugin (that it is used to make calculations over fractals) we can obtain the fractal dimension based on the box counting (BC) method [6].

The direction to download “ImageJ” app is: https://imagej.nih.gov/ij/download.html

But version that works with corresponding Operating System must be selected.

Install the app and use it to know the tool, but even when the software has a specific process to measure fractal dimension (Analyze-Tools-Fractal Box Counting), this is a limited characteristic of the app and we could use it as a first approach, in the sense that it didn't shows the boxes it draws and how changes in box's sizes are made.

The direction to download the “FracLac” plugin is: http://rsb.info.nih.gov/ij/plugins/fraclac/Frac_Lac.jar

To install the plugin go to Plugins-Install, locate the folder where Frac_Lac.jar file was downloaded and select “open”. After the plugin is installed “ImageJ” program must be closed completely.

Open the program again, go to Plugins and must see the “Fractal Analysis” option as an additional sub-menu and “FracLac” as a sub-process.

Now, all the “ambience” is prepared to make ours first measurements. Then a graphic file in a png, jpg or bmp format must be opened, and so even when the calculations are made in pixels is preferable that the graphic have a printed scale.

2.1 Preliminary measurement

As a first step a scale must be established on the figure, so with this objective, open a graphic file and in the toolbar choose the “Straight” tool, as is shown in Figure 1.

Review 368345517339-Imagej-Toolbar.png
Figure 1. Toolbar of the ImageJ app


Over the Mandelbrot Figure 2, locate the scale and with the shift button and the mouse pressed, touch one end of the scale and without release go to the other end, then release.

Review 368345517339-Mandelbrot-with-scale.png
Figure 2. Mandelbrot figure with measure over the scale


After this, go to menu and over “Analyze” select “Set Scale”, as shown in Figure 3, put in the “Known distance” the value of the scale and in unit write the name of the scale.

Review 368345517339-Setting-Scale.png
Figure 3. Setting the scale of the figure


Calculations over the open figure can be made, but also another strategy can be taken, that is with “Rectangle” button of the toolbar choose an area that it is wanted to measure, without the scale, and on the menu select “Image” and the sub-process “Duplicate”, generates another figure with a different name proposed. So there are two figures and the original can be closed. With this new image active, select “Process” on the menu and go to “Binary” process, and “Make Binary” sub-process. Now if wants to calculate the fractal dimension of the figure's perimeter, must find the edges (Figure 4) or can outline the graphic, at this step of the process the image is prepared to be measured.

Review 368345517339-Find-Edges.png
Figure 4. Menu for finding the edges of the figure


Then select “Analize” on the menu go to “Tools” process and “Fractal Box Counting” sub-process, as is shown in Figure 5, this procedure gives a first result of the fractal dimension as a result of the “Box Counting” technique (Figure 6), but this is just a preliminary measure, that is because the boxes can't be seen, just the result.

Review 368345517339-Frac-Dim1.png
Figure 5. Menu for calculate directly the fractal dimension by the box counting method.


Review 368345517339-Frac-Dim1-Result.png
Figure 6. Result of calculations of fractal dimension over the Mandelbrot figure


3. Using the FracLac plugin

In order to apply the “FracLac” plugin over any figure, the same treatment must be given as before, stablish the scale of the figure, that is to corroborate any measure is made,“Binarize” the picture and duplicate it and if wants to calculate fractal dimension of the perimeter, find the edges or outline the figure.

After figure was prepared, go to the “Plugins” section of the menu and in the “Fractal Analysis” process, accede to the sub-process of “FracLac” as is shown in Figure 7.

Review 368345517339-Access-FracLac.png
Figure 7. Menu to FracLac sub-process


A new toolbar is open, from where the “BC” button that is located in the left superior corner must be choosen, a Pop Up appear that must be accepted and not include “Select for legacy mode”. A menu of characteristic appear and in “Grid design” puts number one, that is because grid must have just one origin, if wants more than one origin, then change this number. Modify the “Graphic options” as is shown on a red circle over the Figure 8. Just make this changes if wants to measure fractal dimension of a perimeter line.

Review 368345517339-FracLac-Menu.png
Figure 8. FracLac characteristics menu


After given the characteristics of box counting, must press the“Scan” button (that is below the “Box Counting” button), then “FracLac” operate it's internal calculations and gives various results, two of them are shown in Figure 9, the image in “tif” format and the box counting data with , the value obtained is very close as previously calculated but it's not the same.

Review 368345517339-Image-BC-Data.png
Figure 9. Two of the analysis results given by the plugin's operations


The “tif” image gives 14 moments of the calculations over the perimeter, that could be extracted each one of them as an individual figure, four of them are shown in Figure 10.

Review 368345517339-Four-Moments.png
Figure 10. Four moments of the box counting calculations


The calculation's data could be saved in “csv” format, that is compatible with apps, as Numbers, Excel, Mathematica etc. The fractal dimension is given in this file too, however if for some reason wants to make the linear regression adjustment, the columns two and three are the appropriate ones, as is shown in Figure 11.

Review 368345517339-Linear-Adjust.png
Figure 11. Linear adjustment of columns two an three of data from file in “csv” format


Then the process to calculate fractal dimension from a perimeter of any figure could be made in two ways; one is with an automatic operation of ImageJ (but we don't see any boxes), that gives a graph and a csv file. The box's size is defined by user and are between six to nine sizes. The other process is with the plugin “FracLac”, where all the steps of the process are shown even the boxes used in fourteen moments of calculations.

Results of the fractal dimension obtained in both procedures must gives values very close one to the other, not exactly the same, because the first one is made with 9 or less box's sizes, and the second one is made with 100 box's sizes.

4. Fractal dimension of an image's area

Performing calculation of the again, but now for the area of Mandelbrot's fractal figure, so let's do the whole procedure of opening the image, setting the scale, selecting the work area, duplicating the image, and finally “Binarize” the image, and an important part of the process is that we do not look for the edges or outline the image. Locates the “Plugins” tab, goes down to “Fractal Analysis” and the “FracLac” sub-process. The toolbar opens, in which it has to be given the initial parameters, select the “Box Counting” (BC) button, accept the “Pop Up” and do not include the inherited mode “Select for legacy mode”.

Now, since the DB of a figure's area are going to be measured, in the “Image Type” section, first line must have “Use binary” but in second line choose “Lock Black Background” if background is black,that is the one that wants to avoid, it means that measurement will be made over figure's white part. If wants to measure over figure's black part, then choose “Lock White Background”, the other parameters are set as previously did, as shown in Figure 12.

Review 368345517339-BC-area-figure.png
Figure 12. BC menu's characteristic for measurement of over a figure's area


Choose “Ok” at the bottom of BC menu's, and the “Pop Up” of “Show Regression Line Summaries” appears, which accept.

Once the characteristics of the measurements have been established select the “Scan” button, which is just below the “Box Counting” button. The “FracLac” plugin performs its internal procedures and gives us several results, but the box count is now done on the white area and the result of the fractal dimension is obtained, which is as can be seen in Figure 13.

Review 368345517339-DB-Area-Fractal.png
Figure 13. Results of over a figure's area


The data file is saved in “csv” format and the necessary calculations are made to fit a straight line with the data in columns 2 and 3, it must be taken into account that the natural logarithm of the reciprocal of the scale is plotted against the logarithm natural of the number of boxes, the equation of the straight line is: and the result of the fractal dimension is directly the slope, which is .

5. Conclusions

So there is the question, what does the fractal dimension measure? To answer it, based on the “Box Counting” methodology, let's take a line of length , a square and a cube with sides also and measure their fractal dimensions (Figure 14).

Review 368345517339-Fractal-Euclidean-dimension.png
Figure 14. Calculation of fractal dimension over a line, a square and a cube


Using the box counting technique it has been measured in this work the fractal dimension of a Mandelbrot fractal figure with two different process [7,8,9]:

  • Measurement of the fractal dimension of the image perimeter.
  • Measurement of the fractal dimension of the image area.


Both measurements of the fractal dimension are different and both means how far they are from the corresponding Euclidean dimension [10,11].

References

[1] Mandelbrot B. The fractal geometry of nature. W.H. Freeman, 1982.

[2] Mandelbrot B. Self-affine and fractal dimension. Physica Scripta, 32(4):257-260, 1985.

[3] Mandelbrot B. How long is the coast of Britain? Statistical self-similarity and fractional dimension. Science, 156(3775):636-638, 1967.

[4] Gatzouras D., Lalley S. Hausdorff and box dimensions of certainself-affine fractals. Indiana University Mathematics Journal, 41(2):533-568, 1992.

[5] Husain A., Reddy J., Bisht D., Sajid M. Fractal dimension of coastline of Australia. Sci. Rep., 11, 6304, 2021.

[6] Schneider C., Rasband W., Eliceiri K. NIH image to ImageJ: 25 years of image analysis. Nature Methods, 9:671-675, 2012.

[7] Shanmugavadivu P., Sivakumar V., Sudhir R. Fractal dimension-bound spatiotemporal analysis of digital mammograms. The European Physics Journal Special Topics, 225:137-146, 2016.

[8] Bárány B., Hochman M., Rapaport A. Hausdorff dimension of planar self-affine measures. Inventiones Mathematicae, 16:601-659, 2019.

[9] Christensen H., Driver O. The fractal nature of clouds in global storm-resolving models. ArXiv:2108.08565v1, 2021.

[10] Strogatz H. Nonlinear dynamics and chaos: With applications to physics, biology, chemistry and engineering. Westview Press, Boulder CO. USA, 2nd edition, 2015.

[11] Devaney R. A first course in chaotic dynamical systems theory and experiment. CRC Press, Florida USA, 2nd edition, 2020.
Back to Top

Document information

Published on 17/03/22
Accepted on 07/03/22
Submitted on 14/12/21

Volume 38, Issue 1, 2022
DOI: 10.23967/j.rimni.2022.03.007
Licence: CC BY-NC-SA license

Document Score

0

Views 287
Recommendations 0

Share this document

claim authorship

Are you one of the authors of this document?