|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectImageReader
AsciiGridsImageReader
public final class AsciiGridsImageReader
Class used for reading ASCII ArcInfo Grid Format (ArcGrid) and ASCII GRASS
Grid Format and to create RenderedImages and Rasters.
| Field Summary |
|---|
| Fields inherited from class ImageReader |
|---|
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales |
| Constructor Summary | |
|---|---|
AsciiGridsImageReader(AsciiGridsImageReaderSpi originatingProvider)
Constructor. |
|
| Method Summary | |
|---|---|
void |
abort()
Request to abort any current read operation. |
protected boolean |
abortRequested()
Checks if a request to abort the current read operation has been made. |
boolean |
canReadRaster()
Returns true since this plug-in supports reading just a
of pixel data. |
protected void |
clearAbortRequest()
Clear any request to abort. |
void |
dispose()
Cleans this AsciiGridsImageReader up. |
ImageInputStream |
getCurrentImageInputStream()
A simple method which returns the imageInputStream used to perform reading operations |
int |
getHeight(int imageIndex)
Returns the height in pixels of the image |
IIOMetadata |
getImageMetadata(int imageIndex)
Returns an IIOMetadata object containing metadata
associated with the image. |
Iterator<ImageTypeSpecifier> |
getImageTypes(int imageIndex)
this method provides suggestions for possible image types that will be used to decode the image. |
int |
getMinIndex()
Returns the smallest valid index for reading, 0 for the AsciiGridsImageReader. |
int |
getNumImages(boolean allowSearch)
Returns the number of images available from the current input source. |
int |
getNumThumbnails(int imageIndex)
Returns the number of thumbnail preview images associated with the given image. |
AsciiGridRaster |
getRasterReader()
A simple method which returns the proper AsciiGridRaster used to perform reading operations |
IIOMetadata |
getStreamMetadata()
Since Ascii Grid format sources may only contain data for a single image, we return null. |
int |
getTileHeight(int imageIndex)
Returns the height of a tile in the image. |
int |
getTileWidth(int imageIndex)
Returns the width of a tile in the image. |
int |
getWidth(int imageIndex)
Returns the width in pixels of the image |
boolean |
hasThumbnails(int imageIndex)
Always return false since the AsciiGridsImageReader does not
support thumbnails |
boolean |
isHasListeners()
|
boolean |
isIgnoringMetadata()
Returns true if the current input source has been marked
as allowing metadata to be ignored by passing true as the
ignoreMetadata argument to the
setInput(java.lang.Object) method. |
boolean |
isImageTiled(int imageIndex)
Returns true if the image has been tiled. |
boolean |
isRandomAccessEasy(int imageIndex)
Returns true if the storage format of the image places no
inherent impediment on random access to pixels. |
boolean |
isSeekForwardOnly()
Returns true since we always call the
setInput method with the seekForwardOnly
argument set to true. |
void |
processImageProgress(float percentageDone)
|
BufferedImage |
read(int imageIndex)
Simply call the overloaded read method by passing
null as value of the ImageReadParam
argument. |
BufferedImage |
read(int imageIndex,
ImageReadParam param)
Reads the raster and return it as a complete BufferedImage
using a supplied ImageReadParam |
boolean |
readerSupportsThumbnails()
Returns false since AsciiGrid format does not supports
thumbnail preview images. |
Raster |
readRaster(int imageIndex,
ImageReadParam param)
Returns a new Raster object containing the raw pixel data
from the image stream, without any color conversion applied. |
BufferedImage |
readTile(int imageIndex,
int tileX,
int tileY)
Reads the tile indicated by the tileX and
tileY arguments, returning it as a
BufferedImage. |
Raster |
readTileRaster(int imageIndex,
int tileX,
int tileY)
Returns a new Raster object containing the raw pixel data
from the tile, without any color conversion applied. |
void |
reset()
Resets this AsciiGridsImageReader. |
void |
setInput(Object input)
Sets the input for this AsciiGridsImageReader. |
void |
setInput(Object input,
boolean seekForwardOnly)
A Simple call to the setInput(Object input) method,
ignoring all other parameters. |
void |
setInput(Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
A Simple call to the setInput(Object input) method,
ignoring all other parameters. |
| Methods inherited from class ImageReader |
|---|
addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, processImageComplete, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, readAll, readAll, readAsRenderedImage, readThumbnail, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setLocale |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AsciiGridsImageReader(AsciiGridsImageReaderSpi originatingProvider)
AsciiGridsImageReader by providing an
AsciiGridsImageReaderSpi
originatingProvider - the originating service provider interface| Method Detail |
|---|
public void setInput(Object input)
AsciiGridsImageReader.
setInput in class ImageReaderinput - Source the AsciiGridsImageReader will read from
NOTE: Constrain on GZipped InputStream If we want to
provide explicitly an InputStream (instead of a File) for a GZipped
source, we MUST provide a proper previously created GZIPInputStream
instead of a simple InputStream.
Thus, you need to use Code A) instead of Code B): //as an instance: File file = new File("example.asc.gz"); //A GZipped Source ... //Code A) GZIPInputStream stream = new GZIPInputStream(new FileInputStream(file)); //Code B) //InputStream stream = new FileInputStream(file);Otherwise, when calling
ImageIO.getImageReaders(stream), (directly or indirectly by a
Jai ImageRead Operation), the proper SPI can't correctly try to read the
Header in order to decode the input.
public int getHeight(int imageIndex)
throws IOException
getHeight in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
IOException
public int getWidth(int imageIndex)
throws IOException
getWidth in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
IOException
public int getNumImages(boolean allowSearch)
throws IOException
getNumImages in class ImageReaderIOException
public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
throws IOException
getImageTypes in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
Iterator containing an
ImageTypeSpecifier suggesting to use a 32 bit
grayscale image.
IOException
public IIOMetadata getStreamMetadata()
throws IOException
null. We suggest to use
getImageMetadata(0) in order to retrieve valid metadata
getStreamMetadata in class ImageReadernull
IOException
public IIOMetadata getImageMetadata(int imageIndex)
throws IOException
IIOMetadata object containing metadata
associated with the image.
getImageMetadata in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
IIOMetadata object.
IOException
public BufferedImage read(int imageIndex,
ImageReadParam param)
throws IOException
BufferedImage
using a supplied ImageReadParam
read in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.param - an ImageReadParam to specify subsampling
factors, and sourceRegion settings. Other properties are
actually ignored.
BufferedImage
IOExceptionImageReader.read(int, javax.imageio.ImageReadParam)
public int getTileHeight(int imageIndex)
throws IOException
getTileHeight in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
IOException
public int getTileWidth(int imageIndex)
throws IOException
getTileWidth in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
IOException
public boolean isImageTiled(int imageIndex)
throws IOException
true if the image has been tiled. All AsciiGrid
sources are untiled. However, when the size of an image is greater than a
threshold value, we introduce a tiling mechanism.
isImageTiled in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
true if the image has been tiled.
IOException
public boolean isRandomAccessEasy(int imageIndex)
throws IOException
true if the storage format of the image places no
inherent impediment on random access to pixels. Since each value
contained within an AsciiGrid file may be represented with a different
number of decimal digits, we need to find/count a specific number of
whitespaces before to get a desired pixel value. For this reason, this
method returns false
isRandomAccessEasy in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
false
IOExceptionpublic boolean isSeekForwardOnly()
true since we always call the
setInput method with the seekForwardOnly
argument set to true.
isSeekForwardOnly in class ImageReadertrue
public BufferedImage read(int imageIndex)
throws IOException
read method by passing
null as value of the ImageReadParam
argument.
read in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
BufferedImage.
IOExceptionread(int, ImageReadParam)public boolean readerSupportsThumbnails()
false since AsciiGrid format does not supports
thumbnail preview images.
readerSupportsThumbnails in class ImageReaderfalse
public Raster readRaster(int imageIndex,
ImageReadParam param)
throws IOException
Raster object containing the raw pixel data
from the image stream, without any color conversion applied.
readRaster in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.param - an ImageReadParam used to control the reading
process, or null.
Raster.
IOException
public BufferedImage readTile(int imageIndex,
int tileX,
int tileY)
throws IOException
tileX and
tileY arguments, returning it as a
BufferedImage.
readTile in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.tileX - the column index (starting with 0) of the tile to be
retrieved.tileY - the row index (starting with 0) of the tile to be retrieved.
BufferedImage.
IOException
public Raster readTileRaster(int imageIndex,
int tileX,
int tileY)
throws IOException
Raster object containing the raw pixel data
from the tile, without any color conversion applied.
readTileRaster in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.tileX - the column index (starting with 0) of the tile to be
retrieved.tileY - the row index (starting with 0) of the tile to be retrieved.
Raster.
IOExceptionpublic boolean canReadRaster()
true since this plug-in supports reading just a
Raster of pixel data.
canReadRaster in class ImageReadertruepublic int getMinIndex()
AsciiGridsImageReader.
getMinIndex in class ImageReader
public int getNumThumbnails(int imageIndex)
throws IOException
AsciiGridsImageReader does not support thumbnails,
this method always returns 0.
getNumThumbnails in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
IOException
public boolean hasThumbnails(int imageIndex)
throws IOException
AsciiGridsImageReader does not
support thumbnails
hasThumbnails in class ImageReaderimageIndex - the index of the required image which need to be always 0
since AsciiGrid format supports only single image.
false
IOExceptionpublic boolean isIgnoringMetadata()
true if the current input source has been marked
as allowing metadata to be ignored by passing true as the
ignoreMetadata argument to the
setInput(java.lang.Object) method.
isIgnoringMetadata in class ImageReadertrue if the metadata may be ignored.public AsciiGridRaster getRasterReader()
public ImageInputStream getCurrentImageInputStream()
public void dispose()
AsciiGridsImageReader up.
dispose in class ImageReaderpublic void reset()
AsciiGridsImageReader.
reset in class ImageReaderpublic void processImageProgress(float percentageDone)
processImageProgress in class ImageReaderpublic void abort()
abort in class ImageReaderprotected boolean abortRequested()
abortRequested in class ImageReaderprotected void clearAbortRequest()
clearAbortRequest in class ImageReader
public void setInput(Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
setInput(Object input) method,
ignoring all other parameters.
setInput in class ImageReader
public void setInput(Object input,
boolean seekForwardOnly)
setInput(Object input) method,
ignoring all other parameters.
setInput in class ImageReaderpublic boolean isHasListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||