(11 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
==Fractal dimension measured over areas and perimeters using “Box Counting” technique applied over a Mandelbrot figure.label1== | ==Fractal dimension measured over areas and perimeters using “Box Counting” technique applied over a Mandelbrot figure.label1== | ||
− | '''C. R. Acosta1, F. Peñuñuri 1, | + | '''C. R. Acosta1, F. Peñuñuri 1, O. Carvente 1''' |
--> | --> | ||
− | |||
==Abstract== | ==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. | 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” <span id='citeF-1'></span><span id='citeF-2'></span>[[#cite-1|[1,2]]], which is based on a Lewis Fry Richardson's idea <span id='citeF-3'></span>[[#cite-3|[3]]], can be calculated directly with any of the simplified data ([[#table-1|Tables 1]], and [[#table-2|2]]), shown below. | |
− | + | <div class="center" style="font-size: 75%;">'''Table 1'''. The magnitude of scale is in kms</div> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | <span id='table-1'></span> | ||
+ | {| class="wikitable" style="margin: 1em auto 0.1em auto;border-collapse: collapse;font-size:85%;width:auto;" | ||
+ | |-style="text-align:center" | ||
+ | ! Scale (s) !! Long. (L) !! Ln(s) !! Ln(L) | ||
+ | |- style="text-align:center" | ||
+ | | 200 | ||
+ | | 2350 | ||
+ | | 5.2983 | ||
+ | | 7.7622 | ||
+ | |- style="text-align:center" | ||
+ | | 100 | ||
+ | | 2775 | ||
+ | | 4.6052 | ||
+ | | 7.9284 | ||
+ | |- style="text-align:center" | ||
+ | | 50 | ||
+ | | 3425 | ||
+ | | 5.2983 | ||
+ | | 8.1389 | ||
|} | |} | ||
− | + | <div class="center" style="font-size: 75%;">'''Table 2'''. The scale is relative to the greatest magnitude</div> | |
− | + | <span id='table-2'></span> | |
− | | | + | {| class="wikitable" style="margin: 1em auto 0.1em auto;border-collapse: collapse;font-size:85%;width:auto;" |
− | + | |-style="text-align:center" | |
− | | style=" | + | ! Scale (s) !! Long. (L) !! Ln(s) !! Ln(L) |
− | + | |- style="text-align:center" | |
− | + | | 200/200 | |
− | |- style=" | + | | 2350 |
− | | | + | | 0.0000 |
− | + | | 7.7622 | |
− | | | + | |- style="text-align:center" |
− | | | + | | 100/200 |
− | |- style=" | + | | 2775 |
− | | | + | | -6.6931 |
− | + | | 7.9284 | |
− | | | + | |- style="text-align:center" |
− | | | + | | 50/200 |
− | |- style=" | + | | 3425 |
− | | | + | | -1.3863 |
− | | | + | | 8.1389 |
− | | | + | |
− | | | + | |
− | + | ||
|} | |} | ||
− | |||
− | + | Linear regression calculations from data of the first ([[#table-1|Table 1]]), are made directly over the scale, while in the second data table, greatest magnitude is used as reference ([[#table-2|Table 2]]). | |
+ | Result of linear adjustment over data from any of both tables is the Eq.([[#eq-1|1]]) | ||
<span id="eq-1"></span> | <span id="eq-1"></span> | ||
{| class="formulaSCP" style="width: 100%; text-align: left;" | {| class="formulaSCP" style="width: 100%; text-align: left;" | ||
Line 103: | Line 88: | ||
|} | |} | ||
− | so the fractal dimension is <math display="inline">D=1.27</math> | + | so the fractal dimension is <math display="inline">D=1.27</math>, here <math display="inline">D</math> 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 <math display="inline"> L \approx N\xi _k </math>, where <math display="inline"> \xi _k </math> is the size of one side o a box, change size of a generic box (<math display="inline"> \xi _k </math>) and measure <math display="inline">L</math> again, doing this procedure by “practically” six or seven times, there are enough data to make a linear approximation <span id='citeF-3'></span>[[#cite-3|[3]]]. But if an area is measured the relation is <math display="inline">A \approx N\xi _k^2 </math> and if a volume is measured, the rule now is given by <math display="inline">V \approx N\xi _k^3 </math>, based on this ideas there is a power law for any dimension <span id='citeF-2'></span>[[#cite-2|[2]]]: | 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 <math display="inline"> L \approx N\xi _k </math>, where <math display="inline"> \xi _k </math> is the size of one side o a box, change size of a generic box (<math display="inline"> \xi _k </math>) and measure <math display="inline">L</math> again, doing this procedure by “practically” six or seven times, there are enough data to make a linear approximation <span id='citeF-3'></span>[[#cite-3|[3]]]. But if an area is measured the relation is <math display="inline">A \approx N\xi _k^2 </math> and if a volume is measured, the rule now is given by <math display="inline">V \approx N\xi _k^3 </math>, based on this ideas there is a power law for any dimension <span id='citeF-2'></span>[[#cite-2|[2]]]: | ||
Line 116: | Line 101: | ||
|} | |} | ||
− | And by analogy with the fractal dimension, <math display="inline">D_B</math> that is generally called “capacity” or “box dimension” is defined by the relation ([[#eq-3|3]]) <span id='citeF-4'></span>[[#cite-4|[4]]] | + | And by analogy with the fractal dimension, <math display="inline">D_B</math> that is generally called “capacity” or “box dimension” is defined by the relation (Eq.[[#eq-3|(3)]]) <span id='citeF-4'></span>[[#cite-4|[4]]] |
<span id="eq-3"></span> | <span id="eq-3"></span> | ||
Line 129: | Line 114: | ||
|} | |} | ||
− | If the box counting technique is utilized to calculate again the fractal dimension of the England coast line, | + | If the box counting technique is utilized to calculate again the fractal dimension of the England coast line, ([[#table-3|Table 3]]) must be used <span id='citeF-5'></span>[[#cite-5|[5]]]. |
+ | <div class="center" style="font-size: 75%;">'''Table 3'''. Data to calculate fractal dimension <math>D_B</math> using “Box Counting” technique</div> | ||
− | + | <span id='table-3'></span> | |
− | + | {| class="wikitable" style="margin: 1em auto 0.1em auto;border-collapse: collapse;font-size:85%;width:auto;" | |
− | | | + | |-style="text-align:center" |
− | + | ! Scale (<math display="inline">\xi _k</math>) !! <math>N(\xi _k)</math> !! <math>\ln (1/\xi _k)</math> !! <math>\ln (N)</math> | |
− | + | |- style="text-align:center" | |
− | | style=" | + | | 1 |
− | + | | 2350 | |
− | |- style=" | + | | 0.0000 |
− | | | + | | 7.7622 |
− | | | + | |- style="text-align:center" |
− | | | + | | 0.5 |
− | | | + | | 5550 |
− | |- style=" | + | | 0.6931 |
− | | | + | | 8.6216 |
− | | | + | |- style="text-align:center" |
− | | | + | | 0.25 |
− | | | + | | 13700 |
− | |- style=" | + | | 1.3863 |
− | + | | 9.5252 | |
− | | | + | |
− | + | ||
− | | | + | |
− | + | ||
|} | |} | ||
− | The result of applying the linear adjustment over the data | + | |
+ | The result of applying the linear adjustment over the data ([[#table-3|Table 3]]) is the equation shown below (Eq.[[#eq-4|(4)]]) | ||
<span id="eq-4"></span> | <span id="eq-4"></span> | ||
Line 172: | Line 155: | ||
and it could be seen that the fractal dimension is given directly form the slope of the equation <math display="inline">D_B = 1.27</math>. | and it could be seen that the fractal dimension is given directly form the slope of the equation <math display="inline">D_B = 1.27</math>. | ||
− | 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 | + | 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.[[#eq-4|(4)]]) <span id='citeF-6'></span>[[#cite-6|[6]]]. |
− | ==2 ImageJ application== | + | ==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 <span id='citeF-6'></span>[[#cite-6|[6]]]. | 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 <span id='citeF-6'></span>[[#cite-6|[6]]]. | ||
Line 180: | Line 163: | ||
The direction to download “ImageJ” app is: https://imagej.nih.gov/ij/download.html | The direction to download “ImageJ” app is: https://imagej.nih.gov/ij/download.html | ||
− | But | + | 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-<math display="inline">></math>Tools-<math display="inline">></math>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. | Install the app and use it to know the tool, but even when the software has a specific process to measure fractal dimension (Analyze-<math display="inline">></math>Tools-<math display="inline">></math>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. | ||
Line 194: | Line 177: | ||
===2.1 Preliminary measurement=== | ===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 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 [[#img-1|Figure 1]]. |
<div id='img-1'></div> | <div id='img-1'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Imagej-Toolbar.png|425px | + | |style="padding:10px;"| [[Image:Review_368345517339-Imagej-Toolbar.png|425px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 1 | + | | colspan="1" style="padding:10px;"| '''Figure 1'''. Toolbar of the ImageJ app |
|} | |} | ||
− | Over the Mandelbrot | + | |
+ | Over the Mandelbrot [[#img-2|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. | ||
<div id='img-2'></div> | <div id='img-2'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Mandelbrot-with-scale.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Mandelbrot-with-scale.png|222px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 2 | + | | colspan="1" style="padding:10px;"| '''Figure 2'''. Mandelbrot figure with measure over the scale |
|} | |} | ||
− | After this, go to menu and over “Analyze” select “Set Scale” put in the “Known distance” the value of the scale and in unit write the name of the scale. | + | |
+ | After this, go to menu and over “Analyze” select “Set Scale”, as shown in [[#img-3|Figure 3]], put in the “Known distance” the value of the scale and in unit write the name of the scale. | ||
<div id='img-3'></div> | <div id='img-3'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Setting-Scale.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Setting-Scale.png|222px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 3 | + | | colspan="1" style="padding:10px;"| '''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 | + | |
+ | 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 ([[#img-4|Figure 4]]) or can outline the graphic, at this step of the process the image is prepared to be measured. | ||
<div id='img-4'></div> | <div id='img-4'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Find-Edges.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Find-Edges.png|200px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 4 | + | | colspan="1" style="padding:10px;"| '''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, this procedure gives a first result of the fractal dimension <math display="inline">D_B</math> as a result of the “Box Counting” technique, but this is just a preliminary measure, that is because the boxes can't be seen, just the result. | + | |
+ | Then select “Analize” on the menu go to “Tools” process and “Fractal Box Counting” sub-process, as is shown in [[#img-5|Figure 5]], this procedure gives a first result of the fractal dimension <math display="inline">D_B = 1.1955</math> as a result of the “Box Counting” technique ([[#img-6|Figure 6]]), but this is just a preliminary measure, that is because the boxes can't be seen, just the result. | ||
<div id='img-5'></div> | <div id='img-5'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Frac-Dim1.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Frac-Dim1.png|300px|]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 5 | + | | colspan="1" style="padding:10px;"| '''Figure 5'''. Menu for calculate directly the fractal dimension by the box counting method. |
|} | |} | ||
+ | |||
<div id='img-6'></div> | <div id='img-6'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Frac-Dim1-Result.png|466px | + | |style="padding:10px;"|[[Image:Review_368345517339-Frac-Dim1-Result.png|466px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 6 | + | | colspan="1" style="padding:10px;" | '''Figure 6'''. Result of calculations of fractal dimension over the Mandelbrot figure |
|} | |} | ||
− | ==3 Using the FracLac plugin== | + | |
+ | ==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. | 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”. | + | 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 [[#img-7|Figure 7]]. |
<div id='img-7'></div> | <div id='img-7'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Access-FracLac.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Access-FracLac.png|274px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 7 | + | | colspan="1" style="padding:10px;" | '''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 | + | |
+ | 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 [[#img-8|Figure 8]]. Just make this changes if wants to measure fractal dimension of a perimeter line. | ||
<div id='img-8'></div> | <div id='img-8'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-FracLac-Menu.png|347px| | + | |style="padding:10px;"|[[Image:Review_368345517339-FracLac-Menu.png|347px|]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 8 | + | | colspan="1" style="padding:10px;" | '''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, the image in | + | |
+ | 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 [[#img-9|Figure 9]], the image in “tif” format and the box counting data with <math display="inline">D_B = 1.1965</math>, the value obtained is very close as previously calculated but it's not the same. | ||
<div id='img-9'></div> | <div id='img-9'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Image-BC-Data.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Image-BC-Data.png|357px|]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 9 | + | | colspan="1" style="padding:10px;"| '''Figure 9'''. Two of the analysis results given by the plugin's operations |
|} | |} | ||
− | The | + | |
+ | 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 [[#img-10|Figure 10]]. | ||
<div id='img-10'></div> | <div id='img-10'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Four-Moments.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Four-Moments.png|270px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 10 | + | | colspan="1" style="padding:10px;"| '''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 [[#img-11|Figure 11]]. | |
− | + | ||
− | + | ||
<div id='img-11'></div> | <div id='img-11'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Linear-Adjust.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-Linear-Adjust.png|431px]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 11 | + | | colspan="1" style="padding:10px;"| '''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. | |
− | 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 | + | 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 <math display="inline">D_B</math> 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 <u>we do not look for the edges or outline the image</u>. 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 [[#img-12|Figure 12]]. | ||
<div id='img-12'></div> | <div id='img-12'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-BC-area-figure.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-BC-area-figure.png|401px|]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 12 | + | | colspan="1" style="padding:10px;" | '''Figure 12'''. BC menu's characteristic for measurement of <math>D_B</math> over a figure's area |
|} | |} | ||
− | |||
− | Once the characteristics of the measurements have been established select the | + | 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 <math display="inline">D_B = 1.7614</math> as can be seen in [[#img-13|Figure 13]]. | ||
<div id='img-13'></div> | <div id='img-13'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-DB-Area-Fractal.png| | + | |style="padding:10px;"|[[Image:Review_368345517339-DB-Area-Fractal.png|541px|]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 13 | + | | colspan="1" style="padding:10px;"| '''Figure 13'''. Results of <math>D_B</math> 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: <math display="inline">y = 1.76124x + 0.31013</math> and the result of the fractal dimension is directly the slope, which is <math display="inline">D_B = 1.76124</math>. |
− | 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 <math display="inline">a</math>, a square and a cube with sides also <math display="inline">a</math> and measure their fractal dimensions. | + | ==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 <math display="inline">a</math>, a square and a cube with sides also <math display="inline">a</math> and measure their fractal dimensions ([[#img-14|Figure 14]]). | ||
<div id='img-14'></div> | <div id='img-14'></div> | ||
− | {| | + | {| style="text-align: center; border: 1px solid #BBB; margin: 1em auto; width: auto;max-width: auto;" |
|- | |- | ||
− | |[[Image:Review_368345517339-Fractal-Euclidean-dimension.png|502px| | + | |style="padding:10px;"|[[Image:Review_368345517339-Fractal-Euclidean-dimension.png|502px|]] |
|- style="text-align: center; font-size: 75%;" | |- style="text-align: center; font-size: 75%;" | ||
− | | colspan="1" | '''Figure 14 | + | | colspan="1" style="padding:10px;"| '''Figure 14'''. Calculation of fractal dimension <math>D_B</math> over a line, a square and a cube |
|} | |} | ||
− | Using the box counting technique it has been measured in this work the fractal dimension <math display="inline">D_B</math> of a Mandelbrot fractal figure with two different process <span id='citeF-7'></span><span id='citeF-8'></span><span id='citeF-9'></span>[[#cite-7|[7,8,9]]] | + | |
+ | Using the box counting technique it has been measured in this work the fractal dimension <math display="inline">D_B</math> of a Mandelbrot fractal figure with two different process <span id='citeF-7'></span><span id='citeF-8'></span><span id='citeF-9'></span>[[#cite-7|[7,8,9]]]: | ||
* Measurement of the fractal dimension of the image perimeter. | * Measurement of the fractal dimension of the image perimeter. | ||
* Measurement of the fractal dimension of the image area. | * 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 <span id='citeF-10'></span><span id='citeF-11'></span>[[#cite-10|[10,11]]]. | Both measurements of the fractal dimension are different and both means how far they are from the corresponding Euclidean dimension <span id='citeF-10'></span><span id='citeF-11'></span>[[#cite-10|[10,11]]]. | ||
− | === | + | ==References== |
+ | <div class="auto" style="text-align: left;width: auto; margin-left: auto; margin-right: auto;font-size: 85%;"> | ||
<div id="cite-1"></div> | <div id="cite-1"></div> | ||
− | + | [[#citeF-1|[1]]] Mandelbrot B. The fractal geometry of nature. W.H. Freeman, 1982. | |
− | + | <div id="cite-2"></div> | |
− | + | [[#citeF-2|[2]]] Mandelbrot B. Self-affine and fractal dimension. Physica Scripta, 32(4):257-260, 1985. | |
− | + | <div id="cite-3"></div> | |
− | + | [[#citeF-3|[3]]] Mandelbrot B. How long is the coast of Britain? Statistical self-similarity and fractional dimension. Science, 156(3775):636-638, 1967. | |
− | + | <div id="cite-4"></div> | |
− | + | [[#citeF-4|[4]]] Gatzouras D., Lalley S. Hausdorff and box dimensions of certainself-affine fractals. Indiana University Mathematics Journal, 41(2):533-568, 1992. | |
− | + | <div id="cite-5"></div> | |
− | + | [[#citeF-5|[5]]] Husain A., Reddy J., Bisht D., Sajid M. Fractal dimension of coastline of Australia. Sci. Rep., 11, 6304, 2021. | |
− | + | <div id="cite-6"></div> | |
− | + | [[#citeF-6|[6]]] Schneider C., Rasband W., Eliceiri K. NIH image to ImageJ: 25 years of image analysis. Nature Methods, 9:671-675, 2012. | |
+ | <div id="cite-7"></div> | ||
+ | [[#citeF-7|[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. | ||
+ | <div id="cite-8"></div> | ||
+ | [[#citeF-8|[8]]] Bárány B., Hochman M., Rapaport A. Hausdorff dimension of planar self-affine measures. Inventiones Mathematicae, 16:601-659, 2019. | ||
+ | <div id="cite-9"></div> | ||
+ | [[#citeF-9|[9]]] Christensen H., Driver O. The fractal nature of clouds in global storm-resolving models. ArXiv:2108.08565v1, 2021. | ||
+ | <div id="cite-10"></div> | ||
+ | [[#citeF-10|[10]]] Strogatz H. Nonlinear dynamics and chaos: With applications to physics, biology, chemistry and engineering. Westview Press, Boulder CO. USA, 2nd edition, 2015. | ||
+ | <div id="cite-11"></div> | ||
+ | [[#citeF-11|[11]]] Devaney R. A first course in chaotic dynamical systems theory and experiment. CRC Press, Florida USA, 2nd edition, 2020. |
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
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.
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 |
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].
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].
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.
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.
![]() |
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.
![]() |
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.
![]() |
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.
![]() |
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.
![]() |
Figure 5. Menu for calculate directly the fractal dimension by the box counting method. |
![]() |
Figure 6. Result of calculations of fractal dimension over the Mandelbrot figure |
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.
![]() |
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.
![]() |
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.
![]() |
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.
![]() |
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.
![]() |
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.
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.
![]() |
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.
![]() |
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 .
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).
![]() |
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]:
Both measurements of the fractal dimension are different and both means how far they are from the corresponding Euclidean dimension [10,11].
[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.
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
Are you one of the authors of this document?