Login  Register

Re: Convert macro from NIH Image to ImageJ

Posted by dinurf on Jun 20, 2016; 2:57am
URL: http://imagej.273.s1.nabble.com/Convert-macro-from-NIH-Image-to-ImageJ-tp5015304p5016688.html

Hello,

I downloaded a macro from ImageJ website a long time ago, the macro is
called FractalEDM (attaced) to compute an object's fractal dimension.
Because I am new using ImageJ, I don't really understand what has written
within the macro. So if you don't mind, Could you help me please to let me
know what step by step within the macro or general step? I cannot contact
the main author, her email was no longer used.

For example, for the first line, (requires "1.30p") and I see that they
used "run(Invert)" which is I don't understand why.

Besides that, I am also trying to used menu Distance Map. The steps I used:

1. Make an image into binary
2. Menu --> Process --> Binary --> Distance map
3. Menu --> Analyze --> Histogram , to get the list of data of values and
counts.

And I followed this way to get the fractal dimension:



But the result that I got, for example the koch snowflake, seems weird or
too high from the theoretical value. That's why I ask your help whether I
made some mistakes on those steps.

Is the way that I did using the above steps VERY different with the way
written in the macro?

Thank you.
I am looking forward your advice.

Dini



On Sat, Jan 9, 2016 at 10:28 AM, dinurf <[hidden email]> wrote:

> Thank you very much.
>
> On Fri, Jan 1, 2016 at 4:32 AM, Rasband, Wayne (NIH/NIMH) [E] [via ImageJ]
> <
> [hidden email]> wrote:
>
> > > On Dec 31, 2015, at 1:05 AM, dinurf <[hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=5015305&i=0>> wrote:
> > >
> > > Hi All,
> > >
> > > Could someone please help me to convert the macro below? The macro used
> > to
> > > be written for NIH Image while I want to run it on ImageJ.
> >
> > A macro something like the following should work. Note that it assumes,
> > like the NIH Image version, that objects are black and background is
> white
> > and that black pixels have a value of 255.
> >
> > -wayne
> >
> >   macro "Fractal Dilation" {
> >      iterations = 64;
> >      run("Clear Results");
> >      setOption("BlackBackground", false);
> >      run("Make Binary"); // needed if image is not binary
> >      for (i=0; i<=iterations; i++) {
> >         showProgress(i, iterations);
> >         getRawStatistics(n, mean, min, max, std, hist);
> >         setResult("i*2+1", i, i*2+1);
> >         setResult("hist[255]", i, hist[255]);
> >         setResult("hist[255]/(i*2+1)", i, hist[255]/(i*2+1));
> >         run("Options...", "iterations=1 count=1 do=Dilate");
> >       }
> >      updateResults;
> >   }
> >
> >
> > > =============================================
> > > macro 'Fractal Dilation';
> > > var
> > > iterations,i:integer;
> > > tab:string;
> > > begin
> > > SaveState;
> > > iterations:=64;
> > > tab:=chr(9);
> > > SetFont('Monaco');
> > > SetFontSize(9);
> > > ResetCounter;
> > > SetBinaryCount(1);
> > > NewTextWindow(contact(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;
> > > =========================================================
> > > --
> > > View this message in context:
> >
> http://imagej.1557.x6.nabble.com/Convert-macro-from-NIH-Image-to-ImageJ-tp5015304.html
> > > Sent from the ImageJ mailing list archive at Nabble.com.
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://imagej.1557.x6.nabble.com/Convert-macro-from-NIH-Image-to-ImageJ-tp5015304p5015305.html
> > To unsubscribe from Convert macro from NIH Image to ImageJ, click here
> > <
> >
> > .
> > NAML
> > <
>
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Convert-macro-from-NIH-Image-to-ImageJ-tp5015304p5015355.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Untitled.png (368K) Download Attachment
FractalEDM notes.txt (2K) Download Attachment