Package noaa.coastwatch.render
Class ColorComposite
java.lang.Object
noaa.coastwatch.render.EarthDataView
noaa.coastwatch.render.ColorComposite
- All Implemented Interfaces:
Cloneable
,Renderable
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 Summary
Modifier and TypeFieldDescriptionstatic final int
The blue component.static final int
The green component.static final int
The red component.Fields inherited from class noaa.coastwatch.render.EarthDataView
changed, image, imageDims, overlays, progress, stopRendering, trans, UPDATE_FRACTION, verbose
-
Constructor Summary
ConstructorDescriptionColorComposite
(EarthTransform trans, Grid[] grids, EnhancementFunction[] funcs) Constructs a new color composite from the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionGets the enhancement functions.Grid[]
getGrids()
Gets the data grid variables.void
normalize
(int component, 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
setFunctions
(EnhancementFunction[] funcs) Sets the enhancement functions.void
Sets the data grid variables.void
setRange
(int component, Function<Statistics, double[]> statsFunction) Set the enhancement function range for this view using the visible grid value statistics.Methods inherited from class noaa.coastwatch.render.EarthDataView
addOverlay, addOverlays, clone, computeCaches, containsOverlay, getArea, getBounds, getCenter, getCorners, getImageAffine, getLegend, 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
-
Field Details
-
RED
public static final int REDThe red component.- See Also:
-
GREEN
public static final int GREENThe green component.- See Also:
-
BLUE
public static final int BLUEThe blue component.- See Also:
-
-
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
Gets the data grid variables. -
getFunctions
Gets the enhancement functions. -
setGrids
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
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
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
-
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, eitherRED
,GREEN
, orBLUE
.units
- the number of standard deviation units above and below the mean for the data range.
-
setRange
Set the enhancement function range for this view using the visible grid value statistics. This is a generalized version ofnormalize(int, double)
in which the range is computed with a user-supplied function.- Parameters:
component
- the component to set, eitherRED
,GREEN
, orBLUE
.statsFunction
- the statistics function to use for setting the range.- Since:
- 3.6.1
-