/** Simple utility method generating a Byte Based lookup table */ private static LookupTable generateLookupTableByte(byte[] lut) { return LookupTableFactory.create(lut, DataBuffer.TYPE_BYTE); }
/** * Constructs a single-banded double lookup table with an index offset. * * @param data The single-banded double data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(double[] data, int offset) { return new LookupTable(data, offset); }
/** * 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; }
/** * Constructs a multi-banded double lookup table. The index offset for each band is 0. * * @param data The multi-banded double data in [band][index] format. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(double[][] data) { return new LookupTable(data); }
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); }
/** * Constructs a multi-banded double lookup table where all bands have the same index offset. * * @param data The multi-banded double data in [band][index] format. * @param offset The common offset for all bands. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(double[][] data, int offset) { return new LookupTable(data, offset); }
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); } }
/** * Constructs a multi-banded double lookup table where each band has a different index offset. * * @param data The multi-banded double data in [band][index] format. * @param offsets The offsets for the bands. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(double[][] data, int[] offsets) { return new LookupTable(data, offsets); }
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);
/** * Constructs a multi-banded byte lookup table. The index offset for each band is 0. * * @param data The multi-banded byte data in [band][index] format. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(byte[][] data) { return new LookupTable(data); }
LookupTable table = LookupTableFactory.create(lut, dataType); worker.lookup(table); } else {
/** * Constructs a single-banded int lookup table with an index offset. * * @param data The single-banded int data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(int[] data, int offset) { return new LookupTable(data, offset); }
/** * Constructs a multi-banded float lookup table where all bands have the same index offset. * * @param data The multi-banded float data in [band][index] format. * @param offset The common offset for all bands. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(float[][] data, int offset) { return new LookupTable(data, offset); }
LookupTableFactory.create(tableData, image.getSampleModel().getDataType());
/** * Constructs a single-banded double lookup table with an index offset. * * @param data The single-banded double data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ public static LookupTable create(double[] data, int offset) { return new LookupTable(data, offset); }
LookupTableFactory.create(lutData, mask.getSampleModel().getDataType());
.rangeLookup(lookupTable) .bandCombine(matrix) .lookup(LookupTableFactory.create(ALPHA_LUT)) .getRenderedImage();