Class Visualization

All Implemented Interfaces:
RenderedImage, Disposable

final class Visualization extends ResampledImage
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
  • Field Details

    • converters

      private final org.opengis.referencing.operation.MathTransform1D[] converters
      Transfer functions to apply on each band of the source image, or null if those conversions are done by Visualization.InterpConvert. Non-null array is used for allowing computeTile(int, int, WritableRaster) to use a shortcut avoiding ResampledImage cost. Outputs should be values in the [0 … 255] range; values outside that ranges will be clamped.
    • colorModel

      private final ColorModel colorModel
      The color model for the expected range of values. Typically an IndexColorModel for byte values. May be null if the color model is unknown.
  • Constructor Details

    • Visualization

      private Visualization(Visualization.Builder builder)
      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()
      Returns true if this image cannot have mask.
      Overrides:
      hasNoMask in class ResampledImage
    • getColorModel

      public ColorModel getColorModel()
      Returns the color model associated with all rasters of this image.
      Specified by:
      getColorModel in interface RenderedImage
      Overrides:
      getColorModel in class ResampledImage
      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 class ResampledImage
      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. Otherwise null.
      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

      public boolean equals(Object object)
      Compares the given object with this image for equality.
      Overrides:
      equals in class ResampledImage
      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 class ResampledImage
      Returns:
      a hash code value based on a description of the operation performed by this image.