import ij.*; import ij.process.*; import ij.gui.*; import ij.io.*; import java.awt.*; import java.io.*; import ij.plugin.*; /** This plugin opens images from a text file list. The list can contain full paths or just file names. The default directory is the one containing the text file. */ public class RawList_toTiffMontage implements PlugIn { public void run(String arg) { OpenDialog od = new OpenDialog("List Opener", null); String name = od.getFileName(); if (name==null) return; String dir = od.getDirectory(); String windowName; Opener o = new Opener(); int count = 0; String separator = System.getProperty("file.separator"); try { BufferedReader r = new BufferedReader(new FileReader(dir+name)); while (true) { String path = r.readLine(); if (path==null) break; else { windowName=path; if (path.indexOf(separator)<0) path = dir + path; IJ.run("Raw...", "path='"+path+"' image='16-bit Unsigned' width=64 height=64 offset=0 number=90 gap=0"); IJ.run("Fire"); IJ.run("Make Montage...", "columns=8 rows=8 scale=1 first=1 last=64 increment=1 label borders"); IJ.run("Rename...", "title=M_"+windowName); IJ.run("Tiff...", "path='"+dir+"M_"+windowName); IJ.run("Close"); IJ.run("Close"); // ImagePlus imp = o.openImage(path); // count++; // if (imp!=null) { // IJ.write(count+" + " +path); // imp.show(); // } else // IJ.write(count+" - "+path); } } r.close(); } catch (IOException e) { IJ.error(""+e); return; } } }