//
// LociPlugin.java
//

/*
LOCI Bio-Formats package for reading and converting biological file formats.
Copyright (C) 2005-2006 Melissa Linkert, Curtis Rueden and Eric Kjellman.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import ij.*;
import ij.io.OpenDialog;
import ij.plugin.PlugIn;
import java.awt.Dimension;
import java.awt.Image;
import loci.formats.ImageReader;
import loci.formats.ImageTools;

/**
 * ImageJ plugin for the LOCI Bio-Formats package.
 *
 * @author Curtis Rueden ctrueden at wisc.edu
 */
public class LociPlugin implements PlugIn {

  // -- PlugIn API methods --

  /** Executes the plugin. */
  public void run(String arg) {
    OpenDialog od = new OpenDialog("Open...", arg);
    String directory = od.getDirectory();
    String fileName = od.getFileName();
    if (fileName == null) return;
    String id = directory + fileName;

    IJ.showStatus("Opening: " + fileName);
    ImageReader reader = new ImageReader();
    try {
      int num = reader.getImageCount(id);
      ImageStack stack = null;
      for (int i=0; i<num; i++) {
        IJ.showProgress((double) i / num);
        Image img = reader.open(id, i);
        if (stack == null) {
          Dimension dim = ImageTools.getSize(img);
          stack = new ImageStack(dim.width, dim.height);
        }
        stack.addSlice(fileName + ":" + (i + 1),
          new ImagePlus(null, img).getProcessor());
      }
      IJ.showProgress(1);
      new ImagePlus(fileName, stack).show();
    }
    catch (Exception exc) {
      IJ.showStatus("");
      IJ.showMessage("LOCI Bio-Formats", "" + exc);
    }
  }

}

@@ -1512,17 +1512,16 @@
 %22Opening
-:
  %22 + fil
@@ -1685,24 +1685,103 @@
 num; i++) %7B%0A
+        if (i %25 5 == 4) IJ.showStatus(%22Reading plane %22 + (i + 1) + %22/%22 + num);%0A
         IJ.s
@@ -2103,24 +2103,63 @@
 ));%0A      %7D%0A
+      IJ.showStatus(%22Creating image%22);%0A
       IJ.sho

Update status message every fifth plane.