|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RasterData
Interface for a 2 dimensional raster.
A raster is a rectangular grid of pixels with coordinates from the uppler left corner (0, 0) to the lower right
corner (width-1, height-1). A raster can contain multiple bands. A pixel stores one sample for every band. The sample
arrangement is determined by the interleaving type (InterleaveType
). The size of each sample is dertermined
by the data type (DataType
).
Most get-methods accept an array as a parameter for performance reasons. This parameter is used to store the result.
The same array will be returned by the method, filled with requested values. A new array will be created, filled and
returned if this parameter is null
.
TODO: Only defines interface to byte, short and float data at the moment. Copy float methods for other data types.
DataType
,
InterleaveType
Field Summary | |
---|---|
static int |
TYPE_BYTE_RGB
Integer defining the RGB byte bands |
static int |
TYPE_BYTE_RGBA
Integer defining the RGBA byte bands with. |
Method Summary | |
---|---|
RasterData |
asReadOnly()
Return a read-only version of this RasterData. |
RasterData |
createCompatibleRasterData()
Returns a new RasterData with the same size, bands, DataType and InterleaveType |
RasterData |
createCompatibleRasterData(BandType[] bands)
Returns a new RasterData with the same size, DataType and InterleaveType |
RasterData |
createCompatibleRasterData(int width,
int height)
Returns a new RasterData with the same DataType and InterleaveType and all bands |
ByteBufferRasterData |
createCompatibleRasterData(RasterRect sampleDomain)
Returns a view as a new RasterData with the same DataType and InterleaveType but valid only for the given rect. |
RasterData |
createCompatibleRasterData(RasterRect sampleDomain,
BandType[] bands)
Returns a new RasterData with the same DataType and InterleaveType |
RasterData |
createCompatibleWritableRasterData(RasterRect sampleDomain,
BandType[] bands)
Create a writable compatible raster with the height and width of the given sample domain. |
void |
dispose()
Try to dispose all allocated memory of this data object. |
int |
getBands()
Returns the number of bands of the raster |
byte[] |
getBytePixel(int x,
int y,
byte[] result)
Returns a byte array with all sample values from coordinate x/y. |
byte[] |
getBytes(int x,
int y,
int width,
int height,
int band,
byte[] result)
Gets values from the specified rectangle and band. |
byte |
getByteSample(int x,
int y,
int band)
Returns a byte sample from coordinate x/y and selected band. |
int |
getColumns()
Returns the width of the raster |
RasterDataInfo |
getDataInfo()
Returns an encapsulation of all available information of this raster data. |
DataType |
getDataType()
Returns the data type of the raster. |
double[] |
getDoublePixel(int x,
int y,
double[] result)
Returns a double array with all sample values from coordinate x/y. |
double[] |
getDoubles(int x,
int y,
int width,
int height,
int band,
double[] result)
Gets values from the specified rectangle and band. |
double |
getDoubleSample(int x,
int y,
int band)
Returns a double sample from coordinate x/y and selected band. |
float[] |
getFloatPixel(int x,
int y,
float[] result)
Returns a float array with all sample values from coordinate x/y. |
float[] |
getFloats(int x,
int y,
int width,
int height,
int band,
float[] result)
Gets values from the specified rectangle and band. |
float |
getFloatSample(int x,
int y,
int band)
Returns a float sample from coordinate x/y and selected band. |
int[] |
getIntPixel(int x,
int y,
int[] result)
Returns an integer array with all sample values from coordinate x/y. |
int[] |
getInts(int x,
int y,
int width,
int height,
int band,
int[] result)
Gets values from the specified rectangle and band. |
int |
getIntSample(int x,
int y,
int band)
Returns an integer sample from coordinate x/y and selected band. |
byte[] |
getNullPixel(byte[] result)
Returns the no data values for this raster, or the view of this rasters bands. |
byte[] |
getPixel(int x,
int y,
byte[] result)
Returns a pixel as byte array, regardless of the DataType. i.e. a FLOAT DataType results in a four byte array. |
int |
getRows()
Returns the height of the raster |
byte[] |
getSample(int x,
int y,
int band,
byte[] result)
Returns a sample as byte array, regardless of the DataType. i.e. a FLOAT DataType results in a four byte array |
short[] |
getShortPixel(int x,
int y,
short[] result)
Returns a short array with all sample values from coordinate x/y. |
short[] |
getShorts(int x,
int y,
int width,
int height,
int band,
short[] result)
Gets values from the specified rectangle and band. |
short |
getShortSample(int x,
int y,
int band)
Returns a short sample from coordinate x/y and selected band. |
RasterData |
getSubset(RasterRect rasterRect)
Returns new RasterData object for the specified rectangle. |
RasterData |
getSubset(RasterRect rasterRect,
BandType[] bands)
Returns new single-band RasterData object for the specified rectangle. |
void |
setBytePixel(int x,
int y,
byte[] pixel)
Sets a single pixel with byte values for each sample. |
void |
setBytes(int x,
int y,
int width,
int height,
int band,
byte[] values)
Sets values from the array to the specified rectangle and band. |
void |
setByteSample(int x,
int y,
int band,
byte value)
Sets a single byte sample on coordinate x/y and selected band. |
void |
setDoublePixel(int x,
int y,
double[] pixel)
Sets a single pixel with double values for each sample. |
void |
setDoubles(int x,
int y,
int width,
int height,
int band,
double[] values)
Sets values from the array to the specified rectangle and band. |
void |
setDoubleSample(int x,
int y,
int band,
double value)
Sets a single double sample on coordinate x/y and selected band. |
void |
setFloatPixel(int x,
int y,
float[] pixel)
Sets a single pixel with float values for each sample. |
void |
setFloats(int x,
int y,
int width,
int height,
int band,
float[] values)
Sets values from the array to the specified rectangle and band. |
void |
setFloatSample(int x,
int y,
int band,
float value)
Sets a single float sample on coordinate x/y and selected band. |
void |
setIntPixel(int x,
int y,
int[] pixel)
Sets a single pixel with integer values for each sample. |
void |
setInts(int x,
int y,
int width,
int height,
int band,
int[] values)
Sets values from the array to the specified rectangle and band. |
void |
setIntSample(int x,
int y,
int band,
int value)
Sets a single integer sample on coordinate x/y and selected band. |
void |
setNoDataValue(byte[] values)
Sets the no data values for this raster |
void |
setPixel(int x,
int y,
byte[] pixel)
Sets a pixel with data from a byte array, regardless of the DataType. i.e. a float sample must be packed as a four byte array. |
void |
setSample(int x,
int y,
int band,
byte[] values)
Sets a sample with data from a byte array, regardless of the DataType. i.e. a float must be packed as a four byte array |
void |
setShortPixel(int x,
int y,
short[] pixel)
Sets a single pixel with short values for each sample. |
void |
setShorts(int x,
int y,
int width,
int height,
int band,
short[] values)
Sets values from the array to the specified rectangle and band. |
void |
setShortSample(int x,
int y,
int band,
short value)
Sets a single short sample on coordinate x/y and selected band. |
void |
setSubset(int x,
int y,
int width,
int height,
int dstBand,
RasterData sourceRaster,
int srcBand)
Sets a single band of the raster with values from one band of the sourceRaster. |
void |
setSubset(int x,
int y,
int width,
int height,
int dstBand,
RasterData sourceRaster,
int srcBand,
int xOffset,
int yOffset)
Sets a single band of the raster with values from one band of the sourceRaster. |
void |
setSubset(int x,
int y,
int width,
int height,
RasterData sourceRaster)
Sets the raster with values from sourceRaster. |
void |
setSubset(int x,
int y,
int width,
int height,
RasterData sourceRaster,
int xOffset,
int yOffset)
Sets the raster with values from sourceRaster. |
Field Detail |
---|
static final int TYPE_BYTE_RGB
static final int TYPE_BYTE_RGBA
Method Detail |
---|
DataType getDataType()
int getBands()
RasterDataInfo getDataInfo()
int getRows()
int getColumns()
byte[] getNullPixel(byte[] result)
result
- an array to put the values into or null
result
array or a new array, if the result
array is null
void setNoDataValue(byte[] values)
values
- an array with the null valuesRasterData createCompatibleRasterData(RasterRect sampleDomain, BandType[] bands)
sampleDomain
- the raster rectangle defining the sample domain of this raster data.bands
- indices to the requested bands
RasterData createCompatibleWritableRasterData(RasterRect sampleDomain, BandType[] bands)
sampleDomain
- the raster rectangle defining the sample domain of this raster data.bands
- indices to the requested bands if null
all bands will be available.
ByteBufferRasterData createCompatibleRasterData(RasterRect sampleDomain)
sampleDomain
- the raster rectangle defining the sample domain of this raster data.
RasterData createCompatibleRasterData(int width, int height)
width
- width of the new rasterheight
- height of the new raster
RasterData createCompatibleRasterData(BandType[] bands)
bands
- definitions of the new rasterdata.
RasterData createCompatibleRasterData()
RasterData asReadOnly()
byte[] getSample(int x, int y, int band, byte[] result)
x
- y
- band
- selected bandresult
- an array to put the values into or null
result
array or a new array, if the result
array is null
void setSample(int x, int y, int band, byte[] values)
x
- y
- band
- selected bandvalues
- array with the sample valuebyte[] getPixel(int x, int y, byte[] result)
x
- y
- result
- a byte array to put the values into or null
result
array or a new array, if the result
array is null
void setPixel(int x, int y, byte[] pixel)
x
- y
- pixel
- byte[] getBytePixel(int x, int y, byte[] result)
x
- y
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
double[] getDoublePixel(int x, int y, double[] result)
x
- y
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
float[] getFloatPixel(int x, int y, float[] result)
x
- y
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
int[] getIntPixel(int x, int y, int[] result)
x
- y
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
short[] getShortPixel(int x, int y, short[] result)
x
- y
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
void setBytePixel(int x, int y, byte[] pixel)
x
- y
- pixel
- array with one sample per bandvoid setDoublePixel(int x, int y, double[] pixel)
x
- y
- pixel
- array with one sample per bandvoid setFloatPixel(int x, int y, float[] pixel)
x
- y
- pixel
- array with one sample per bandvoid setIntPixel(int x, int y, int[] pixel)
x
- y
- pixel
- array with one sample per bandvoid setShortPixel(int x, int y, short[] pixel)
x
- y
- pixel
- array with one sample per bandbyte getByteSample(int x, int y, int band)
x
- y
- band
- band number for sample
double getDoubleSample(int x, int y, int band)
x
- y
- band
- band number for sample
float getFloatSample(int x, int y, int band)
x
- y
- band
- band number for sample
int getIntSample(int x, int y, int band)
x
- y
- band
- band number for sample
short getShortSample(int x, int y, int band)
x
- y
- band
- band number for sample
void setByteSample(int x, int y, int band, byte value)
x
- y
- band
- band number for samplevalue
- new value for samplevoid setDoubleSample(int x, int y, int band, double value)
x
- y
- band
- band number for samplevalue
- new value for samplevoid setFloatSample(int x, int y, int band, float value)
x
- y
- band
- band number for samplevalue
- new value for samplevoid setIntSample(int x, int y, int band, int value)
x
- y
- band
- band number for samplevalue
- new value for samplevoid setShortSample(int x, int y, int band, short value)
x
- y
- band
- band number for samplevalue
- new value for samplebyte[] getBytes(int x, int y, int width, int height, int band, byte[] result)
x
- y
- width
- height
- band
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
double[] getDoubles(int x, int y, int width, int height, int band, double[] result)
x
- y
- width
- height
- band
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
float[] getFloats(int x, int y, int width, int height, int band, float[] result)
x
- y
- width
- height
- band
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
int[] getInts(int x, int y, int width, int height, int band, int[] result)
x
- y
- width
- height
- band
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
short[] getShorts(int x, int y, int width, int height, int band, short[] result)
x
- y
- width
- height
- band
- result
- an array to put the values into or null
result
array or a new array, if the result
array is null
void setBytes(int x, int y, int width, int height, int band, byte[] values)
x
- y
- width
- height
- band
- values
- the samples to put into the rastervoid setDoubles(int x, int y, int width, int height, int band, double[] values)
x
- y
- width
- height
- band
- values
- the samples to put into the rastervoid setFloats(int x, int y, int width, int height, int band, float[] values)
x
- y
- width
- height
- band
- values
- the samples to put into the rastervoid setInts(int x, int y, int width, int height, int band, int[] values)
x
- y
- width
- height
- band
- values
- the samples to put into the rastervoid setShorts(int x, int y, int width, int height, int band, short[] values)
x
- y
- width
- height
- band
- values
- the samples to put into the rasterRasterData getSubset(RasterRect rasterRect)
rasterRect
- rectangle for subset
RasterData getSubset(RasterRect rasterRect, BandType[] bands)
rasterRect
- rectangle for subsetbands
- selected band
void setSubset(int x, int y, int width, int height, RasterData sourceRaster)
x
- insert positiony
- insert positionwidth
- width of the subsetheight
- height of the subsetsourceRaster
- data source to copyvoid setSubset(int x, int y, int width, int height, RasterData sourceRaster, int xOffset, int yOffset)
x
- insert positiony
- insert positionwidth
- width of the subsetheight
- height of the subsetxOffset
- x offset in the source rasteryOffset
- y offset in the source rastersourceRaster
- data source to copyvoid setSubset(int x, int y, int width, int height, int dstBand, RasterData sourceRaster, int srcBand)
x
- insert positiony
- insert positionwidth
- width of the subsetheight
- height of the subsetdstBand
- the index of the destination bandsourceRaster
- data source to copysrcBand
- the index of the source band of sourceRaster
void setSubset(int x, int y, int width, int height, int dstBand, RasterData sourceRaster, int srcBand, int xOffset, int yOffset)
x
- insert positiony
- insert positionwidth
- width of the subsetheight
- height of the subsetdstBand
- the index of the destination bandsourceRaster
- data source to copysrcBand
- the index of the source band of sourceRaster
xOffset
- x offset in the source rasteryOffset
- y offset in the source rastervoid dispose()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |