Login  Register

Re: Convert macro from NIH Image to ImageJ

Posted by dinurf on Jan 09, 2016; 2:28am
URL: http://imagej.273.s1.nabble.com/Convert-macro-from-NIH-Image-to-ImageJ-tp5015304p5015355.html

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