public void run(String arg) { String dir = IJ.getDirectory("Choose a Folder"); if (dir==null) return; String[] list = (new File(dir)).list(); if (list==null) return; Analyzer.setMeasurement(Measurements.LABELS, true); for (int i=0; i<list.length; i++) { if (list[i].startsWith(".")) continue; String path = dir + list[i]; IJ.showProgress(i+1, list.length); IJ.redirectErrorMessages(true); ImagePlus imp = !path.endsWith("/")?IJ.openImage(path):null; IJ.redirectErrorMessages(false); if (imp!=null) { IJ.run(imp, "Measure", ""); imp.close(); } else if (!path.endsWith("/")) IJ.log("IJ.openImage() returned null: "+path); } }
public void run(String arg) { String dir = IJ.getDirectory("Choose a Folder"); if (dir==null) return; String[] list = (new File(dir)).list(); if (list==null) return; Analyzer.setMeasurement(Measurements.LABELS, true); for (int i=0; i<list.length; i++) { if (list[i].startsWith(".")) continue; String path = dir + list[i]; IJ.showProgress(i+1, list.length); IJ.redirectErrorMessages(true); ImagePlus imp = !path.endsWith("/")?IJ.openImage(path):null; IJ.redirectErrorMessages(false); if (imp!=null) { IJ.run(imp, "Measure", ""); imp.close(); } else if (!path.endsWith("/")) IJ.log("IJ.openImage() returned null: "+path); } }
ImagePlus imp_stack = null; try { IJ.redirectErrorMessages(); imp_stack = openImagePlus(f.getCanonicalPath()); } catch (final Exception e) {
IJ.redirectErrorMessages(); final ImagePlus imp = openImagePlus(dir_name + next_file); if (null == imp) return null;
private final ImagePlus openImagePlus(final String path, int retries) { while (retries < MAX_RETRIES) try { IJ.redirectErrorMessages(); final ImagePlus imp = opener.openImage(path); if (null != imp) { imp.killRoi(); // newer ImageJ may store ROI in the file! } return imp; // TODO: Use windowless LOCI to bypass Opener class completely } catch (final OutOfMemoryError oome) { Utils.log2("openImagePlus: recovering from OutOfMemoryError"); recoverOOME(); // No need to unlock db_lock: all image loading calls are by design outside the db_lock. Thread.yield(); // Retry: retries++; } catch (final Throwable t) { // Don't retry IJError.print(t); break; } return null; }
continue; IJ.showProgress(i+1, list.length); IJ.redirectErrorMessages(true); ImagePlus imp = IJ.openImage(path); IJ.redirectErrorMessages(false); if (imp==null && WindowManager.getImageCount()>startingCount) imp = WindowManager.getCurrentImage();
continue; IJ.showProgress(i+1, list.length); IJ.redirectErrorMessages(true); ImagePlus imp = IJ.openImage(path); IJ.redirectErrorMessages(false); if (imp==null && WindowManager.getImageCount()>startingCount) imp = WindowManager.getCurrentImage();
if (n<1 || n>nImages) throw new IllegalArgumentException("Argument out of range: "+n); IJ.redirectErrorMessages(true); String url = list[n-1]; ImagePlus imp = null; IJ.redirectErrorMessages(false); return ip; } else { case 32: ip=new FloatProcessor(imageWidth,imageHeight); break; IJ.redirectErrorMessages(false); return ip;
if (n<1 || n>nImages) throw new IllegalArgumentException("Argument out of range: "+n); IJ.redirectErrorMessages(true); String url = list[n-1]; ImagePlus imp = null; IJ.redirectErrorMessages(false); return ip; } else { case 32: ip=new FloatProcessor(imageWidth,imageHeight); break; IJ.redirectErrorMessages(false); return ip;
{interp.getParens(); return ""+IJ.getToolName();} else if (name.equals("redirectErrorMessages")) {interp.getParens(); IJ.redirectErrorMessages(); return null;} else if (name.equals("renameResults")) renameResults();
{interp.getParens(); return ""+IJ.getToolName();} else if (name.equals("redirectErrorMessages")) {interp.getParens(); IJ.redirectErrorMessages(); return null;} else if (name.equals("renameResults")) renameResults();
IJ.redirectErrorMessages(); final ImagePlus imp = openImagePlus(path); if (null == imp) return null;
IJ.redirectErrorMessages(true); if (virtualStack!=null) imp = getVirtualStackImage(); else imp = getFolderImage(); IJ.redirectErrorMessages(false); if (imp==null) { if (!errorDisplayed)
IJ.redirectErrorMessages(true); if (virtualStack!=null) imp = getVirtualStackImage(); else imp = getFolderImage(); IJ.redirectErrorMessages(false); if (imp==null) { if (!errorDisplayed)
for (int k=0; k<names.length; k++) { if (!names[k].startsWith(".")) { IJ.redirectErrorMessages(true); ImagePlus imp = IJ.openImage(path+names[k]); if (imp!=null) { imp.show(); IJ.redirectErrorMessages(false);
for (int k=0; k<names.length; k++) { if (!names[k].startsWith(".")) { IJ.redirectErrorMessages(true); ImagePlus imp = IJ.openImage(path+names[k]); if (imp!=null) { imp.show(); IJ.redirectErrorMessages(false);
/** The behavior is undefined if @param last is not a descendant of @param first. */ public void createReviewStack(final Node<T> first, final Node<T> last, final Tag tag, final String filepath, final int width, final int height, final double magnification, final int image_type) { try { final ImagePlus imp = project.getLoader().createLazyFlyThrough(generateRegions(first, last, width, height, magnification), magnification, image_type, this); imp.setTitle(imp.getTitle() + tag.toString()); ij.IJ.redirectErrorMessages(); new FileSaver(imp).saveAsZip(filepath); } catch (final Exception e) { IJError.print(e); Utils.log("\nERROR: NOT created review stack for " + tag.toString()); return; } }
VirtualStack stack = new VirtualStack(10, 10, null, f.getAbsolutePath().replace('\\', '/')); // I don't care about the dimensions for (int k=0; k<names.length; k++) { IJ.redirectErrorMessages(); if (names[k].toLowerCase().endsWith(".xml")) continue; // ignore trakem2 files stack.addSlice(names[k]);
IJ.redirectErrorMessages(true); ImagePlus imp = opener.openImage(path, names[n-1]); IJ.redirectErrorMessages(false); ImageProcessor ip = null; int depthThisImage = 0;
IJ.redirectErrorMessages(true); ImagePlus imp = opener.openImage(path, names[n-1]); IJ.redirectErrorMessages(false); ImageProcessor ip = null; int depthThisImage = 0;