ShortLookupTablepublic class ShortLookupTable extends LookupTable The ShortLookupTable class provides provides functionality for lookup
operations, and is defined by an input short array for bands or components of
image and an offset value. The offset value will be subtracted from the input
values before indexing the input arrays. The output of a lookup operation is
represented as an unsigned short array. |
Fields Summary |
---|
private short[] | dataThe data. |
Constructors Summary |
---|
public ShortLookupTable(int offset, short[] data)Instantiates a new ShortLookupTable with the specified offset value and
the specified short array which represents lookup table for all bands.
super(offset, 1);
this.data = new short[1][data.length];
// The data array stored as a reference
this.data[0] = data;
| public ShortLookupTable(int offset, short[] data)Instantiates a new ShortLookupTable with the specified offset value and
the specified short array of arrays which represents lookup table for
each band.
super(offset, data.length);
this.data = new short[data.length][data[0].length];
for (int i = 0; i < data.length; i++) {
// The data array for each band stored as a reference
this.data[i] = data[i];
}
|
Methods Summary |
---|
public final short[][] | getTable()Gets the lookup table of this ShortLookupTable object. If this
ShortLookupTable object has one short array for all bands, the returned
array length is one.
return data;
| public short[] | lookupPixel(short[] src, short[] dst)Returns a short array which contains samples of the specified pixel which
is translated with the lookup table of this ShortLookupTable object. The
resulted array is stored to the dst array.
if (dst == null) {
dst = new short[src.length];
}
int offset = getOffset();
if (getNumComponents() == 1) {
for (int i = 0; i < src.length; i++) {
dst[i] = data[0][src[i] - offset];
}
} else {
for (int i = 0; i < getNumComponents(); i++) {
dst[i] = data[i][src[i] - offset];
}
}
return dst;
| public int[] | lookupPixel(int[] src, int[] dst)
if (dst == null) {
dst = new int[src.length];
}
int offset = getOffset();
if (getNumComponents() == 1) {
for (int i = 0; i < src.length; i++) {
dst[i] = data[0][src[i] - offset];
}
} else {
for (int i = 0; i < getNumComponents(); i++) {
dst[i] = data[i][src[i] - offset];
}
}
return dst;
|
|