double[] getRange(GenericDialog gd, int start, int end) { String[] range = Tools.split(gd.getNextString(), " -"); double d1 = Tools.parseDouble(range[0]); double d2 = range.length==2?Tools.parseDouble(range[1]):Double.NaN; double[] result = new double[2]; result[0] = Double.isNaN(d1)?1:(int)d1; result[1] = Double.isNaN(d2)?end:(int)d2; if (result[0]<start) result[0] = start; if (result[1]>end) result[1] = end; if (result[0]>result[1]) { result[0] = start; result[1] = end; } return result; }
double[] getRange(GenericDialog gd, int start, int end) { String[] range = Tools.split(gd.getNextString(), " -"); double d1 = Tools.parseDouble(range[0]); double d2 = range.length==2?Tools.parseDouble(range[1]):Double.NaN; double[] result = new double[2]; result[0] = Double.isNaN(d1)?1:(int)d1; result[1] = Double.isNaN(d2)?end:(int)d2; if (result[0]<start) result[0] = start; if (result[1]>end) result[1] = end; if (result[0]>result[1]) { result[0] = start; result[1] = end; } return result; }
@Override public void run(ImageProcessor ip) { GenericDialog gd = new GenericDialog("Transform Parameters"); gd.addStringField("files", ""); gd.addStringField("matrices", ""); gd.showDialog(); if (gd.wasCanceled()) return; String[] fileNames = gd.getNextString().split(","); FastMatrix[] matrices = FastMatrix.parseMatrices( gd.getNextString()); new AverageBrain().doit(image, fileNames, matrices); }
/** Allows the user to enter a string in a dialog box. Returns "" if the user cancels the dialog box. */ public static String getString(String prompt, String defaultString) { GenericDialog gd = new GenericDialog(""); gd.addStringField(prompt, defaultString, 20); gd.showDialog(); if (gd.wasCanceled()) return ""; return gd.getNextString(); }
String promptForName(String name) { GenericDialog gd = new GenericDialog("ROI Manager"); gd.addStringField("Rename As:", name, 20); gd.showDialog(); if (gd.wasCanceled()) return null; else return gd.getNextString(); }
String getEquation() { GenericDialog gd = new GenericDialog("Formula"); gd.addStringField("Formula:", equation, 38); gd.showDialog(); if (gd.wasCanceled()) return null; equation = gd.getNextString(); return equation; }
String promptForName(String name) { GenericDialog gd = new GenericDialog("ROI Manager"); gd.addStringField("Rename As:", name, 20); gd.showDialog(); if (gd.wasCanceled()) return null; else return gd.getNextString(); }
/** Allows the user to enter a string in a dialog box. Returns "" if the user cancels the dialog box. */ public static String getString(String prompt, String defaultString) { GenericDialog gd = new GenericDialog(""); gd.addStringField(prompt, defaultString, 20); gd.showDialog(); if (gd.wasCanceled()) return ""; return gd.getNextString(); }
String getEquation() { GenericDialog gd = new GenericDialog("Formula"); gd.addStringField("Formula:", equation, 38); gd.showDialog(); if (gd.wasCanceled()) return null; equation = gd.getNextString(); return equation; }
private void renameMaterial() { GenericDialog gd = new GenericDialog("Rename"); gd.addStringField("name", getSelectedItem()); gd.showDialog(); if (gd.wasCanceled()) return; String newName = gd.getNextString(); if (newName.indexOf(' ') >= 0) { newName = newName.replace(' ', '_'); IJ.showMessage("Names cannot contain spaces; using '" + newName + "' instead!"); } renameMaterial(newName); }
String showDialog() { String options = Macro.getOptions(); if (options!=null && !options.contains("slices=")) { Macro.setOptions(options.replace("channels=", "slices=")); Macro.setOptions(options.replace("frames=", "slices=")); } GenericDialog gd = new GenericDialog("Substack Maker"); gd.setInsets(10,45,0); gd.addMessage("Enter a range (e.g. 2-14), a range with increment\n(e.g. 1-100-2) or a list (e.g. 7,9,25,27)", null, Color.darkGray); gd.addStringField("Slices:", "", 40); gd.addCheckbox("Delete slices from original stack", delete); gd.showDialog(); if (gd.wasCanceled()) return null; else { delete = gd.getNextBoolean(); return gd.getNextString(); } }
/** * Opens an input dialog to ask the user for a new name for the specified * point * * @param p */ public void renamePoint(final BenesNamedPoint p) { final GenericDialog gd = new GenericDialog("Rename point"); gd.addStringField("New name ", p.getName()); gd.showDialog(); if (gd.wasCanceled()) return; points.rename(p, gd.getNextString()); }
/** * Prompts the user to enter their LuraWave * license code in an ImageJ dialog window. */ public static String promptLicenseCode(String code, boolean first) { GenericDialog gd = new GenericDialog("LuraWave License Code"); if (!first) gd.addMessage("Invalid license code; try again."); gd.addStringField("LuraWave_License Code: ", code, 16); gd.showDialog(); if (gd.wasCanceled()) return null; code = gd.getNextString(); if (code != null) Prefs.set(LuraWaveServiceImpl.LICENSE_PROPERTY, code); return code; }
/** * Prompts the user to enter their LuraWave * license code in an ImageJ dialog window. */ public static String promptLicenseCode(String code, boolean first) { GenericDialog gd = new GenericDialog("LuraWave License Code"); if (!first) gd.addMessage("Invalid license code; try again."); gd.addStringField("LuraWave_License Code: ", code, 16); gd.showDialog(); if (gd.wasCanceled()) return null; code = gd.getNextString(); if (code != null) Prefs.set(LuraWaveServiceImpl.LICENSE_PROPERTY, code); return code; }
private void rename() { ImagePlus imp = IJ.getImage(); GenericDialog gd = new GenericDialog("Rename"); gd.addStringField("Title:", imp.getTitle(), 30); gd.showDialog(); if (!gd.wasCanceled()) imp.setTitle(gd.getNextString()); }
private void rename() { ImagePlus imp = IJ.getImage(); GenericDialog gd = new GenericDialog("Rename"); gd.addStringField("Title:", imp.getTitle(), 30); gd.showDialog(); if (!gd.wasCanceled()) imp.setTitle(gd.getNextString()); }
boolean showDialog() { GenericDialog gd=new GenericDialog("Proxy Settings"); gd.addStringField("Proxy server:", proxyhost, 15); gd.addNumericField("Port:", proxyport , 0); gd.addCheckbox("Or, use system proxy settings", Prefs.useSystemProxies); gd.addHelp(IJ.URL+"/docs/menus/edit.html#proxy"); gd.showDialog(); if (gd.wasCanceled()) return false; proxyhost = gd.getNextString(); proxyport = (int)gd.getNextNumber(); Prefs.useSystemProxies = gd.getNextBoolean(); return true; }
@Override public void run(ImageProcessor ip) { GenericDialog gd = new GenericDialog("Transform Parameters"); AmiraParameters.addAmiraMeshList(gd, "imageToTransform"); gd.addStringField("origPoints", ""); gd.addStringField("transPoints", ""); gd.showDialog(); if (gd.wasCanceled()) return; ImagePlus trans = WindowManager.getImage(gd.getNextChoice()); Point3d[] origPoints = parsePoints(gd.getNextString()); Point3d[] transPoints = parsePoints(gd.getNextString()); ElasticTransformedImage t = new ElasticTransformedImage(new InterpolatedImage(image), new InterpolatedImage(trans), origPoints, transPoints); t.getTransformed().image.show(); }
boolean showDialog() { GenericDialog gd=new GenericDialog("Proxy Settings"); gd.addStringField("Proxy server:", proxyhost, 15); gd.addNumericField("Port:", proxyport , 0); gd.addCheckbox("Or, use system proxy settings", Prefs.useSystemProxies); gd.addHelp(IJ.URL+"/docs/menus/edit.html#proxy"); gd.showDialog(); if (gd.wasCanceled()) return false; proxyhost = gd.getNextString(); proxyport = (int)gd.getNextNumber(); Prefs.useSystemProxies = gd.getNextBoolean(); return true; }
void rename(int i) { NamedPointWorld npw = points.get(i); GenericDialog gd = new GenericDialog( "Rename Point" ); gd.addStringField( "Rename point to:", npw.getName() ); gd.showDialog(); if( gd.wasCanceled() ) return; String newName = gd.getNextString(); boolean result = points.renamePointTo( i, newName ); if( result ) { dialog.markButtons[i].setLabel( newName ); dialog.pack(); } else { IJ.error("Couldn't rename point: there already is one called \"" + newName + "\"" ); } }