Package noaa.coastwatch.render
Class ColorEnhancement
java.lang.Object
noaa.coastwatch.render.EarthDataView
noaa.coastwatch.render.ColorEnhancement
- All Implemented Interfaces:
Cloneable
,Renderable
A color enhancement is an earth data view that creates an image
based on a grid variable, color palette, and enhancement function.
The variable data is mapped to a normalized range of [0..1] using
the enhancement function, then the color palette is applied. For
example, if the data is visible surface albedo in percent, the
palette is a black-to-white grayscale ramp, and the enhancement is
a linear enhancement set to map 0.0 to 0 and 30.0 to 1, then the
color enhancement will produce an image that has close to black
colors for low albedo values and close to white for albedo values
near 30 percent. Values falling below the [0..1] range of the
enhancement function are mapped to the missing color, by default
black. Values falling above the [0..1] range are mapped to the
last palette color.
- Since:
- 3.1.1
- Author:
- Peter Hollemans
-
Field Summary
Fields inherited from class noaa.coastwatch.render.EarthDataView
changed, image, imageDims, overlays, progress, stopRendering, trans, UPDATE_FRACTION, verbose
-
Constructor Summary
ConstructorDescriptionColorEnhancement
(EarthTransform trans, Grid grid, Palette pal, EnhancementFunction func) Constructs a new color enhancement from the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Overrides the parent class to null out the cached legend.Gets the index color model used for images.int
Gets the number of colors in color model.Gets the enhancement function.getGrid()
Gets the data grid variable.Gets a data color scale legend for annotation of this color enhancement.Gets the enhancement color palette.void
normalize
(double units) Normalizes the enhancement function for this view using the visible grid value statistics.protected void
Prepares this view for rendering using the specified graphics object.void
restoreSettings
(ColorEnhancementSettings settings) Restores the previously saved settings.Saves and returns the current settings.void
setAdjustingFunction
(EnhancementFunction adjFunc) Sets an adjusting function.void
setColors
(int colors) Sets the number of colors in the color model.void
Sets the enhancement function.void
Sets the data grid variable.void
setMissingColor
(Color missingColor) Sets the missing value color.void
setPalette
(Palette pal) Sets the enhancement color palette.void
setVarName
(String varName) Sets the variable name to display in the legend for this view.Methods inherited from class noaa.coastwatch.render.EarthDataView
addOverlay, addOverlays, computeCaches, containsOverlay, getArea, getBounds, getCenter, getCorners, getImageAffine, getOrientationAffine, getOverlays, getProgress, getResolution, getScale, getSize, getSubregion, getTransform, getUpsideDown, hasCompatibleCaches, hasCoordinateCaches, invalidate, isChanged, isPrepared, isRendering, magnify, magnify, magnify, main, removeOverlay, render, reset, resize, resize, resizeHeight, resizeMaxAspect, resizeWidth, setCenter, setCenterAndScale, setChanged, setImageAffine, setProgress, setProperties, setSize, setVerbose, showSubregion, stopRendering, transform, transform
-
Constructor Details
-
ColorEnhancement
public ColorEnhancement(EarthTransform trans, Grid grid, Palette pal, EnhancementFunction func) throws NoninvertibleTransformException Constructs a new color enhancement from the specified parameters.- Parameters:
trans
- the view earth transform.grid
- the grid variable to use for this enhancement.pal
- the indexed color palette for color enhancement.func
- the enhancement function.- Throws:
NoninvertibleTransformException
- if the resulting image transform is not invertible.
-
-
Method Details
-
setVarName
Sets the variable name to display in the legend for this view.- Parameters:
varName
- the variable name or null to use the grid variable name.
-
getColors
public int getColors()Gets the number of colors in color model.- See Also:
-
setColors
public void setColors(int colors) Sets the number of colors in the color model.- Parameters:
colors
- the number of colors in the model, up to 256 which is the default. The actual number of colors for data will be one less than the number of colors in the model, and the last color will be used for missing data.
-
getColorModel
Gets the index color model used for images. -
getGrid
Gets the data grid variable. -
getPalette
Gets the enhancement color palette. -
getFunction
Gets the enhancement function. -
setGrid
Sets the data grid variable. -
setPalette
Sets the enhancement color palette. -
setMissingColor
Sets the missing value color. -
setAdjustingFunction
Sets an adjusting function. This may be used when the function is being adjusted interactively, and the view should reflect the new function as well as possible. The view image data is not recomputed, rather the color index model is adjusted to approximate what the view would look like with the new function. The next call tosetFunction(noaa.coastwatch.render.EnhancementFunction)
will set the view back to normal.- Parameters:
adjFunc
- the adjusting function.
-
setFunction
Sets the enhancement function. -
prepare
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 classEarthDataView
-
getLegend
Gets a data color scale legend for annotation of this color enhancement.- Overrides:
getLegend
in classEarthDataView
- Returns:
- the data color scale legend. The legend is constructed with the default font and colors.
- See Also:
-
normalize
public void normalize(double units) Normalizes the enhancement function for this view using the visible grid value statistics.- Parameters:
units
- the number of standard deviation units above and below the mean for the data range.
-
saveSettings
Saves and returns the current settings. -
restoreSettings
Restores the previously saved settings.- Parameters:
settings
- the settings to restore. Only the palette and function are used -- the variable name is igored.
-
clone
Overrides the parent class to null out the cached legend.- Overrides:
clone
in classEarthDataView
-