Fractal Dilation Macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Fractal Dilation Macro

dinurf
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
Reply | Threaded
Open this post in threaded view
|

Re: Fractal Dilation Macro

Herbie
Dini,

NIH Image was written in Pascal and its macro language is quite
different from that used with ImageJ that is written in Java. I fear you
have to re-write your macro in ImageJ macro language which should not be
too difficult, especially when using the macro recorder of ImageJ.

For details please study the docs that are available from:
<http://rsb.info.nih.gov/ij/docs/index.html>

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::::::::::
Am 07.12.15 um 03:44 schrieb SUBSCRIBE IMAGEJ Dini:

> 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fractal Dilation Macro

Jeremy Adler
In reply to this post by dinurf
You don't need a complicated macro.

All possible dilations are contained in the Distance Map made from the outline - and can be output using a histogram.

The histogram gives the area of a band at each radius and the cumulative histogram (could generate in Excel or a  macro) gives the area at each radius.

A bigger problem is that many shapes do not produce a linear relationship in the final log log plot.

Adler J & Hancock D, Powder Technology, 1994, 78,191-196.



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of SUBSCRIBE IMAGEJ Dini
Sent: den 7 december 2015 03:45
To: [hidden email]
Subject: Fractal Dilation Macro

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fractal Dilation Macro

dinurf
Hi Jeremy,

Thanks for your reply. So the histogram will give me each kernel size
(diameter) and area? Ok, I will try and if I still have problem May I ask
you later?

Yes, it is. I am dealing with volcanic ash and I am using EDM method as
well to produce the log log plot and yes it's not a linear relationship.

Thank you.

Best,
Dini

On Mon, Dec 7, 2015 at 8:35 PM, Jeremy Adler <[hidden email]> wrote:

> You don't need a complicated macro.
>
> All possible dilations are contained in the Distance Map made from the
> outline - and can be output using a histogram.
>
> The histogram gives the area of a band at each radius and the cumulative
> histogram (could generate in Excel or a  macro) gives the area at each
> radius.
>
> A bigger problem is that many shapes do not produce a linear relationship
> in the final log log plot.
>
> Adler J & Hancock D, Powder Technology, 1994, 78,191-196.
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> SUBSCRIBE IMAGEJ Dini
> Sent: den 7 december 2015 03:45
> To: [hidden email]
> Subject: Fractal Dilation Macro
>
> 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
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fractal Dilation Macro

dinurf
In reply to this post by Jeremy Adler
Hi Jeremy,

Is that like this?
First, I opened the image that I want to analyze.
Second, I go to Process >> Binary >> Distance Map. The original image
became as shown on the left (1.JPG).
Afterwards, I go to Analyze >> Histogram. Histogram emerged, as shown in
the middle. I click on "List" menu below the histogram and I got a table on
the right. What are value and count? Are those the diameter and the area?

I ask your guidance. Thank you.

Dini





On Mon, Dec 7, 2015 at 8:35 PM, Jeremy Adler <[hidden email]> wrote:

> You don't need a complicated macro.
>
> All possible dilations are contained in the Distance Map made from the
> outline - and can be output using a histogram.
>
> The histogram gives the area of a band at each radius and the cumulative
> histogram (could generate in Excel or a  macro) gives the area at each
> radius.
>
> A bigger problem is that many shapes do not produce a linear relationship
> in the final log log plot.
>
> Adler J & Hancock D, Powder Technology, 1994, 78,191-196.
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> SUBSCRIBE IMAGEJ Dini
> Sent: den 7 december 2015 03:45
> To: [hidden email]
> Subject: Fractal Dilation Macro
>
> 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
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Fractal Dilation Macro

dinurf
Hi Jeremy,

I think what I have done using Distance Map and histogram is EDM method?
not dilation, sorry I am still confused.

Dini

On Tue, Dec 8, 2015 at 10:50 AM, Dini Nurfiani <[hidden email]>
wrote:

> Hi Jeremy,
>
> Is that like this?
> First, I opened the image that I want to analyze.
> Second, I go to Process >> Binary >> Distance Map. The original image
> became as shown on the left (1.JPG).
> Afterwards, I go to Analyze >> Histogram. Histogram emerged, as shown in
> the middle. I click on "List" menu below the histogram and I got a table on
> the right. What are value and count? Are those the diameter and the area?
>
> I ask your guidance. Thank you.
>
> Dini
>
>
>
> ​
>
> On Mon, Dec 7, 2015 at 8:35 PM, Jeremy Adler <[hidden email]>
> wrote:
>
>> You don't need a complicated macro.
>>
>> All possible dilations are contained in the Distance Map made from the
>> outline - and can be output using a histogram.
>>
>> The histogram gives the area of a band at each radius and the cumulative
>> histogram (could generate in Excel or a  macro) gives the area at each
>> radius.
>>
>> A bigger problem is that many shapes do not produce a linear relationship
>> in the final log log plot.
>>
>> Adler J & Hancock D, Powder Technology, 1994, 78,191-196.
>>
>>
>>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>> SUBSCRIBE IMAGEJ Dini
>> Sent: den 7 december 2015 03:45
>> To: [hidden email]
>> Subject: Fractal Dilation Macro
>>
>> 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
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
>

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