Tabnine Logo
LookupTableFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
LookupTableFactory
in
it.geosolutions.jaiext.lookup

Best Java code snippets using it.geosolutions.jaiext.lookup.LookupTableFactory (Showing top 14 results out of 315)

origin: geotools/geotools

/** Simple utility method generating a Byte Based lookup table */
private static LookupTable generateLookupTableByte(byte[] lut) {
  return LookupTableFactory.create(lut, DataBuffer.TYPE_BYTE);
}
origin: geotools/geotools

/**
 * Builds a lookup table that is the identity on all bands but the alpha one, where the opacity
 * is applied
 *
 * @param opacity
 * @param bands
 * @param alphaBand
 * @return
 */
LookupTable buildOpacityLookupTable(
    float opacity, final int bands, int alphaBand, int dataType) {
  byte[][] matrix = new byte[bands][256];
  for (int band = 0; band < matrix.length; band++) {
    if (band == alphaBand) {
      for (int i = 0; i < 256; i++) {
        matrix[band][i] = (byte) Math.round(i * opacity);
      }
    } else {
      for (int i = 0; i < 256; i++) {
        matrix[band][i] = (byte) i;
      }
    }
  }
  LookupTable table = LookupTableFactory.create(matrix, dataType);
  return table;
}
origin: geotools/geotools

private LookupTable createLookupTableByte(List<Range<Integer>> exclusionValues, int dataType) {
  final byte[] b = new byte[256];
  Arrays.fill(b, (byte) 0);
  for (Range<Integer> exclusionValue : exclusionValues) {
    final int minValue = exclusionValue.getMinValue();
    final int maxValue = exclusionValue.getMaxValue();
    for (int i = minValue; i <= maxValue; i++) {
      b[i] = (byte) INVALID_PIXEL_I;
    }
  }
  return LookupTableFactory.create(b, dataType);
}
origin: geotools/geotools

  private LookupTable createLookupTableUShort(
      List<Range<Integer>> exclusionValues, int dataType) {
    final byte[] bUShort = new byte[65536];
    Arrays.fill(bUShort, (byte) 0);
    for (Range<Integer> exclusionValue : exclusionValues) {
      final int minValue = exclusionValue.getMinValue();
      final int maxValue = exclusionValue.getMaxValue();
      for (int i = minValue; i <= maxValue; i++) {
        bUShort[i] = (byte) INVALID_PIXEL_I;
      }
    }
    return LookupTableFactory.create(bUShort, dataType);
  }
}
origin: geotools/geotools

if (max < 256) {
  table =
      LookupTableFactory.create(
          new byte[] {(byte) value0, (byte) value1}, DataBuffer.TYPE_BYTE);
} else if (max < 65536) {
  table =
      LookupTableFactory.create(
          new short[] {(short) value0, (short) value1}, true);
} else {
  table = LookupTableFactory.create(new int[] {value0, value1});
table = LookupTableFactory.create(new int[] {value0, value1}, DataBuffer.TYPE_BYTE);
origin: geotools/geotools

  LookupTable table = LookupTableFactory.create(lut, dataType);
  worker.lookup(table);
} else {
origin: geotools/geotools

switch (dataType) {
  case DataBuffer.TYPE_BYTE:
    lut = LookupTableFactory.create(IDENTITY_BYTE);
    break;
    lut = LookupTableFactory.create(IDENTITY_SHORT, unsigned);
    break;
origin: geotools/geotools

lut = LookupTableFactory.create(data, datatype);
lut = LookupTableFactory.create(data, datatype == DataBuffer.TYPE_USHORT);
origin: geotools/geotools

LookupTableFactory.create(tableData, image.getSampleModel().getDataType());
origin: geotools/geotools

      LookupTableFactory.create(table, image.getSampleModel().getDataType());
} else {
  final short[] table = new short[mapSize];
    table[i] = (short) ((oldCM.getAlpha(i) == 0) ? suggestedTransparent : i);
  lookupTable = LookupTableFactory.create(table, true);
origin: geosolutions-it/jai-ext

private LookupTable buildNoDataLookupTable(int dataType, Range noDataRange) {
  byte[] table;
  switch (dataType) {
  case DataBuffer.TYPE_BYTE:
    table = new byte[256];
    for (int i = 0; i < table.length; i++) {
      if (noDataRange.contains(i)) {
        table[i] = 0;
      } else {
        table[i] = 1;
      }
    }
    break;
  case DataBuffer.TYPE_USHORT:
    table = new byte[65536];
    for (int i = 0; i < table.length; i++) {
      if (noDataRange.contains(i)) {
        table[i] = 0;
      } else {
        table[i] = 1;
      }
    }
    break;
  default:
    throw new IllegalArgumentException(
        "Unable to handle a index color model based on data type " + dataType);
  }
  return LookupTableFactory.create(table);
}
origin: geotools/geotools

LookupTableFactory.create(lutData, mask.getSampleModel().getDataType());
origin: geotools/geotools

.rangeLookup(lookupTable)
.bandCombine(matrix)
.lookup(LookupTableFactory.create(ALPHA_LUT))
.getRenderedImage();
origin: org.geoserver/gs-wms

/**
 * This takes an image with an indexed color model that uses less than 256 colors and has a 8bit
 * sample model, and transforms it to one that has the optimal sample model (for example, 1bit
 * if the palette only has 2 colors)
 *
 * @param source
 */
private static RenderedImage optimizeSampleModel(RenderedImage source) {
  int w = source.getWidth();
  int h = source.getHeight();
  ImageLayout layout = new ImageLayout();
  layout.setColorModel(source.getColorModel());
  layout.setSampleModel(source.getColorModel().createCompatibleSampleModel(w, h));
  // if I don't force tiling off with this setting an exception is thrown
  // when writing the image out...
  layout.setTileWidth(w);
  layout.setTileHeight(h);
  RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
  LookupTable table = LookupTableFactory.create(IDENTITY_TABLE);
  // TODO SIMONE why not format?
  ImageWorker worker = new ImageWorker(source);
  worker.setRenderingHints(hints);
  worker.lookup(table);
  return worker.getRenderedImage();
}
it.geosolutions.jaiext.lookupLookupTableFactory

Most used methods

  • create
    Constructs a multi-banded short or unsigned short lookup table where each band has a different index

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JPanel (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now