コード例 #1
0
ファイル: Binary.java プロジェクト: kkkkxu/BioImage
 public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) {
   if (doOptions) {
     this.imp = imp;
     this.pfr = pfr;
     GenericDialog gd = new GenericDialog("Binary Options");
     gd.addNumericField("Iterations (1-" + MAX_ITERATIONS + "):", iterations, 0, 3, "");
     gd.addNumericField("Count (1-8):", count, 0, 3, "");
     gd.addCheckbox("Black background", Prefs.blackBackground);
     gd.addCheckbox("Pad edges when eroding", Prefs.padEdges);
     gd.addChoice("EDM output:", outputTypes, outputTypes[EDM.getOutputType()]);
     if (imp != null) {
       gd.addChoice("Do:", operations, operation);
       gd.addPreviewCheckbox(pfr);
       gd.addDialogListener(this);
       previewing = true;
     }
     gd.addHelp(IJ.URL + "/docs/menus/process.html#options");
     gd.showDialog();
     previewing = false;
     if (gd.wasCanceled()) return DONE;
     if (imp == null) { // options dialog only, no do/preview
       dialogItemChanged(gd, null); // read dialog result
       return DONE;
     }
     return operation.equals(NO_OPERATION) ? DONE : IJ.setupDialog(imp, flags);
   } else { // no dialog, 'arg' is operation type
     if (!((ByteProcessor) imp.getProcessor()).isBinary()) {
       IJ.error("8-bit binary (black and white only) image required.");
       return DONE;
     }
     return IJ.setupDialog(imp, flags);
   }
 }
コード例 #2
0
 public int setup(String arg, ImagePlus imp) {
   this.arg = arg;
   this.imp = imp;
   IJ.register(ParticleAnalyzer.class);
   if (imp == null) {
     IJ.noImage();
     return DONE;
   }
   if (imp.getBitDepth() == 24 && !isThresholdedRGB(imp)) {
     IJ.error(
         "Particle Analyzer",
         "RGB images must be thresholded using\n" + "Image>Adjust>Color Threshold.");
     return DONE;
   }
   if (!showDialog()) return DONE;
   int baseFlags = DOES_ALL + NO_CHANGES + NO_UNDO;
   int flags = IJ.setupDialog(imp, baseFlags);
   processStack = (flags & DOES_STACKS) != 0;
   slice = 0;
   saveRoi = imp.getRoi();
   if (saveRoi != null && saveRoi.getType() != Roi.RECTANGLE && saveRoi.isArea())
     polygon = saveRoi.getPolygon();
   imp.startTiming();
   nextFontSize = defaultFontSize;
   nextLineWidth = 1;
   return flags;
 }
コード例 #3
0
ファイル: Rotator.java プロジェクト: AlexJoz/docuensj
 public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) {
   this.pfr = pfr;
   String macroOptions = Macro.getOptions();
   if (macroOptions != null) {
     if (macroOptions.indexOf(" interpolate") != -1)
       macroOptions.replaceAll(" interpolate", " interpolation=Bilinear");
     else if (macroOptions.indexOf(" interpolation=") == -1)
       macroOptions = macroOptions + " interpolation=None";
     Macro.setOptions(macroOptions);
   }
   gd = new GenericDialog("Rotate", IJ.getInstance());
   gd.addNumericField("Angle (degrees):", angle, (int) angle == angle ? 1 : 2);
   gd.addNumericField("Grid Lines:", gridLines, 0);
   gd.addChoice("Interpolation:", methods, methods[interpolationMethod]);
   if (bitDepth == 8 || bitDepth == 24)
     gd.addCheckbox("Fill with Background Color", fillWithBackground);
   if (canEnlarge) gd.addCheckbox("Enlarge Image to Fit Result", enlarge);
   else enlarge = false;
   gd.addPreviewCheckbox(pfr);
   gd.addDialogListener(this);
   gd.showDialog();
   drawGridLines(0);
   if (gd.wasCanceled()) {
     return DONE;
   }
   if (!enlarge) flags |= KEEP_PREVIEW; // standard filter without enlarge
   else if (imp.getStackSize() == 1) flags |= NO_CHANGES; // undoable as a "compound filter"
   return IJ.setupDialog(imp, flags);
 }
コード例 #4
0
 public int setup(String arg, ImagePlus imp) {
   this.arg = arg;
   this.imp = imp;
   // return IJ.setupDialog(imp, DOES_8G+DOES_8C+SUPPORTS_MASKING);
   if (imp != null) {
     Roi roi = imp.getRoi();
     if (roi != null && !roi.isArea()) imp.killRoi(); // ignore any line selection
   }
   int flags = IJ.setupDialog(imp, DOES_ALL - DOES_8C + SUPPORTS_MASKING);
   return flags;
 }