Package ij.gui

Examples of ij.gui.GenericDialog


            if (options.indexOf("radius=") >= 0) {  // ensure compatibility with old macros
                oldMacro = true;                    // specifying "radius=", not "sigma=
                Macro.setOptions(options.replaceAll("radius=", "sigma="));
            }
        }
        GenericDialog gd = new GenericDialog(command);
        sigma = Math.abs(sigma);
        gd.addNumericField("Sigma (Radius)", sigma, 2);
        if (imp.getCalibration()!=null && !imp.getCalibration().getUnits().equals("pixels")) {
            hasScale = true;
            gd.addCheckbox("Scaled Units ("+imp.getCalibration().getUnits()+")", sigmaScaled);
        } else
            sigmaScaled = false;
        gd.addPreviewCheckbox(pfr);
        gd.addDialogListener(this);
        gd.showDialog();                    // input by the user (or macro) happens here
        if (gd.wasCanceled()) return DONE;
        if (oldMacro) sigma /= 2.5;         // for old macros, "radius" was 2.5 sigma
        IJ.register(this.getClass());       // protect static class variables (parameters) from garbage collection
        return IJ.setupDialog(imp, flags)// ask whether to process all slices of stack (if a stack)
    }
View Full Code Here


    Component comp = getParent();
    if (comp==null || !(comp instanceof TextWindow))
      return;
    TextWindow tw = (TextWindow)comp;
    if (title2==null) {
      GenericDialog gd = new GenericDialog("Rename", tw);
      gd.addStringField("Title:", "Results2", 20);
      gd.showDialog();
      if (gd.wasCanceled())
        return;
      title2 = gd.getNextString();
    }
    String title1 = title;
    if (title!=null && title.equals("Results")) {
      IJ.setTextPanel(null);
      Analyzer.setUnsavedMeasurements(false);
View Full Code Here

    return zp.getProjection();
  }
 
  boolean showDialog(ImagePlus imp) {
    int size = imp.getStackSize();
    GenericDialog gd = new GenericDialog("Z Project");
    gd.addChoice("Projection method", ZProjector.METHODS, ZProjector.METHODS[method]);
    gd.addNumericField("Group size:", size, 0);
    gd.showDialog();
    if (gd.wasCanceled()) return false;
    method = gd.getNextChoiceIndex();
    groupSize = (int)gd.getNextNumber();
    if (groupSize<||  groupSize>size || (size%groupSize)!=0) {
      IJ.error("ZProject", "Group size must divide evenly into the stack size.");
      return false;
    }
    return true;
View Full Code Here

        stopSlice = imp.getNFrames();
    } else
      stopSlice  = stackSize;
     
    // Build control dialog
    GenericDialog gd = buildControlDialog(startSlice,stopSlice);
    gd.showDialog();
    if(gd.wasCanceled()) return;

    if (!imp.lock()) return;   // exit if in use
    long tstart = System.currentTimeMillis();
    setStartSlice((int)gd.getNextNumber());
    setStopSlice((int)gd.getNextNumber());
    method = gd.getNextChoiceIndex();
    Prefs.set(METHOD_KEY, method);
    if (isHyperstack) {
      allTimeFrames = imp.getNFrames()>1&&imp.getNSlices()>1?gd.getNextBoolean():false;
      doHyperStackProjection(allTimeFrames);
    } else if (imp.getType()==ImagePlus.COLOR_RGB)
      doRGBProjection();
    else
      doProjection();
View Full Code Here

    /** Builds dialog to query users for projection parameters.
  @param start starting slice to display
  @param stop last slice */
    protected GenericDialog buildControlDialog(int start, int stop) {
    GenericDialog gd = new GenericDialog("ZProjection",IJ.getInstance());
    gd.addNumericField("Start slice:",startSlice,0/*digits*/);
    gd.addNumericField("Stop slice:",stopSlice,0/*digits*/);
    gd.addChoice("Projection Type", METHODS, METHODS[method]);
    if (isHyperstack && imp.getNFrames()>1&& imp.getNSlices()>1)
      gd.addCheckbox("All Time Frames", allTimeFrames);
    return gd;
    }
