Class Visualization.Builder

java.lang.Object
org.apache.sis.image.Visualization.Builder
Enclosing class:
Visualization

static final class Visualization.Builder extends Object
Builds an image where all sample values are indices of colors in an IndexColorModel. If the given image stores sample values as unsigned bytes or short integers, then those values are used as-is (they are not copied or converted). Otherwise Visualization will convert sample values to unsigned bytes in order to enable the use of IndexColorModel.

This builder accepts two kinds of input:

The resulting image is suitable for visualization purposes but should not be used for computation purposes. There is no guarantee about the number of bands in returned image and the formulas used for converting floating point values to integer values.

Resampling

Visualization can optionally be combined with a ResampledImage operation. This can be done by providing a non-null value to the toSource argument.
See Also:
  • Field Details

    • NUM_BANDS

      private static final int NUM_BANDS
      Number of bands of the image to create.
      See Also:
    • VISIBLE_BAND

      private static final int VISIBLE_BAND
      Band to make visible.
      See Also:
    • bounds

      private Rectangle bounds
      Pixel coordinates of the visualization image, or null if same as source image.
    • source

      private RenderedImage source
      Image to be resampled and converted.
    • toSource

      private org.opengis.referencing.operation.MathTransform toSource
      Conversion from pixel coordinates of visualization image to pixel coordinates of source image.
    • sourceBands

      private List<SampleDimension> sourceBands
      Description of source bands, or null if none.
    • rangesAndColors

      private Collection<Map.Entry<NumberRange<?>,Color[]>> rangesAndColors
      Colors to apply for range of sample values in source image, or null if none.
    • layout

      ImageLayout layout
      Computer of tile size.
    • interpolation

      Interpolation interpolation
      Object to use for performing interpolations.
    • categoryColors

      Function<Category,Color[]> categoryColors
      The colors to use for given categories of sample values, or null is unspecified.
    • fillValues

      Number[] fillValues
      Values to use for pixels in this image that cannot be mapped to pixels in source image.
    • positionalAccuracyHints

      javax.measure.Quantity<?>[] positionalAccuracyHints
      Values of "org.apache.sis.PositionalAccuracy" property, or null if none.
    • converters

      private org.opengis.referencing.operation.MathTransform1D[] converters
      Transfer functions to apply on each band of the source image.
    • sampleModel

      private SampleModel sampleModel
      Sample model of Visualization image.
    • colorModel

      private ColorModel colorModel
      Color model of Visualization image.
  • Constructor Details

    • Builder

      Builder(Rectangle bounds, RenderedImage source, org.opengis.referencing.operation.MathTransform toSource, List<SampleDimension> sourceBands)
      Creates a builder for a visualization image with colors inferred from sample dimensions.
      Parameters:
      bounds - desired domain of pixel coordinates, or null if same as source image.
      source - the image for which to replace the color model.
      toSource - pixel coordinates conversion to source image, or null if none.
      sourceBands - description of source bands.
    • Builder

      Builder(RenderedImage source, Collection<Map.Entry<NumberRange<?>,Color[]>> rangesAndColors)
      Creates a builder for a visualization image with colors specified for range of values. Current version assumes that target image bounds are the same than source image bounds and that there is no change of pixel coordinates, but this is not a real restriction. The bounds and toSource arguments could be added back in the future if useful.
      Parameters:
      source - the image for which to replace the color model.
      rangesAndColors - range of sample values in source image associated to colors to apply.
  • Method Details

    • create

      RenderedImage create(ImageProcessor processor) throws org.opengis.referencing.operation.NoninvertibleTransformException
      Returns an image where all sample values are indices of colors in an IndexColorModel. If the source image stores sample values as unsigned bytes or short integers, then those values are used as-is (they are not copied or converted). Otherwise this operation will convert sample values to unsigned bytes in order to enable the use of IndexColorModel.

      The resulting image is suitable for visualization but should not be used for computational purposes. There is no guarantee about the number of bands in returned image and the formulas used for converting floating point values to integer values.

      Resampling

      This operation can optionally be combined with a ResampledImage operation. This can be done by providing a non-null value to the toSource field.
      Parameters:
      processor - the processor invoking this constructor.
      Returns:
      resampled and recolored image for visualization purposes only.
      Throws:
      org.opengis.referencing.operation.NoninvertibleTransformException - if sample values in source image cannot be converted to sample values in the recolored image.