Login  Register

Re: output results to file - batch

Posted by Richard Fetter on Oct 22, 2008; 8:03am
URL: http://imagej.273.s1.nabble.com/output-results-to-file-batch-tp3694671p3694672.html

Remove the period "." after the semi-colon in line 21


On Mon, Oct 20, 2008 at 4:05 PM, Justin Walker <[hidden email]> wrote:

> I'm trying to create a macro that analyzes images of droplets, and instead
> of outputting the results of all of the images in the  batch into one large
> data file, I want a single data file for each image.  Can someone take a
> look at my macro and tell me what I'm doing wrong? it gets past the first
> image in the folder and then throws the error
> *
> Statement cannot begin with '.' in line 21.
> txtPath = path + ".txt" ; <.>
>
> *I'm simply trying to append .txt to the image filename to save the results
> (so I get something like image1.tif.txt), which I have done successfully
> with other macros.
>
> Any help you can provide would be invaluable.
>
> Thanks
>
> - Justin Walker
> University of Maryland
>
> macro "Batch Particle Size for stereo images" {
>    dir = getDirectory("Choose a Directory ");
>    list = getFileList(dir);
>    setBatchMode(true);
>    for (i=0; i<list.length; i++) {
>        path = dir+list[i];
>        showProgress(i, list.length);
>        if (!endsWith(path,"/")) open(path);
>        if (nImages>=1) {
>            //run("8-bit");
>            //run("Deinterlace ");
>            setThreshold(0, 113);
>            run("Convert to Mask");
>            run("Dilate");
>            run("Dilate");
>            run("Fill Holes");
>                run("Erode");
>                run("Erode");
>            run("Watershed");
>            run("Analyze Particles...", "size=0.15-Infinity
> circularity=0.2-1.00 show=Nothing display exclude");
>            txtPath = path+".txt";.
>            saveAs("Measurements", "["+txtPath+"]");
>            run("Clear Results");
>            close();
>
>        }
>    }
> }
>
>