/**
   * Creates new dialog for distances within a cell from the geometric center using a plugin.
   *
   * @param theParentFrame Parent frame.
   * @param im Source image.
   */
  public PlugInDialogCenterDistance2(Frame theParentFrame, ModelImage im) {
    super(theParentFrame, false);

    if (!im.isColorImage()) {
      MipavUtil.displayError("Source Image must be Color");
      dispose();

      return;
    }

    image = im;
    init();
  }
  /** {@inheritDoc} */
  protected void setGUIFromParams() {
    image = scriptParameters.retrieveInputImage();
    parentFrame = image.getParentFrame();

    if (!image.isColorImage()) {
      throw new ParameterException(
          AlgorithmParameters.getInputImageLabel(1), "Source Image must be Color");
    }

    setBlueMin(scriptParameters.getParams().getInt("blue_min"));
    setRedMin(scriptParameters.getParams().getInt("red_min"));
    setRedFraction(scriptParameters.getParams().getFloat("red_fraction"));
    setMergingDistance(scriptParameters.getParams().getFloat("merging_distance"));
    setGreenMin(scriptParameters.getParams().getInt("green_min"));
    setGreenFraction(scriptParameters.getParams().getFloat("green_fraction"));
    setGreenRegionNumber(scriptParameters.getParams().getInt("green_region_number"));
    setTwoGreenLevels(scriptParameters.getParams().getBoolean("two_green_levels"));
    setBlueBoundaryFraction(scriptParameters.getParams().getFloat("blue_boundary_fraction"));
    setBlueSmooth(scriptParameters.getParams().getBoolean("blue_smooth"));
    setInterpolationDivisor(scriptParameters.getParams().getFloat("interpolation_divisor"));
  }