Package org.apache.sis.image
Class BandSelectImage
java.lang.Object
org.apache.sis.image.PlanarImage
org.apache.sis.image.ComputedImage
org.apache.sis.image.SourceAlignedImage
org.apache.sis.image.BandSelectImage
- All Implemented Interfaces:
RenderedImage
,Disposable
Selects or reorder bands from a source image. This operation avoid copying sample values;
it works by modifying the sample model and color model.
- Since:
- 1.1
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
The selected bands.Properties to inherit from the source image, after bands reduction if applicable.Fields inherited from class org.apache.sis.image.SourceAlignedImage
POSITIONAL_PROPERTIES
Fields inherited from class org.apache.sis.image.ComputedImage
sampleModel, SOURCE_PADDING_KEY
Fields inherited from class org.apache.sis.image.PlanarImage
GRID_GEOMETRY_KEY, MASK_KEY, POSITIONAL_ACCURACY_KEY, SAMPLE_RESOLUTIONS_KEY, STATISTICS_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
BandSelectImage
(RenderedImage source, ColorModel cm, int[] bands) Creates a new "band select" operation for the given source. -
Method Summary
Modifier and TypeMethodDescriptionprotected Raster
computeTile
(int tileX, int tileY, WritableRaster previous) Creates a raster sharing the same data buffer than the source image but showing only a subset of the bands.(package private) static RenderedImage
create
(RenderedImage source, int[] bands) Creates a new "band select" operation for the given source.boolean
Compares the given object with this image for equality.private static Object
getProperty
(RenderedImage source, String key, int[] bands) Gets a property from the given image, reducing the number of dimensions if needed.getProperty
(String key) Gets a property from this image.String[]
Returns the names of all recognized properties, ornull
if this image has no properties.int
hashCode()
Returns a hash code value for this image.Methods inherited from class org.apache.sis.image.SourceAlignedImage
filterPropertyNames, getColorModel, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, prefetch
Methods inherited from class org.apache.sis.image.ComputedImage
clearErrorFlags, createTile, dispose, equalsBase, getDestination, getSampleModel, getSource, getSource, getSources, getTile, getWritableTileIndices, hashCodeBase, hasTileWriters, isTileWritable, markDirtyTiles, markTileWritable, reference, setDestination, sourceTileChanged
-
Field Details
-
INHERITED_PROPERTIES
Properties to inherit from the source image, after bands reduction if applicable.- See Also:
-
bands
private final int[] bandsThe selected bands.
-
-
Constructor Details
-
BandSelectImage
Creates a new "band select" operation for the given source. It is caller responsibility to verify the validity of givenbands
indices.- Parameters:
source
- the image in which to select bands.cm
- the color model to associate to this image.bands
- the bands to select. Should be a clone of user-specified argument (this constructor retains the given array reference as-is, without cloning).
-
-
Method Details
-
create
Creates a new "band select" operation for the given source.- Parameters:
source
- the image in which to select bands.bands
- the bands to select.
-
getPropertyNames
Returns the names of all recognized properties, ornull
if this image has no properties.- Specified by:
getPropertyNames
in interfaceRenderedImage
- Overrides:
getPropertyNames
in classPlanarImage
- Returns:
- names of all recognized properties, or
null
if none.
-
getProperty
Gets a property from this image.- Specified by:
getProperty
in interfaceRenderedImage
- Overrides:
getProperty
in classPlanarImage
- Parameters:
key
- the name of the property to get.- Returns:
- the property value, or
Image.UndefinedProperty
if none.
-
getProperty
Gets a property from the given image, reducing the number of dimensions if needed. It is caller responsibility to verify that the given key is one of the keys enumerated inINHERITED_PROPERTIES
. -
computeTile
Creates a raster sharing the same data buffer than the source image but showing only a subset of the bands.- Specified by:
computeTile
in classComputedImage
- Parameters:
tileX
- the column index of the tile to compute.tileY
- the row index of the tile to compute.previous
- ignored.- Returns:
- computed tile for the given indices. May be the
previous
tile after update but cannot be null.
-
hashCode
public int hashCode()Returns a hash code value for this image.- Overrides:
hashCode
in classSourceAlignedImage
-
equals
Compares the given object with this image for equality.- Overrides:
equals
in classSourceAlignedImage
-