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.
- See Also:
- 
Field SummaryFields
- 
Method SummaryModifier 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- 
hasLowerAndUpperBoundspublic boolean hasLowerAndUpperBounds()Returns true if this parameter has both lower and upper bounds constraining valid values.- Returns:
 
- 
isUnboundedpublic boolean isUnbounded()Returns true if this neither a lower nor an upper bound constraining valid values.- Returns:
 
- 
getLowerBoundpublic double getLowerBound()Retrieve the lower bound. May be Double.NEGATIVE_INFINITY if the parameter has no lower bound.- Returns:
 
- 
getUpperBoundpublic double getUpperBound()Retrieve the upper bound. May be Double.POSITIVE_INFINITY if the parameter has no upper bound.- Returns:
 
- 
setRangepublic 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-
 
- 
hasLowerBoundpublic boolean hasLowerBound()Returns true if the parameter has a valid lower bound.- Returns:
 
- 
hasUpperBoundpublic boolean hasUpperBound()Returns true if the parameter has a valid upper bound.- Returns:
 
- 
getUnitGet the unit to display for this parameter (may be null if no unit is available).- Returns:
 
- 
setValueWithBoundsCheckSet the value of this parameter, constraining it to be within any lower and upper bounds if necessary.- Parameters:
- lastValue-
- Returns:
 
- 
setDoubleLastValuepublic abstract boolean setDoubleLastValue(double val) A class for setting the numeric value as a double (subclasses should convert this as needed).- Parameters:
- val-
- Returns:
 
- 
isValidInputNumbers are considered valid if they are not NaN- Parameters:
- value-
- Returns:
- true if the value would be valid, false otherwise
 
- 
setStringLastValueDescription copied from interface:ParameterSet last value using a string; implementing classes may need to parse this- Parameters:
- locale-
- value-
- Returns:
 
- 
setHiddenpublic 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.
- 
isHiddenpublic boolean isHidden()Description copied from interface:ParameterTest is the 'hidden' flag is set for the parameter.
- 
getDefaultValueDescription copied from interface:ParameterGet a default value to use if the Parameter has not been otherwise set.- Specified by:
- getDefaultValuein interface- Parameter<S>
- Returns:
 
- 
getValueDescription copied from interface:ParameterGet the current set value (may be null).
- 
resetValuepublic void resetValue()Description copied from interface:ParameterSet last value to null (so default can be used).- Specified by:
- resetValuein interface- Parameter<S>
 
- 
getValueOrDefaultDescription copied from interface:ParameterGet the current set value, or any default if no value has been set.- Specified by:
- getValueOrDefaultin interface- Parameter<S>
- Returns:
- See Also:
 
- 
getPromptDescription copied from interface:ParameterGet some prompt text that may be displayed to a user.
- 
setValueDescription copied from interface:ParameterSet the Parameter to have a specified value.
- 
toString
- 
hasHelpTextpublic boolean hasHelpText()Description copied from interface:ParameterQuery whether getHelpText() returns a meaningful String (as opposed to null).- Specified by:
- hasHelpTextin interface- Parameter<S>
- Returns:
 
- 
getHelpTextDescription copied from interface:ParameterGet a description of the meaning of the Parameter; may be displayed e.g. as a tooltip.- Specified by:
- getHelpTextin interface- Parameter<S>
- Returns:
 
 
-