/*Makes isotropic grid with circles and points as non-destructive overlay.
You do not need to rotate the grid to get isotropic line orientation.
Do not forget to "Set Scale" to get correct printout of grid parameters.
Parameters of the grid are reflected in the "Multiple Circles grid parameters" window.
"Number of circles within short side" determines number and size of grid circles.
"Central Point" makes one point in every circle.
"Additional Points" makes 4 additional points per circle.
Grid constant a/l (area per line unit) is used to estimate total length
of a flat structure. Total length equals to number of intersections (between
linear feature and test lines) multiplied by PI/2 times the grid constant a/l.
Area per point can be used to estimate an area in 2D samples or volume density
in isotropic uniform random sections.
Test line per point (l/p) constant is used to estimate surface density (surface
area per unit volume) in isotropic uniform random sections.
Version: 1.0
Date: 04/09/2014
Author: Aleksandr Mironov amj-box@mail.ru
*/
requires("1.46b");
//help
html = ""
+"
Multiple Circles Grid
"
+"is a linear test system with built-in 2D isotropy
"
+"Options:
"
+"Number of tiles - determines how many tiles are drawn
"
+"Random Offset - randomizes grid location
"
+"New Overlay - removes previous overlays
"
+"Central point - point in the middle of circles
"
+"Additional Points - 4 additional points per circle
"
+"Set Scale to get correct printout of the grid parameters,
"
+"which are reflected in the 'Multiple Circles grid parameters' window
"
+"Useful parameters:
"
+"Area per point can be used to estimate an area in 2D samples
"
+"or volume density isotropic uniform random sections
"
+"Test line per point constant is used to estimate surface density
"
+"(surface area per unit volume) in isotropic uniform random sections
"
+"Grid constant a/l (area per line unit) is used to estimate total lenght
"
+"of a flat stucture. Total length equals to number of intersections
"
+"multiplied by PI/2 times the grid constant a/l
"
//Creating dialog box
Dialog.create("Multiple Circles Grid, ver. 1.0");
Dialog.addNumber("Number of tiles =", 3,0,2,"within short side");
Dialog.addNumber("Line thickness =", 1,0,2,"pixels");
Dialog.addCheckbox("Random Offset", true);
Dialog.addCheckbox("New Overlay", true);
Dialog.addCheckbox("Central Point", true);
Dialog.addCheckbox("Additional Points", true);
Dialog.addChoice("Color:", newArray("cyan", "red", "green", "magenta", "blue", "yellow", "orange", "black", "white"));
Dialog.addHelp(html);
Dialog.show();
name = getTitle();
//grid parameters
nt = Dialog.getNumber();
t = Dialog.getNumber();
getDimensions(a, b, channels, slices, frames);
ss = minOf(a,b);
r = ss/(3*nt);
d = 2*r;
tile = 3*r;
//creating random offset
off1 = random;
off2 = random;
offset = Dialog.getCheckbox();
if (offset == false) off1 = off2 = 0;
//other choices
new = Dialog.getCheckbox();
if (new == true) Overlay.remove;
point = Dialog.getCheckbox();
points = Dialog.getCheckbox();
color = Dialog.getChoice();
//initial coordinates X
xoff = -round(d*off1);
x1 = xoff + r;
x2 = x1 - d/30;
x3 = x1 + d/30;
setColor(color);
setLineWidth(t);
//X loop;
while (true && xoff