es.unex.sextante.dataObjects
Interface IRasterLayer

All Superinterfaces:
IDataObject, ILayer
All Known Implementing Classes:
AbstractRasterLayer

public interface IRasterLayer
extends ILayer

This is the base interface that all raster object have to implement to be able to be used by SEXTANTE algorithms. Instead of implementing this class directly, it is recommended to extend AbstractRasterLayer, since it solves some of the most complex methods, such as grid window definition and resampling methods

Author:
Victor Olaya. volaya@unex.es

Field Summary
static int INTERPOLATION_BicubicSpline
           
static int INTERPOLATION_Bilinear
           
static int INTERPOLATION_BSpline
           
static int INTERPOLATION_InverseDistance
           
static int INTERPOLATION_NearestNeighbour
           
static int RASTER_DATA_TYPE_BYTE
           
static int RASTER_DATA_TYPE_DOUBLE
           
static int RASTER_DATA_TYPE_FLOAT
           
static int RASTER_DATA_TYPE_INT
           
static int RASTER_DATA_TYPE_SHORT
           
 
Method Summary
 void add(IRasterLayer layer)
          adds the value of another raster layer to this one.
 void addToCellValue(int x, int y, double dValue)
          Adds a value to the current value of a cell in the first band of the layer in the first band of the layer
 void addToCellValue(int x, int y, int iBand, double dValue)
          Adds a value to the current value of a cell
 void assign(double dValue)
           
 void assign(IRasterLayer layer)
           
 void assignNoData()
           
 void fitToGridExtent(GridExtent gridExtent)
          Resamples the layer so the new full extent is the same as a given gridExtent.
 int[] getAccumulatedHistogram()
           
 double getAspect(int i, int j)
           
 int getBandsCount()
          Returns the number of bands of the layer
 byte getCellValueAsByte(int x, int y)
           
 byte getCellValueAsByte(int x, int y, int iBand)
           
 double getCellValueAsDouble(int x, int y)
           
 double getCellValueAsDouble(int x, int y, int iBand)
           
 float getCellValueAsFloat(int x, int y)
           
 float getCellValueAsFloat(int x, int y, int iBand)
           
 int getCellValueAsInt(int x, int y)
           
 int getCellValueAsInt(int x, int y, int iBand)
           
 short getCellValueAsShort(int x, int y)
           
 short getCellValueAsShort(int x, int y, int iBand)
           
 double getCellValueInLayerCoords(int x, int y, int band)
          Returns the value of a cell in the original image coords, that is, not using the query window
 int getDataType()
          Returns the data type of the layer
 int getDirToNextDownslopeCell(int x, int y)
           
 int getDirToNextDownslopeCell(int x, int y, boolean b)
           
 double getDistToNeighborInDir(int i)
           
 int[] getHistogram()
          Returns the histogram of the first band of this layer
 int[] getHistogram(int iBand)
          Returns a histogram of a given band of this layer
 double getLayerCellSize()
          Return the original cellsize of the layer.
 GridExtent getLayerGridExtent()
          Returns the grid extent of the layer
 double getMaxValue()
          Returns the max value in the first band of the layer
 double getMaxValue(int iBand)
          Returns the max value in the given band of the layer
 double getMeanValue()
          Returns the mean value in the first band of the layer
 double getMeanValue(int iBand)
          Returns the mean value in the given band of the layer
 double getMinValue()
          Returns the min value in the first band of the layer
 double getMinValue(int iBand)
          Returns the min value in the given band of the layer
 double getNoDataValue()
          Gets the no-data value of the layer
 int getNX()
          Returns the number of columns in the query window of this layer
 int getNY()
          Returns the number of rows in the query window of this layer
 double getSlope(int x, int y)
           
 double getValueAt(double x, double y)
          Returns the value of the first band of this layer, at a given world coordinate.
 double getValueAt(double x, double y, int iBand)
          Returns the value at a given world coordinate.
 double getVariance()
          Returns the variance in the first band of the layer
 double getVariance(int iBand)
          Returns the variance in the given band of the layer
 double getWindowCellSize()
          Return the cellsize of the query window.
 GridExtent getWindowGridExtent()
          Returns the grid extent of the query window of this layer.
 boolean isInWindow(int x, int y)
           
 boolean isNoDataValue(double dNoDataValue)
          Checks if the given value equals the no-data value of the layer
 void multiply(double d)
          Multiplies all the values of a layer by a fixed value
 void setCellValue(int x, int y, double dValue)
          Sets the value at a cell, in the first band of the layer
 void setCellValue(int x, int y, int iBand, double dValue)
          Sets the value at a cell
 void setFullExtent()
          Sets the query window extent to the full extent of the layer
 void setInterpolationMethod(int iMethod)
          Sets the interpolation method to use for calculating value in points other than cell centers
 void setNoData(int x, int y)
          Set the value of a cell in the first band of a layer to the no-data value
 void setNoData(int x, int y, int iBand)
          Set the value of a cell to the no-data value
 void setNoDataValue(double dNoDataValue)
          Sets the no-data value of the layer
 void setWindowExtent(GridExtent gridExtent)
          Sets a new query window extent
 void setWindowExtent(IRasterLayer layer)
          Sets the extent of the query window using the full extent of another layer
 
