Class RasterDataNode
- java.lang.Object
-
- com.bc.ceres.core.ExtensibleObject
-
- org.esa.snap.core.datamodel.ProductNode
-
- org.esa.snap.core.datamodel.DataNode
-
- org.esa.snap.core.datamodel.RasterDataNode
-
- All Implemented Interfaces:
Extensible,Scaling,SceneTransformProvider
- Direct Known Subclasses:
AbstractBand,TiePointGrid
public abstract class RasterDataNode extends DataNode implements Scaling, SceneTransformProvider
TheRasterDataNodeclass ist the abstract base class for all objects in the product package that contain rasterized data. i.e.BandandTiePointGrid. It unifies the access to raster data in the product model. A raster is considered as a rectangular raw data array with a fixed width and height. A raster data node can scale its raw raster data samples in order to return geophysically meaningful pixel values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRasterDataNode.RasterDataProcessorA raster data processor which is called for a set of raster lines to be processed.
-
Field Summary
-
Fields inherited from class org.esa.snap.core.datamodel.DataNode
PROPERTY_NAME_DATA, PROPERTY_NAME_READ_ONLY, PROPERTY_NAME_SYNTHETIC, PROPERTY_NAME_UNIT
-
Fields inherited from class org.esa.snap.core.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRasterDataNode(String name, int dataType, long numElems)Constructs an object of typeRasterDataNode.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidacceptVisitor(ProductVisitor visitor)Accepts the given visitor.voidaddAncillaryVariable(RasterDataNode variable, String... relations)Adds an associated ancillary variable and sets its relation names.booleancanBeOrthorectified()Tests if this raster data node can be orthorectified.voidcheckCompatibleRasterData(ProductData rasterData, int w, int h)Throws anIllegalArgumentExceptionif the given parameters dont specify a compatible raster.voidclearNoDataValue()Clears the no-data value, so thatisNoDataValueSet()will returnfalse.protected StxcomputeStxImpl(int level, ProgressMonitor pm)Computes the statistics.BufferedImagecreateColorIndexedImage(ProgressMonitor pm)Creates an image for this raster data node.ProductDatacreateCompatibleRasterData()Creates raster data that is compatible to this dataset's data type.ProductDatacreateCompatibleRasterData(int width, int height)Creates raster data that is compatible to this dataset's data type.ProductDatacreateCompatibleSceneRasterData()Creates raster data that is compatible to this dataset's data type.ImageInfocreateDefaultImageInfo(double[] histoSkipAreas, ProgressMonitor pm)Creates a default image information instance.ImageInfocreateDefaultImageInfo(double[] histoSkipAreas, Histogram histogram)Creates an instance of a default image information.MultiLevelModelcreateMultiLevelModel()Create a multi-level image model suited for source and geo-physical images returned by thisRasterDataNodeprotected PointingcreatePointing()Creates aPointingapplicable for this raster.BufferedImagecreateRgbImage(ProgressMonitor pm)Creates an RGB image for this raster data node.protected abstract RenderedImagecreateSourceImage()Creates the source image associated with thisRasterDataNode.TransectProfileDatacreateTransectProfileData(Shape shape)Creates a transect profile for the given shape (-outline).voiddispose()Releases all of the resources used by this object instance and all of its owned children.voidfireImageInfoChanged()Notifies listeners that the image (display) information has changed.String[]getAncillaryRelations()Gets the names of an ancillary relations to another raster data node.RasterDataNodegetAncillaryVariable(String... relations)Finds the first associated ancillary band for the specified relations.RasterDataNode[]getAncillaryVariables(String... relations)Finds any associated ancillary band for the specified relation.GeoCodinggetGeoCoding()Returns the geo-coding of thisRasterDataNode.intgetGeophysicalDataType()Returns the geophysical data type of thisRasterDataNode.MultiLevelImagegetGeophysicalImage()doublegetGeophysicalNoDataValue()Gets the geophysical no-data value which is simply the scaled "raw" no-data value returned bygetNoDataValue().ImageInfogetImageInfo()Gets the image information for image display.ImageInfogetImageInfo(double[] histoSkipAreas, ProgressMonitor pm)Gets the image creation information.ImageInfogetImageInfo(ProgressMonitor pm)Returns the image information for this raster data node.AffineTransformgetImageToModelTransform()Gets the transformation used to convert this raster's image (pixel) coordinates to model coordinates used for rendering the image together with other images and vector data.MathTransform2DgetModelToSceneTransform()Gets the transformation that transforms from localRasterDataNodemodel coordinates to theProduct's scene coordinates.MultiLevelModelgetMultiLevelModel()Gets the multi-level image (image pyramid) model that describes an image pyramid layout.doublegetNoDataValue()Gets the no-data value as a primitivedouble.ProductNodeGroup<Mask>getOverlayMaskGroup()abstract doublegetPixelDouble(int x, int y)Returns the pixel located at (x,y) as a double value.abstract floatgetPixelFloat(int x, int y)Returns the pixel located at (x,y) as a float value.abstract intgetPixelInt(int x, int y)Returns the pixel located at (x,y) as an integer value.abstract double[]getPixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as double array.float[]getPixels(int x, int y, int w, int h, float[] pixels)abstract float[]getPixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as float array.int[]getPixels(int x, int y, int w, int h, int[] pixels)abstract int[]getPixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as integer array.StringgetPixelString(int x, int y)Returns the pixel located at (x,y) as a string value.PointinggetPointing()Gets aPointingif one is available for this raster.ProductDatagetRasterData()Gets the raster data for this dataset.abstract intgetRasterHeight()DimensiongetRasterSize()abstract intgetRasterWidth()floatgetSampleFloat(int x, int y)Gets a geo-physical sample value at the given pixel coordinate asfloatvalue.intgetSampleInt(int x, int y)Gets a geo-physical sample value at the given pixel coordinate asintvalue.doublegetScalingFactor()Gets the scaling factor which is applied to rawProductData.doublegetScalingOffset()Gets the scaling offset which is applied to rawProductData.MathTransform2DgetSceneToModelTransform()Gets the transformation that transforms from theProduct's scene coordinates to the localRasterDataNodemodel coordinates.MultiLevelImagegetSourceImage()Gets the source image associated with thisRasterDataNode.StxgetStx()Gets the statistics.StxgetStx(boolean accurate, ProgressMonitor pm)Gets the statistics.TimeCodinggetTimeCoding()Gets the time-coding of thisRasterDataNode.StringgetValidMaskExpression()Gets the expression used for the computation of the mask which identifies valid pixel values.MultiLevelImagegetValidMaskImage()Gets the valid-mask image associated with thisRasterDataNode.StringgetValidPixelExpression()Gets the expression that is used to determine whether a pixel is valid or not.ShapegetValidShape()Gets the shape of the area where this raster data contains valid samples.booleanhasIntPixels()Determines whether this raster data node contains integer samples.booleanhasRasterData()Returns true if the raster data of thisRasterDataNodeis loaded or elsewhere available, otherwise false.booleanisCompatibleRasterData(ProductData rasterData, int w, int h)Tests whether the given parameters specify a compatible raster or not.booleanisFloatingPointType()Returnstrueif the pixel data contained in this band is "naturally" a floating point number type.booleanisGeophysicalImageSet()Returns whether the geophysical image is set on thisRasterDataNode.booleanisLog10Scaled()Gets whether or not theProductDataof this band has a negative binomial distribution and thus the common logarithm (base 10) of the values is stored in the raw data.booleanisNoDataValueSet()Tests whether or not a no-data value has been specified.booleanisNoDataValueUsed()Tests whether or not the no-data value is used.booleanisPixelValid(int pixelIndex)Checks whether or not the pixel located at (x,y) is valid.booleanisPixelValid(int x, int y)Checks whether or not the pixel located at (x,y) is valid.booleanisPixelValid(int x, int y, javax.media.jai.ROI roi)Checks whether or not the pixel located at (x,y) is valid.booleanisPixelWithinImageBounds(int x, int y)booleanisScalingApplied()Tests whether scaling of raw raster data values is applied before they are returned as geophysically meaningful pixel values.booleanisSourceImageSet()Returns whether the source image is set on thisRasterDataNode.booleanisStxSet()booleanisValidMaskImageSet()Returns whether the valid mask image is set on thisRasterDataNode.static booleanisValidMaskProperty(String propertyName)Tests if the given name is the name of a property which is relevant for the computation of the valid mask.booleanisValidMaskUsed()Tests whether or not this raster data node uses a data-mask in order to determine valid pixels.voidloadRasterData()voidloadRasterData(ProgressMonitor pm)Loads the raster data for thisRasterDataNode.voidprocessRasterData(String message, RasterDataNode.RasterDataProcessor processor, ProgressMonitor pm)Processes the raster's data.voidquantizeRasterData(double newMin, double newMax, double gamma, byte[] samples, int offset, int stride, ProgressMonitor pm)byte[]quantizeRasterData(double newMin, double newMax, double gamma, ProgressMonitor pm)double[]readPixels(int x, int y, int w, int h, double[] pixels)abstract double[]readPixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm)Retrieves the band data at the given offset (x, y), width and height as int data.float[]readPixels(int x, int y, int w, int h, float[] pixels)abstract float[]readPixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm)Retrieves the band data at the given offset (x, y), width and height as int data.int[]readPixels(int x, int y, int w, int h, int[] pixels)abstract int[]readPixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm)Retrieves the band data at the given offset (x, y), width and height as int data.voidreadRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData)Reads raster data from the node's associated data source into the given data buffer.abstract voidreadRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData, ProgressMonitor pm)The method behaves exactly asreadRasterData(int, int, int, int, ProductData), but clients can additionally pass aProgressMonitor.voidreadRasterDataFully()abstract voidreadRasterDataFully(ProgressMonitor pm)Reads the complete underlying raster data.boolean[]readValidMask(int x, int y, int w, int h, boolean[] validMask)Reads the valid mask values for the specified area.voidremoveAncillaryVariable(RasterDataNode variable)Removes an associated ancillary variable.voidremoveCachedImageData()voidresetValidMask()Resets the valid mask of this raster.doublescale(double v)Applies the scalingv * scalingFactor + scalingOffsetthe given input value.doublescaleInverse(double v)Applies the inverse scaling(v - scalingOffset) / scalingFactorthe given input value.voidsetAncillaryRelations(String... relations)Sets the names of an ancillary relations to another raster data node.voidsetGeoCoding(GeoCoding geoCoding)Sets the geo-coding for thisRasterDataNode.voidsetGeophysicalNoDataValue(double noDataValue)Sets the geophysical no-data value which is simply the scaled "raw" no-data value returned bygetNoDataValue().voidsetImageInfo(ImageInfo imageInfo)Sets the image information for image display.protected voidsetImageInfo(ImageInfo imageInfo, boolean change)voidsetImageToModelTransform(AffineTransform imageToModelTransform)Sets the transformation used to convert this raster's image (pixel) coordinates to model coordinates used for rendering the image together with other images and vector data.voidsetLog10Scaled(boolean log10Scaled)Sets whether or not theProductDataof this band has a negative binomial distribution and thus the common logarithm (base 10) of the values is stored in the raw data.voidsetModelToSceneTransform(MathTransform2D modelToSceneTransform)Sets aMathTransform2Dfrom the local model CRS of thisRasterDataNodeto aProduct's scene coordinate reference system.voidsetModified(boolean modified)Sets this node's modified flag.voidsetNoDataValue(double noDataValue)Sets the no-data value as a primitivedouble.voidsetNoDataValueUsed(boolean noDataValueUsed)Sets whether or not the no-data value is used.abstract voidsetPixelDouble(int x, int y, double pixelValue)Sets the pixel located at (x,y) to the given double value.abstract voidsetPixelFloat(int x, int y, float pixelValue)Sets the pixel located at (x,y) to the given float value.abstract voidsetPixelInt(int x, int y, int pixelValue)Sets the pixel located at (x,y) to the given integer value.abstract voidsetPixels(int x, int y, int w, int h, double[] pixels)Sets a range of pixels specified by the coordinates as double array.abstract voidsetPixels(int x, int y, int w, int h, float[] pixels)Sets a range of pixels specified by the coordinates as float array.abstract voidsetPixels(int x, int y, int w, int h, int[] pixels)Sets a range of pixels specified by the coordinates as integer array.voidsetRasterData(ProductData rasterData)Sets the raster data of this dataset.voidsetScalingFactor(double scalingFactor)Sets the scaling factor which is applied to rawProductData.voidsetScalingOffset(double scalingOffset)Sets the scaling offset which is applied to rawProductData.voidsetSceneToModelTransform(MathTransform2D sceneToModelTransform)Sets aMathTransform2Dfrom aProduct's scene coordinate reference system to the local model CRS of thisRasterDataNode.voidsetSourceImage(MultiLevelImage sourceImage)Sets the source image associated with thisRasterDataNode.voidsetSourceImage(RenderedImage sourceImage)Sets the source image associated with thisRasterDataNode.voidsetStx(Stx stx)Sets the statistics.voidsetTimeCoding(TimeCoding timeCoding)Sets the time-coding for thisRasterDataNode.voidsetValidPixelExpression(String validPixelExpression)Sets the expression that is used to determine whether a pixel is valid or not.voidunloadRasterData()Un-loads the raster data for thisRasterDataNode.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)abstract voidwritePixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm)Writes the range of given pixels specified to the specified coordinates as doubles.voidwritePixels(int x, int y, int w, int h, float[] pixels)abstract voidwritePixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm)Writes the range of given pixels specified to the specified coordinates as floats.voidwritePixels(int x, int y, int w, int h, int[] pixels)abstract voidwritePixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm)Writes the range of given pixels specified to the specified coordinates as integers.voidwriteRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData)abstract voidwriteRasterData(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.voidwriteRasterDataFully()abstract voidwriteRasterDataFully(ProgressMonitor pm)Writes the complete underlying raster data.-
Methods inherited from class org.esa.snap.core.datamodel.DataNode
checkDataCompatibility, createCompatibleProductData, fireProductNodeDataChanged, getData, getDataElems, getDataElemSize, getDataType, getNumDataElems, getRawStorageSize, getUnit, isReadOnly, isSynthetic, setData, setDataElems, setReadOnly, setSynthetic, setUnit
-
Methods inherited from class org.esa.snap.core.datamodel.ProductNode
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setName, setOwner, toString
-
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
-
-
-
Field Detail
-
PROPERTY_NAME_IMAGE_INFO
public static final String PROPERTY_NAME_IMAGE_INFO
- See Also:
- Constant Field Values
-
PROPERTY_NAME_LOG_10_SCALED
public static final String PROPERTY_NAME_LOG_10_SCALED
- See Also:
- Constant Field Values
-
PROPERTY_NAME_SCALING_FACTOR
public static final String PROPERTY_NAME_SCALING_FACTOR
- See Also:
- Constant Field Values
-
PROPERTY_NAME_SCALING_OFFSET
public static final String PROPERTY_NAME_SCALING_OFFSET
- See Also:
- Constant Field Values
-
PROPERTY_NAME_NO_DATA_VALUE
public static final String PROPERTY_NAME_NO_DATA_VALUE
- See Also:
- Constant Field Values
-
PROPERTY_NAME_NO_DATA_VALUE_USED
public static final String PROPERTY_NAME_NO_DATA_VALUE_USED
- See Also:
- Constant Field Values
-
PROPERTY_NAME_VALID_PIXEL_EXPRESSION
public static final String PROPERTY_NAME_VALID_PIXEL_EXPRESSION
- See Also:
- Constant Field Values
-
PROPERTY_NAME_GEO_CODING
public static final String PROPERTY_NAME_GEO_CODING
- See Also:
- Constant Field Values
-
PROPERTY_NAME_TIME_CODING
public static final String PROPERTY_NAME_TIME_CODING
- See Also:
- Constant Field Values
-
PROPERTY_NAME_STX
public static final String PROPERTY_NAME_STX
- See Also:
- Constant Field Values
-
PROPERTY_NAME_ANCILLARY_VARIABLES
public static final String PROPERTY_NAME_ANCILLARY_VARIABLES
- See Also:
- Constant Field Values
-
PROPERTY_NAME_ANCILLARY_RELATIONS
public static final String PROPERTY_NAME_ANCILLARY_RELATIONS
- See Also:
- Constant Field Values
-
PROPERTY_NAME_IMAGE_TO_MODEL_TRANSFORM
public static final String PROPERTY_NAME_IMAGE_TO_MODEL_TRANSFORM
- See Also:
- Constant Field Values
-
PROPERTY_NAME_MODEL_TO_SCENE_TRANSFORM
public static final String PROPERTY_NAME_MODEL_TO_SCENE_TRANSFORM
- See Also:
- Constant Field Values
-
PROPERTY_NAME_SCENE_TO_MODEL_TRANSFORM
public static final String PROPERTY_NAME_SCENE_TO_MODEL_TRANSFORM
- See Also:
- Constant Field Values
-
NO_DATA_TEXT
public static final String NO_DATA_TEXT
Text returned by themethod if no data is available at the given pixel position.getPixelString(int, int)- See Also:
- Constant Field Values
-
INVALID_POS_TEXT
public static final String INVALID_POS_TEXT
Text returned by themethod if no data is available at the given pixel position.getPixelString(int, int)- See Also:
- Constant Field Values
-
IO_ERROR_TEXT
public static final String IO_ERROR_TEXT
Text returned by themethod if an I/O error occurred while pixel data was reloaded.getPixelString(int, int)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RasterDataNode
protected RasterDataNode(String name, int dataType, long numElems)
Constructs an object of typeRasterDataNode.- Parameters:
name- the name of the new objectdataType- the data type used by the raster, must be one of the multipleProductData.TYPE_Xconstants, with the exception ofProductData.TYPE_UINT32numElems- the number of elements in this data node.
-
-
Method Detail
-
getRasterWidth
public abstract int getRasterWidth()
- Returns:
- The native width of the raster in pixels.
-
getRasterHeight
public abstract int getRasterHeight()
- Returns:
- The native height of the raster in pixels.
-
getRasterSize
public Dimension getRasterSize()
- Returns:
- The native size of the raster in pixels.
-
setModified
public void setModified(boolean modified)
Description copied from class:ProductNodeSets this node's modified flag.If the modified flag changes to true and this node has an owner, the owner's modified flag is also set to true.
- Overrides:
setModifiedin classProductNode- Parameters:
modified- whether or not this node is beeing marked as modified.- See Also:
Product.fireNodeChanged(org.esa.snap.core.datamodel.ProductNode, java.lang.String, java.lang.Object, java.lang.Object)
-
getImageToModelTransform
public AffineTransform getImageToModelTransform()
Gets the transformation used to convert this raster's image (pixel) coordinates to model coordinates used for rendering the image together with other images and vector data.If this raster data node's (
source image is set) theimage-to-model transformationof the image pyramid's lowest level image is returned. Otherwise the transformation which has been set using thesetImageToModelTransform(AffineTransform)is returned. If the transformation was not set explicitly, the method tries to determine it from geo-codings. If this fails, the identity transform is returned.- Returns:
- The image-to-model transformation.
- Since:
- SNAP 2.0
- See Also:
ProductNode.getProduct(),Product.getSceneCRS(),setImageToModelTransform(AffineTransform),getSourceImage(),getGeoCoding()
-
setImageToModelTransform
public void setImageToModelTransform(AffineTransform imageToModelTransform)
Sets the transformation used to convert this raster's image (pixel) coordinates to model coordinates used for rendering the image together with other images and vector data.The method call will fail if this raster data node has already a source image which uses a different image-to-model transformation.
WARNING: This method belongs to a preliminary API and may change in an incompatible way or may even be removed in a next SNAP release.
- Parameters:
imageToModelTransform- The new image-to-model transformation- Throws:
IllegalStateException- If a source image is already set which uses a different image-to-model transformation.- Since:
- SNAP 2.0
- See Also:
getImageToModelTransform(),createSourceImage()
-
getModelToSceneTransform
public MathTransform2D getModelToSceneTransform()
Gets the transformation that transforms from localRasterDataNodemodel coordinates to theProduct's scene coordinates.If no model-to-scene transformation has been explicitly set but a scene-to-model transformation exists, then the latter's
inverse()is returned.- Specified by:
getModelToSceneTransformin interfaceSceneTransformProvider- Returns:
- The model-to-scene transformation, or
nullif no such exists. - Since:
- SNAP 2.0.3
- See Also:
Product.getSceneCRS(),getImageToModelTransform()
-
setModelToSceneTransform
public void setModelToSceneTransform(MathTransform2D modelToSceneTransform)
Sets aMathTransform2Dfrom the local model CRS of thisRasterDataNodeto aProduct's scene coordinate reference system. If the sceneToModelTransform is not the inverse of this transform or cannot be derived from it, it must be set usingsetSceneToModelTransform().Only use this method when you know that the model CRS of this
RasterDataNodeis different than theProduct's scene CRS or when you want to model a special relationship between differentRasterDataNode's. When no transformation from local model to scene is possible, useMathTransform2D.NULL.- Parameters:
modelToSceneTransform- TheMathTransform2Dto convert local model coordinates to product scene coordinates- Since:
- SNAP 2.0.3
- See Also:
setSceneToModelTransform(MathTransform2D)
-
getSceneToModelTransform
public MathTransform2D getSceneToModelTransform()
Gets the transformation that transforms from theProduct's scene coordinates to the localRasterDataNodemodel coordinates.If no scene-to-model transformation has been explicitly set but a model-to-scene transformation exists, then the latter's
inverse()is returned.- Specified by:
getSceneToModelTransformin interfaceSceneTransformProvider- Returns:
- The model-to-scene transformation
- Since:
- SNAP 2.0.3
- See Also:
Product.getSceneCRS(),getImageToModelTransform()
-
setSceneToModelTransform
public void setSceneToModelTransform(MathTransform2D sceneToModelTransform)
Sets aMathTransform2Dfrom aProduct's scene coordinate reference system to the local model CRS of thisRasterDataNode. If the modelToSceneTransform is not the inverse of this transformor cannot be derived from it, it must be set usingsetModelToSceneTransform().Only use this method when you know that the model CRS of this
RasterDataNodeis different than theProduct's scene CRS or when you want to model a special relationship between differentRasterDataNode's. When no transformation from scene to local model is possible, useMathTransform2D.NULL.- Parameters:
sceneToModelTransform- TheMathTransform2Dto convert product scene coordinates to local model coordinates- Since:
- SNAP 2.0.3
- See Also:
setModelToSceneTransform(MathTransform2D)
-
getGeoCoding
public GeoCoding getGeoCoding()
Returns the geo-coding of thisRasterDataNode.- Returns:
- the geo-coding, or
nullif not available.
-
setGeoCoding
public void setGeoCoding(GeoCoding geoCoding)
Sets the geo-coding for thisRasterDataNode. Also sets the geo-coding of the parentProductif it has no geo-coding yet.On property change, the method calls
ProductNode.fireProductNodeChanged(String)with the property namePROPERTY_NAME_GEO_CODING.- Parameters:
geoCoding- the new geo-coding- See Also:
Product.setSceneGeoCoding(GeoCoding)
-
getTimeCoding
public TimeCoding getTimeCoding()
Gets the time-coding of thisRasterDataNode.- Returns:
- the time-coding, or
nullif not available. - Since:
- SNAP 2.0
- See Also:
Product.getSceneTimeCoding()
-
setTimeCoding
public void setTimeCoding(TimeCoding timeCoding)
Sets the time-coding for thisRasterDataNode.- Parameters:
timeCoding- the new time-coding- Since:
- SNAP 2.0
- See Also:
Product.setSceneTimeCoding(TimeCoding)
-
createPointing
protected Pointing createPointing()
Creates aPointingapplicable for this raster.- Returns:
- the pointing object, or null if a pointing is not available
-
getPointing
public Pointing getPointing()
Gets aPointingif one is available for this raster. The methods callscreatePointing()if a pointing has not been set so far or if itsGeoCodingchanged since the last creation of this raster'sPointinginstance.- Returns:
- the pointing object, or null if a pointing is not available
-
canBeOrthorectified
public boolean canBeOrthorectified()
Tests if this raster data node can be orthorectified.- Returns:
- true, if so
-
isFloatingPointType
public boolean isFloatingPointType()
Returnstrueif the pixel data contained in this band is "naturally" a floating point number type.- Overrides:
isFloatingPointTypein classDataNode- Returns:
- true, if so
-
getGeophysicalDataType
public int getGeophysicalDataType()
Returns the geophysical data type of thisRasterDataNode. The value returned is always one of theProductData.TYPE_XXXconstants.- Returns:
- the geophysical data type
- See Also:
ProductData,isScalingApplied()
-
getScalingFactor
public final double getScalingFactor()
Gets the scaling factor which is applied to rawProductData. The default value is1.0(no factor).- Returns:
- the scaling factor
- See Also:
isScalingApplied()
-
setScalingFactor
public final void setScalingFactor(double scalingFactor)
Sets the scaling factor which is applied to rawProductData.- Parameters:
scalingFactor- the scaling factor- See Also:
isScalingApplied()
-
getScalingOffset
public final double getScalingOffset()
Gets the scaling offset which is applied to rawProductData. The default value is0.0(no offset).- Returns:
- the scaling offset
- See Also:
isScalingApplied()
-
setScalingOffset
public final void setScalingOffset(double scalingOffset)
Sets the scaling offset which is applied to rawProductData.- Parameters:
scalingOffset- the scaling offset- See Also:
isScalingApplied()
-
isLog10Scaled
public final boolean isLog10Scaled()
Gets whether or not theProductDataof this band has a negative binomial distribution and thus the common logarithm (base 10) of the values is stored in the raw data. The default value isfalse.- Returns:
- whether or not the data is logging-10 scaled
- See Also:
isScalingApplied()
-
setLog10Scaled
public final void setLog10Scaled(boolean log10Scaled)
Sets whether or not theProductDataof this band has a negative binomial distribution and thus the common logarithm (base 10) of the values is stored in the raw data.- Parameters:
log10Scaled- whether or not the data is logging-10 scaled- See Also:
isScalingApplied()
-
isScalingApplied
public final boolean isScalingApplied()
Tests whether scaling of raw raster data values is applied before they are returned as geophysically meaningful pixel values.The methods which return geophysical pixel values are all
getPixels(int, int, int, int, int[]),setPixels(int, int, int, int, int[]),readPixels(int, int, int, int, int[])andwritePixels(int, int, int, int, int[])methods as well as thegetPixel<Type>andsetPixel<Type>methods such asgetPixelFloat(int, int)* andsetPixelFloat(int, int, float).- Returns:
trueif a conversion is applyied to raw data samples before the are retuned.- See Also:
getScalingOffset(),getScalingFactor(),isLog10Scaled()
-
isValidMaskProperty
public static boolean isValidMaskProperty(String propertyName)
Tests if the given name is the name of a property which is relevant for the computation of the valid mask.- Parameters:
propertyName- the name to test- Returns:
true, if so.- Since:
- BEAM 4.2
-
isNoDataValueSet
public boolean isNoDataValueSet()
Tests whether or not a no-data value has been specified. The no-data value is not-specified unless eithersetNoDataValue(double)orsetGeophysicalNoDataValue(double)is called.- Returns:
- true, if so
- See Also:
isNoDataValueUsed(),setNoDataValue(double)
-
clearNoDataValue
public void clearNoDataValue()
Clears the no-data value, so thatisNoDataValueSet()will returnfalse.
-
isNoDataValueUsed
public boolean isNoDataValueUsed()
Tests whether or not the no-data value is used.The no-data value is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.- Returns:
- true, if so
- See Also:
setNoDataValueUsed(boolean),isNoDataValueSet()
-
setNoDataValueUsed
public void setNoDataValueUsed(boolean noDataValueUsed)
Sets whether or not the no-data value is used. If the no-data value is enabled and the no-data value has not been set so far, a default no-data value it is set with a value of to zero.The no-data value is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.On property change, the method calls
ProductNode.fireProductNodeChanged(String)with the property namePROPERTY_NAME_NO_DATA_VALUE_USED.- Parameters:
noDataValueUsed- true, if so- See Also:
isNoDataValueUsed()
-
getNoDataValue
public double getNoDataValue()
Gets the no-data value as a primitivedouble.Note that the value returned is NOT necessarily the same as the value returned by
getGeophysicalNoDataValue()because no scaling is applied.The no-data value is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.The method returns
0.0, if no no-data value has been specified so far.- Returns:
- the no-data value. It is returned as a
doublein order to cover all other numeric types. - See Also:
setNoDataValue(double),isNoDataValueSet(),isNoDataValueUsed()
-
setNoDataValue
public void setNoDataValue(double noDataValue)
Sets the no-data value as a primitivedouble.Note that the given value is related to the "raw", un-scaled raster data. In order to set the geophysical, scaled no-data value use the method
setGeophysicalNoDataValue(double).The no-data value is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.On property change, the method calls
ProductNode.fireProductNodeChanged(String)with the property namePROPERTY_NAME_NO_DATA_VALUE.- Parameters:
noDataValue- the no-data value. It is passed as adoublein order to cover all other numeric types.- See Also:
getNoDataValue(),isNoDataValueSet()
-
getGeophysicalNoDataValue
public double getGeophysicalNoDataValue()
Gets the geophysical no-data value which is simply the scaled "raw" no-data value returned bygetNoDataValue().The no-data value is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.- Returns:
- the geophysical no-data value
- See Also:
setGeophysicalNoDataValue(double)
-
setGeophysicalNoDataValue
public void setGeophysicalNoDataValue(double noDataValue)
Sets the geophysical no-data value which is simply the scaled "raw" no-data value returned bygetNoDataValue().The no-data value is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.On property change, the method calls
ProductNode.fireProductNodeChanged(String)with the property namePROPERTY_NAME_NO_DATA_VALUE.- Parameters:
noDataValue- the new geophysical no-data value- See Also:
setGeophysicalNoDataValue(double),isNoDataValueSet()
-
getValidPixelExpression
public String getValidPixelExpression()
Gets the expression that is used to determine whether a pixel is valid or not. For more information on valid pixels, please refer to the documentation of theisPixelValid(int, int, javax.media.jai.ROI)method.- Returns:
- the valid mask expression.
-
setValidPixelExpression
public void setValidPixelExpression(String validPixelExpression)
Sets the expression that is used to determine whether a pixel is valid or not.The valid-pixel expression is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.On property change, the method calls
ProductNode.fireProductNodeChanged(String)with the property namePROPERTY_NAME_VALID_PIXEL_EXPRESSION.- Parameters:
validPixelExpression- the valid mask expression, can be null
-
isValidMaskUsed
public boolean isValidMaskUsed()
Tests whether or not this raster data node uses a data-mask in order to determine valid pixels. The method returns true if eitherisValidPixelExpressionSet()orisNoDataValueUsed()returns true.The data-mask is used to determine valid pixels. For more information on valid pixels, please refer to the documentation of the
isPixelValid(int, int, javax.media.jai.ROI)method.- Returns:
- true, if so
-
resetValidMask
public void resetValidMask()
Resets the valid mask of this raster. The mask will be lazily regenerated when requested the next time.
-
getValidMaskExpression
public String getValidMaskExpression()
Gets the expression used for the computation of the mask which identifies valid pixel values. It recognizes the value of thenoDataValueand thevalidPixelExpressionproperties, if any. The method returnsnull, if none of these properties are set.- Returns:
- The expression used for the computation of the mask which identifies valid pixel values,
or
null. - Since:
- BEAM 4.2
- See Also:
getValidPixelExpression(),getNoDataValue()
-
updateExpression
public 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 classProductNode- Parameters:
oldExternalName- The old node name.newExternalName- The new node name.
-
hasRasterData
public boolean hasRasterData()
Returns true if the raster data of thisRasterDataNodeis loaded or elsewhere available, otherwise false.- Returns:
- true, if so.
-
getRasterData
public ProductData getRasterData()
Gets the raster data for this dataset. If the data hasn't been loaded so far the method returnsnull.- Returns:
- the raster data for this band, or
nullif data has not been loaded
-
setRasterData
public void setRasterData(ProductData rasterData)
Sets the raster data of this dataset.Note that this method does not copy data at all. If the supplied raster data is compatible with this product raster, then simply its reference is stored. Modifications in the supplied raster data will also affect this dataset's data.
- Parameters:
rasterData- The raster data for this raster data node.- See Also:
getRasterData()
-
loadRasterData
public void loadRasterData() throws IOException- Throws:
IOException- if an I/O error occurs- See Also:
loadRasterData(com.bc.ceres.core.ProgressMonitor)
-
loadRasterData
public void loadRasterData(ProgressMonitor pm) throws IOException
Loads the raster data for thisRasterDataNode. After this method has been called successfully,hasRasterData()should always returntrueandgetRasterData()should always return a validProductDatainstance with at leastgetRasterWidth()*getRasterHeight()elements (samples).The default implementation of this method does nothing.
- Parameters:
pm- a monitor to inform the user about progress- Throws:
IOException- if an I/O error occurs- See Also:
unloadRasterData()
-
unloadRasterData
public void unloadRasterData()
Un-loads the raster data for thisRasterDataNode.It is up to the implementation whether after this method has been called successfully, the
hasRasterData()method returnsfalseortrue.The default implementation of this method does nothing.
- See Also:
loadRasterData()
-
removeCachedImageData
public void removeCachedImageData()
-
dispose
public 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.
-
isPixelValid
public boolean isPixelValid(int x, int y)Checks whether or not the pixel located at (x,y) is valid. A pixel is assumed to be valid either ifvalidMaskImageis null or or if the bit corresponding to (x,y) is set within the returned mask image.Note: Implementation changed by Norman (2011-08-09) in order to increase performance since a synchronised block was used due to problem with the JAI ROI class that has been used in the former implementation.
- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel location- Returns:
trueif the pixel is valid- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in bounds- See Also:
isPixelValid(int, int, javax.media.jai.ROI),isPixelValid(int),setNoDataValueUsed(boolean),setNoDataValue(double),setValidPixelExpression(String)
-
getSampleInt
public int getSampleInt(int x, int y)Gets a geo-physical sample value at the given pixel coordinate asintvalue.Note: This method does not belong to the public API. It has been added by Norman (2011-08-09) in order to perform performance tests.
- Parameters:
x- pixel X coordinatey- pixel Y coordinate- Returns:
- The geo-physical sample value.
-
getSampleFloat
public float getSampleFloat(int x, int y)Gets a geo-physical sample value at the given pixel coordinate asfloatvalue.Note: This method does not belong to the public API. It has been added by Norman (2011-08-09) in order to perform performance tests.
- Parameters:
x- pixel X coordinatey- pixel Y coordinate- Returns:
- The geo-physical sample value.
-
isPixelValid
public boolean isPixelValid(int pixelIndex)
Checks whether or not the pixel located at (x,y) is valid. A pixel is assumed to be valid either ifvalidMaskImageis null or or if the bit corresponding to (x,y) is set within the returned mask image.- Parameters:
pixelIndex- the linear pixel index in the range 0 to width * height - 1- Returns:
trueif the pixel is valid- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in bounds- Since:
- 4.1
- See Also:
isPixelValid(int, int, javax.media.jai.ROI),isPixelValid(int, int),setNoDataValueUsed(boolean),setNoDataValue(double),setValidPixelExpression(String)
-
isPixelValid
public boolean isPixelValid(int x, int y, javax.media.jai.ROI roi)Checks whether or not the pixel located at (x,y) is valid. The method first test whether a pixel is valid by using theisPixelValid(int, int)method, and secondly, if the pixel is within the ROI (if any).- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel locationroi- the ROI, if null the method returnsisPixelValid(int, int)- Returns:
trueif the pixel is valid- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in bounds- See Also:
isPixelValid(int, int),isPixelValid(int),setNoDataValueUsed(boolean),setNoDataValue(double),setValidPixelExpression(String),readValidMask(int, int, int, int, boolean[])
-
getPixelInt
public abstract int getPixelInt(int x, int y)Returns the pixel located at (x,y) as an integer value.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel location- Returns:
- the pixel value at (x,y)
- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in boundsIllegalStateException- if this object has no internal data buffer
-
getPixelFloat
public abstract float getPixelFloat(int x, int y)Returns the pixel located at (x,y) as a float value.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel location- Returns:
- the pixel value at (x,y)
- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in boundsIllegalStateException- if this object has no internal data buffer
-
getPixelDouble
public abstract double getPixelDouble(int x, int y)Returns the pixel located at (x,y) as a double value.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel location- Returns:
- the pixel value at (x,y)
- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in boundsIllegalStateException- if this object has no internal data buffer
-
setPixelInt
public abstract void setPixelInt(int x, int y, int pixelValue)Sets the pixel located at (x,y) to the given integer value.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel locationpixelValue- the new pixel value at (x,y)- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in boundsIllegalStateException- if this object has no internal data buffer
-
setPixelFloat
public abstract void setPixelFloat(int x, int y, float pixelValue)Sets the pixel located at (x,y) to the given float value.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel locationpixelValue- the new pixel value at (x,y)- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in boundsIllegalStateException- if this object has no internal data buffer
-
setPixelDouble
public abstract void setPixelDouble(int x, int y, double pixelValue)Sets the pixel located at (x,y) to the given double value.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel locationpixelValue- the new pixel value at (x,y)- Throws:
ArrayIndexOutOfBoundsException- if the co-ordinates are not in boundsIllegalStateException- if this object has no internal data buffer
-
getPixels
public int[] getPixels(int x, int y, int w, int h, int[] pixels)
-
getPixels
public abstract int[] getPixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as integer array.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded. You can use thereadPixels(int, int, int, int, double[], ProgressMonitor)method to read or compute pixel values without a raster data buffer.If the
pixelsarray isnulla new one will be created and returned.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be readh- height of the pixel array to be read.pixels- integer array to be filled with datapm- a progress monitor- Throws:
IllegalStateException- if this object has no internal data buffer
-
getPixels
public float[] getPixels(int x, int y, int w, int h, float[] pixels)
-
getPixels
public abstract float[] getPixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as float array.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded. You can use thereadPixels(int, int, int, int, double[], ProgressMonitor)method to read or compute pixel values without a raster data buffer.If the
pixelsarray isnulla new one will be created and returned.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be readh- height of the pixel array to be read.pixels- float array to be filled with datapm- a progress monitor- Throws:
IllegalStateException- if this object has no internal data buffer
-
getPixels
public abstract double[] getPixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm)Retrieves the range of pixels specified by the coordinates as double array.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded. You can use thereadPixels(int, int, int, int, double[], ProgressMonitor)method to read or compute pixel values without a raster data buffer.If the
pixelsarray isnulla new one will be created and returned.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be readh- height of the pixel array to be read.pixels- double array to be filled with datapm- a monitor to inform the user about progress- Throws:
IllegalStateException- if this object has no internal data buffer
-
setPixels
public abstract void setPixels(int x, int y, int w, int h, int[] pixels)Sets a range of pixels specified by the coordinates as integer array.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded. You can use thewritePixels(int, int, int, int, double[], ProgressMonitor)method to write pixels directly to the associatedproduct writer.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be written.pixels- integer array to be written- Throws:
NullPointerException- if this band has no raster dataIllegalStateException- if this object has no internal data buffer
-
setPixels
public abstract void setPixels(int x, int y, int w, int h, float[] pixels)Sets a range of pixels specified by the coordinates as float array.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded. You can use thewritePixels(int, int, int, int, double[], ProgressMonitor)method to write pixels directly to the associatedproduct writer.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be written.pixels- float array to be written- Throws:
NullPointerException- if this band has no raster dataIllegalStateException- if this object has no internal data buffer
-
setPixels
public abstract void setPixels(int x, int y, int w, int h, double[] pixels)Sets a range of pixels specified by the coordinates as double array.Note that this method can only be used if this object's internal raster data buffer has been
setorloaded. You can use thewritePixels(int, int, int, int, double[], ProgressMonitor)method to write pixels directly to the associatedproduct writer.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be written.pixels- double array to be written- Throws:
NullPointerException- if this band has no raster dataIllegalStateException- if this object has no internal data buffer
-
readPixels
public int[] readPixels(int x, int y, int w, int h, int[] pixels) throws IOException- Throws:
IOException- See Also:
readPixels(int, int, int, int, int[], ProgressMonitor)
-
readPixels
public abstract int[] readPixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm) throws IOExceptionRetrieves the band data at the given offset (x, y), width and height as int data. If the data is already in memory, it merely copies the data to the buffer provided. If not, it calls the attached product reader or operator to read or compute the data.If the
pixelsarray isnulla new one will be created and returned.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be readh- height of the pixel array to be readpixels- array to be filled with datapm- a progress monitor- Returns:
- the pixels read
- Throws:
IOException- if an /IO error occursIllegalStateException- if this object has no attachedproduct reader
-
readPixels
public float[] readPixels(int x, int y, int w, int h, float[] pixels) throws IOException- Throws:
IOException- See Also:
readPixels(int, int, int, int, float[], ProgressMonitor)
-
readPixels
public abstract float[] readPixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm) throws IOExceptionRetrieves the band data at the given offset (x, y), width and height as int data. If the data is already in memory, it merely copies the data to the buffer provided. If not, it calls the attached product reader or operator to read or compute the data.If the
pixelsarray isnulla new one will be created and returned.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be readh- height of the pixel array to be readpixels- array to be filled with datapm- a progress monitor- Returns:
- the pixels read
- Throws:
IllegalStateException- if this object has no attachedproduct readerIOException
-
readPixels
public double[] readPixels(int x, int y, int w, int h, double[] pixels) throws IOException- Throws:
IOException- See Also:
readPixels(int, int, int, int, double[], ProgressMonitor)
-
readPixels
public abstract double[] readPixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm) throws IOExceptionRetrieves the band data at the given offset (x, y), width and height as int data. If the data is already in memory, it merely copies the data to the buffer provided. If not, it calls the attached product reader or operator to read or compute the data.If the
pixelsarray isnulla new one will be created and returned.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be readh- height of the pixel array to be readpixels- array to be filled with datapm- a progress monitor- Returns:
- the pixels read
- Throws:
IllegalStateException- if this object has no attachedproduct readerIOException
-
writePixels
public void writePixels(int x, int y, int w, int h, int[] pixels) throws IOException- Throws:
IOException- See Also:
writePixels(int, int, int, int, int[], ProgressMonitor)
-
writePixels
public abstract void writePixels(int x, int y, int w, int h, int[] pixels, ProgressMonitor pm) throws IOExceptionWrites the range of given pixels specified to the specified coordinates as integers.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be writtenpixels- array of pixels to writepm- a progress monitor- Throws:
IllegalStateException- if this object has no attachedproduct writerIOException- if an I/O error occurs
-
writePixels
public void writePixels(int x, int y, int w, int h, float[] pixels) throws IOException- Throws:
IOException- See Also:
writePixels(int, int, int, int, float[], ProgressMonitor)
-
writePixels
public abstract void writePixels(int x, int y, int w, int h, float[] pixels, ProgressMonitor pm) throws IOExceptionWrites the range of given pixels specified to the specified coordinates as floats.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be writtenpixels- array of pixels to writepm- a progress monitor- Throws:
IllegalStateException- if this object has no attachedproduct writerIOException- if an I/O error occurs
-
writePixels
public void writePixels(int x, int y, int w, int h, double[] pixels) throws IOException- Throws:
IOException- See Also:
writePixels(int, int, int, int, double[], ProgressMonitor)
-
writePixels
public abstract void writePixels(int x, int y, int w, int h, double[] pixels, ProgressMonitor pm) throws IOExceptionWrites the range of given pixels specified to the specified coordinates as doubles.- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be writtenpixels- array of pixels to writepm- a progress monitor- Throws:
IllegalStateException- if this object has no attachedproduct writerIOException- if an I/O error occurs
-
readValidMask
public boolean[] readValidMask(int x, int y, int w, int h, boolean[] validMask) throws IOExceptionReads the valid mask values for the specified area. The mask indicates if a pixel is valid or not. The values are retrieved from thegetValidMaskImage(). For a single pixel it is also possible to usisPixelValid(int, int)- Parameters:
x- x offset into the bandy- y offset into the bandw- width of the pixel array to be writtenh- height of the pixel array to be writtenvalidMask- mask for the specified area if the pixels are valid. Can benull, then a new array will be created and returned. If the array is provided it must have the size (w * h)- Returns:
- the valid mask. Either the provided array or a newly created.
- Throws:
IOException- if an I/O error occurs- See Also:
getValidMaskImage(),getValidPixelExpression(),isPixelValid(int, int)
-
readRasterDataFully
public void readRasterDataFully() throws IOException- Throws:
IOException- if an I/O error occurs- See Also:
readRasterDataFully(ProgressMonitor),unloadRasterData()
-
readRasterDataFully
public abstract void readRasterDataFully(ProgressMonitor pm) throws IOException
Reads the complete underlying raster data.After this method has been called successfully,
hasRasterData()should always returntrueandgetRasterData()should always return a validProductDatainstance with at leastgetRasterWidth()*getRasterHeight()elements (samples).In opposite to the
loadRasterDatamethod, thereadRasterDataFullymethod always reloads the data of this product raster, independently of whether its has already been loaded or not.- Parameters:
pm- a monitor to inform the user about progress- Throws:
IOException- if an I/O error occurs- See Also:
loadRasterData(),readRasterData(int, int, int, int, ProductData, com.bc.ceres.core.ProgressMonitor)
-
readRasterData
public void readRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData) throws IOExceptionReads raster data from the node's associated data source into the given data buffer.- Parameters:
offsetX- the X-offset in the raster co-ordinates where reading startsoffsetY- the Y-offset in the 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 read- Throws:
IOException- 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 reader- See Also:
ProductReader.readBandRasterData(Band, int, int, int, int, ProductData, com.bc.ceres.core.ProgressMonitor)
-
readRasterData
public abstract void readRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData, ProgressMonitor pm) throws IOExceptionThe method behaves exactly asreadRasterData(int, int, int, int, ProductData), but clients can additionally pass aProgressMonitor.- Parameters:
offsetX- the X-offset in the raster co-ordinates where reading startsoffsetY- the Y-offset in the 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 progress- Throws:
IOException- 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 reader
-
writeRasterDataFully
public void writeRasterDataFully() throws IOException- Throws:
IOException
-
writeRasterDataFully
public abstract void writeRasterDataFully(ProgressMonitor pm) throws IOException
Writes the complete underlying raster data.- Parameters:
pm- a monitor to inform the user about progress- Throws:
IOException- if an I/O error occurs
-
writeRasterData
public void writeRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData) throws IOException- Throws:
IOException
-
writeRasterData
public abstract void writeRasterData(int offsetX, int offsetY, int width, int height, ProductData rasterData, ProgressMonitor pm) throws IOExceptionWrites data from this product raster into the specified region of the user-supplied raster.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.
- Parameters:
rasterData- a raster data buffer receiving the pixels to be readoffsetX- 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 bufferpm- a monitor to inform the user about progress- Throws:
IOException- 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 reader- See Also:
ProductReader.readBandRasterData(Band, int, int, int, int, ProductData, com.bc.ceres.core.ProgressMonitor)
-
createCompatibleRasterData
public ProductData createCompatibleRasterData()
Creates raster data that is compatible to this dataset's data type. The data buffer returned contains exactlygetRasterWidth()*getRasterHeight()elements of a compatible data type.- Returns:
- raster data compatible with this product raster
- See Also:
createCompatibleSceneRasterData()
-
createCompatibleSceneRasterData
public ProductData createCompatibleSceneRasterData()
Creates raster data that is compatible to this dataset's data type. The data buffer returned contains exactlygetBandOutputRasterWidth()*getBandOutputRasterHeight()elements of a compatible data type.- Returns:
- raster data compatible with this product raster
- See Also:
createCompatibleRasterData()
-
createCompatibleRasterData
public ProductData createCompatibleRasterData(int width, int height)
Creates raster data that is compatible to this dataset's data type. The data buffer returned contains exactlywidth*heightelements of a compatible data type.- Parameters:
width- the width of the raster data to be createdheight- the height of the raster data to be created- Returns:
- raster data compatible with this product raster
- See Also:
createCompatibleRasterData(),createCompatibleSceneRasterData()
-
isCompatibleRasterData
public boolean isCompatibleRasterData(ProductData rasterData, int w, int h)
Tests whether the given parameters specify a compatible raster or not.- Parameters:
rasterData- the raster dataw- the raster widthh- the raster height- Returns:
trueif so
-
checkCompatibleRasterData
public void checkCompatibleRasterData(ProductData rasterData, int w, int h)
Throws anIllegalArgumentExceptionif the given parameters dont specify a compatible raster.- Parameters:
rasterData- the raster dataw- the raster widthh- the raster height
-
hasIntPixels
public boolean hasIntPixels()
Determines whether this raster data node contains integer samples.- Returns:
- true if this raster data node contains integer samples.
-
createTransectProfileData
public TransectProfileData createTransectProfileData(Shape shape) throws IOException
Creates a transect profile for the given shape (-outline).- Parameters:
shape- the shape- Returns:
- the profile data
- Throws:
IOException- if an I/O error occurs
-
acceptVisitor
public abstract 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.- Specified by:
acceptVisitorin classDataNode- Parameters:
visitor- the visitor, must not benull
-
getImageInfo
public ImageInfo getImageInfo()
Gets the image information for image display.- Returns:
- the image info or
null
-
setImageInfo
public void setImageInfo(ImageInfo imageInfo)
Sets the image information for image display.- Parameters:
imageInfo- the image info, can benull
-
setImageInfo
protected void setImageInfo(ImageInfo imageInfo, boolean change)
-
fireImageInfoChanged
public void fireImageInfoChanged()
Notifies listeners that the image (display) information has changed.- Since:
- BEAM 4.7
-
getImageInfo
public final ImageInfo getImageInfo(ProgressMonitor pm)
Returns the image information for this raster data node.The method simply returns the value of
ensureValidImageInfo(null, ProgressMonitor.NULL).- Parameters:
pm- A progress monitor.- Returns:
- A valid image information instance.
- Since:
- BEAM 4.2
- See Also:
getImageInfo(double[], ProgressMonitor)
-
getImageInfo
public final ImageInfo getImageInfo(double[] histoSkipAreas, ProgressMonitor pm)
Gets the image creation information.If no image information has been assigned before, the
method is called with the given parameters passed to this method.createDefaultImageInfo(double[], com.bc.ceres.core.ProgressMonitor)- Parameters:
histoSkipAreas- Only used, if new image info is created (seemethod).createDefaultImageInfo(double[], com.bc.ceres.core.ProgressMonitor)pm- A progress monitor.- Returns:
- The image creation information.
- Since:
- BEAM 4.2
-
createDefaultImageInfo
public ImageInfo createDefaultImageInfo(double[] histoSkipAreas, ProgressMonitor pm)
Creates a default image information instance.An
IllegalStateExceptionis thrown in the case that this raster data node has no raster data.- Parameters:
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 benull, in this case{0.01, 0.04}resp. 5% of the entire area is skipped.pm- a monitor to inform the user about progress- Returns:
- a valid image information instance, never
null.
-
createDefaultImageInfo
public final ImageInfo createDefaultImageInfo(double[] histoSkipAreas, Histogram histogram)
Creates an instance of a default image information.An
IllegalStateExceptionis thrown in the case that this raster data node has no raster data.- Parameters:
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 benull, in this case{0.01, 0.04}resp. 5% of the entire area is skipped.histogram- the histogram to create the image information.- Returns:
- a valid image information instance, never
null.
-
getOverlayMaskGroup
public ProductNodeGroup<Mask> getOverlayMaskGroup()
- Returns:
- The overlay mask group.
-
createColorIndexedImage
public BufferedImage createColorIndexedImage(ProgressMonitor pm) throws IOException
Creates an image for this raster data node. The method simply returnsProductUtils.createColorIndexedImage(this, null).- Parameters:
pm- a monitor to inform the user about progress- Returns:
- a greyscale/palette-based image for this raster data node
- Throws:
IOException- if the raster data is not loaded so far and reload causes an I/O error- See Also:
setImageInfo(ImageInfo)
-
createRgbImage
public BufferedImage createRgbImage(ProgressMonitor pm) throws IOException
Creates an RGB image for this raster data node.- Parameters:
pm- a monitor to inform the user about progress- Returns:
- a greyscale/palette-based image for this raster data node
- Throws:
IOException- if the raster data is not loaded so far and reload causes an I/O error- See Also:
setImageInfo(ImageInfo)
-
quantizeRasterData
public byte[] quantizeRasterData(double newMin, double newMax, double gamma, ProgressMonitor pm) throws IOException- Throws:
IOException
-
quantizeRasterData
public void quantizeRasterData(double newMin, double newMax, double gamma, byte[] samples, int offset, int stride, ProgressMonitor pm) throws IOException- Throws:
IOException
-
scale
public final double scale(double v)
Applies the scalingv * scalingFactor + scalingOffsetthe given input value. If thelog10Scaledproperty is true, the result is taken to the power of 10 after the actual scaling.
-
scaleInverse
public final double scaleInverse(double v)
Applies the inverse scaling(v - scalingOffset) / scalingFactorthe given input value. If thelog10Scaledproperty is true, the common logarithm is applied to the input before the actual scaling.- Specified by:
scaleInversein interfaceScaling- Parameters:
v- the input value- Returns:
- the scaled value
-
getPixelString
public String getPixelString(int x, int y)
Returns the pixel located at (x,y) as a string value.- Parameters:
x- the X co-ordinate of the pixel locationy- the Y co-ordinate of the pixel location- Returns:
- the pixel value at (x,y) as string or an error message text
-
isPixelWithinImageBounds
public boolean isPixelWithinImageBounds(int x, int y)
-
isSourceImageSet
public boolean isSourceImageSet()
Returns whether the source image is set on thisRasterDataNode.- Returns:
- whether the source image is set.
- Since:
- BEAM 4.5
- See Also:
getSourceImage(),setSourceImage(java.awt.image.RenderedImage),setSourceImage(com.bc.ceres.glevel.MultiLevelImage),createSourceImage()
-
getSourceImage
public MultiLevelImage getSourceImage()
Gets the source image associated with thisRasterDataNode.- Returns:
- The source image. Never
null. In the case thatisSourceImageSet()returnsfalse, the methodcreateSourceImage()will be called in order to set and return a valid source image. - Since:
- BEAM 4.2
- See Also:
createSourceImage(),isSourceImageSet()
-
createSourceImage
protected abstract RenderedImage createSourceImage()
Creates the source image associated with thisRasterDataNode. This shall preferably be aMultiLevelImageinstance which recognises this raster data node's {@link ##getImageToModelTransform() imageToModelTransform} property, if set.- Returns:
- A new source image instance.
- Since:
- BEAM 4.5
-
setSourceImage
public void setSourceImage(RenderedImage sourceImage)
Sets the source image associated with thisRasterDataNode.- Parameters:
sourceImage- The source image. Can benull. If so,isSourceImageSet()will returnfalse.- Since:
- BEAM 4.2
-
setSourceImage
public void setSourceImage(MultiLevelImage sourceImage)
Sets the source image associated with thisRasterDataNode.- Parameters:
sourceImage- The source image. Can benull. If so,isSourceImageSet()will returnfalse.- Since:
- BEAM 4.6
-
isGeophysicalImageSet
public boolean isGeophysicalImageSet()
Returns whether the geophysical image is set on thisRasterDataNode.This method belongs to preliminary API and may be removed or changed in the future.
- Returns:
- whether the geophysical image is set.
- Since:
- BEAM 4.6
-
getGeophysicalImage
public MultiLevelImage getGeophysicalImage()
- Returns:
- The geophysical source image.
- Since:
- BEAM 4.5
-
getMultiLevelModel
public MultiLevelModel getMultiLevelModel()
Gets the multi-level image (image pyramid) model that describes an image pyramid layout. If this raster data node has a source image, its multi-level model will be returned. Otherwise a new model will be created usingcreateMultiLevelModel().- Returns:
- The multi-level image (image pyramid) model
- See Also:
createMultiLevelModel()
-
createMultiLevelModel
public MultiLevelModel createMultiLevelModel()
Create a multi-level image model suited for source and geo-physical images returned by thisRasterDataNode- Returns:
- A new suitable multi-level image (image pyramid) model
- See Also:
getMultiLevelModel(),Product.createMultiLevelModel()
-
isValidMaskImageSet
public boolean isValidMaskImageSet()
Returns whether the valid mask image is set on thisRasterDataNode.- Returns:
- Whether the source image is set.
- Since:
- BEAM 4.5
-
getValidMaskImage
public MultiLevelImage getValidMaskImage()
Gets the valid-mask image associated with thisRasterDataNode. The image is based on thegetValidMaskExpression()- Returns:
- The rendered image.
- Since:
- BEAM 4.2
-
isStxSet
public boolean isStxSet()
-
getStx
public Stx getStx()
Gets the statistics. If statistics are not yet available, the method will compute (possibly inaccurate) statistics and return those.If accurate statistics are required, the
getStx(boolean, com.bc.ceres.core.ProgressMonitor)shall be used instead.This method belongs to preliminary API and may be removed or changed in the future.
- Returns:
- The statistics.
- Since:
- BEAM 4.2, revised in BEAM 4.5
- See Also:
getStx(boolean, com.bc.ceres.core.ProgressMonitor),setStx(Stx)
-
getStx
public Stx getStx(boolean accurate, ProgressMonitor pm)
Gets the statistics. If the statistics have not been set before they are computed using the given progress monitorpmand then set. This method belongs to preliminary API and may be removed or changed in the future.- Parameters:
accurate- If true, accurate statistics are computed.pm- A progress monitor which is used to compute the new statistics, if required.- Returns:
- The statistics.
- Since:
- since BEAM 4.5
-
setStx
public void setStx(Stx stx)
Sets the statistics. It is the responsibility of the caller to ensure that the given statistics are really related to thisRasterDataNode's raster data. The method fires a property change event for the propertyPROPERTY_NAME_STX. This method belongs to preliminary API and may be removed or changed in the future.- Parameters:
stx- The statistics.- Since:
- BEAM 4.2, revised in BEAM 4.5
-
computeStxImpl
protected Stx computeStxImpl(int level, ProgressMonitor pm)
Computes the statistics. May be overridden. This method belongs to preliminary API and may be removed or changed in the future.- Parameters:
level- The resolution level.pm- A progress monitor.- Returns:
- The statistics.
- Since:
- BEAM 4.5
-
getValidShape
public Shape getValidShape()
Gets the shape of the area where this raster data contains valid samples. The method returnsnull, if the entire raster contains valid samples.- Returns:
- The shape of the area where the raster data has samples, can be
null. - Since:
- BEAM 4.7
-
getAncillaryVariable
public RasterDataNode getAncillaryVariable(String... relations)
Finds the first associated ancillary band for the specified relations.- Parameters:
relations- Names of relations such as"uncertainty","variance", ornull(any).- Returns:
- The associated ancillary band or
null. - Since:
- SNAP 2.0
-
getAncillaryVariables
public RasterDataNode[] getAncillaryVariables(String... relations)
Finds any associated ancillary band for the specified relation.- Parameters:
relations- Names of relations such as"uncertainty","variance", ornull(any).- Returns:
- The associated ancillary bands or an empty array.
- Since:
- SNAP 2.0
-
addAncillaryVariable
public void addAncillaryVariable(RasterDataNode variable, String... relations)
Adds an associated ancillary variable and sets its relation names.- Parameters:
variable- The associated ancillary variable.relations- The names of the relations, may be"uncertainty","variance", ornull(not set).- Since:
- SNAP 2.0
-
removeAncillaryVariable
public void removeAncillaryVariable(RasterDataNode variable)
Removes an associated ancillary variable.- Parameters:
variable- The associated ancillary variable.- Since:
- SNAP 2.0
-
getAncillaryRelations
public String[] getAncillaryRelations()
Gets the names of an ancillary relations to another raster data node. See NetCDF-U 'rel' attribute.- Returns:
- The names of an ancillary relations to another raster data node, or an empty array.
- Since:
- SNAP 2.0
- See Also:
addAncillaryVariable(RasterDataNode, String...),removeAncillaryVariable(RasterDataNode),getAncillaryVariable(String...)
-
setAncillaryRelations
public void setAncillaryRelations(String... relations)
Sets the names of an ancillary relations to another raster data node. See NetCDF-U 'rel' attribute.- Parameters:
relations- The names of an ancillary relations.- Since:
- SNAP 2.0
- See Also:
addAncillaryVariable(RasterDataNode, String...),getAncillaryVariable(String...)
-
processRasterData
public void processRasterData(String message, RasterDataNode.RasterDataProcessor processor, ProgressMonitor pm) throws IOException
Processes the raster's data.Users of this method may also consider implementing a GPF
org.esa.snap.core.gpf.Operatoror aSingleBandedOpImageinstead.- Parameters:
message- a task descriptionprocessor- the raster processorpm- a progress monitor- Throws:
IOException
-
-