MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / showDialog

Method showDialog

ij/src/main/java/ij/plugin/filter/Binary.java:59–95  ·  view source on GitHub ↗
(ImagePlus imp, String command, PlugInFilterRunner pfr)

Source from the content-addressed store, hash-verified

57 }
58
59 public int showDialog (ImagePlus imp, String command, PlugInFilterRunner pfr) {
60 if (doOptions) {
61 this.imp = imp;
62 this.pfr = pfr;
63 if (count<1) count=1;
64 if (count>8) count=8;
65 GenericDialog gd = new GenericDialog("Binary Options");
66 gd.addNumericField("Iterations (1-"+MAX_ITERATIONS+"):", iterations, 0, 3, "");
67 gd.addNumericField("Count (1-8):", count, 0, 3, "");
68 gd.addCheckbox("Black background", Prefs.blackBackground);
69 gd.addCheckbox("Pad edges when eroding", Prefs.padEdges);
70 gd.addChoice("EDM output:", outputTypes, outputTypes[EDM.getOutputType()]);
71 if (imp!=null) {
72 gd.addChoice("Do:", operations, operation);
73 gd.addPreviewCheckbox(pfr);
74 gd.addDialogListener(this);
75 previewing = true;
76 }
77 gd.addHelp(IJ.URL2+"/docs/menus/process.html#options");
78 gd.showDialog();
79 previewing = false;
80 if (gd.wasCanceled())
81 return DONE;
82 Prefs.set(COUNT_KEY, count);
83 if (imp==null) { //options dialog only, no do/preview
84 dialogItemChanged(gd, null); //read dialog result
85 return DONE;
86 }
87 return operation.equals(NO_OPERATION) ? DONE : IJ.setupDialog(imp, flags);
88 } else { //no dialog, 'arg' is operation type
89 if (!((ByteProcessor)imp.getProcessor()).isBinary()) {
90 IJ.error("8-bit binary (0 and 255 only) image required.");
91 return DONE;
92 }
93 return IJ.setupDialog(imp, flags);
94 }
95 }
96
97 public boolean dialogItemChanged (GenericDialog gd, AWTEvent e) {
98 iterations = (int)gd.getNextNumber();

Callers

nothing calls this directly

Calls 15

addNumericFieldMethod · 0.95
addCheckboxMethod · 0.95
addChoiceMethod · 0.95
getOutputTypeMethod · 0.95
addPreviewCheckboxMethod · 0.95
addDialogListenerMethod · 0.95
addHelpMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
setMethod · 0.95
dialogItemChangedMethod · 0.95
setupDialogMethod · 0.95

Tested by

no test coverage detected