Login  Register

Re: macro ImageJ

Posted by Michael Schmid on Jul 12, 2007; 10:10am
URL: http://imagej.273.s1.nabble.com/macro-ImageJ-tp3698877p3698880.html

Hi Michelina,

no problem, you have to put it into the loop of your macro.

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);
//probably you want something like setThreshold(threshold, max); here?
           run("Create Mask");
           rename(list[i]); //otherwise all lines in the summary will  
be labelled "mask"
           run("Watershed");
           run("Analyze Particles...", "size=100-650 summarize");
           close;
           close;
       }
       selectWindow("Summary");
       saveAs("Text", getDirectory("home")+"Summary.txt");


Michael
________________________________________________________________

On 11 Jul 2007, at 17:50, Michelina Nascimbeni wrote:

> Hi Michael,
>
> Thanks for your answer. Actually, our macro runs on a folder  
> containing a
> set of images. We need to include the watershed function into this  
> macro and
> run this on the whole folder not only on one single picture.
> Any other idea?
> Thanks
> Michelina