Package qupath.lib.plugins.parameters
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
Abstract parameter to represent a numeric value.
- Author:
- Pete Bankhead
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionGet 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.doubleRetrieve the lower bound.Get some prompt text that may be displayed to a user.getUnit()Get the unit to display for this parameter (may be null if no unit is available).doubleRetrieve the upper bound.getValue()Get the current set value (may be null).Get the current set value, or any default if no value has been set.booleanQuery whether getHelpText() returns a meaningful String (as opposed to null).booleanReturns true if this parameter has both lower and upper bounds constraining valid values.booleanReturns true if the parameter has a valid lower bound.booleanReturns true if the parameter has a valid upper bound.booleanisHidden()Test is the 'hidden' flag is set for the parameter.booleanReturns true if this neither a lower nor an upper bound constraining valid values.booleanisValidInput(S value) Numbers are considered valid if they are not NaNvoidSet last value to null (so default can be used).abstract booleansetDoubleLastValue(double val) A class for setting the numeric value as a double (subclasses should convert this as needed).voidsetHidden(boolean hidden) Mark that a parameter should not be displayed to a user.voidsetRange(double minValue, double maxValue) Set the upper and lower bounds.booleansetStringLastValue(Locale locale, String value) Set last value using a string; implementing classes may need to parse thisbooleanSet the Parameter to have a specified value.abstract booleansetValueWithBoundsCheck(S lastValue) Set the value of this parameter, constraining it to be within any lower and upper bounds if necessary.toString()
-
Field Details
-
lastValue
-
-
Method Details
-
hasLowerAndUpperBounds
public boolean hasLowerAndUpperBounds()Returns true if this parameter has both lower and upper bounds constraining valid values.- Returns:
-
isUnbounded
public boolean isUnbounded()Returns true if this neither a lower nor an upper bound constraining valid values.- Returns:
-
getLowerBound
public double getLowerBound()Retrieve the lower bound. May be Double.NEGATIVE_INFINITY if the parameter has no lower bound.- Returns:
-
getUpperBound
public double getUpperBound()Retrieve the upper bound. May be Double.POSITIVE_INFINITY if the parameter has no upper bound.- Returns:
-
setRange
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
public boolean hasLowerBound()Returns true if the parameter has a valid lower bound.- Returns:
-
hasUpperBound
public boolean hasUpperBound()Returns true if the parameter has a valid upper bound.- Returns:
-
getUnit
Get the unit to display for this parameter (may be null if no unit is available).- Returns:
-
setValueWithBoundsCheck
Set the value of this parameter, constraining it to be within any lower and upper bounds if necessary.- Parameters:
lastValue-- Returns:
-
setDoubleLastValue
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
Numbers are considered valid if they are not NaN- Returns:
- true if the value would be valid, false otherwise
-
setStringLastValue
Description copied from interface:ParameterSet last value using a string; implementing classes may need to parse this- Returns:
-
setHidden
public void setHidden(boolean hidden) Description copied from interface:ParameterMark 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. -
isHidden
public boolean isHidden()Description copied from interface:ParameterTest is the 'hidden' flag is set for the parameter. -
getDefaultValue
Description copied from interface:ParameterGet a default value to use if the Parameter has not been otherwise set.- Specified by:
getDefaultValuein interfaceParameter<S>- Returns:
-
getValue
Description copied from interface:ParameterGet the current set value (may be null). -
resetValue
public void resetValue()Description copied from interface:ParameterSet last value to null (so default can be used).- Specified by:
resetValuein interfaceParameter<S>
-
getValueOrDefault
Description copied from interface:ParameterGet the current set value, or any default if no value has been set.- Specified by:
getValueOrDefaultin interfaceParameter<S>- Returns:
- See Also:
-
getPrompt
Description copied from interface:ParameterGet some prompt text that may be displayed to a user. -
setValue
Description copied from interface:ParameterSet the Parameter to have a specified value. -
toString
-
hasHelpText
public boolean hasHelpText()Description copied from interface:ParameterQuery whether getHelpText() returns a meaningful String (as opposed to null).- Specified by:
hasHelpTextin interfaceParameter<S>- Returns:
-
getHelpText
Description copied from interface:ParameterGet a description of the meaning of the Parameter; may be displayed e.g. as a tooltip.- Specified by:
getHelpTextin interfaceParameter<S>- Returns:
-