@SuppressWarnings("unchecked") public static List<Checkbox> getCheckboxes(GenericDialog gd) { return gd.getCheckboxes(); }
@SuppressWarnings("unchecked") public static List<Checkbox> getCheckboxes(GenericDialog gd) { return gd.getCheckboxes(); }
@Override public boolean dialogItemChanged(final GenericDialog arg, final AWTEvent event) { useOnlySelectedPaths = gd.getNextRadioButton().contains("only"); restrictByRoi = gd.getNextRadioButton().contains("only"); restrictBySWCType = gd.getNextRadioButton().contains("only"); final String analysisChoice = gd.getNextRadioButton(); summarizeSkeleton = analysisChoice.contains("summary"); callAnalyzeSkeleton = analysisChoice.contains("Analyze Skeleton"); if (restrictBySWCType) { selectedSwcTypes.clear(); for (final int type : Path.getSWCtypes()) { if (gd.getNextBoolean()) selectedSwcTypes.add(type); } } final Vector<?> cbxs = gd.getCheckboxes(); for (int i = 0; i < cbxs.size(); i++) ((Checkbox) cbxs.get(i)).setEnabled(restrictBySWCType); return true; }
/** * Disables features which rely on missing third party libraries. * @param gd settings dialog * */ public static void disableMissingFeatures(final GenericDialog gd) { if (!isImageScienceAvailable()) { IJ.log("Warning: ImageScience library unavailable. " + "Some training features will be disabled."); @SuppressWarnings("unchecked") final Vector<Checkbox> v = gd.getCheckboxes(); for (int i = 0; i < v.size(); i++) { if (FeatureStack.IMAGESCIENCE_FEATURES[i]) { v.get(i).setState(false); v.get(i).setEnabled(false); } } } }
/** * Disables features which rely on missing third party libraries. * @param gd settings dialog * */ public static void disableMissingFeatures(final GenericDialog gd) { if (!isImageScienceAvailable()) { IJ.log("Warning: ImageScience library unavailable. " + "Some training features will be disabled."); @SuppressWarnings("unchecked") final Vector<Checkbox> v = gd.getCheckboxes(); for (int i = 0; i < v.size(); i++) { if (FeatureStack.IMAGESCIENCE_FEATURES[i]) { v.get(i).setState(false); v.get(i).setEnabled(false); } } } }
/** Sets the style fields of the dialog according to the style of the PlotObject having the * index given. Does nothing with index < 0 */ private void setDialogStyleFields(int index) { if (index < 0) return; Checkbox visibleC = (Checkbox)gd.getCheckboxes().get(0); String styleString = plot.getPlotObjectStyle(index); String designation = plot.getPlotObjectDesignations()[index].toLowerCase(); boolean isData = designation.startsWith("data"); boolean isText = designation.startsWith("text"); boolean isBox = designation.startsWith("shapes") && (designation.contains("boxes") || designation.contains("rectangles")); boolean isGrid = designation.startsWith("shapes") && designation.contains("redraw_grid"); String[] items = styleString.split(","); colorField.setText(items[0]); color2Field.setText(items[1]); widthField.setText(items[2]); if (items.length >= 4) symbolChoice.select(items[3]); labelField.setText(isData ? plot.getPlotObjectLabel(index) : ""); visibleC.setState(!styleString.contains("hidden")); colorField.setEnabled(!isGrid); //grid color is fixed color2Field.setEnabled(isData || isBox);//only (some) data symbols and boxes have secondary (fill) color widthField.setEnabled(!isText && !isGrid); //all non-Text types have line width // visibleC.setEnabled(!isGrid); //allow to hide everything symbolChoice.setEnabled(isData); //only data have a symbol to choose labelField.setEnabled(isData); //only data have a label in the legend }
/** Sets the style fields of the dialog according to the style of the PlotObject having the * index given. Does nothing with index < 0 */ private void setDialogStyleFields(int index) { if (index < 0) return; Checkbox visibleC = (Checkbox)gd.getCheckboxes().get(0); String styleString = plot.getPlotObjectStyle(index); String designation = plot.getPlotObjectDesignations()[index].toLowerCase(); boolean isData = designation.startsWith("data"); boolean isText = designation.startsWith("text"); boolean isBox = designation.startsWith("shapes") && (designation.contains("boxes") || designation.contains("rectangles")); boolean isGrid = designation.startsWith("shapes") && designation.contains("redraw_grid"); String[] items = styleString.split(","); colorField.setText(items[0]); color2Field.setText(items[1]); widthField.setText(items[2]); if (items.length >= 4) symbolChoice.select(items[3]); labelField.setText(isData ? plot.getPlotObjectLabel(index) : ""); visibleC.setState(!styleString.contains("hidden")); colorField.setEnabled(!isGrid); //grid color is fixed color2Field.setEnabled(isData || isBox);//only (some) data symbols and boxes have secondary (fill) color widthField.setEnabled(!isText && !isGrid); //all non-Text types have line width // visibleC.setEnabled(!isGrid); //allow to hide everything symbolChoice.setEnabled(isData); //only data have a symbol to choose labelField.setEnabled(isData); //only data have a label in the legend }
private void rebuild(GenericDialog gd) { Vector checkboxes = gd.getCheckboxes(); Vector fields = gd.getStringFields(); final ArrayList<Label> labels = new ArrayList<Label>();
private void rebuild(GenericDialog gd) { Vector checkboxes = gd.getCheckboxes(); Vector fields = gd.getStringFields(); final ArrayList<Label> labels = new ArrayList<Label>();
(Component)gd.getNumericFields().get(gd.getNumericFields().size()-2), (Component)gd.getNumericFields().get(gd.getNumericFields().size()-1), (Component)gd.getCheckboxes().get(gd.getCheckboxes().size()-2), (Component)gd.getCheckboxes().get(gd.getCheckboxes().size()-1) }; Utils.addEnablerListener((Checkbox)gd.getCheckboxes().get(gd.getCheckboxes().size()-3), c, null); if (!apply_bandpass_filter) { for (Component comp : c) comp.setEnabled(false);
gd.addStringField("Range:", "1-"+stackSize); if (!isMacro) { checkbox = (Checkbox)(gd.getCheckboxes().elementAt(0)); checkbox.addItemListener(this); Vector v = gd.getStringFields();
if ((showNames&&!showNames2) || colorChanged || sizeChanged) { showLabels = true; Vector checkboxes = gd.getCheckboxes(); ((Checkbox)checkboxes.elementAt(0)).setState(true);
if ((showNames&&!showNames2) || colorChanged || sizeChanged) { showLabels = true; Vector checkboxes = gd.getCheckboxes(); ((Checkbox)checkboxes.elementAt(0)).setState(true);
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) { ImageProcessor ip = imp.getProcessor(); ip.resetBinaryThreshold(); // remove any invisible threshold set by Make Binary or Convert to Mask thresholded = ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD; GenericDialog gd = new GenericDialog(command); int digits = (ip instanceof FloatProcessor)?2:0; String unit = (imp.getCalibration()!=null)?imp.getCalibration().getValueUnit():null; unit = (unit==null||unit.equals("Gray Value"))?":":" ("+unit+"):"; gd.addNumericField("Noise tolerance"+unit,tolerance, digits); gd.addChoice("Output type:", outputTypeNames, outputTypeNames[dialogOutputType]); gd.addCheckbox("Exclude edge maxima", excludeOnEdges); if (thresholded) gd.addCheckbox("Above lower threshold", useMinThreshold); gd.addCheckbox("Light background", lightBackground); gd.addPreviewCheckbox(pfr, "Preview point selection"); gd.addMessage(" "); //space for number of maxima messageArea = (Label)gd.getMessage(); gd.addDialogListener(this); checkboxes = gd.getCheckboxes(); previewing = true; gd.addHelp(IJ.URL+"/docs/menus/process.html#find-maxima"); gd.showDialog(); //input by the user (or macro) happens here if (gd.wasCanceled()) return DONE; previewing = false; if (!dialogItemChanged(gd, null)) //read parameters return DONE; IJ.register(this.getClass()); //protect static class variables (parameters) from garbage collection return flags; } // boolean showDialog
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) { ImageProcessor ip = imp.getProcessor(); ip.resetBinaryThreshold(); // remove any invisible threshold set by Make Binary or Convert to Mask thresholded = ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD; GenericDialog gd = new GenericDialog(command); int digits = (ip instanceof FloatProcessor)?2:0; String unit = (imp.getCalibration()!=null)?imp.getCalibration().getValueUnit():null; unit = (unit==null||unit.equals("Gray Value"))?":":" ("+unit+"):"; gd.addNumericField("Noise tolerance"+unit,tolerance, digits); gd.addChoice("Output type:", outputTypeNames, outputTypeNames[dialogOutputType]); gd.addCheckbox("Exclude edge maxima", excludeOnEdges); if (thresholded) gd.addCheckbox("Above lower threshold", useMinThreshold); gd.addCheckbox("Light background", lightBackground); gd.addPreviewCheckbox(pfr, "Preview point selection"); gd.addMessage(" "); //space for number of maxima messageArea = (Label)gd.getMessage(); gd.addDialogListener(this); checkboxes = gd.getCheckboxes(); previewing = true; gd.addHelp(IJ.URL+"/docs/menus/process.html#find-maxima"); gd.showDialog(); //input by the user (or macro) happens here if (gd.wasCanceled()) return DONE; previewing = false; if (!dialogItemChanged(gd, null)) //read parameters return DONE; IJ.register(this.getClass()); //protect static class variables (parameters) from garbage collection return flags; } // boolean showDialog
public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) { ImageProcessor ip = imp.getProcessor(); ip.resetBinaryThreshold(); // remove invisible threshold set by MakeBinary and Convert to Mask thresholded = ip.getMinThreshold()!=ImageProcessor.NO_THRESHOLD; GenericDialog gd = new GenericDialog(command); int digits = (ip instanceof FloatProcessor)?2:0; String unit = (imp.getCalibration()!=null)?imp.getCalibration().getValueUnit():null; unit = (unit==null||unit.equals("Gray Value"))?":":" ("+unit+"):"; gd.addNumericField("Noise tolerance"+unit,tolerance, digits); gd.addChoice("Output type:", outputTypeNames, outputTypeNames[dialogOutputType]); gd.addCheckbox("Exclude edge maxima", excludeOnEdges); if (thresholded) gd.addCheckbox("Above lower threshold", useMinThreshold); gd.addCheckbox("Light background", lightBackground); gd.addPreviewCheckbox(pfr, "Preview point selection"); gd.addMessage(" "); //space for number of maxima messageArea = (Label)gd.getMessage(); gd.addDialogListener(this); checkboxes = gd.getCheckboxes(); previewing = true; gd.addHelp(IJ.URL+"/docs/menus/process.html#find-maxima"); gd.showDialog(); //input by the user (or macro) happens here if (gd.wasCanceled()) return DONE; previewing = false; if (!dialogItemChanged(gd, null)) //read parameters return DONE; IJ.register(this.getClass()); //protect static class variables (parameters) from garbage collection return flags; } // boolean showDialog
gd.addNumericField("Grid total height:", height*cal.pixelHeight, 1, 10, cal.getUnits()); gd.addCheckbox("Read bounds from ROI", null != roi); ((Component)gd.getCheckboxes().get(0)).setEnabled(null != roi); gd.addMessage(""); gd.addNumericField("Tile width:", tilewidth*cal.pixelWidth, 1, 10, cal.getUnits());
gd.addDialogListener(this); if (!isMacro) { Vector v = gd.getCheckboxes(); centerCheckbox = (Checkbox)v.elementAt(1); randomCheckbox = (Checkbox)v.elementAt(2);
gd.addDialogListener(this); if (!isMacro) { Vector v = gd.getCheckboxes(); centerCheckbox = (Checkbox)v.elementAt(1); randomCheckbox = (Checkbox)v.elementAt(2);
final Vector<?> checkBoxes = gd.getCheckboxes(); for ( final Object o : checkBoxes ) ( (Checkbox)o ).addItemListener( new IntroItemListener( (Checkbox)o, checkBoxes ) );