Methods inherited from interface es.unex.sextante.dataObjects.ILayer
getCRS, getFullExtent
 
Methods inherited from interface es.unex.sextante.dataObjects.IDataObject
close, getBaseDataObject, getFilename, getName, open, postProcess, setName
 

Field Detail

RASTER_DATA_TYPE_FLOAT

static final int RASTER_DATA_TYPE_FLOAT
See Also:
Constant Field Values

RASTER_DATA_TYPE_DOUBLE

static final int RASTER_DATA_TYPE_DOUBLE
See Also:
Constant Field Values

RASTER_DATA_TYPE_INT

static final int RASTER_DATA_TYPE_INT
See Also:
Constant Field Values

RASTER_DATA_TYPE_SHORT

static final int RASTER_DATA_TYPE_SHORT
See Also:
Constant Field Values

RASTER_DATA_TYPE_BYTE

static final int RASTER_DATA_TYPE_BYTE
See Also:
Constant Field Values

INTERPOLATION_NearestNeighbour

static final int INTERPOLATION_NearestNeighbour
See Also:
Constant Field Values

INTERPOLATION_Bilinear

static final int INTERPOLATION_Bilinear
See Also:
Constant Field Values

INTERPOLATION_InverseDistance

static final int INTERPOLATION_InverseDistance
See Also:
Constant Field Values

INTERPOLATION_BicubicSpline

static final int INTERPOLATION_BicubicSpline
See Also:
Constant Field Values

INTERPOLATION_BSpline

static final int INTERPOLATION_BSpline
See Also:
Constant Field Values
Method Detail

getDataType

int getDataType()
Returns the data type of the layer

Returns:
the data type of the layer

getWindowGridExtent

GridExtent getWindowGridExtent()
Returns the grid extent of the query window of this layer. Each layer can have a query window, which makes it easier to seamlessly combine several layers.

Returns:
the window grid extent

getLayerGridExtent

GridExtent getLayerGridExtent()
Returns the grid extent of the layer

Returns:
the grid extent of the layer

getWindowCellSize

double getWindowCellSize()
Return the cellsize of the query window. X and Y cellsizes are assumed to be equal

Returns:
the cellsize of the query window

getLayerCellSize

double getLayerCellSize()
Return the original cellsize of the layer. X and Y cellsizes are assumed to be equal

Returns:
the original cellsize of the layer

assign

void assign(double dValue)

assign

void assign(IRasterLayer layer)

assignNoData

void assignNoData()

setCellValue

void setCellValue(int x,
                  int y,
                  double dValue)
Sets the value at a cell, in the first band of the layer

Parameters:
x - the x coordinate (cols)
y - the y coordinate (rows)
dValue - the new value

setCellValue

void setCellValue(int x,
                  int y,
                  int iBand,
                  double dValue)
Sets the value at a cell

Parameters:
x - the x coordinate (cols)
y - the y coordinate (rows)
iBand - the band (zero-based)
dValue - the new value

addToCellValue

void addToCellValue(int x,
                    int y,
                    double dValue)
Adds a value to the current value of a cell in the first band of the layer in the first band of the layer

Parameters:
x - the x coordinate (cols)
y - the y coordinate (rows)
dValue - the value to sum

addToCellValue

void addToCellValue(int x,
                    int y,
                    int iBand,
                    double dValue)
Adds a value to the current value of a cell

Parameters:
x - the x coordinate (cols)
y - the y coordinate (rows)
iBand - the band (zero-based)
dValue - the value to sum

add

void add(IRasterLayer layer)
adds the value of another raster layer to this one. Both layers must have the same window This is supposed to be used with monoband layers, so only the first band of each one is used.


multiply

void multiply(double d)
Multiplies all the values of a layer by a fixed value

Parameters:
d - the value to multiply

getNoDataValue

double getNoDataValue()
Gets the no-data value of the layer

Returns:
the no-data value of the layer

setNoDataValue

void setNoDataValue(double dNoDataValue)
Sets the no-data value of the layer

Parameters:
dNoDataValue - the new no-data value

setNoData

void setNoData(int x,
               int y,
               int iBand)
Set the value of a cell to the no-data value

Parameters:
x - the x coordinate(col) of the cell to set to no-data
y - the y coordinate(row) of the cell to set to no-data
iBand - the band to set to no-data

setNoData

void setNoData(int x,
               int y)
Set the value of a cell in the first band of a layer to the no-data value

Parameters:
x - the x coordinate(col) of the cell to set to no-data
y - the y coordinate(row) of the cell to set to no-data

isNoDataValue

boolean isNoDataValue(double dNoDataValue)
Checks if the given value equals the no-data value of the layer

Parameters:
dNoDataValue - a value to check
Returns:
true if the given value equals the no-data value of the layer

getCellValueAsByte

byte getCellValueAsByte(int x,
                        int y,
                        int iBand)

getCellValueAsByte

