Class TLcdIndexLookupOp

java.lang.Object
com.luciad.imaging.operator.ALcdImageOperator
com.luciad.imaging.operator.TLcdIndexLookupOp

public final class TLcdIndexLookupOp extends ALcdImageOperator
Performs a color lookup using a single-band image.

The TLcdLookupTable specified must satisfy the following constraints:

  • 1-dimensional
  • 4 components per pixel, red/green/blue/alpha

The range of values that is mapped to the lookup table is determined as follows:

  1. The range in [MIN_VALUE, MAX_VALUE] if they are specified.
  2. The range in [ALcdBandSemantics.getMinValue(), ALcdBandSemantics.getMaxValue()] if they are specified.
  3. The full normalized range of the band otherwise.

Example


 // Define the table colors
 // With interpolation enabled, a smooth gradient is automatically created
 byte[] lookupColors = new byte[]{         0,          0, (byte) 255, (byte) 255,  // blue
                                           0, (byte) 255, (byte) 255, (byte) 255,
                                           0, (byte) 255,          0, (byte) 255,  // green
                                  (byte) 255, (byte) 255,          0, (byte) 255,
                                  (byte) 255,          0,          0, (byte) 255}; // red

 TLcdLookupTable indexLookupTable = TLcdLookupTable.newBuilder()
   .dimensions(5)
   .componentCount(4)
   .data(ByteBuffer.wrap(lookupColors))
   .build();

 //use a chain. First bandSelect then indexLookUp
 ALcdImageOperatorChain chain = ALcdImageOperatorChain.newBuilder()
                                                      .bandSelect(new int[]{0})
                                                      .indexLookup(indexLookupTable, new double[]{0.0, 0.0, 0.0, 0.0})
                                                      .build();

 ALcdImage outputImage = chain.apply(inputImage);
 
Input
Output
Since:
2014.0
  • Field Details

    • NAME

      public static final String NAME
      Name of the operator.
      See Also:
    • INPUT_IMAGE

      public static final TLcdDataProperty INPUT_IMAGE
      The input image.
    • LOOKUP_TABLE

      public static final TLcdDataProperty LOOKUP_TABLE
      The lookup table to use.
    • NAN_COLOR

      public static final TLcdDataProperty NAN_COLOR
      The color to set invalid pixels to.
    • INDEX_LOOKUP_FILTER_TYPE

      public static final TLcdDataType INDEX_LOOKUP_FILTER_TYPE
      Input data type of the operator.
  • Constructor Details

    • TLcdIndexLookupOp

      public TLcdIndexLookupOp()
      Default constructor.
  • Method Details

    • apply

      public ALcdImage apply(ILcdDataObject aParameters)
      Description copied from class: ALcdImageOperator
      Applies this operator to the given input parameters. The parameters are stored in a data object which must be of the type given by ALcdImageOperator.getParameterDataType().
      Specified by:
      apply in class ALcdImageOperator
      Parameters:
      aParameters - the parameters for the operator
      Returns:
      the image produced by the operator
    • indexLookup

      public static ALcdImage indexLookup(ALcdImage aImage, TLcdLookupTable aLUT)
      Perform a color lookup operation.
      Parameters:
      aImage - the input image.
      aLUT - the lookup table to use.
      Returns:
      an image equivalent to the input, with every value replaced by its corresponding color in the lookup table.
    • indexLookup

      public static ALcdImage indexLookup(ALcdImage aSource, TLcdLookupTable aLUT, double[] aNaNColor)
      Perform a color lookup operation.
      Parameters:
      aSource - the input image.
      aLUT - the lookup table to use.
      aNaNColor - color to use for pixels that have an invalid or no value.
      Returns:
      an image equivalent to the input, with every value replaced by its corresponding color in the lookup table.