Sei sulla pagina 1di 2

r.

boxcount

http://www.ucl.ac.uk/~tcrnmar/GIS/r.boxcount.html

r.boxcount
Description Examples Download Installation Acknowledgements

Description
r.boxcount calculates the box-counting (fractal) dimension of a binary raster map. The program counts the minimum number of boxes, NbE, of size 1,...,1/2^k that are required to cover all non-zero cells. It then uses this information to calculate the fractal dimension for each pair of box sizes. The results may be saved in a text file, in which case they may also be displayed in graph form by invoking the program Gnuplot (which, athough not part of GRASS, is widely available on UNIX-like systems). r.boxcount also calculates the box-counting dimension by linear regression over a range of box sizes determined by the parameters resolution and saturation. The largest box size that will be used is 1/resolution (i.e. this is the coarsest resolution). The smallest box size is set to that for which the results satisfy the condition NbE < saturation * the number of non-zero cells in the region (i.e. before saturation occurs). Note that the shell script boxcount.sh can be used to study how the boxcounting fractal dimension varies across a raster map.

Examples
The screenshot shows the result of running r.boxcount on a raster map containing the sierpinski gasket. Even though the sierpinski gasket is a true fractal the graph does not contain a straight line: this is due to the effect of saturation. Nevertheless, since the user has chosen an appropriate value for the parameter saturation the program has calculated the correct (theoretically calculable) fractal dimension for this map.

Download
This code may only work for 80x86 machines. For very good reasons, some functions in r.boxcount manipulate individual bits and might need modification on a Big-Endian machine (e.g SPARC, 68xxx): I don't currently have access to such a machine and so haven't tested it. If anyone is interested in doing this then please email me and I'll send some diagnostic code. The GRASS 4.x source code for r.boxcount is available as a compressed tar file. This includes installation instructions, man page and a patch to add the program to the tcltkgrass menu. Please let me know if you find this module useful so that I can judge whether it is worth revising the code for GRASS 5.0.

Installation
Installation of r.boxcount should be straightforward (but see the note above about portability) provided you have a source code distribution of GRASS 4.2. The patch file for the tcltkgrass interface assumes that you have tcltkgrass 2.8. The process is as follows:
($GISBASE is the top-level directory of your GRASS source code tree, e.g. /usr/local/grass42.) NOTE: The functions in 'bits.c' manipuluate individual bits and might

1 of 2

7/5/2011 4:57 PM

r.boxcount

http://www.ucl.ac.uk/~tcrnmar/GIS/r.boxcount.html

need modification on a Big-Endian machine (e.g SPARC, 68xxx). code was developed on an 80x86. 1) Copy the source file into the contrib directory: cp r.boxcount.tar.gz $GISBASE/src421/src.contrib 2) Unpack the source file: cd $GISBASE/src421/src.contrib gunzip r.boxcount.tar.gz tar -xvf r.boxcount.tar

This

3) Compile the binaries and make them available to the GRASS front-end (these should compile without any special compiler flags): cd MWL/r.boxcount/cmd gmake4.2 cd $GISBASE/src421/src/CMD ./MAKELINKS.my 4) Install the tcltkgrass module: cd $GISBASE/tcltkgrass/main cp $GISBASE/src421/src.contrib/MWL/r.boxcount/tcltk/menu_boxcount.diff . patch menu.tcl menu_boxcount.diff cd ../module cp $GISBASE/src421/src.contrib/MWL/r.boxcount/tcltk/r.boxcount . 5) Install the manual page cd $GISBASE/src421/man cp $GISBASE/src421/src.contrib/MWL/r.boxcount/man4/r.boxcount man4 gmake4.2 6) In order for r.boxcount to graph the results you must ensure that the graphing program Gnuplot is in the PATH of your GRASS shell. If Gnuplot is not installed on your system visit http://www.cs.dartmouth.edu/gnuplot_info.html. 7) Have fun!

Acknowledgements
This program was written during the author's tenure of a Leverhulme Special Research Fellowhip.

2 of 2

7/5/2011 4:57 PM

Potrebbero piacerti anche