/** Starts ImageJ if it's not already running. */ public void init() { ImageJ ij = IJ.getInstance(); if (ij==null || (ij!=null && !ij.isShowing())) new ImageJ(this); for (int i=1; i<=9; i++) { String url = getParameter("url"+i); if (url==null) break; ImagePlus imp = new ImagePlus(url); if (imp!=null) imp.show(); } }
/** Opens and displays the nth image in the specified tiff stack. */ public static void open(String path, int n) { if (ij==null && Menus.getCommands()==null) init(); ImagePlus imp = openImage(path, n); if (imp!=null) imp.show(); }
void revert() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) imp.revert(); else IJ.noImage(); }
private ImageProcessor getFirstSliceIP(final String filename) { final ImagePlus imp = IJ.openImage(filename); final ImageStack is = imp.getImageStack(); final ImageProcessor ip = is.getProcessor(1); return ip == null ? imp.getProcessor() : ip; }
public int setup(String arg, ImagePlus imp) { if (imp!=null) { virtualStack = imp.getStack().isVirtual(); if (virtualStack) useOverlay = true; baseOverlay = imp.getOverlay(); flags += virtualStack?0:DOES_STACKS; firstFrame=1; lastFrame=defaultLastFrame=imp.getStackSize(); } this.imp = imp; return flags; }
/** Returns a list of the titles of all open images. */ public synchronized static String[] getImageTitles() { int[] list = getIDList(); if (list==null) return new String[0]; String[] titles = new String[list.length]; for (int i=0; i<list.length; i++) { ImagePlus img = getImage(list[i]); titles[i] = img.getTitle(); } return titles; }
void updateScreen(ImagePlus imp) { if (showUpdates) imp.updateAndDraw(); IJ.showStatus((counter++) + "/"+72); }
/** Returns the active image or stack slice as an ImageProcessor, or displays an error message and aborts the plugin or macro if no images are open. */ public static ImageProcessor getProcessor() { ImagePlus imp = IJ.getImage(); return imp.getProcessor(); }
static void checkForDuplicateName(ImagePlus imp) { if (checkForDuplicateName) { String name = imp.getTitle(); if (isDuplicateName(name)) imp.setTitle(getUniqueName(name)); } checkForDuplicateName = false; }
/** Sets the Paste transfer mode. @see ij.process.Blitter */ public static void setPasteMode(int transferMode) { if (transferMode==pasteMode) return; pasteMode = transferMode; ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) imp.updateAndDraw(); }
private static PointRoi getPointRoi() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp==null) return null; Roi roi = imp.getRoi(); if (roi==null) return null; if (roi instanceof PointRoi) return (PointRoi)roi; else return null; }
public void windowActivated(WindowEvent e) { if (IJ.isMacintosh() && !quitting) { IJ.wait(10); // may be needed for Java 1.4 on OS X MenuBar mb = Menus.getMenuBar(); if (mb!=null && mb!=getMenuBar()) { setMenuBar(mb); Menus.setMenuBarCount++; if (IJ.debugMode) IJ.log("setMenuBar: "+Menus.setMenuBarCount); } } }
void copy(boolean cut) { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) { imp.copy(cut); if (cut) imp.changes = true; } else IJ.noImage(); }
void undo() { ImagePlus imp = WindowManager.getCurrentImage(); if (imp!=null) Undo.undo(); else IJ.noImage(); }
/** Sets the display mode of composite color images, where 'mode' should be IJ.COMPOSITE, IJ.COLOR or IJ.GRAYSCALE. */ public void setDisplayMode(int mode) { if (this instanceof CompositeImage) { ((CompositeImage)this).setMode(mode); updateAndDraw(); } }
public void windowActivated(WindowEvent e) { ImageJ ij = IJ.getInstance(); //if (IJ.isMacOSX() && ij!=null && !ij.isActive() && !(this instanceof ThresholdAdjuster)) // ij.toFront(); WindowManager.setWindow(this); }
void showImageJ() { ImageJ ij = IJ.getInstance(); if (ij!=null) ij.toFront(); }
private synchronized void setStackNull() { if (oneSliceStack && stack!=null && stack.size()>0) { String label = stack.getSliceLabel(1); setProperty("Label", label); } stack = null; oneSliceStack = false; }