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
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEnhancementFunction(double[] range) Creates an enhancement function with the specified range. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates and returns a copy of this object.abstract Stringdescribe()Gets a description of the function.booleanIndicates whether some other object is "equal to" this one.abstract doublegetInverse(double normValue) Gets the inverse enhancement value.double[]getRange()Gets the enhancement range.booleanGets the enhancement reversal flag.doublegetValue(double dataValue) Gets the enhancement value.voidnormalize(Statistics stats, double units) Sets the range based on statistical data.protected voidreset()Resets the enhancement function.voidsetRange(double[] range) Sets the enhancement range.voidsetReverse(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.
-