Macro to make Z-projections from .lif stacks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro to make Z-projections from .lif stacks

Luis Boero
Hi! I´ve been trying to develop a macro to get z projections from the stacks I take in the microscope.

run("Bio-Formats Macro Extensions");
inputFolder=getDirectory("");
images=getFileList(inputFolder);
NewDir=inputFolder+"Procesadas";
//File.makeDirectory(NewDir); // creo la carpeta

for (i=0; i<images.length; i++) {
        path=inputFolder+images[i];
        filename=images[i];
        Ext.setId(path);
        Ext.getSeriesCount(seriesCount);
       
        for (j=1; j<=seriesCount; j++) {
                       
                run("Bio-Formats", "open=path autoscale color_mode=Default view=Hyperstack split_channels stack_order=XYCZT,j);
               
                list = getList("image.titles");
  if (list.length==0)
             print("No image windows are open");
  else {
             //print("Image windows:");
             for (k=0; k<=list.length; k++) {
            print("   "+list[k]);
            selectWindow();
            run("Z Project...", "projection=[Max Intensity]");
            close(title);
  }
  }
}

When I run the macro, I only get the Max Projection from the channel that corresponds to k=1, but the other one remains as a substack. What can I do?

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro to make Z-projections from .lif stacks

Luis Boero
Sorry, I make a mistake at the latest at the line 30

close(title);

should say

close();

However, the problem remains.

Thanks in advance.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro to make Z-projections from .lif stacks

Olivier Burri
In reply to this post by Luis Boero
Hi Luis,

Might it be that your selectWindow() is not taking an argument, right at the end of your code?

To get to working, try changing it to
selectImage(list[k]);
and then running your Z-Project

If you run the close(); right after your projection, you will close it before finishing.

Either save your image before or run
selectImage(list[k]);
again before the close command.

Best

Oli

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Luis
> Boero
> Sent: mercredi, 6 juillet 2016 21:48
> To: [hidden email]
> Subject: Macro to make Z-projections from .lif stacks
>
> Hi! I´ve been trying to develop a macro to get z projections from the stacks I
> take in the microscope.
>
> run("Bio-Formats Macro Extensions");
> inputFolder=getDirectory("");
> images=getFileList(inputFolder);
> NewDir=inputFolder+"Procesadas";
> //File.makeDirectory(NewDir); // creo la carpeta
>
> for (i=0; i<images.length; i++) {
> path=inputFolder+images[i];
> filename=images[i];
> Ext.setId(path);
> Ext.getSeriesCount(seriesCount);
>
> for (j=1; j<=seriesCount; j++) {
>
> run("Bio-Formats", "open=path autoscale color_mode=Default
> view=Hyperstack split_channels stack_order=XYCZT,j);
>
>                 list = getList("image.titles");
>   if (list.length==0)
>              print("No image windows are open");
>   else {
>              //print("Image windows:");
>              for (k=0; k<=list.length; k++) {
>             print("   "+list[k]);
>             selectWindow();
>             run("Z Project...", "projection=[Max Intensity]");
>             close(title);
>   }
>   }
> }
>
> When I run the macro, I only get the Max Projection from the channel that
> corresponds to k=1, but the other one remains as a substack. What can I do?
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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