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
-
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.double
Retrieve 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).double
Retrieve 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.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
isHidden()
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 NaNvoid
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
setStringLastValue
(Locale locale, String value) Set last value using a string; implementing classes may need to parse thisboolean
Set the Parameter to have a specified value.abstract boolean
setValueWithBoundsCheck
(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- Parameters:
value
-- Returns:
- true if the value would be valid, false otherwise
-
setStringLastValue
Description copied from interface:Parameter
Set last value using a string; implementing classes may need to parse this- Parameters:
locale
-value
-- Returns:
-
setHidden
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. -
isHidden
public boolean isHidden()Description copied from interface:Parameter
Test is the 'hidden' flag is set for the parameter. -
getDefaultValue
Description copied from interface:Parameter
Get a default value to use if the Parameter has not been otherwise set.- Specified by:
getDefaultValue
in interfaceParameter<S>
- Returns:
-
getValue
Description copied from interface:Parameter
Get the current set value (may be null). -
resetValue
public void resetValue()Description copied from interface:Parameter
Set last value to null (so default can be used).- Specified by:
resetValue
in interfaceParameter<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 interfaceParameter<S>
- Returns:
- See Also:
-
getPrompt
Description copied from interface:Parameter
Get some prompt text that may be displayed to a user. -
setValue
Description copied from interface:Parameter
Set the Parameter to have a specified value. -
toString
-
hasHelpText
public boolean hasHelpText()Description copied from interface:Parameter
Query whether getHelpText() returns a meaningful String (as opposed to null).- Specified by:
hasHelpText
in interfaceParameter<S>
- Returns:
-
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 interfaceParameter<S>
- Returns:
-