Package org.apache.sis.image
Class Visualization
java.lang.Object
org.apache.sis.image.PlanarImage
org.apache.sis.image.ComputedImage
org.apache.sis.image.ResampledImage
org.apache.sis.image.Visualization
- All Implemented Interfaces:
RenderedImage
,Disposable
Image generated for visualization purposes only (not to be used for computation purposes).
This class merges
ResampledImage
, BandedSampleConverter
and RecoloredImage
operations
in a single operation for efficiency. This merge avoids creating intermediate tiles of float
values.
By writing directly byte
values, we save memory and CPU because
WritableRaster.setPixel(int, int, int[])
has more efficient implementations for integers.- Since:
- 1.1
- Version:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Builds an image where all sample values are indices of colors in anIndexColorModel
.(package private) static class
Interpolation followed by conversion from floating point values to the values to store as integers in the destination image.private static final class
Same asVisualization.InterpConvert
optimized for the single-band case. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ColorModel
The color model for the expected range of values.private final org.opengis.referencing.operation.MathTransform1D[]
Transfer functions to apply on each band of the source image, ornull
if those conversions are done byVisualization.InterpConvert
.Fields inherited from class org.apache.sis.image.ResampledImage
BIDIMENSIONAL, interpolation, POSITIONAL_CONSISTENCY_KEY, toSource
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
Visualization
(Visualization.Builder builder) Creates a new image which will resample and convert values of the given image. -
Method Summary
Modifier and TypeMethodDescriptionprivate static Interpolation
combine
(Interpolation interpolation, org.opengis.referencing.operation.MathTransform1D[] converters) Combines the given interpolation method with the given sample conversion.protected Raster
computeTile
(int tileX, int tileY, WritableRaster tile) Invoked when a tile need to be computed or updated.boolean
Compares the given object with this image for equality.Returns the color model associated with all rasters of this image.int
hashCode()
Returns a hash code value for this image.(package private) final boolean
Returnstrue
if this image cannot have mask.Methods inherited from class org.apache.sis.image.ResampledImage
getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getProperty, getPropertyNames, getWidth, interpolationSupportOffset, prefetch, verify
Methods inherited from class org.apache.sis.image.ComputedImage
clearErrorFlags, createTile, dispose, equalsBase, getDestination, getSampleModel, getSource, getSource, getSources, getTile, getTileHeight, getTileWidth, getWritableTileIndices, hashCodeBase, hasTileWriters, isTileWritable, markDirtyTiles, markTileWritable, reference, setDestination, sourceTileChanged
Methods inherited from class org.apache.sis.image.PlanarImage
copyData, getBounds, getData, getData, getNumXTiles, getNumYTiles, getTileGridXOffset, getTileGridYOffset, toString
-
Field Details
-
converters
private final org.opengis.referencing.operation.MathTransform1D[] convertersTransfer functions to apply on each band of the source image, ornull
if those conversions are done byVisualization.InterpConvert
. Non-null array is used for allowingcomputeTile(int, int, WritableRaster)
to use a shortcut avoidingResampledImage
cost. Outputs should be values in the [0 … 255] range; values outside that ranges will be clamped. -
colorModel
The color model for the expected range of values. Typically anIndexColorModel
for byte values. May benull
if the color model is unknown.
-
-
Constructor Details
-
Visualization
Creates a new image which will resample and convert values of the given image. See parent class for more details about arguments.
-
-
Method Details
-
combine
private static Interpolation combine(Interpolation interpolation, org.opengis.referencing.operation.MathTransform1D[] converters) Combines the given interpolation method with the given sample conversion. -
hasNoMask
final boolean hasNoMask()Returnstrue
if this image cannot have mask.- Overrides:
hasNoMask
in classResampledImage
-
getColorModel
Returns the color model associated with all rasters of this image.- Specified by:
getColorModel
in interfaceRenderedImage
- Overrides:
getColorModel
in classResampledImage
- Returns:
- the color model, or
null
if unspecified.
-
computeTile
protected Raster computeTile(int tileX, int tileY, WritableRaster tile) throws org.opengis.referencing.operation.TransformException Invoked when a tile need to be computed or updated.- Overrides:
computeTile
in classResampledImage
- Parameters:
tileX
- the column index of the tile to compute.tileY
- the row index of the tile to compute.tile
- if the tile already exists but needs to be updated, the tile to update. Otherwisenull
.- Returns:
- computed tile for the given indices.
- Throws:
org.opengis.referencing.operation.TransformException
- if an error occurred while computing pixel coordinates or converting sample values.
-
equals
Compares the given object with this image for equality.- Overrides:
equals
in classResampledImage
- Parameters:
object
- the object to compare with this image.- Returns:
true
if the given object is an image performing the same resampling than this image.
-
hashCode
public int hashCode()Returns a hash code value for this image.- Overrides:
hashCode
in classResampledImage
- Returns:
- a hash code value based on a description of the operation performed by this image.
-