public class Band extends AbstractBand
ProductData
. The band class is just a
container for attached metadata of the band, currently: FlagCoding
The several getPixel
and readPixel
methods of this class do not necessarily return the
values contained in the data buffer of type ProductData
. If the scalingFactor
,
scalingOffset
or log10Scaled
are set a conversion of the form scalingFactor *
rawSample + scalingOffset
is applied to the raw samples before the getPixel
and @
readPixel
methods return the actual pixel values. If the log10Scaled
property is true then
the conversion is pow(10, scalingFactor * rawSample + scalingOffset)
. The several setPixel
and writePixel
perform the inverse operations in this case.
ProductData
RasterDataNode.RasterDataProcessor
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_NAME_SAMPLE_CODING |
static String |
PROPERTY_NAME_SOLAR_FLUX |
static String |
PROPERTY_NAME_SPECTRAL_BAND_INDEX |
static String |
PROPERTY_NAME_SPECTRAL_BANDWIDTH |
static String |
PROPERTY_NAME_SPECTRAL_WAVELENGTH |
INVALID_POS_TEXT, IO_ERROR_TEXT, NO_DATA_TEXT, PROPERTY_NAME_ANCILLARY_RELATIONS, PROPERTY_NAME_ANCILLARY_VARIABLES, PROPERTY_NAME_GEO_CODING, PROPERTY_NAME_IMAGE_INFO, PROPERTY_NAME_IMAGE_TO_MODEL_TRANSFORM, PROPERTY_NAME_LOG_10_SCALED, PROPERTY_NAME_NO_DATA_VALUE, PROPERTY_NAME_NO_DATA_VALUE_USED, PROPERTY_NAME_SCALING_FACTOR, PROPERTY_NAME_SCALING_OFFSET, PROPERTY_NAME_STX, PROPERTY_NAME_TIME_CODING, PROPERTY_NAME_VALID_PIXEL_EXPRESSION
PROPERTY_NAME_DATA, PROPERTY_NAME_READ_ONLY, PROPERTY_NAME_SYNTHETIC, PROPERTY_NAME_UNIT
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
Constructor and Description |
---|
Band(String name,
int dataType,
int width,
int height)
Constructs a new
Band . |
Modifier and Type | Method and Description |
---|---|
void |
acceptVisitor(ProductVisitor visitor)
Accepts the given visitor.
|
protected Stx |
computeStxImpl(int level,
ProgressMonitor pm)
Computes the statistics.
|
ImageInfo |
createDefaultImageInfo(double[] histoSkipAreas,
ProgressMonitor pm)
Creates a default image information instance.
|
protected RenderedImage |
createSourceImage()
Creates the source image associated with this
RasterDataNode . |
void |
dispose()
Releases all of the resources used by this object instance and all of its owned children.
|
FlagCoding |
getFlagCoding()
Gets the flag coding for this band.
|
IndexCoding |
getIndexCoding()
Gets the index coding for this band.
|
long |
getRawStorageSize(ProductSubsetDef subsetDef)
Gets an estimated raw storage size in bytes of this product node.
|
SampleCoding |
getSampleCoding()
Gets the sample coding.
|
float |
getSolarFlux()
Gets the solar flux in
mW/(m^2 nm) (milli-watts per square metre per nanometer)
units for the wavelength of this band. |
int |
getSpectralBandIndex()
Gets the (zero-based) spectral band index.
|
float |
getSpectralBandwidth()
Gets the spectral bandwidth in
nm (nanomater) units. |
float |
getSpectralWavelength()
Gets the spectral wavelength in
nm (nanometer) units. |
boolean |
isFlagBand()
Tests whether or not this band is a flag band (
getFlagCoding() ! |
boolean |
isIndexBand()
Tests whether or not this band is an index band (
getIndexCoding() ! |
void |
readRasterData(int offsetX,
int offsetY,
int width,
int height,
ProductData rasterData,
ProgressMonitor pm)
Reads raster data from its associated data source into the given data buffer.
|
void |
readRasterDataFully(ProgressMonitor pm)
Reads the complete underlying raster data.
|
void |
removeFromFile(ProductWriter productWriter)
Physically remove this node from the file associated with the given product writer.
|
void |
setSampleCoding(SampleCoding sampleCoding)
Sets the sample coding for this band.
|
void |
setSolarFlux(float solarFlux)
Sets the solar flux in
mW/(m^2 nm) (milli-watts per square metre per nanometer)
units for the wavelength of this band. |
void |
setSpectralBandIndex(int spectralBandIndex)
Sets the (zero-based) spectral band index.
|
void |
setSpectralBandwidth(float spectralBandwidth)
Sets the spectral bandwidth in
nm (nanomater) units. |
void |
setSpectralWavelength(float spectralWavelength)
Sets the spectral wavelength in
nm (nanomater) units. |
String |
toString()
Creates a string defining this band object.
|
void |
writeRasterData(int offsetX,
int offsetY,
int width,
int height,
ProductData rasterData,
ProgressMonitor pm)
Writes data from this product raster into the specified region of the user-supplied raster.
|
void |
writeRasterDataFully(ProgressMonitor pm)
Writes the complete underlying raster data.
|
ensureMinLengthArray, ensureMinLengthArray, ensureMinLengthArray, ensureRasterData, getPixelDouble, getPixelFloat, getPixelInt, getPixels, getPixels, getPixels, getRasterHeight, getRasterWidth, loadRasterData, readPixels, readPixels, readPixels, setPixelDouble, setPixelFloat, setPixelInt, setPixels, setPixels, setPixels, unloadRasterData, writePixels, writePixels, writePixels
addAncillaryVariable, canBeOrthorectified, checkCompatibleRasterData, clearNoDataValue, createColorIndexedImage, createCompatibleRasterData, createCompatibleRasterData, createCompatibleSceneRasterData, createDefaultImageInfo, createMultiLevelModel, createPointing, createRgbImage, createTransectProfileData, fireImageInfoChanged, getAncillaryRelations, getAncillaryVariable, getAncillaryVariables, getGeoCoding, getGeophysicalDataType, getGeophysicalImage, getGeophysicalNoDataValue, getImageInfo, getImageInfo, getImageInfo, getImageToModelTransform, getMultiLevelModel, getNoDataValue, getOverlayMaskGroup, getPixels, getPixels, getPixels, getPixelString, getPointing, getRasterData, getRasterSize, getSampleFloat, getSampleInt, getScalingFactor, getScalingOffset, getSceneRasterTransform, getSourceImage, getStx, getStx, getTimeCoding, getValidMaskExpression, getValidMaskImage, getValidPixelExpression, getValidShape, hasIntPixels, hasRasterData, isCompatibleRasterData, isFloatingPointType, isGeophysicalImageSet, isLog10Scaled, isNoDataValueSet, isNoDataValueUsed, isPixelValid, isPixelValid, isPixelValid, isScalingApplied, isSourceImageSet, isStxSet, isValidMaskImageSet, isValidMaskProperty, isValidMaskUsed, loadRasterData, processRasterData, quantizeRasterData, quantizeRasterData, readPixels, readPixels, readPixels, readRasterData, readRasterDataFully, readValidMask, removeAncillaryVariable, resetValidMask, scale, scaleInverse, setAncillaryRelations, setGeoCoding, setGeophysicalNoDataValue, setImageInfo, setImageInfo, setImageToModelTransform, setLog10Scaled, setModified, setNoDataValue, setNoDataValueUsed, setRasterData, setScalingFactor, setScalingOffset, setSceneRasterTransform, setSourceImage, setSourceImage, setStx, setTimeCoding, setValidPixelExpression, updateExpression, writePixels, writePixels, writePixels, writeRasterData, writeRasterDataFully
checkDataCompatibility, createCompatibleProductData, fireProductNodeDataChanged, getData, getDataElems, getDataElemSize, getDataType, getNumDataElems, getUnit, isReadOnly, isSynthetic, setData, setDataElems, setReadOnly, setSynthetic, setUnit
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, setDescription, setName, setOwner
getExtension
public static final String PROPERTY_NAME_SAMPLE_CODING
public static final String PROPERTY_NAME_SOLAR_FLUX
public static final String PROPERTY_NAME_SPECTRAL_BAND_INDEX
public static final String PROPERTY_NAME_SPECTRAL_BANDWIDTH
public static final String PROPERTY_NAME_SPECTRAL_WAVELENGTH
public Band(String name, int dataType, int width, int height)
Band
.name
- the name of the new objectdataType
- the raster data type, must be one of the multiple ProductData.TYPE_X
constants, with the exception of ProductData.TYPE_UINT32
width
- the width of the raster in pixelsheight
- the height of the raster in pixelspublic FlagCoding getFlagCoding()
null
otherwisepublic boolean isFlagBand()
getFlagCoding() != null
).true
if sopublic IndexCoding getIndexCoding()
null
otherwisepublic boolean isIndexBand()
getIndexCoding() != null
).true
if sopublic SampleCoding getSampleCoding()
null
if not set.public void setSampleCoding(SampleCoding sampleCoding)
sampleCoding
- the sample codingIllegalArgumentException
- if this band does not contain integer pixelspublic int getSpectralBandIndex()
-1
if it is unknownpublic void setSpectralBandIndex(int spectralBandIndex)
spectralBandIndex
- the (zero-based) spectral band index or -1
if it is unknownpublic float getSpectralWavelength()
nm
(nanometer) units.public void setSpectralWavelength(float spectralWavelength)
nm
(nanomater) units.spectralWavelength
- the wavelength in nanometers of this band, or zero if this is not a spectral band or
the wavelength is not known.public float getSpectralBandwidth()
nm
(nanomater) units.public void setSpectralBandwidth(float spectralBandwidth)
nm
(nanomater) units.spectralBandwidth
- the spectral bandwidth in nanometers of this band, or zero if this is not a spectral band
or the spectral bandwidth is not known.public float getSolarFlux()
mW/(m^2 nm)
(milli-watts per square metre per nanometer)
units for the wavelength of this band.public void setSolarFlux(float solarFlux)
mW/(m^2 nm)
(milli-watts per square metre per nanometer)
units for the wavelength of this band.solarFlux
- the solar flux for the wavelength of this band, or zero if this is not a spectral band or the
solar flux is not known.protected RenderedImage createSourceImage()
RasterDataNode
RasterDataNode
.
This shall preferably be a MultiLevelImage
instance which recognises this raster data node's
imageToModelTransform
property, if set.createSourceImage
in class RasterDataNode
public void readRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData, ProgressMonitor pm) throws IOException
readRasterData
in class RasterDataNode
offsetX
- the X-offset in the band's pixel co-ordinates where reading startsoffsetY
- the Y-offset in the band's pixel co-ordinates where reading startswidth
- the width of the raster data bufferheight
- the height of the raster data bufferrasterData
- a raster data buffer receiving the pixels to be readpm
- a monitor to inform the user about progressIOException
- if an I/O error occursIllegalArgumentException
- if the raster is nullIllegalStateException
- if this product raster was not added to a product so far, or if the product to which
this product raster belongs to, has no associated product readerProductReader.readBandRasterData(Band, int, int, int, int, ProductData, com.bc.ceres.core.ProgressMonitor)
public void readRasterDataFully(ProgressMonitor pm) throws IOException
After this method has been called successfully, hasRasterData()
should always return
true
and getRasterData()
should always return a valid ProductData
instance
with at least getRasterWidth()*getRasterHeight()
elements (samples).
In opposite to the loadRasterData
method, the readRasterDataFully
method always
reloads the data of this product raster, independently of whether its has already been loaded or not.
readRasterDataFully
in class RasterDataNode
pm
- a monitor to inform the user about progressIOException
- if an I/O error occursRasterDataNode.loadRasterData()
,
RasterDataNode.readRasterData(int, int, int, int, ProductData, com.bc.ceres.core.ProgressMonitor)
public void writeRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData, ProgressMonitor pm) throws IOException
It is important to know that this method does not change this product raster's internal state nor does it write into this product raster's internal raster.
writeRasterData
in class RasterDataNode
offsetX
- the X-offset in raster co-ordinates where reading startsoffsetY
- the Y-offset in raster co-ordinates where reading startswidth
- the width of the raster data bufferheight
- the height of the raster data bufferrasterData
- a raster data buffer receiving the pixels to be readpm
- a monitor to inform the user about progressIOException
- if an I/O error occursProductReader.readBandRasterData(Band, int, int, int, int, ProductData, com.bc.ceres.core.ProgressMonitor)
public void writeRasterDataFully(ProgressMonitor pm) throws IOException
writeRasterDataFully
in class RasterDataNode
pm
- a monitor to inform the user about progressIOException
- if an I/O error occurspublic long getRawStorageSize(ProductSubsetDef subsetDef)
getRawStorageSize
in class AbstractBand
subsetDef
- if not null
the subset may limit the size returnedpublic void acceptVisitor(ProductVisitor visitor)
The method simply calls visitor.visit(this)
.
acceptVisitor
in class RasterDataNode
visitor
- the visitor, must not be null
public String toString()
toString
in class ProductNode
public void removeFromFile(ProductWriter productWriter)
ProductNode
removeFromFile
in class ProductNode
productWriter
- the product writer to be used to remove this node from the underlying file.public ImageInfo createDefaultImageInfo(double[] histoSkipAreas, ProgressMonitor pm)
RasterDataNode
An IllegalStateException
is thrown in the case that this raster data node has no raster data.
createDefaultImageInfo
in class RasterDataNode
histoSkipAreas
- the left (at index 0) and right (at index 1) normalized areas of the raster data
histogram to be excluded when determining the value range for a linear constrast
stretching. Can be null
, in this case {0.01, 0.04}
resp. 5% of
the entire area is skipped.pm
- a monitor to inform the user about progressnull
.protected Stx computeStxImpl(int level, ProgressMonitor pm)
RasterDataNode
computeStxImpl
in class RasterDataNode
level
- The resolution level.pm
- A progress monitor.public void dispose()
This method should be called only if it is for sure that this object instance will never be used again. The
results of referencing an instance of this class after a call to dispose()
are undefined.
Overrides of this method should always call super.dispose();
after disposing this instance.
dispose
in class RasterDataNode
Copyright © 2014–2015 European Space Agency (ESA). All rights reserved.