Java Code Examples for javax.media.jai.Interpolation#INTERP_NEAREST

The following examples show how to use javax.media.jai.Interpolation#INTERP_NEAREST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RasterDataAdapter.java    From geowave with Apache License 2.0 6 votes vote down vote up
public RasterDataAdapter(
    final String coverageName,
    final SampleModel sampleModel,
    final ColorModel colorModel,
    final Map<String, String> metadata,
    final int tileSize,
    final double[][] noDataValuesPerBand,
    final double[] backgroundValuesPerBand,
    final boolean buildPyramid) {
  this(
      coverageName,
      sampleModel,
      colorModel,
      metadata,
      tileSize,
      noDataValuesPerBand,
      backgroundValuesPerBand,
      new HistogramConfig(sampleModel),
      true,
      Interpolation.INTERP_NEAREST,
      buildPyramid,
      new NoDataMergeStrategy());
}
 
Example 2
Source File: RasterDataAdapter.java    From geowave with Apache License 2.0 6 votes vote down vote up
protected static byte interpolationToByte(final Interpolation interpolation) {
  // this is silly because it seems like a translation JAI should provide,
  // but it seems its not provided and its the most efficient approach
  // (rather than serializing class names)
  if (interpolation instanceof InterpolationNearest) {
    return Interpolation.INTERP_NEAREST;
  }
  if (interpolation instanceof InterpolationBilinear) {
    return Interpolation.INTERP_BILINEAR;
  }
  if (interpolation instanceof InterpolationBicubic2) {
    return Interpolation.INTERP_BICUBIC_2;
  }

  return Interpolation.INTERP_BICUBIC;
}
 
Example 3
Source File: RasterUtils.java    From geowave with Apache License 2.0 5 votes vote down vote up
public static RasterDataAdapter createDataAdapterTypeDouble(
    final String coverageName,
    final int numBands,
    final int tileSize,
    final double[] minsPerBand,
    final double[] maxesPerBand,
    final String[] namesPerBand,
    final RasterTileMergeStrategy<?> mergeStrategy) {
  final double[][] noDataValuesPerBand = new double[numBands][];
  final double[] backgroundValuesPerBand = new double[numBands];
  final int[] bitsPerSample = new int[numBands];
  for (int i = 0; i < numBands; i++) {
    noDataValuesPerBand[i] = new double[] {Double.valueOf(Double.NaN)};
    backgroundValuesPerBand[i] = Double.valueOf(Double.NaN);
    bitsPerSample[i] = DataBuffer.getDataTypeSize(DataBuffer.TYPE_DOUBLE);
  }
  final SampleModel sampleModel = createRasterTypeDouble(numBands, tileSize).getSampleModel();
  return new RasterDataAdapter(
      coverageName,
      sampleModel,
      new ComponentColorModel(
          new BogusColorSpace(numBands),
          bitsPerSample,
          false,
          false,
          Transparency.OPAQUE,
          DataBuffer.TYPE_DOUBLE),
      new HashMap<String, String>(),
      tileSize,
      minsPerBand,
      maxesPerBand,
      namesPerBand,
      noDataValuesPerBand,
      backgroundValuesPerBand,
      null,
      false,
      Interpolation.INTERP_NEAREST,
      false,
      mergeStrategy);
}