org.deegree.style.utils
Class RasterDataUtility

java.lang.Object
  extended by org.deegree.style.utils.RasterDataUtility

public class RasterDataUtility
extends Object

Utility class to interpret raster data in a consistent way. It should be used in raster lookup operations (for example in Categorize or Interpolate). This class can read 1, 2, 3 and 4-band rasters, and combines band values into a single pixel value. RGB bands are combined and their average value is returned (yielding the overall gray-pixel intensity of a pixel), and alpha bands are ignored. This class can perform contrast enhancement on-the-fly. If channel mappings are provided, this class can process rasters with any number of bands.

Version:
$Revision: 24704 $, $Date: 2010-06-07 10:08:59 +0200 (Mon, 07 Jun 2010) $
Author:
Andrei Aiordachioaie, last edited by: $Author: aschmitz $

Constructor Summary
RasterDataUtility(AbstractRaster raster)
           
RasterDataUtility(AbstractRaster raster, RasterChannelSelection style)
          Create a RasterDataUtility object, where channels are mapped according to the RasterStyle options
RasterDataUtility(RasterData d)
           
 
Method Summary
 float get(int col, int row)
           
 float get(int col, int row, int band)
           
 float getEnhanced(int col, int row, int band)
          Return a pixel value in a particular band, after performing contrastEnhancements.
 void precomputeContrastEnhancements(int index, RasterStyling.ContrastEnhancement enhancement)
          Precomputes weight factors for applying contrast enhancements to the current raster.
 void setContrastEnhancement(RasterStyling.ContrastEnhancement ce)
          Update the contrast enhancement.
 void setGamma(double g)
          Update the gamma value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RasterDataUtility

public RasterDataUtility(AbstractRaster raster)
Parameters:
raster - abstract raster data source

RasterDataUtility

public RasterDataUtility(AbstractRaster raster,
                         RasterChannelSelection style)
Create a RasterDataUtility object, where channels are mapped according to the RasterStyle options

Parameters:
raster -
style -

RasterDataUtility

public RasterDataUtility(RasterData d)
Parameters:
d - raster data
Method Detail

setContrastEnhancement

public void setContrastEnhancement(RasterStyling.ContrastEnhancement ce)
Update the contrast enhancement. Method getEnhanced(row, col, band) will apply this contrast enhancement before returning values.

Parameters:
ce -

get

public float get(int col,
                 int row)
Parameters:
col - column index
row - row index
Returns:
the appropriate value, as a float value

get

public float get(int col,
                 int row,
                 int band)
Parameters:
col - column index
row - row index
band - band index
Returns:
the appropriate value, as a float value

getEnhanced

public float getEnhanced(int col,
                         int row,
                         int band)
Return a pixel value in a particular band, after performing contrastEnhancements. NOTE: The user is responsible for calling setGamma(double) or setContrastEnhancements(...) before calling this function.

Parameters:
col - column index
row - row index
band - band index
Returns:
the appropriate value, as a float value, after gamma correction

setGamma

public void setGamma(double g)
Update the gamma value

Parameters:
g - new gamma value

precomputeContrastEnhancements

public void precomputeContrastEnhancements(int index,
                                           RasterStyling.ContrastEnhancement enhancement)
Precomputes weight factors for applying contrast enhancements to the current raster. Can apply enhancements to all channels (if index is less than 0) or to a particular channel (if index is non-negative). This function is relevant for normalize or histogram enhancements, where the operation is dependent on the input raster data. All subsequent calls to getEnhanced(col,row) will use this contrast enhancement. NOTE: This function overrides the effects of setGamma().

Parameters:
index - target channel number.
enhancement - desired contrast enhancement


Copyright © 2011. All Rights Reserved.