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

public abstract class EnhancementFunction extends Function implements Cloneable, Serializable

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
    Modifier and Type
    Field
    Description
    protected double[]
    The enhancement range as [min, max].
    protected boolean
    The enhancement reverse flag.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    EnhancementFunction(double[] range)
    Creates an enhancement function with the specified range.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a copy of this object.
    abstract String
    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[]
    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
    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

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • range

      protected double[] range
      The enhancement range as [min, max].
    • reverse

      protected boolean reverse
      The 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

      public Object clone()
      Creates and returns a copy of this object.
      Overrides:
      clone in class 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

      public void normalize(Statistics stats, double units)
      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

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
    • getRange

      public double[] getRange()
      Gets the enhancement range.
    • describe

      public abstract String describe()
      Gets a description of the function.