byte getCellValueAsByte(int x,
                        int y)

getCellValueAsShort

short getCellValueAsShort(int x,
                          int y,
                          int iBand)

getCellValueAsShort

short getCellValueAsShort(int x,
                          int y)

getCellValueAsInt

int getCellValueAsInt(int x,
                      int y,
                      int iBand)

getCellValueAsInt

int getCellValueAsInt(int x,
                      int y)

getCellValueAsFloat

float getCellValueAsFloat(int x,
                          int y,
                          int iBand)

getCellValueAsFloat

float getCellValueAsFloat(int x,
                          int y)

getCellValueAsDouble

double getCellValueAsDouble(int x,
                            int y,
                            int iBand)

getCellValueAsDouble

double getCellValueAsDouble(int x,
                            int y)

getCellValueInLayerCoords

double getCellValueInLayerCoords(int x,
                                 int y,
                                 int band)
Returns the value of a cell in the original image coords, that is, not using the query window

Parameters:
x - the x coordinate(col) of the cell
y - the y coordinate(row) of the cell
band - the band to be queried
Returns:
the value of a cell in the original image coords.

getValueAt

double getValueAt(double x,
                  double y,
                  int iBand)
Returns the value at a given world coordinate. The current interpolation method is used if the coordinate does not fall on the exact center of a cell.

Parameters:
x - the x coordinate
y - the y coordinate
iBand - the band to query
Returns:
the value at the given world coordinate

getValueAt

double getValueAt(double x,
                  double y)
Returns the value of the first band of this layer, at a given world coordinate. The current interpolation method is used if the coordinate does not fall on the exact center of a cell.

Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the value at the given coordinate. If it falls outside of the layer, the current no-data value of the layer is returned

isInWindow

boolean isInWindow(int x,
                   int y)
Parameters:
x - the x coordinate(col) of the cell
y - the y coordinate(row) of the cell
Returns:
true if the given ccell is within the query window extent

getNX

int getNX()
Returns the number of columns in the query window of this layer

Returns:
the number of columns in the query window

getNY

int getNY()
Returns the number of rows in the query window of this layer

Returns:
the number of rows in the query window

getBandsCount

int getBandsCount()
Returns the number of bands of the layer

Returns:
the number of bands of the layer

setWindowExtent

void setWindowExtent(IRasterLayer layer)
Sets the extent of the query window using the full extent of another layer

Parameters:
layer - the layer from which to take the extent

setWindowExtent

void setWindowExtent(GridExtent gridExtent)
Sets a new query window extent

Parameters:
gridExtent - the new grid extent to set fro this layer

setFullExtent

void setFullExtent()
Sets the query window extent to the full extent of the layer


fitToGridExtent

void fitToGridExtent(GridExtent gridExtent)
Resamples the layer so the new full extent is the same as a given gridExtent. This method is called before calling postProcess, once a GeoAlgorithm is finished

Parameters:
gridExtent - the reference gridExtent

setInterpolationMethod

void setInterpolationMethod(int iMethod)
Sets the interpolation method to use for calculating value in points other than cell centers

Parameters:
iMethod -

getMeanValue

double getMeanValue()
Returns the mean value in the first band of the layer

Returns:
the mean value of the first band of this layer

getMinValue

double getMinValue()
Returns the min value in the first band of the layer

Returns:
the min value of the first band of this layer

getMaxValue

double getMaxValue()
Returns the max value in the first band of the layer

Returns:
the max value of the first band of this layer

getVariance

double getVariance()
Returns the variance in the first band of the layer

Returns:
the variance of the first band of this layer

getMeanValue

double getMeanValue(int iBand)
Returns the mean value in the given band of the layer

Parameters:
iBand - the index of the band (zero-based)
Returns:
the mean value of the given band of this layer

getMinValue

double getMinValue(int iBand)
Returns the min value in the given band of the layer

Parameters:
iBand - the index of the band (zero-based)
Returns:
the min value of the given band of this layer

getMaxValue

double getMaxValue(int iBand)
Returns the max value in the given band of the layer

Parameters:
iBand - the index of the band (zero-based)
Returns:
the max value of the given band of this layer

getVariance

double getVariance(int iBand)
Returns the variance in the given band of the layer

Parameters:
iBand - the index of the band (zero-based)
Returns:
the variance of the given band of this layer

getSlope

double getSlope(int x,
                int y)

getDistToNeighborInDir

double getDistToNeighborInDir(int i)

getAspect

double getAspect(int i,
                 int j)

getDirToNextDownslopeCell

int getDirToNextDownslopeCell(int x,
                              int y)

getDirToNextDownslopeCell

int getDirToNextDownslopeCell(int x,
                              int y,
                              boolean b)

getHistogram

int[] getHistogram()
Returns the histogram of the first band of this layer

Returns:
a histogram of the first band of this layer

getHistogram

int[] getHistogram(int iBand)
Returns a histogram of a given band of this layer

Parameters:
iBand - the index of the band (zero-based)
Returns:
a histogram of the given band of this layer

getAccumulatedHistogram

int[] getAccumulatedHistogram()