View Full Code Here

    public int showDialog(ImagePlus imp, String command, PlugInFilterRunner pfr) {
    if (filterType == DESPECKLE) {
            filterType = MEDIAN;
            makeKernel(1.0);
    } else {
      GenericDialog gd = new GenericDialog(command+"...");
      gd.addNumericField("Radius", radius, 1, 6, "pixels");
      int digits = imp.getType() == ImagePlus.GRAY32 ? 2 : 0;
      if(filterType == OUTLIERS) {
        gd.addNumericField("Threshold", threshold, digits);
        gd.addChoice("Which Outliers", outlierStrings, outlierStrings[whichOutliers]);
      }
      gd.addPreviewCheckbox(pfr);    //passing pfr makes the filter ready for preview
      gd.addDialogListener(this);    //the DialogItemChanged method will be called on user input
      gd.showDialog();              //display the dialog; preview runs in the  now
      if (gd.wasCanceled()) return DONE;
      IJ.register(this.getClass());   //protect static class variables (filter parameters) from garbage collection
        }
    return IJ.setupDialog(imp, flags)//ask whether to process all slices of stack (if a stack)
    }
View Full Code Here

            if (options.indexOf("radius=") >= 0) {  // ensure compatibility with old macros
                oldMacro = true;                    // specifying "radius=", not "sigma=
                Macro.setOptions(options.replaceAll("radius=", "sigma="));
            }
        }
        GenericDialog gd = new GenericDialog(command);
        sigma = Math.abs(sigma);
        gd.addNumericField("Sigma (Radius)", sigma, 2);
        if (imp.getCalibration()!=null && !imp.getCalibration().getUnits().equals("pixels")) {
            hasScale = true;
            gd.addCheckbox("Scaled Units ("+imp.getCalibration().getUnits()+")", sigmaScaled);
        } else
            sigmaScaled = false;
        gd.addPreviewCheckbox(pfr);
        gd.addDialogListener(this);
        gd.showDialog();                    // input by the user (or macro) happens here
        if (gd.wasCanceled()) return DONE;
        if (oldMacro) sigma /= 2.5;         // for old macros, "radius" was 2.5 sigma
        IJ.register(this.getClass());       // protect static class variables (parameters) from garbage collection
        return IJ.setupDialog(imp, flags)// ask whether to process all slices of stack (if a stack)
    }
View Full Code Here

    isHyperStack = imp.isHyperStack()&&imp.getNSlices()>1;
    startSlice = 1;
    stopSlice  = isHyperStack?imp.getNSlices():imp.getStackSize();

    // Build control dialog
    GenericDialog gd = buildControlDialog(startSlice,stopSlice);
    gd.showDialog();
    if(gd.wasCanceled()) return;

    if(!imp.lock()) return;   // exit if in use
    long tstart = System.currentTimeMillis();
    setStartSlice((int)gd.getNextNumber());
    setStopSlice((int)gd.getNextNumber());
    method = gd.getNextChoiceIndex();
    if (isHyperStack) {
      allTimeFrames = imp.getNFrames()>1?gd.getNextBoolean():false;
      doHyperStackProjection(allTimeFrames);
    } else if (imp.getType()==ImagePlus.COLOR_RGB) {
      if(method==SUM_METHOD || method==SD_METHOD || method==MEDIAN_METHOD) {
          IJ.error("ZProjection", "Sum, StdDev and Median methods \nnot available with RGB stacks.");
          imp.unlock();
View Full Code Here

    /** Builds dialog to query users for projection parameters.
  @param start starting slice to display
  @param stop last slice */
    protected GenericDialog buildControlDialog(int start, int stop) {
    GenericDialog gd = new GenericDialog("ZProjection",IJ.getInstance());
    gd.addNumericField("Start slice:",startSlice,0/*digits*/);
    gd.addNumericField("Stop slice:",stopSlice,0/*digits*/);
    gd.addChoice("Projection Type", METHODS, METHODS[method]);
    if (isHyperStack && imp.getNFrames()>1)
      gd.addCheckbox("All Time Frames", allTimeFrames);
    return gd;
    }
View Full Code Here

      image.updateAndDraw();
    }
  }

  private boolean showDialog() {
    GenericDialog gd = new GenericDialog("Process pixels");

    // default value is 0.00, 2 digits right of the decimal point
    gd.addNumericField("value", 0.00, 2);
    gd.addStringField("name", "John");

    gd.showDialog();
    if (gd.wasCanceled())
      return false;

    // get entered values
    value = gd.getNextNumber();
    name = gd.getNextString();

    return true;
  }
View Full Code Here

TOP

Related Classes of ij.gui.GenericDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.