/**
   * Returns a table listing the input parameters of this algorithm (which should match up with the
   * scripting parameters used in {@link #setGUIFromParams()}).
   *
   * @return A parameter table listing the inputs of this algorithm.
   */
  public ParameterTable createInputParameters() {
    final ParameterTable table = new ParameterTable();

    try {

      table.put(new ParameterExternalImage(AlgorithmParameters.getInputImageLabel(1)));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_OUTPUT_NEW_IMAGE, true));
    } catch (final ParserException e) {
      // this shouldn't really happen since there isn't any real parsing going on...
      e.printStackTrace();
    }

    return table;
  }
  /**
   * Returns a table listing the input parameters of this algorithm (which should match up with the
   * scripting parameters used in {@link #setGUIFromParams()}).
   *
   * @return A parameter table listing the inputs of this algorithm.
   */
  public ParameterTable createInputParameters() {
    final ParameterTable table = new ParameterTable();

    try {
      table.put(new ParameterExternalImage(AlgorithmParameters.getInputImageLabel(1)));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_OUTPUT_NEW_IMAGE, true));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_PROCESS_WHOLE_IMAGE, true));
      table.put(new ParameterBoolean(AlgorithmParameters.DO_PROCESS_3D_AS_25D, false));
      table.put(new ParameterInt("search_window_side", 15));
      table.put(new ParameterInt("similarity_window_side", 7));
      table.put(new ParameterFloat("noise_standard_deviation", 10f));
      table.put(new ParameterFloat("degree_of_filtering", 1.414f));
      table.put(new ParameterBoolean("do_rician", false));
    } catch (final ParserException e) {
      // this shouldn't really happen since there isn't any real parsing going on...
      e.printStackTrace();
    }

    return table;
  }
  /** {@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"));
  }