# Class Colorizer.Target

Object
Target

Enclosing interface:
  `Colorizer`

public static class Colorizer.Target extends Object
Information about the computed image to colorize. The most important information is the `SampleModel`, as the inferred color model must be compatible with the sample model. A `Target` instance may also contain contextual information such as the `SampleDimension`s of the target coverage.

Since:
  1.4

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Target(SampleModel model, RenderedImage template)`
  Creates a new target with the same sample dimensions and visible band as the given image.
  `Target(SampleModel model, List<SampleDimension> ranges, int visibleBand)`
  Creates a new target with the sample model of the image to colorize.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Optional<List<SampleDimension>>`
  `getRanges()`
  Returns a description of the bands of the image to colorize.
  `SampleModel`
  `getSampleModel()`
  Returns the sample model of the computed image to colorize.
  `OptionalInt`
  `getVisibleBand()`
  Returns the band to colorize if the colorization algorithm uses only one band.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Target

    public Target(SampleModel model, List<SampleDimension> ranges, int visibleBand)
    Creates a new target with the sample model of the image to colorize.
    Parameters:
      `model` - sample model of the computed image to colorize (mandatory).
      `ranges` - description of the bands of the computed image to colorize, or `null` if none.
      `visibleBand` - the band to colorize if the colorization algorithm uses only one band, or -1 if none.

  - ### Target

    public Target(SampleModel model, RenderedImage template)
    Creates a new target with the same sample dimensions and visible band as the given image. This is a convenience constructor for operations producing the same kind of data than an existing image, taken as a template. The list of sample dimensions is fetched from the image property associated to the "org.apache.sis.SampleDimensions" key.
    Parameters:
      `model` - sample model of the computed image to colorize (mandatory).
      `template` - the image from which to get the sample dimensions and visible band, or `null` if none.
    Since:
      1.5

- ## Method Details

  - ### getSampleModel

    public SampleModel getSampleModel()
    Returns the sample model of the computed image to colorize. The color model created by `Colorizer​.apply(Target)` must be compatible with this sample model.
    Returns:
      computed image sample model (never null).
    See Also:
      - `ColorModel​.isCompatibleSampleModel(SampleModel)`

  - ### getRanges

    public Optional<List<SampleDimension>> getRanges()
    Returns a description of the bands of the image to colorize. This information may be present if the image operation is invoked by a `GridCoverageProcessor` operation, or if the source image contains the "org.apache.sis.SampleDimensions" property Note that in the latter case, the list may contain null elements if this information is missing in some bands.
    Returns:
      description of the bands of the image to colorize.
    See Also:
      - `GridCoverage​.getSampleDimensions()`

  - ### getVisibleBand

    public OptionalInt getVisibleBand()
    Returns the band to colorize if the colorization algorithm uses only one band. The value is always positive and less than the number of bands of the sample model. This information is ignored if the colorization uses many bands (e.g. `Colorizer​.ARGB`).
    Returns:
      the band to colorize if the colorization algorithm uses only one band.
    See Also:
      - `ImageRenderer​.setVisibleBand(int)`