/** For IDs less than zero, returns the ImagePlus with the specified ID. Returns null if no open window has a matching ID or no images are open. For IDs greater than zero, returns the Nth ImagePlus. Returns null if the ID is zero. */ public synchronized static ImagePlus getImage(int imageID) { if (imageID>0) imageID = getNthImageID(imageID); if (imageID==0 || getImageCount()==0) return null; ImagePlus imp2 = Interpreter.getBatchModeImage(imageID); if (imp2!=null) return imp2; ImagePlus imp = null; for (int i=0; i<imageList.size(); i++) { ImageWindow win = (ImageWindow)imageList.get(i); imp2 = win.getImagePlus(); if (imageID==imp2.getID()) { imp = imp2; break; } } imp2 = getCurrentImage(); if (imp==null &&imp2!=null && imp2.getID()==imageID) return imp2; return imp; }
/** For IDs less than zero, returns the ImagePlus with the specified ID. Returns null if no open window has a matching ID or no images are open. For IDs greater than zero, returns the Nth ImagePlus. Returns null if the ID is zero. */ public synchronized static ImagePlus getImage(int imageID) { if (imageID>0) imageID = getNthImageID(imageID); if (imageID==0 || getImageCount()==0) return null; ImagePlus imp2 = Interpreter.getBatchModeImage(imageID); if (imp2!=null) return imp2; ImagePlus imp = null; for (int i=0; i<imageList.size(); i++) { ImageWindow win = (ImageWindow)imageList.get(i); imp2 = win.getImagePlus(); if (imageID==imp2.getID()) { imp = imp2; break; } } imp2 = getCurrentImage(); if (imp==null &&imp2!=null && imp2.getID()==imageID) return imp2; return imp; }
id = WindowManager.getNthImageID(id); ImagePlus imp = WindowManager.getImage(id); if (imp==null)
id = WindowManager.getNthImageID(id); ImagePlus imp = WindowManager.getImage(id); if (imp==null)
final int id = WindowManager.getNthImageID(i); final ImagePlus ip = WindowManager.getImage(id); if (ip != null && ip.getWidth() != 0 && !ip.getTitle().equals("3d")) windows