/** * Determines whether we're running inside a macro right now. * * @return whether we're running a macro right now. */ public boolean isMacro() { return IJ.isMacro(); }
/** Returns a reference to the ROI Manager, or null if it is not open * and a batch mode macro is not running. If the ROI Manager * is not open and a batch mode macro is running, * returns the hidden batch mode RoiManager. * @see #getRoiManager */ public static RoiManager getInstance() { if (instance==null && IJ.isMacro()) return Interpreter.getBatchModeRoiManager(); else return (RoiManager)instance; }
/** Returns a reference to the ROI Manager, or null if it is not open * and a batch mode macro is not running. If the ROI Manager * is not open and a batch mode macro is running, * returns the hidden batch mode RoiManager. * @see #getRoiManager */ public static RoiManager getInstance() { if (instance==null && IJ.isMacro()) return Interpreter.getBatchModeRoiManager(); else return (RoiManager)instance; }
public void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID()==WindowEvent.WINDOW_CLOSING) { instance = null; } if (!IJ.isMacro()) ignoreInterrupts = false; }
/** Returns a reference to the ROI Manager window or to the macro batch mode RoiManager, or null if neither exists. */ public static RoiManager getInstance2() { RoiManager rm = getInstance(); if (rm==null && IJ.isMacro()) rm = Interpreter.getBatchModeRoiManager(); return rm; }
public void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID()==WindowEvent.WINDOW_CLOSING) { instance = null; } if (!IJ.isMacro()) ignoreInterrupts = false; }
/** Returns a reference to the ROI Manager window or to the macro batch mode RoiManager, or null if neither exists. */ public static RoiManager getInstance2() { RoiManager rm = getInstance(); if (rm==null && IJ.isMacro()) rm = Interpreter.getBatchModeRoiManager(); return rm; }
/** Clears this RoiManager so that it contains no ROIs. */ public void reset() { if (IJ.isMacOSX() && IJ.isMacro()) ignoreInterrupts = true; listModel.removeAllElements(); overlayTemplate = null; rois.clear(); updateShowAll(); }
/** Clears this RoiManager so that it contains no ROIs. */ public void reset() { if (IJ.isMacOSX() && IJ.isMacro()) ignoreInterrupts = true; listModel.removeAllElements(); overlayTemplate = null; rois.clear(); updateShowAll(); }
private static ImagePlus getFocusManagerActiveImage() { if (IJ.isMacro()) return null; KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Window win = kfm.getActiveWindow(); ImagePlus imp = null; if (win!=null && (win instanceof ImageWindow)) imp = ((ImageWindow)win).getImagePlus(); return imp; }
private static ImagePlus getFocusManagerActiveImage() { if (IJ.isMacro()) return null; KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Window win = kfm.getActiveWindow(); ImagePlus imp = null; if (win!=null && (win instanceof ImageWindow)) imp = ((ImageWindow)win).getImagePlus(); return imp; }
public static void setForegroundColor(Color c) { if (c==null) return; foregroundColor = c; IJ.notifyEventListeners(IJEventListener.FOREGROUND_COLOR_CHANGED); if (instance==null) return; repaintTool(DROPPER); for (int i=CUSTOM1; i<=instance.getNumTools()-2; i++) { if (instance.icons[i]!=null && instance.icons[i].contains("C123")) repaintTool(i); // some of this tool's icon is drawn in the foreground color } if (!IJ.isMacro()) setRoiColor(c); }
public void run(String arg) { if (gd!=null && gd.isShowing() && !IJ.isMacro()) { gd.toFront(); update(); } else showDialog(); }
public void run(String arg) { if (gd!=null && gd.isShowing() && !IJ.isMacro()) { gd.toFront(); update(); } else showDialog(); }
public void windowActivated(WindowEvent e) { super.windowActivated(e); if (IJ.isMacro()) { // do nothing if macro and RGB image ImagePlus imp2 = WindowManager.getCurrentImage(); if (imp2!=null && imp2.getBitDepth()==24) { return; } } previousImageID = 0; // user may have modified image setup(); WindowManager.setWindow(this); }
void closeImage(ImagePlus imp) { if (imp==null) { IJ.noImage(); return; } imp.close(); if (Recorder.record && !IJ.isMacro()) { if (Recorder.scriptMode()) Recorder.recordCall("imp.close();"); else Recorder.record("close"); Recorder.setCommand(null); // don't record run("Close") } }
void show() { ImagePlus imp = IJ.getImage(); imp.setHideOverlay(false); if (imp.getOverlay()==null) { RoiManager rm = RoiManager.getInstance(); if (rm!=null && rm.getCount()>1) { if (!IJ.isMacro()) rm.toFront(); rm.runCommand("show all with labels"); } } }
void show() { ImagePlus imp = IJ.getImage(); imp.setHideOverlay(false); if (imp.getOverlay()==null) { RoiManager rm = RoiManager.getInstance(); if (rm!=null && rm.getCount()>1) { if (!IJ.isMacro()) rm.toFront(); rm.runCommand("show all with labels"); } } }
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) { if (IJ.isMacOSX()) IJ.wait(100); if (slices1!=1) slices2 = gd.getNextBoolean()?slices1:1; if (frames1!=1) frames2 = gd.getNextBoolean()?frames1:1; keep = gd.getNextBoolean(); if (!IJ.isMacro()) staticKeep = keep; ((Label)gd.getMessage()).setText(getNewDimensions()); return true; }
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) { if (IJ.isMacOSX()) IJ.wait(100); if (slices1!=1) slices2 = gd.getNextBoolean()?slices1:1; if (frames1!=1) frames2 = gd.getNextBoolean()?frames1:1; keep = gd.getNextBoolean(); if (!IJ.isMacro()) staticKeep = keep; ((Label)gd.getMessage()).setText(getNewDimensions()); return true; }