/** * Delegates to ImageJ 1.x' {@link Macro#getOptions()} function. * * @return the macro options, or null */ public String getOptions() { final String options = Macro.getOptions(); return options == null ? "" : options; }
public ArchiveClient( Applet applet ) { this(applet,Macro.getOptions()); }
public void showDialog() { if (Macro.getOptions() == null) throw new RuntimeException("Cannot run dialog headlessly"); numberfieldIndex = 0; stringfieldIndex = 0; checkboxIndex = 0; choiceIndex = 0; textAreaIndex = 0; }
public HeadlessGenericDialog() { if (Macro.getOptions() == null) throw new RuntimeException("Cannot instantiate headless dialog except in macro mode"); numbers = new ArrayList<Double>(); strings = new ArrayList<String>(); checkboxes = new ArrayList<Boolean>(); choices = new ArrayList<String>(); choiceIndices = new ArrayList<Integer>(); radioButtons = new ArrayList<String>(); }
public HeadlessGenericDialog() { if (Macro.getOptions() == null) throw new RuntimeException("Cannot instantiate headless dialog except in macro mode"); numbers = new ArrayList<Double>(); strings = new ArrayList<String>(); checkboxes = new ArrayList<Boolean>(); choices = new ArrayList<String>(); choiceIndices = new ArrayList<Integer>(); radioButtons = new ArrayList<String>(); }
static void options() { // Ensure backward compatibility with previous versions: String options = Macro.getOptions(); if (options == null || options.isEmpty()) return; options = options.replaceAll("additive","Additive"); options = options.replaceAll("multiplicative","Multiplicative"); options = options.replaceAll("modulatory","Modulatory"); Macro.setOptions(options); }
@Override public void run(String message) { if (message.equals("")) message = Macro.getOptions(); appendText(message); }
/** * Gets a macro parameter of type <i>double</i>. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the double value */ private static double getMacroParameter(String label, double defaultValue) { String value = Macro.getValue(Macro.getOptions(), label, null); return value != null ? Double.parseDouble(value) : defaultValue; }
/** * Gets a macro parameter of type <i>double</i>. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the double value */ private static double getMacroParameter(String label, double defaultValue) { String value = Macro.getValue(Macro.getOptions(), label, null); return value != null ? Double.parseDouble(value) : defaultValue; }
/** * Gets a macro parameter of type {@link String}. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the value */ private static String getMacroParameter(String label, String defaultValue) { return Macro.getValue(Macro.getOptions(), label, defaultValue); } }
/** * Gets a macro parameter of type {@link String}. * * @param label * the name of the macro parameter * @param defaultValue * the default value * @return the value */ private static String getMacroParameter(String label, String defaultValue) { return Macro.getValue(Macro.getOptions(), label, defaultValue); } }
public void run(final String arg) { final String options = Macro.getOptions(); System.out.println("Got options " + options); if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { runHeadless(options); } else { runWithUI(arg); } } }
public void showDialog() { if (Macro.getOptions() == null) throw new RuntimeException("Cannot run dialog headlessly"); resetCounters(); // NB: ImageJ 1.x has logic to call the first DialogListener at least once, // in case the plugin _only_ updates its values via the dialogItemChanged // method. See the bottom of the ij.gui.GenericDialog#showDialog() method. if (listener != null) { // NB: Thanks to Javassist, this class _will_ be a GenericDialog object. listener.dialogItemChanged((ij.gui.GenericDialog) (Object) this, null); resetCounters(); } }
private void rotate(ImagePlus imp) { Roi roi = imp.getRoi(); if (IJ.macroRunning()) { String options = Macro.getOptions(); if (options!=null && (options.indexOf("grid=")!=-1||options.indexOf("interpolat")!=-1)) { IJ.run("Rotate... ", options); // run Image>Transform>Rotate return; } } (new RoiRotator()).run(""); }
private void rotate(ImagePlus imp) { Roi roi = imp.getRoi(); if (IJ.macroRunning()) { String options = Macro.getOptions(); if (options!=null && (options.indexOf("grid=")!=-1||options.indexOf("interpolat")!=-1)) { IJ.run("Rotate... ", options); // run Image>Transform>Rotate return; } } (new RoiRotator()).run(""); }
/** Parses core options. */ public ImporterOptions parseOptions(String arg) throws IOException { ImporterOptions options = new ImporterOptions(); if (Macro.getOptions() == null) { options.loadOptions(); } options.parseArg(arg); options.checkObsoleteOptions(); return options; }
/** Parses core options. */ public ImporterOptions parseOptions(String arg) throws IOException { ImporterOptions options = new ImporterOptions(); if (Macro.getOptions() == null) { options.loadOptions(); } options.parseArg(arg); options.checkObsoleteOptions(); return options; }
@Override protected boolean displayDialog(GenericDialog gd) { ThumbLoader loader = null; if (thumbReader != null && !options.isForceThumbnails() && Macro.getOptions() == null) { // spawn background thumbnail loader loader = new ThumbLoader(thumbReader, p, gd); } gd.showDialog(); if (loader != null) loader.stop(); return !gd.wasCanceled(); }
@Override protected boolean displayDialog(GenericDialog gd) { ThumbLoader loader = null; if (thumbReader != null && !options.isForceThumbnails() && Macro.getOptions() == null) { // spawn background thumbnail loader loader = new ThumbLoader(thumbReader, p, gd); } gd.showDialog(); if (loader != null) loader.stop(); return !gd.wasCanceled(); }
void getMacro(String macro) { String options = Macro.getOptions(); if (options!=null && options.startsWith("v=")) Macro.setOptions("code="+options); gd = new GenericDialog("Expression Evaluator"); gd.addStringField("Code:", macro, 42); gd.setInsets(0,40,0); gd.addMessage("v=pixel value, x,y&z=pixel coordinates, w=image width,\nh=image height, a=angle, d=distance from center\n"); gd.setInsets(5,40,0); gd.addPreviewCheckbox(pfr); gd.addDialogListener(this); gd.addHelp(IJ.URL+"/docs/menus/process.html#math-macro"); gd.showDialog(); }