| java.lang.Object javax.media.jai.LookupTableJAI
All known Subclasses: javax.media.jai.ColorCube,
LookupTableJAI | public class LookupTableJAI extends Object implements Serializable(Code) | | A lookup table object associated with the "Lookup" operation. The
"Lookup" operation is described in
javax.media.jai.operator.LookupDescriptor .
This object represents a single- or multi-banded table of any
JAI supported data type. A single- or multi-banded source image
of integral data types is passed through the table and transformed
into a single- or multi-banded destination image of either integral
and floating point data types.
The table data may cover only a subrange of the legal range of the
input data type. The subrange is selected by means of an offset parameter
which is to be subtracted from the input value before indexing into the
table array. When only a subranged table is used with a source image, it
is up to the user to make certain that the source image does not have
pixel values outside of the table range. Otherwise,
an ArrayIndexOutOfBoundsException can occur.
The table data is saved by reference only.
See Also: javax.media.jai.operator.LookupDescriptor |
Field Summary | |
transient DataBuffer | data The table data. |
Constructor Summary | |
public | LookupTableJAI(byte[] data) Constructs a single-banded byte lookup table. | public | LookupTableJAI(byte[] data, int offset) Constructs a single-banded byte lookup table with an index offset. | public | LookupTableJAI(byte[][] data) Constructs a multi-banded byte lookup table. | public | LookupTableJAI(byte[][] data, int offset) Constructs a multi-banded byte lookup table where all bands have
the same index offset. | public | LookupTableJAI(byte[][] data, int[] offsets) Constructs a multi-banded byte lookup table where each band has
a different index offset. | public | LookupTableJAI(short[] data, boolean isUShort) Constructs a single-banded short or unsigned short lookup table. | public | LookupTableJAI(short[] data, int offset, boolean isUShort) Constructs a single-banded short or unsigned short lookup table with
an index offset. | public | LookupTableJAI(short[][] data, boolean isUShort) Constructs a multi-banded short or unsigned short lookup table. | public | LookupTableJAI(short[][] data, int offset, boolean isUShort) Constructs a multi-banded short or unsigned short lookup table where all
bands have the same index offset. | public | LookupTableJAI(short[][] data, int[] offsets, boolean isUShort) Constructs a multi-banded short or unsigned short lookup table where
each band has a different index offset. | public | LookupTableJAI(int[] data) Constructs a single-banded int lookup table. | public | LookupTableJAI(int[] data, int offset) Constructs a single-banded int lookup table with an index offset. | public | LookupTableJAI(int[][] data) Constructs a multi-banded int lookup table. | public | LookupTableJAI(int[][] data, int offset) Constructs a multi-banded int lookup table where all bands have
the same index offset. | public | LookupTableJAI(int[][] data, int[] offsets) Constructs a multi-banded int lookup table where each band has
a different index offset. | public | LookupTableJAI(float[] data) Constructs a single-banded float lookup table. | public | LookupTableJAI(float[] data, int offset) Constructs a single-banded float lookup table with an index offset. | public | LookupTableJAI(float[][] data) Constructs a multi-banded float lookup table. | public | LookupTableJAI(float[][] data, int offset) Constructs a multi-banded float lookup table where all bands have
the same index offset. | public | LookupTableJAI(float[][] data, int[] offsets) Constructs a multi-banded float lookup table where each band has
a different index offset. | public | LookupTableJAI(double[] data) Constructs a single-banded double lookup table. | public | LookupTableJAI(double[] data, int offset) Constructs a single-banded double lookup table with an index offset. | public | LookupTableJAI(double[][] data) Constructs a multi-banded double lookup table. | public | LookupTableJAI(double[][] data, int offset) Constructs a multi-banded double lookup table where all bands have
the same index offset. | public | LookupTableJAI(double[][] data, int[] offsets) Constructs a multi-banded double lookup table where each band has
a different index offset. |
Method Summary | |
public int | findNearestEntry(float[] pixel) Determine which entry in the LookupTableJAI is closest
in Euclidean distance to the argument pixel.
Parameters: pixel - The pixel the closest entry to which is to be found. | public byte[][] | getByteData() Returns the byte table data in array format, or null if the
table's data type is not byte. | public byte[] | getByteData(int band) Returns the byte table data of a specific band in array format,
or null if the table's data type is not byte. | public DataBuffer | getData() Returns the table data as a DataBuffer. | public int | getDataType() Returns the data type of the table data. | public int | getDestNumBands(int srcNumBands) Returns the number of bands of the destination image, based on
the number of bands of the source image and lookup table.
Parameters: srcNumBands - The number of bands of the source image. | public SampleModel | getDestSampleModel(SampleModel srcSampleModel) Returns a SampleModel suitable for holding the output
of a lookup operation on the source data described by a given
SampleModel with this table. | public SampleModel | getDestSampleModel(SampleModel srcSampleModel, int width, int height) Returns a SampleModel suitable for holding the output
of a lookup operation on the source data described by a given
SampleModel with this table. | public double[][] | getDoubleData() Returns the double table data in array format, or null if the
table's data type is not double. | public double[] | getDoubleData(int band) Returns the double table data of a specific band in array format,
or null if table's data type is not double. | public float[][] | getFloatData() Returns the float table data in array format, or null if the
table's data type is not float. | public float[] | getFloatData(int band) Returns the float table data of a specific band in array format,
or null if table's data type is not float. | public int[][] | getIntData() Returns the integer table data in array format, or null if the
table's data type is not int. | public int[] | getIntData(int band) Returns the integer table data of a specific band in array format,
or null if table's data type is not int. | public int | getNumBands() Returns the number of bands of the table. | public int | getNumEntries() Returns the number of entries per band of the table. | public int | getOffset() Returns the index offset of entry 0 for the default band. | public int | getOffset(int band) Returns the index offset of entry 0 for a specific band. | public int[] | getOffsets() Returns the index offsets of entry 0 for all bands. | public short[][] | getShortData() Returns the short table data in array format, or null if the
table's data type is not short. | public short[] | getShortData(int band) Returns the short table data of a specific band in array format,
or null if the table's data type is not short. | public boolean | isIntegralDataType(SampleModel sampleModel) Validates data type. | public boolean | isIntegralDataType(int dataType) Returns true if the specified data type is
an integral data type, such as byte, ushort, short, or int. | public int | lookup(int band, int value) Performs lookup on a given value belonging to a given source
band, and returns the result as an int. | public WritableRaster | lookup(WritableRaster src) Performs table lookup in place on a given WritableRaster. | public WritableRaster | lookup(Raster src, WritableRaster dst, Rectangle rect) Performs table lookup on a source Raster, writing the result
into a supplied WritableRaster. | public double | lookupDouble(int band, int value) Performs lookup on a given value belonging to a given source
band, and returns the result as a double. | public float | lookupFloat(int band, int value) Performs lookup on a given value belonging to a given source
band, and returns the result as a float. |
data | transient DataBuffer data(Code) | | The table data.
|
LookupTableJAI | public LookupTableJAI(byte[] data)(Code) | | Constructs a single-banded byte lookup table. The index offset is 0.
Parameters: data - The single-banded byte data. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(byte[] data, int offset)(Code) | | Constructs a single-banded byte lookup table with an index offset.
Parameters: data - The single-banded byte data. Parameters: offset - The offset. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(byte[][] data)(Code) | | Constructs a multi-banded byte lookup table. The index offset for
each band is 0.
Parameters: data - The multi-banded byte data in [band][index] format. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(byte[][] data, int offset)(Code) | | Constructs a multi-banded byte lookup table where all bands have
the same index offset.
Parameters: data - The multi-banded byte data in [band][index] format. Parameters: offset - The common offset for all bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(byte[][] data, int[] offsets)(Code) | | Constructs a multi-banded byte lookup table where each band has
a different index offset.
Parameters: data - The multi-banded byte data in [band][index] format. Parameters: offsets - The offsets for the bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(short[] data, boolean isUShort)(Code) | | Constructs a single-banded short or unsigned short lookup table.
The index offset is 0.
Parameters: data - The single-banded short data. Parameters: isUShort - True if data type is DataBuffer.TYPE_USHORT;false if data type is DataBuffer.TYPE_SHORT. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(short[] data, int offset, boolean isUShort)(Code) | | Constructs a single-banded short or unsigned short lookup table with
an index offset.
Parameters: data - The single-banded short data. Parameters: offset - The offset. Parameters: isUShort - True if data type is DataBuffer.TYPE_USHORT;false if data type is DataBuffer.TYPE_SHORT. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(short[][] data, boolean isUShort)(Code) | | Constructs a multi-banded short or unsigned short lookup table.
The index offset for each band is 0.
Parameters: data - The multi-banded short data in [band][index] format. Parameters: isUShort - True if data type is DataBuffer.TYPE_USHORT;false if data type is DataBuffer.TYPE_SHORT. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(short[][] data, int offset, boolean isUShort)(Code) | | Constructs a multi-banded short or unsigned short lookup table where all
bands have the same index offset.
Parameters: data - The multi-banded short data in [band][index] format. Parameters: offset - The common offset for all bands. Parameters: isUShort - True if data type is DataBuffer.TYPE_USHORT;false if data type is DataBuffer.TYPE_SHORT. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(short[][] data, int[] offsets, boolean isUShort)(Code) | | Constructs a multi-banded short or unsigned short lookup table where
each band has a different index offset.
Parameters: data - The multi-banded short data in [band][index] format. Parameters: offsets - The offsets for the bands. Parameters: isUShort - True if data type is DataBuffer.TYPE_USHORT;false if data type is DataBuffer.TYPE_SHORT. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(int[] data)(Code) | | Constructs a single-banded int lookup table. The index offset is 0.
Parameters: data - The single-banded int data. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(int[] data, int offset)(Code) | | Constructs a single-banded int lookup table with an index offset.
Parameters: data - The single-banded int data. Parameters: offset - The offset. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(int[][] data)(Code) | | Constructs a multi-banded int lookup table. The index offset for
each band is 0.
Parameters: data - The multi-banded int data in [band][index] format. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(int[][] data, int offset)(Code) | | Constructs a multi-banded int lookup table where all bands have
the same index offset.
Parameters: data - The multi-banded int data in [band][index] format. Parameters: offset - The common offset for all bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(int[][] data, int[] offsets)(Code) | | Constructs a multi-banded int lookup table where each band has
a different index offset.
Parameters: data - The multi-banded int data in [band][index] format. Parameters: offsets - The offsets for the bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(float[] data)(Code) | | Constructs a single-banded float lookup table. The index offset is 0.
Parameters: data - The single-banded float data. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(float[] data, int offset)(Code) | | Constructs a single-banded float lookup table with an index offset.
Parameters: data - The single-banded float data. Parameters: offset - The offset. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(float[][] data)(Code) | | Constructs a multi-banded float lookup table. The index offset for
each band is 0.
Parameters: data - The multi-banded float data in [band][index] format. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(float[][] data, int offset)(Code) | | Constructs a multi-banded float lookup table where all bands have
the same index offset.
Parameters: data - The multi-banded float data in [band][index] format. Parameters: offset - The common offset for all bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(float[][] data, int[] offsets)(Code) | | Constructs a multi-banded float lookup table where each band has
a different index offset.
Parameters: data - The multi-banded float data in [band][index] format. Parameters: offsets - The offsets for the bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(double[] data)(Code) | | Constructs a single-banded double lookup table. The index offset is 0.
Parameters: data - The single-banded double data. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(double[] data, int offset)(Code) | | Constructs a single-banded double lookup table with an index offset.
Parameters: data - The single-banded double data. Parameters: offset - The offset. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(double[][] data)(Code) | | Constructs a multi-banded double lookup table. The index offset for
each band is 0.
Parameters: data - The multi-banded double data in [band][index] format. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(double[][] data, int offset)(Code) | | Constructs a multi-banded double lookup table where all bands have
the same index offset.
Parameters: data - The multi-banded double data in [band][index] format. Parameters: offset - The common offset for all bands. throws: IllegalArgumentException - if data is null. |
LookupTableJAI | public LookupTableJAI(double[][] data, int[] offsets)(Code) | | Constructs a multi-banded double lookup table where each band has
a different index offset.
Parameters: data - The multi-banded double data in [band][index] format. Parameters: offsets - The offsets for the bands. throws: IllegalArgumentException - if data is null. |
findNearestEntry | public int findNearestEntry(float[] pixel)(Code) | | Determine which entry in the LookupTableJAI is closest
in Euclidean distance to the argument pixel.
Parameters: pixel - The pixel the closest entry to which is to be found. the index of the closest entry. If the data array of thelookup table is in the format data[numBands][numEntries], then thevalue v for band b of the closest entry isv = data[b][index - lookup.getOffset()] where index is the returned value of this method. throws: IllegalArgumentException - if pixel is null. |
getByteData | public byte[][] getByteData()(Code) | | Returns the byte table data in array format, or null if the
table's data type is not byte.
|
getByteData | public byte[] getByteData(int band)(Code) | | Returns the byte table data of a specific band in array format,
or null if the table's data type is not byte.
|
getData | public DataBuffer getData()(Code) | | Returns the table data as a DataBuffer.
|
getDataType | public int getDataType()(Code) | | Returns the data type of the table data.
|
getDestNumBands | public int getDestNumBands(int srcNumBands)(Code) | | Returns the number of bands of the destination image, based on
the number of bands of the source image and lookup table.
Parameters: srcNumBands - The number of bands of the source image. the number of bands in destination image. |
getDestSampleModel | public SampleModel getDestSampleModel(SampleModel srcSampleModel)(Code) | | Returns a SampleModel suitable for holding the output
of a lookup operation on the source data described by a given
SampleModel with this table. The width and height of the destination
SampleModel are the same as that of the source. This method will
return null if the source SampleModel has a non-integral data type.
Parameters: srcSampleModel - The SampleModel of the source image. throws: IllegalArgumentException - if srcSampleModel is null. sampleModel suitable for the destination image. |
getDestSampleModel | public SampleModel getDestSampleModel(SampleModel srcSampleModel, int width, int height)(Code) | | Returns a SampleModel suitable for holding the output
of a lookup operation on the source data described by a given
SampleModel with this table. This method will return null if the
source SampleModel has a non-integral data type.
Parameters: srcSampleModel - The SampleModel of the source image. Parameters: width - The width of the destination SampleModel. Parameters: height - The height of the destination SampleModel. throws: IllegalArgumentException - if srcSampleModel is null. sampleModel suitable for the destination image. |
getDoubleData | public double[][] getDoubleData()(Code) | | Returns the double table data in array format, or null if the
table's data type is not double.
|
getDoubleData | public double[] getDoubleData(int band)(Code) | | Returns the double table data of a specific band in array format,
or null if table's data type is not double.
|
getFloatData | public float[][] getFloatData()(Code) | | Returns the float table data in array format, or null if the
table's data type is not float.
|
getFloatData | public float[] getFloatData(int band)(Code) | | Returns the float table data of a specific band in array format,
or null if table's data type is not float.
|
getIntData | public int[][] getIntData()(Code) | | Returns the integer table data in array format, or null if the
table's data type is not int.
|
getIntData | public int[] getIntData(int band)(Code) | | Returns the integer table data of a specific band in array format,
or null if table's data type is not int.
|
getNumBands | public int getNumBands()(Code) | | Returns the number of bands of the table.
|
getNumEntries | public int getNumEntries()(Code) | | Returns the number of entries per band of the table.
|
getOffset | public int getOffset()(Code) | | Returns the index offset of entry 0 for the default band.
|
getOffset | public int getOffset(int band)(Code) | | Returns the index offset of entry 0 for a specific band.
|
getOffsets | public int[] getOffsets()(Code) | | Returns the index offsets of entry 0 for all bands.
|
getShortData | public short[][] getShortData()(Code) | | Returns the short table data in array format, or null if the
table's data type is not short. This includes both signed and
unsigned short table data.
|
getShortData | public short[] getShortData(int band)(Code) | | Returns the short table data of a specific band in array format,
or null if the table's data type is not short.
|
isIntegralDataType | public boolean isIntegralDataType(SampleModel sampleModel)(Code) | | Validates data type. Returns true if it's one of the integral
data types; false otherwise.
throws: IllegalArgumentException - if sampleModel is null. |
isIntegralDataType | public boolean isIntegralDataType(int dataType)(Code) | | Returns true if the specified data type is
an integral data type, such as byte, ushort, short, or int.
|
lookup | public int lookup(int band, int value)(Code) | | Performs lookup on a given value belonging to a given source
band, and returns the result as an int.
Parameters: band - The source band the value is from. Parameters: value - The source value to be placed through the lookup table. |
lookup | public WritableRaster lookup(WritableRaster src)(Code) | | Performs table lookup in place on a given WritableRaster. The
The lookup operation must preserve the data type and
SampleModel of the source. A reference to the supplied
WritableRaster will be returned.
throws: IllegalArgumentException - if the src is null. throws: IllegalArgumentException - if the source's SampleModelis not of integral type. throws: IllegalArgumentException - if the lookup operation wouldresult in a change in the data type or number of bandsof the Raster. |
lookup | public WritableRaster lookup(Raster src, WritableRaster dst, Rectangle rect)(Code) | | Performs table lookup on a source Raster, writing the result
into a supplied WritableRaster. The destination must have a
data type and SampleModel appropriate to the results of the
lookup operation. The table lookup operation is performed
within a specified rectangle.
The dst argument may be null, in which case a new
WritableRaster is created using the appropriate SampleModel.
The rectangle of interest may be null, in which case the
operation will be performed on the intersection of the source
and destination bounding rectangles.
Parameters: src - A Raster containing the source pixel data. Parameters: dst - The WritableRaster to be computed, or null.If supplied, its data type and number of bands mustbe suitable for the source and lookup table. Parameters: rect - The rectangle within the tile to be computed.If rect is null, the intersection of the source anddestination bounds will be used. Otherwise, itwill be clipped to the intersection of the sourceand destination bounds. A reference to the supplied WritableRaster, or to anew WritableRaster if the supplied one was null. throws: IllegalArgumentException - if the source is null. throws: IllegalArgumentException - if the source's SampleModelis not of integral type. throws: IllegalArgumentException - if the destination's data typeor number of bands differ from those returned bygetDataType() and getDestNumBands(). |
lookupDouble | public double lookupDouble(int band, int value)(Code) | | Performs lookup on a given value belonging to a given source
band, and returns the result as a double.
Parameters: band - The source band the value is from. Parameters: value - The source value to be placed through the lookup table. |
lookupFloat | public float lookupFloat(int band, int value)(Code) | | Performs lookup on a given value belonging to a given source
band, and returns the result as a float.
Parameters: band - The source band the value is from. Parameters: value - The source value to be placed through the lookup table. |
|
|