Login  Register

Fractal Dilation Macro

Posted by dinurf on Dec 07, 2015; 2:44am
URL: http://imagej.273.s1.nabble.com/Fractal-Dilation-Macro-tp5015153.html

Hello All,

I am working on fractal dimension using Dilation method. I found a macro for Dilation method but the macro runs under NIH Image. When I run the macro on ImageJ, it did not work. How to change the command so that be able to be run on ImageJ?
Please find the macro below.

Regards,
Dini

=============================================================
FRACTAL DILATION MACRO

        The FRACTAL DILATION Macro is a macro that runs under NIHImage, v. 1.58 and later.  It performs the measurements that allows one to calculate the so-called "capacity" fractal dimension.  The algorithm is called, in fractal parlance, the "dilation" method.  It is meant to work on an image that is a one pixel wide, binary (black on white) border.
The output is a named file with 3 columns.  The first is a list of the disc kernel sizes.   Th 2nd is a list of the average counts [area] for all kernal sizes and the 3rd is the area/kernel size to give equivalent length.


macro 'Fractal Dilation';
var
  iterations,i:integer;
  tab:string;
begin
  SaveState;
  iterations:=64;
  tab:=chr(9);
  SetFont('Monaco');
  SetFontSize(9);
  ResetCounter;
  SetBinaryCount(1);
  NewTextWindow(concat(WindowTitle, '-Counts'), 140, 350);
  MoveWindow(500,50);
  Measure;
  writeln(1:3, tab, histogram[255]:7, tab, histogram[255]:5);
  for i:=1 to iterations do begin
     Dilate;
     Measure;
     writeln(i*2+1:3, tab, histogram[255]:7, tab, histogram[255]/(i*2+1):5);
  end;
  RestoreState;
end;

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html