Package noaa.coastwatch.render
Class EnhancementFunction
java.lang.Object
noaa.coastwatch.util.Function
noaa.coastwatch.render.EnhancementFunction
- All Implemented Interfaces:
Serializable
,Cloneable
,Encodable
- Direct Known Subclasses:
GammaEnhancement
,LinearEnhancement
,LogEnhancement
An enhancement function normalizes a data value to the range [0..1]. The class is used in conjunction with a data enhancement. For example, if a set of data is to be assigned colors based on the data values, an enhancement function can be used to scale the data values in the range [0..30] to the range [0..1] and then multiplying by 255 would compute a byte value in the range [0..255]. This would color enhance the data to a grayscale color palette from black to white.
Note that since this class implements Cloneable
, all
concrete child classes must have a valid clone()
method.
- Since:
- 3.1.1
- Author:
- Peter Hollemans
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
EnhancementFunction
(double[] range) Creates an enhancement function with the specified range. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a copy of this object.abstract String
describe()
Gets a description of the function.boolean
Indicates whether some other object is "equal to" this one.abstract double
getInverse
(double normValue) Gets the inverse enhancement value.double[]
getRange()
Gets the enhancement range.boolean
Gets the enhancement reversal flag.double
getValue
(double dataValue) Gets the enhancement value.void
normalize
(Statistics stats, double units) Sets the range based on statistical data.protected void
reset()
Resets the enhancement function.void
setRange
(double[] range) Sets the enhancement range.void
setReverse
(boolean flag) Sets the enhancement reversal flag.Methods inherited from class noaa.coastwatch.util.Function
evaluate, getEncoding, useEncoding
-
Field Details
-
range
protected double[] rangeThe enhancement range as [min, max]. -
reverse
protected boolean reverseThe enhancement reverse flag.
-
-
Constructor Details
-
EnhancementFunction
protected EnhancementFunction(double[] range) Creates an enhancement function with the specified range. By default the reversal flag is false.- Parameters:
range
- the enhancement range as [min, max].
-
-
Method Details
-
getReverse
public boolean getReverse()Gets the enhancement reversal flag. When an enhancement is reversed, the mapping is to [1..0] rather than [0..1].- See Also:
-
clone
Creates and returns a copy of this object. -
setReverse
public void setReverse(boolean flag) Sets the enhancement reversal flag. When an enhancement is reversed, the mapping is to [1..0] rather than [0..1]. -
setRange
public void setRange(double[] range) Sets the enhancement range.- Parameters:
range
- the enhancement range as [min, max].
-
getInverse
public abstract double getInverse(double normValue) Gets the inverse enhancement value.- Parameters:
normValue
- the normalized data value.- Returns:
- the unnormalized data value.
-
getValue
public double getValue(double dataValue) Gets the enhancement value.- Parameters:
dataValue
- the data value to convert.- Returns:
- the normalized data value.
-
normalize
Sets the range based on statistical data. The mean and standard deviation are used to compute a normalized data value range.- Parameters:
stats
- the data statistics.units
- the number of standard deviation units above and below the mean for the data range.- See Also:
-
reset
protected void reset()Resets the enhancement function. This method performs no operation, but should be overridden by the subclass to set up internal variables according to the new range values and reverse flag. -
equals
Indicates whether some other object is "equal to" this one. -
getRange
public double[] getRange()Gets the enhancement range. -
describe
Gets a description of the function.
-