Class ColorComposite

java.lang.Object
noaa.coastwatch.render.EarthDataView
noaa.coastwatch.render.ColorComposite
All Implemented Interfaces:
Cloneable, Renderable

public class ColorComposite extends EarthDataView
A color composite is a data view that creates an image based on three data grid variables, one each for red, green, and blue. Each grid is associated with an enhancement function. The composite is created by normalizing each variable to the range [0..1] using the enhancement functions, then mapping the normalized values to byte data in the range [0..255]. Each byte is then used as either the red, green, or blue component of a 24-bit color value. This is repeated for each pixel to form the overall composite image.
Since:
3.1.1
Author:
Peter Hollemans
  • Field Details

  • Constructor Details

    • ColorComposite

      public ColorComposite(EarthTransform trans, Grid[] grids, EnhancementFunction[] funcs) throws NoninvertibleTransformException
      Constructs a new color composite from the specified parameters.
      Parameters:
      trans - the view earth transform.
      grids - the grid variables to use for this composite as [red, green, blue]. Note that the grids must all have the same dimensions.
      funcs - the enhancement functions as [red, green, blue].
      Throws:
      NoninvertibleTransformException - if the resulting image transform is not invertible.
  • Method Details

    • getGrids

      public Grid[] getGrids()
      Gets the data grid variables.
    • getFunctions

      public EnhancementFunction[] getFunctions()
      Gets the enhancement functions.
    • setGrids

      public void setGrids(Grid[] grids)
      Sets the data grid variables.
      Parameters:
      grids - the array of three grid variables. The order of grid variables is [red, green, blue]. Note that the grids must all have the same dimensions.
    • setFunctions

      public void setFunctions(EnhancementFunction[] funcs)
      Sets the enhancement functions.
      Parameters:
      funcs - the array of three enhancement functions. The order of functions is the same as the order of grids: [red, green, blue].
    • prepare

      protected void prepare(Graphics2D g)
      Description copied from class: EarthDataView
      Prepares this view for rendering using the specified graphics object. This method is called when any changes have occurred that require the view to be completely reconstructed, such as a change in view size or data window.
      Specified by:
      prepare in class EarthDataView
    • normalize

      public void normalize(int component, double units)
      Normalizes the enhancement function for this view using the visible grid value statistics.
      Parameters:
      component - the component to enhance, either RED, GREEN, or BLUE.
      units - the number of standard deviation units above and below the mean for the data range.
    • setRange

      public void setRange(int component, Function<Statistics,double[]> statsFunction)
      Set the enhancement function range for this view using the visible grid value statistics. This is a generalized version of normalize(int, double) in which the range is computed with a user-supplied function.
      Parameters:
      component - the component to set, either RED, GREEN, or BLUE.
      statsFunction - the statistics function to use for setting the range.
      Since:
      3.6.1