Login  Register

Re: Struggling to open a list of images (.lif)

Posted by Wayne Rasband-2 on Mar 21, 2019; 4:04pm
URL: http://imagej.273.s1.nabble.com/Struggling-to-open-a-list-of-images-lif-tp5021918p5021919.html

> On Mar 21, 2019, at 7:08 AM, MONARA ANGELIM <[hidden email]> wrote:
>
> Hello,
>
> After updating ImageJ, I have problems to run a macro, which
> worked perfectly beforehand.
>
> Now the macro works only for the first
> image not for all the images that area saved in .lif format (as it
> should work). Could anyone help me? Thank you in advance.

In the macro, change

   outFile = path2 +File.separator+ title;

to

   outFile = path2 + ”/“ + title;

and it should work as expected. “/” is a valid file separator on all operating systems, including Windows.

Here is the description of the getFileList() macro function:

Returns an array containing the names of the files in the specified directory path. The names of subdirectories have a "/" appended. For an example, see the ListFilesRecursively macro at

  https://imagej.nih.gov/ij/macros/ListFilesRecursively.txt

-wayne


> The macro
> is:
>
> path = getDirectory("SP8 Images");
> path2 = getDirectory("Results
> of Find Maxima");
> listN3 = getFileList(path);
> setBatchMode(true);
> for
> (i=0; i<listN3.length; i++) {
>    incomingN3 =
> path+File.separator+listN3[i];
>    run("Bio-Formats Macro Extensions");
>
>  run("Bio-Formats Windowless Importer", "open=incomingN3");
>    title
> = getTitle();
>    run("Z Project...", "projection=[Max Intensity]");
>
> run("Split Channels");
>    selectWindow("C2-MAX_" +title);
>
> run("Gamma...", "value=1.50");
>    run("Gamma...", "value=1.50");
>
> run("Gaussian Blur...", "sigma=1");
>    run("Find Maxima...", "noise=500
> output=Count");
>    outFile = path2 +File.separator+ title;
>
> saveAs("Measurements", outFile +".csv");
>    run("Close");
> }
>
> print("
> ");
> print("All done");
>
> Monara

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html