boolean showDialog() { GenericDialog gd = new GenericDialog("Reduce"); gd.setInsets(10, 20, 5); gd.addMessage("Create image with:"); gd.setInsets(0, 35, 0); if (channels1!=1) gd.addCheckbox("Channels ("+channels1+")", true); gd.setInsets(0, 35, 0); if (slices1!=1) gd.addCheckbox("Slices ("+slices1+")", true); gd.setInsets(0, 35, 0); if (frames1!=1) gd.addCheckbox("Frames ("+frames1+")", true); gd.setInsets(5, 20, 0); gd.addMessage(getNewDimensions()+" "); gd.setInsets(15, 20, 0); gd.addCheckbox("Keep source", keep); gd.addDialogListener(this); gd.showDialog(); if (gd.wasCanceled()) return false; else return true; }
boolean showDialog() { GenericDialog gd = new GenericDialog("Convert to RGB"); gd.setInsets(10, 20, 5); gd.addMessage("Create RGB image with:"); gd.setInsets(0, 35, 0); if (slices1!=1) gd.addCheckbox("Slices ("+slices1+")", true); gd.setInsets(0, 35, 0); if (frames1!=1) gd.addCheckbox("Frames ("+frames1+")", true); gd.setInsets(5, 20, 0); gd.addMessage(getNewDimensions()+" "); gd.setInsets(15, 20, 0); gd.addCheckbox("Keep source", keep); gd.addDialogListener(this); gd.showDialog(); if (gd.wasCanceled()) return false; else return true; }
boolean showDialog() { GenericDialog gd = new GenericDialog("Convert to RGB"); gd.setInsets(10, 20, 5); gd.addMessage("Create RGB image with:"); gd.setInsets(0, 35, 0); if (slices1!=1) gd.addCheckbox("Slices ("+slices1+")", true); gd.setInsets(0, 35, 0); if (frames1!=1) gd.addCheckbox("Frames ("+frames1+")", true); gd.setInsets(5, 20, 0); gd.addMessage(getNewDimensions()+" "); gd.setInsets(15, 20, 0); gd.addCheckbox("Keep source", keep); gd.addDialogListener(this); gd.showDialog(); if (gd.wasCanceled()) return false; else return true; }
void showDialog() { GenericDialog gd = new GenericDialog("FFT Options"); gd.setInsets(0, 20, 0); gd.addMessage("Display:"); gd.setInsets(5, 35, 0); gd.addCheckbox("FFT window", displayFFT); gd.setInsets(0, 35, 0); gd.addCheckbox("Raw power spectrum", displayRawPS); gd.setInsets(0, 35, 0); gd.addCheckbox("Fast Hartley Transform", displayFHT); gd.setInsets(0, 35, 0); gd.addCheckbox("Complex Fourier Transform", displayComplex); gd.setInsets(8, 20, 0); gd.addCheckbox("Do forward transform", false); gd.addHelp(IJ.URL+"/docs/menus/process.html#fft-options"); gd.showDialog(); if (gd.wasCanceled()) return; displayFFT = gd.getNextBoolean(); displayRawPS = gd.getNextBoolean(); displayFHT = gd.getNextBoolean(); displayComplex = gd.getNextBoolean(); doFFT = gd.getNextBoolean(); }
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(); }
private boolean showDialog() { gd = new GenericDialog("Startup Macro"); String text = "Macro code contained in this text area\nexecutes when ImageJ starts up."; Font font = new Font("SansSerif", Font.PLAIN, 14); gd.setInsets(5,15,0); gd.addMessage(text, font); gd.setInsets(5, 10, 0); gd.addTextAreas(macro, null, 12, 50); gd.addChoice("Add code:", code, code[0]); Vector choices = gd.getChoices(); if (choices!=null) { Choice choice = (Choice)choices.elementAt(0); choice.addItemListener(this); } gd.showDialog(); macro = gd.getNextText(); 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(); }
private boolean showDialog() { gd = new GenericDialog("Startup Macro"); String text = "Macro code contained in this text area\nexecutes when ImageJ starts up."; Font font = new Font("SansSerif", Font.PLAIN, 14); gd.setInsets(5,15,0); gd.addMessage(text, font); gd.setInsets(5, 10, 0); gd.addTextAreas(macro, null, 12, 50); gd.addChoice("Add code:", code, code[0]); Vector choices = gd.getChoices(); if (choices!=null) { Choice choice = (Choice)choices.elementAt(0); choice.addItemListener(this); } gd.showDialog(); macro = gd.getNextText(); return !gd.wasCanceled(); }
void showError(String title, String msg, String[] variables) { Macro.setOptions(null); GenericDialog gd = new GenericDialog(title); gd.setInsets(6,5,0); gd.addMessage(msg); gd.setInsets(15,30,5); gd.addCheckbox("Show \"Debug\" Window", showVariables); gd.hideCancelButton(); gd.showDialog(); showVariables = gd.getNextBoolean(); if (!gd.wasCanceled() && showVariables) updateDebugWindow(variables, null); }
void showError(String title, String msg, String[] variables) { Macro.setOptions(null); GenericDialog gd = new GenericDialog(title); gd.setInsets(6,5,0); gd.addMessage(msg); gd.setInsets(15,30,5); gd.addCheckbox("Show \"Debug\" Window", showVariables); gd.hideCancelButton(); gd.showDialog(); showVariables = gd.getNextBoolean(); if (!gd.wasCanceled() && showVariables) updateDebugWindow(variables, null); }
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(); } }
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(); } }
void dicom() { GenericDialog gd = new GenericDialog("DICOM Options"); gd.addCheckbox("Open as 32-bit float", Prefs.openDicomsAsFloat); gd.addCheckbox("Ignore Rescale Slope", Prefs.ignoreRescaleSlope); gd.addMessage("Orthogonal Views"); gd.setInsets(5, 40, 0); gd.addCheckbox("Rotate YZ", Prefs.rotateYZ); gd.setInsets(0, 40, 0); gd.addCheckbox("Flip XZ", Prefs.flipXZ); gd.showDialog(); if (gd.wasCanceled()) return; Prefs.openDicomsAsFloat = gd.getNextBoolean(); Prefs.ignoreRescaleSlope = gd.getNextBoolean(); Prefs.rotateYZ = gd.getNextBoolean(); Prefs.flipXZ = gd.getNextBoolean(); }
void dicom() { GenericDialog gd = new GenericDialog("DICOM Options"); gd.addCheckbox("Open as 32-bit float", Prefs.openDicomsAsFloat); gd.addCheckbox("Ignore Rescale Slope", Prefs.ignoreRescaleSlope); gd.addMessage("Orthogonal Views"); gd.setInsets(5, 40, 0); gd.addCheckbox("Rotate YZ", Prefs.rotateYZ); gd.setInsets(0, 40, 0); gd.addCheckbox("Flip XZ", Prefs.flipXZ); gd.showDialog(); if (gd.wasCanceled()) return; Prefs.openDicomsAsFloat = gd.getNextBoolean(); Prefs.ignoreRescaleSlope = gd.getNextBoolean(); Prefs.rotateYZ = gd.getNextBoolean(); Prefs.flipXZ = gd.getNextBoolean(); }
public void showDialog() { validateTarget(); GenericDialog gd = new GenericDialog("Compile and Run"); gd.addChoice("Target: ", targets, targets[target]); gd.setInsets(15,5,0); gd.addCheckbox("Generate debugging info (javac -g)", generateDebuggingInfo); gd.addHelp(IJ.URL+"/docs/menus/edit.html#compiler"); gd.showDialog(); if (gd.wasCanceled()) return; target = gd.getNextChoiceIndex(); generateDebuggingInfo = gd.getNextBoolean(); validateTarget(); }
public void showDialog() { validateTarget(); GenericDialog gd = new GenericDialog("Compile and Run"); gd.addChoice("Target: ", targets, targets[target]); gd.setInsets(15,5,0); gd.addCheckbox("Generate debugging info (javac -g)", generateDebuggingInfo); gd.addHelp(IJ.URL+"/docs/menus/edit.html#compiler"); gd.showDialog(); if (gd.wasCanceled()) return; target = gd.getNextChoiceIndex(); generateDebuggingInfo = gd.getNextBoolean(); validateTarget(); }
public double showDialog(double angle) { GenericDialog gd = new GenericDialog("Rotate Selection"); int decimalPlaces = 0; if ((int)angle!=angle) decimalPlaces = 2; if (Macro.getOptions()!=null) rotateAroundImageCenter = false; gd.addNumericField("Angle:", angle, decimalPlaces, 3, "degrees"); gd.addCheckbox("Rotate around image center", rotateAroundImageCenter); gd.setInsets(5, 0, 0); gd.addMessage("Enter negative angle to \nrotate counter-clockwise", null, Color.darkGray); gd.showDialog(); if (gd.wasCanceled()) return Double.NaN; rotateAroundImageCenter = gd.getNextBoolean(); return gd.getNextNumber(); }
public double showDialog(double angle) { GenericDialog gd = new GenericDialog("Rotate Selection"); int decimalPlaces = 0; if ((int)angle!=angle) decimalPlaces = 2; if (Macro.getOptions()!=null) rotateAroundImageCenter = false; gd.addNumericField("Angle:", angle, decimalPlaces, 3, "degrees"); gd.addCheckbox("Rotate around image center", rotateAroundImageCenter); gd.setInsets(5, 0, 0); gd.addMessage("Enter negative angle to \nrotate counter-clockwise", null, Color.darkGray); gd.showDialog(); if (gd.wasCanceled()) return Double.NaN; rotateAroundImageCenter = gd.getNextBoolean(); return gd.getNextNumber(); }
private boolean showDialog() { gd = new GenericDialog("Batch Convert"); addPanels(gd); gd.setInsets(15, 0, 5); gd.addChoice("Output_format:", formats, format); gd.addChoice("Interpolation:", methods, methods[interpolationMethod]); //gd.addStringField("Height (pixels): ", height==0?"\u2014":""+height, 6); gd.addNumericField("Scale factor:", scale, 2); gd.addCheckbox("Average when downsizing", averageWhenDownSizing); gd.addCheckbox("Read images using Bio-Formats", useBioFormats); gd.setOKLabel("Convert"); gd.showDialog(); if (gd.wasCanceled()) return false; format = gd.getNextChoice(); interpolationMethod = gd.getNextChoiceIndex(); //height = (int)Tools.parseDouble(gd.getNextString(), 0.0); scale = gd.getNextNumber(); averageWhenDownSizing = gd.getNextBoolean(); useBioFormats = gd.getNextBoolean(); return true; }
public void run(String arg) { imp = WindowManager.getCurrentImage(); Roi roi = imp!=null?imp.getRoi():null; boolean selection = roi!=null && (roi.getType()==Roi.TRACED_ROI||roi.getType()==Roi.POLYGON); if (imp==null || (ID!=0&&imp.getID()!=ID) || !selection) startx = starty = 0; ID = imp!=null?imp.getID():0; double sliderMax = 255; int depth = imp!=null?imp.getBitDepth():0; if (depth==16 || depth==32) { sliderMax = imp.getProcessor().getMax(); if (depth==32) sliderMax+=0.0000000001; } showCheckbox = imp!=null && depth!=24 && WindowManager.getFrame("Threshold")==null && !imp.isThreshold(); GenericDialog gd = new GenericDialog("Wand Tool"); gd.addSlider("Tolerance: ", 0, sliderMax, tolerance); gd.addChoice("Mode:", modes, mode); if (showCheckbox) gd.addCheckbox("Enable Thresholding", false); gd.addCheckbox("Smooth if thresholded", Prefs.smoothWand); if (showCheckbox) { gd.setInsets(2,0,0); gd.addMessage("Thresholded objects are traced and \"Tolerance\"\nis ignored when thresholding is enabled."); } gd.addDialogListener(this); gd.showDialog(); }