Class NumericParameter<S extends Number>

java.lang.Object
qupath.lib.plugins.parameters.NumericParameter<S>
Type Parameters:
S -
All Implemented Interfaces:
Serializable, Parameter<S>
Direct Known Subclasses:
DoubleParameter, IntParameter

public abstract class NumericParameter<S extends Number> extends Object
Abstract parameter to represent a numeric value.
Author:
Pete Bankhead
See Also:
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    protected S
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Get a default value to use if the Parameter has not been otherwise set.
    Get a description of the meaning of the Parameter; may be displayed e.g.
    double
    Retrieve the lower bound.
    Get some prompt text that may be displayed to a user.
    Get the unit to display for this parameter (may be null if no unit is available).
    double
    Retrieve the upper bound.
    Get the current set value (may be null).
    Get the current set value, or any default if no value has been set.
    boolean
    Query whether getHelpText() returns a meaningful String (as opposed to null).
    boolean
    Returns true if this parameter has both lower and upper bounds constraining valid values.
    boolean
    Returns true if the parameter has a valid lower bound.
    boolean
    Returns true if the parameter has a valid upper bound.
    boolean
    Test is the 'hidden' flag is set for the parameter.
    boolean
    Returns true if this neither a lower nor an upper bound constraining valid values.
    boolean
    isValidInput(S value)
    Numbers are considered valid if they are not NaN
    void
    Set last value to null (so default can be used).
    abstract boolean
    setDoubleLastValue(double val)
    A class for setting the numeric value as a double (subclasses should convert this as needed).
    void
    setHidden(boolean hidden)
    Mark that a parameter should not be displayed to a user.
    void
    setRange(double minValue, double maxValue)
    Set the upper and lower bounds.
    boolean
    Set last value using a string; implementing classes may need to parse this
    boolean
    setValue(S value)
    Set the Parameter to have a specified value.
    abstract boolean
    Set the value of this parameter, constraining it to be within any lower and upper bounds if necessary.
     

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface qupath.lib.plugins.parameters.Parameter Link icon

    duplicate
  • Field Details Link icon

    • lastValue Link icon

      protected S extends Number lastValue
  • Method Details Link icon

    • hasLowerAndUpperBounds Link icon

      public boolean hasLowerAndUpperBounds()
      Returns true if this parameter has both lower and upper bounds constraining valid values.
      Returns:
    • isUnbounded Link icon

      public boolean isUnbounded()
      Returns true if this neither a lower nor an upper bound constraining valid values.
      Returns:
    • getLowerBound Link icon

      public double getLowerBound()
      Retrieve the lower bound. May be Double.NEGATIVE_INFINITY if the parameter has no lower bound.
      Returns:
    • getUpperBound Link icon

      public double getUpperBound()
      Retrieve the upper bound. May be Double.POSITIVE_INFINITY if the parameter has no upper bound.
      Returns:
    • setRange Link icon

      public void setRange(double minValue, double maxValue)
      Set the upper and lower bounds.

      Note: depending on how the parameter is displayed (or if it is displayed) this might not appear to make a difference. If shown through a ParameterPanel (in QuPath's JavaFX GUI) it is better to set limits via the panel rather than directly using this method.

      Parameters:
      minValue -
      maxValue -
    • hasLowerBound Link icon

      public boolean hasLowerBound()
      Returns true if the parameter has a valid lower bound.
      Returns:
    • hasUpperBound Link icon

      public boolean hasUpperBound()
      Returns true if the parameter has a valid upper bound.
      Returns:
    • getUnit Link icon

      public String getUnit()
      Get the unit to display for this parameter (may be null if no unit is available).
      Returns:
    • setValueWithBoundsCheck Link icon

      public abstract boolean setValueWithBoundsCheck(S lastValue)
      Set the value of this parameter, constraining it to be within any lower and upper bounds if necessary.
      Parameters:
      lastValue -
      Returns:
    • setDoubleLastValue Link icon

      public abstract boolean setDoubleLastValue(double val)
      A class for setting the numeric value as a double (subclasses should convert this as needed).
      Parameters:
      val -
      Returns:
    • isValidInput Link icon

      public boolean isValidInput(S value)
      Numbers are considered valid if they are not NaN
      Parameters:
      value -
      Returns:
      true if the value would be valid, false otherwise
    • setStringLastValue Link icon

      public boolean setStringLastValue(Locale locale, String value)
      Description copied from interface: Parameter
      Set last value using a string; implementing classes may need to parse this
      Parameters:
      locale -
      value -
      Returns:
    • setHidden Link icon

      public void setHidden(boolean hidden)
      Description copied from interface: Parameter
      Mark that a parameter should not be displayed to a user. This is useful, for example, if a parameter list changes the parameters to be displayed depending upon the image available or current settings, e.g. using different parameters when the pixel size is known in microns.
      Specified by:
      setHidden in interface Parameter<S>
      Parameters:
      hidden -
    • isHidden Link icon

      public boolean isHidden()
      Description copied from interface: Parameter
      Test is the 'hidden' flag is set for the parameter.
      Specified by:
      isHidden in interface Parameter<S>
      Returns:
    • getDefaultValue Link icon

      public S getDefaultValue()
      Description copied from interface: Parameter
      Get a default value to use if the Parameter has not been otherwise set.
      Specified by:
      getDefaultValue in interface Parameter<S>
      Returns:
    • getValue Link icon

      public S getValue()
      Description copied from interface: Parameter
      Get the current set value (may be null).
      Specified by:
      getValue in interface Parameter<S>
      Returns:
      See Also:
    • resetValue Link icon

      public void resetValue()
      Description copied from interface: Parameter
      Set last value to null (so default can be used).
      Specified by:
      resetValue in interface Parameter<S>
    • getValueOrDefault Link icon

      public S getValueOrDefault()
      Description copied from interface: Parameter
      Get the current set value, or any default if no value has been set.
      Specified by:
      getValueOrDefault in interface Parameter<S>
      Returns:
      See Also:
    • getPrompt Link icon

      public String getPrompt()
      Description copied from interface: Parameter
      Get some prompt text that may be displayed to a user.
      Specified by:
      getPrompt in interface Parameter<S>
      Returns:
    • setValue Link icon

      public boolean setValue(S value)
      Description copied from interface: Parameter
      Set the Parameter to have a specified value.
      Specified by:
      setValue in interface Parameter<S>
      Parameters:
      value -
      Returns:
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • hasHelpText Link icon

      public boolean hasHelpText()
      Description copied from interface: Parameter
      Query whether getHelpText() returns a meaningful String (as opposed to null).
      Specified by:
      hasHelpText in interface Parameter<S>
      Returns:
    • getHelpText Link icon

      public String getHelpText()
      Description copied from interface: Parameter
      Get a description of the meaning of the Parameter; may be displayed e.g. as a tooltip.
      Specified by:
      getHelpText in interface Parameter<S>
      Returns: