Class VirtualBand
- 
- All Implemented Interfaces:
- Extensible,- Scaling,- SceneTransformProvider
 
 public class VirtualBand extends Band A band contains the data for geophysical parameter in remote sensing data products. Bands are two-dimensional images which hold their pixel values (samples) in a buffer of the typeProductData. The band class is just a container for attached metadata of the band, currently:- the flag coding FlagCoding
- the band index at which position the band is stored in the associated product
- the center wavelength of the band
- the bandwidth of the band
- the solar spectral flux of the band
- the width and height of the band
 The several getPixelandreadPixelmethods of this class do not necessarily return the values contained in the data buffer of typeProductData. If thescalingFactor,scalingOffsetorlog10Scaledare set a conversion of the formscalingFactor * rawSample + scalingOffsetis applied to the raw samples before thegetPixelandreadPixelmethods return the actual pixel values. If thelog10Scaledproperty is true then the conversion ispow(10, scalingFactor * rawSample + scalingOffset). The severalsetPixelandwritePixelperform the inverse operations in this case.- Version:
- $Revision$ $Date$
- See Also:
- ProductData
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.esa.snap.core.datamodel.RasterDataNodeRasterDataNode.RasterDataProcessor
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static StringPROPERTY_NAME_EXPRESSION- 
Fields inherited from class org.esa.snap.core.datamodel.BandANGULAR_VIEW_NULL_VALUE, PROPERTY_NAME_ANGULAR_BAND_INDEX, PROPERTY_NAME_ANGULAR_VALUE, PROPERTY_NAME_DATE, PROPERTY_NAME_DATE_BAND_INDEX, PROPERTY_NAME_SAMPLE_CODING, PROPERTY_NAME_SOLAR_FLUX, PROPERTY_NAME_SPECTRAL_BAND_INDEX, PROPERTY_NAME_SPECTRAL_BANDWIDTH, PROPERTY_NAME_SPECTRAL_WAVELENGTH
 - 
Fields inherited from class org.esa.snap.core.datamodel.RasterDataNodeINVALID_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_MODEL_TO_SCENE_TRANSFORM, PROPERTY_NAME_NO_DATA_VALUE, PROPERTY_NAME_NO_DATA_VALUE_USED, PROPERTY_NAME_SCALING_FACTOR, PROPERTY_NAME_SCALING_OFFSET, PROPERTY_NAME_SCENE_TO_MODEL_TRANSFORM, PROPERTY_NAME_STX, PROPERTY_NAME_TIME_CODING, PROPERTY_NAME_VALID_PIXEL_EXPRESSION
 - 
Fields inherited from class org.esa.snap.core.datamodel.DataNodePROPERTY_NAME_DATA, PROPERTY_NAME_READ_ONLY, PROPERTY_NAME_SYNTHETIC, PROPERTY_NAME_UNIT
 - 
Fields inherited from class org.esa.snap.core.datamodel.ProductNodePROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
 
- 
 - 
Constructor SummaryConstructors Constructor Description VirtualBand(String name, int dataType, int width, int height, String expression)Constructs a newBand.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisitor(ProductVisitor visitor)Accepts the given visitor.protected RenderedImagecreateSourceImage()Creates the source image associated with thisRasterDataNode.static MultiLevelImagecreateSourceImage(RasterDataNode raster, String expression)Create aMultiLevelImagethat computes its pixel values from the given band math expression.voiddispose()Releases all of the resources used by this object instance and all of its owned children.StringgetExpression()longgetRawStorageSize(ProductSubsetDef subsetDef)Gets an estimated raw storage size in bytes of this product node.voidsetExpression(String expression)voidsetPixelDouble(int x, int y, double pixelValue)Sets the pixel value at the given pixel coordinate to the given pixel value.voidsetPixelFloat(int x, int y, float pixelValue)Sets the pixel at the given pixel coordinate to the given pixel value.voidsetPixelInt(int x, int y, int pixelValue)Sets the pixel at the given pixel co-ordinate to the given pixel value.StringtoString()Creates a string defining this band object.voidupdateExpression(String oldExternalName, String newExternalName)Asks a product node to replace all occurences of and references to the node name given byoldExternalNamewitholdExternalName.voidwritePixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as double array.voidwritePixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as float array.voidwritePixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as integer array.- 
Methods inherited from class org.esa.snap.core.datamodel.BandcomputeStxImpl, createDefaultImageInfo, getAngularBandIndex, getAngularValue, getDate, getDateBandIndex, getFlagCoding, getIndexCoding, getSampleCoding, getSolarFlux, getSpectralBandIndex, getSpectralBandwidth, getSpectralWavelength, isFlagBand, isIndexBand, isProductReaderDirectlyUsable, readRasterData, readRasterDataFully, removeFromFile, setAngularBandIndex, setAngularValue, setDate, setDateBandIndex, setSampleCoding, setSolarFlux, setSpectralBandIndex, setSpectralBandwidth, setSpectralWavelength, writeRasterData, writeRasterDataFully
 - 
Methods inherited from class org.esa.snap.core.datamodel.AbstractBandensureMinLengthArray, ensureMinLengthArray, ensureMinLengthArray, ensureRasterData, getPixelDouble, getPixelFloat, getPixelInt, getPixels, getPixels, getPixels, getRasterHeight, getRasterWidth, loadRasterData, readPixels, readPixels, readPixels, setPixels, setPixels, setPixels, unloadRasterData
 - 
Methods inherited from class org.esa.snap.core.datamodel.RasterDataNodeaddAncillaryVariable, canBeOrthorectified, checkCompatibleRasterData, clearNoDataValue, createColorIndexedImage, createCompatibleRasterData, createCompatibleRasterData, createCompatibleSceneRasterData, createDefaultImageInfo, createMultiLevelModel, createPointing, createRgbImage, createTransectProfileData, fireImageInfoChanged, getAncillaryRelations, getAncillaryVariable, getAncillaryVariables, getGeoCoding, getGeophysicalDataType, getGeophysicalImage, getGeophysicalNoDataValue, getImageInfo, getImageInfo, getImageInfo, getImageToModelTransform, getModelToSceneTransform, getMultiLevelModel, getNoDataValue, getOverlayMaskGroup, getPixels, getPixels, getPixelString, getPointing, getRasterData, getRasterSize, getSampleFloat, getSampleInt, getScalingFactor, getScalingOffset, getSceneToModelTransform, getSourceImage, getStx, getStx, getTimeCoding, getValidMaskExpression, getValidMaskImage, getValidPixelExpression, getValidShape, hasIntPixels, hasRasterData, isCompatibleRasterData, isFloatingPointType, isGeophysicalImageSet, isLog10Scaled, isNoDataValueSet, isNoDataValueUsed, isPixelValid, isPixelValid, isPixelValid, isPixelWithinImageBounds, isScalingApplied, isSourceImageSet, isStxSet, isValidMaskImageSet, isValidMaskProperty, isValidMaskUsed, loadRasterData, processRasterData, quantizeRasterData, quantizeRasterData, readPixels, readPixels, readPixels, readRasterData, readRasterDataFully, readValidMask, removeAncillaryVariable, removeCachedImageData, resetValidMask, scale, scaleInverse, setAncillaryRelations, setGeoCoding, setGeophysicalNoDataValue, setImageInfo, setImageInfo, setImageToModelTransform, setLog10Scaled, setModelToSceneTransform, setModified, setNoDataValue, setNoDataValueUsed, setRasterData, setScalingFactor, setScalingOffset, setSceneToModelTransform, setSourceImage, setSourceImage, setStx, setTimeCoding, setValidPixelExpression, writePixels, writePixels, writePixels, writeRasterData, writeRasterDataFully
 - 
Methods inherited from class org.esa.snap.core.datamodel.DataNodecheckDataCompatibility, createCompatibleProductData, fireProductNodeDataChanged, getData, getDataElems, getDataElemSize, getDataType, getNumDataElems, getUnit, isReadOnly, isSynthetic, setData, setDataElems, setReadOnly, setSynthetic, setUnit
 - 
Methods inherited from class org.esa.snap.core.datamodel.ProductNodefireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, setDescription, setName, setNodeName, setOwner
 - 
Methods inherited from class com.bc.ceres.core.ExtensibleObjectgetExtension
 
- 
 
- 
- 
- 
Field Detail- 
PROPERTY_NAME_EXPRESSIONpublic static final String PROPERTY_NAME_EXPRESSION - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
VirtualBandpublic VirtualBand(String name, int dataType, int width, int height, String expression) Constructs a newBand.- Parameters:
- name- the name of the new object
- dataType- the raster data type, must be one of the multiple- ProductData.TYPE_Xconstants, with the exception of- ProductData.TYPE_UINT32
- width- the width of the raster in pixels
- height- the height of the raster in pixels
- expression- the expression code
 
 
- 
 - 
Method Detail- 
getExpressionpublic String getExpression() 
 - 
setExpressionpublic void setExpression(String expression) 
 - 
updateExpressionpublic void updateExpression(String oldExternalName, String newExternalName) Asks a product node to replace all occurences of and references to the node name given byoldExternalNamewitholdExternalName. Such references most often occur in band arithmetic expressions.- Overrides:
- updateExpressionin class- RasterDataNode
- Parameters:
- oldExternalName- The old node name.
- newExternalName- The new node name.
 
 - 
setPixelIntpublic void setPixelInt(int x, int y, int pixelValue)Description copied from class:AbstractBandSets the pixel at the given pixel co-ordinate to the given pixel value.- Overrides:
- setPixelIntin class- AbstractBand
- Parameters:
- x- The X co-ordinate of the pixel location
- y- The Y co-ordinate of the pixel location
- pixelValue- the new pixel value
 
 - 
setPixelFloatpublic void setPixelFloat(int x, int y, float pixelValue)Description copied from class:AbstractBandSets the pixel at the given pixel coordinate to the given pixel value.- Overrides:
- setPixelFloatin class- AbstractBand
- Parameters:
- x- The X co-ordinate of the pixel location
- y- The Y co-ordinate of the pixel location
- pixelValue- the new pixel value
 
 - 
setPixelDoublepublic void setPixelDouble(int x, int y, double pixelValue)Description copied from class:AbstractBandSets the pixel value at the given pixel coordinate to the given pixel value.- Overrides:
- setPixelDoublein class- AbstractBand
- Parameters:
- x- The X co-ordinate of the pixel location
- y- The Y co-ordinate of the pixel location
- pixelValue- the new pixel value
 
 - 
writePixelspublic void writePixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm) throws IOExceptionRetrieves the range of pixels specified by the coordinates as integer array. Reads the data from disk if ot is not in memory yet. If the data is loaded, just copies the data..- Overrides:
- writePixelsin class- AbstractBand
- Parameters:
- x- x offset into the band
- y- y offset into the band
- w- width of the pixel array to be read
- h- height of the pixel array to be read.
- pixels- integer array to be filled with data
- pm- a monitor to inform the user about progress
- Throws:
- IOException- if an I/O error occurs
 
 - 
writePixelspublic void writePixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm) throws IOExceptionRetrieves the range of pixels specified by the coordinates as float array. Reads the data from disk if ot is not in memory yet. If the data is loaded, just copies the data..- Overrides:
- writePixelsin class- AbstractBand
- Parameters:
- x- x offset into the band
- y- y offset into the band
- w- width of the pixel array to be read
- h- height of the pixel array to be read.
- pixels- float array to be filled with data
- pm- a monitor to inform the user about progress
- Throws:
- IOException- if an I/O error occurs
 
 - 
writePixelspublic void writePixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm) throws IOExceptionRetrieves the range of pixels specified by the coordinates as double array. Reads the data from disk if ot is not in memory yet. If the data is loaded, just copies the data..- Overrides:
- writePixelsin class- AbstractBand
- Parameters:
- x- x offset into the band
- y- y offset into the band
- w- width of the pixel array to be read
- h- height of the pixel array to be read.
- pixels- double array to be filled with data
- pm- a monitor to inform the user about progress
- Throws:
- IOException- if an I/O error occurs
 
 - 
acceptVisitorpublic void acceptVisitor(ProductVisitor visitor) Accepts the given visitor. This method implements the well known 'Visitor' design pattern of the gang-of-four. The visitor pattern allows to define new operations on the product data model without the need to add more code to it. The new operation is implemented by the visitor.The method simply calls visitor.visit(this).- Overrides:
- acceptVisitorin class- Band
- Parameters:
- visitor- the visitor, must not be- null
 
 - 
getRawStorageSizepublic long getRawStorageSize(ProductSubsetDef subsetDef) Gets an estimated raw storage size in bytes of this product node.- Overrides:
- getRawStorageSizein class- Band
- Parameters:
- subsetDef- if not- nullthe subset may limit the size returned
- Returns:
- the size in bytes.
 
 - 
toStringpublic String toString() Creates a string defining this band object.
 - 
disposepublic void dispose() Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.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.
 - 
createSourceImageprotected RenderedImage createSourceImage() Description copied from class:RasterDataNodeCreates the source image associated with thisRasterDataNode. This shall preferably be aMultiLevelImageinstance which recognises this raster data node's {@link ##getImageToModelTransform() imageToModelTransform} property, if set.- Overrides:
- createSourceImagein class- Band
- Returns:
- A new source image instance.
 
 - 
createSourceImagepublic static MultiLevelImage createSourceImage(RasterDataNode raster, String expression) Create aMultiLevelImagethat computes its pixel values from the given band math expression. The returned image is intended to be used as source image for the given target raster.Non-API. - Parameters:
- raster- The raster data node.
- expression- The band-arithmetic expression.
- Returns:
- A multi-level image.
 
 
- 
 
-