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 classBuilds an image where all sample values are indices of colors in anIndexColorModel.(package private) static classInterpolation followed by conversion from floating point values to the values to store as integers in the destination image.private static final classSame asVisualization.InterpConvertoptimized for the single-band case. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ColorModelThe 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, ornullif those conversions are done byVisualization.InterpConvert.Fields inherited from class org.apache.sis.image.ResampledImage
BIDIMENSIONAL, interpolation, POSITIONAL_CONSISTENCY_KEY, toSourceFields inherited from class org.apache.sis.image.ComputedImage
sampleModel, SOURCE_PADDING_KEYFields inherited from class org.apache.sis.image.PlanarImage
GRID_GEOMETRY_KEY, MASK_KEY, POSITIONAL_ACCURACY_KEY, SAMPLE_RESOLUTIONS_KEY, STATISTICS_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateVisualization(Visualization.Builder builder) Creates a new image which will resample and convert values of the given image. -
Method Summary
Modifier and TypeMethodDescriptionprivate static Interpolationcombine(Interpolation interpolation, org.opengis.referencing.operation.MathTransform1D[] converters) Combines the given interpolation method with the given sample conversion.protected RastercomputeTile(int tileX, int tileY, WritableRaster tile) Invoked when a tile need to be computed or updated.booleanCompares the given object with this image for equality.Returns the color model associated with all rasters of this image.inthashCode()Returns a hash code value for this image.(package private) final booleanReturnstrueif this image cannot have mask.Methods inherited from class org.apache.sis.image.ResampledImage
getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getProperty, getPropertyNames, getWidth, interpolationSupportOffset, prefetch, verifyMethods 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, sourceTileChangedMethods 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, ornullif those conversions are done byVisualization.InterpConvert. Non-null array is used for allowingcomputeTile(int, int, WritableRaster)to use a shortcut avoidingResampledImagecost. 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 anIndexColorModelfor byte values. May benullif 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()Returnstrueif this image cannot have mask.- Overrides:
hasNoMaskin classResampledImage
-
getColorModel
Returns the color model associated with all rasters of this image.- Specified by:
getColorModelin interfaceRenderedImage- Overrides:
getColorModelin classResampledImage- Returns:
- the color model, or
nullif 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:
computeTilein 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:
equalsin classResampledImage- Parameters:
object- the object to compare with this image.- Returns:
trueif 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:
hashCodein classResampledImage- Returns:
- a hash code value based on a description of the operation performed by this image.
-