|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectImageReader
SpatialImageReader
RawImageReader
public class RawImageReader
Image reader for raw binary files. The default implementation can process only inputs of type
RawImageInputStream. However subclasses can process arbitrary ImageInputStream
if they override the following methods:
getWidth(int) (mandatory)getHeight(int) (mandatory)getRawDataType(int) (mandatory unless the default value,
which is DataBuffer.TYPE_FLOAT, is suitable)This class provides similar functionalities than the RAW image reader provided by the Image I/O extensions for JAI library. The main difference is that this class can be extended, and provides support for color palette and "no data value" conversion as documented in the super-class. Experience also suggests that this class is faster at least for floating point values. In addition, version 1.1 of the Image I/O extension for JAI seems to have a bug in their reading of subsampled floating point values.
Restrictions on the sample model
The current implementations requires that the image in the stream has a
pixel stride equals to 1.
If the pixel stride may be different, consider using the reader provided by the
Image I/O extensions for JAI library instead.
RawImageInputStream
| coverage/geotk-coverageio (download) | View source code for this class |
| Nested Class Summary | |
|---|---|
static class |
RawImageReader.Spi
Service provider interface (SPI) for RawImageReaders. |
| Field Summary |
|---|
| Fields inherited from class ImageReader |
|---|
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales |
| Fields inherited from interface WarningProducer |
|---|
LOGGER |
| Constructor Summary | |
|---|---|
RawImageReader(RawImageReader.Spi provider)
Constructs a new image reader. |
|
| Method Summary | |
|---|---|
int |
getHeight(int imageIndex)
Returns the image's height. |
int |
getNumBands(int imageIndex)
Returns the number of bands available for the specified image. |
int |
getNumImages(boolean allowSearch)
Returns the number of images available from the current input source. |
protected int |
getRawDataType(int imageIndex)
Returns the data type which most closely represents the "raw" internal data of the image. |
ImageTypeSpecifier |
getRawImageType(int imageIndex)
Returns the data type which most closely represents the "raw" internal data of the image. |
int |
getWidth(int imageIndex)
Returns the image's width. |
boolean |
isRandomAccessEasy(int imageIndex)
Returns true since random access is easy in uncompressed images. |
BufferedImage |
read(int imageIndex,
ImageReadParam param)
Reads the image indexed by imageIndex. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface Localized |
|---|
getLocale |
| Constructor Detail |
|---|
public RawImageReader(RawImageReader.Spi provider)
provider - the ImageReaderSpi that is invoking this constructor, or null.| Method Detail |
|---|
public int getNumImages(boolean allowSearch)
throws IllegalStateException,
IOException
RawImageInputStream, or delegates to the
super-class otherwise.
getNumImages in class SpatialImageReaderallowSearch - If true, the number of images will be returned
even if a search is required.
allowSearch
is false and a search would be required.
IllegalStateException - if the input source has not been set.
IOException - if an error occurs reading the information from the input source.
public int getWidth(int imageIndex)
throws IOException
RawImageInputStream, or thrown an exception otherwise.
Subclasses can override this method if they can get the image width in an other way.
getWidth in class ImageReaderIOException - If the width can not be obtained of an I/O error occurred.
public int getHeight(int imageIndex)
throws IOException
RawImageInputStream, or thrown an exception otherwise.
Subclasses can override this method if they can get the height width in an other way.
getHeight in class ImageReaderIOException - If the height can not be obtained of an I/O error occurred.
public int getNumBands(int imageIndex)
throws IOException
RawImageInputStream, or delegates to the
super-class otherwise.
getNumBands in class SpatialImageReaderimageIndex - The image index.
IOException - if an error occurs reading the information from the input source.
protected int getRawDataType(int imageIndex)
throws IOException
DataBuffer constants. The default implementation fetches this
information from the input stream if it is of kind RawImageInputStream, or returns
DataBuffer.TYPE_FLOAT otherwise.
Subclasses can override this method if they can get the data type in an other way. See the super-class javadoc for an explanation about how the returned type is used.
getRawDataType in class SpatialImageReaderimageIndex - The index of the image to be queried.
IOException - If an error occurs reading the format information from the input source.SpatialImageReader.getImageType(int, ImageReadParam, SampleConverter[]),
SampleConversionType.SHIFT_SIGNED_INTEGERS
public ImageTypeSpecifier getRawImageType(int imageIndex)
throws IOException
RawImageInputStream, or delegates to the
super-class otherwise.
getRawImageType in class SpatialImageReaderimageIndex - The index of the image to be queried.
null).
IOException - If an error occurs reading the format information from the input source.SpatialImageReader.getImageType(int, ImageReadParam, SampleConverter[]),
SpatialImageReader.getDefaultReadParam()
public boolean isRandomAccessEasy(int imageIndex)
throws IOException
true since random access is easy in uncompressed images.
isRandomAccessEasy in class ImageReaderIOException
public BufferedImage read(int imageIndex,
ImageReadParam param)
throws IOException
imageIndex.
read in class ImageReaderimageIndex - The index of the image to be retrieved.param - Parameters used to control the reading process, or null.
IOException - if an input operation failed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||