Login  Register

Re: macro ImageJ

Posted by Michael Schmid on Jul 11, 2007; 3:57pm
URL: http://imagej.273.s1.nabble.com/macro-ImageJ-tp3698877p3698878.html

Hi Michelina,

you have to run Edit>Selection>Create Mask after setThreshold:
   run("Create Mask");
This creates the 8-bit binary image required.
The mask will be in a separate window, so don't forget to close
both, the mask and the original window.

Michael
________________________________________________________________

On 11 Jul 2007, at 16:35, Nascimbeni wrote:

> Hello all,
>
> We do have a macro "Analyze Particles" (the copy is joined below).
> We would like to add to that macro a watershed function.
> We tried to add run("Watershed"); just after setThreshold(30, 80); but
> this did not work. A message telling "8-bit binary image (0 and 255)
> required" appears.
> Anybody has a solution???
>
> Thanks a lot
> Best regards
> Michelina Nascimbeni
>
>
>
> requires("1.38o");
>      dir = getDirectory("Choose a Directory ");
>      list = getFileList(dir);
>      setBatchMode(true);
>      for (i=0; i<list.length; i++) {
>          showProgress(i, list.length);
>          open(dir+list[i]);
>          getStatistics(area, mean, min, max, std);
>          threshold = mean + 2.5*std;
>          setThreshold(30, 80);
>          run("Analyze Particles...", "size=100-650 summarize");
>          close;
>      }
>      selectWindow("Summary");
>      saveAs("Text", getDirectory("home")+"Summary.txt");