Class GrassBinaryImageReader


  • public class GrassBinaryImageReader
    extends ImageReader
    ImageIO reader for the grass binary raster format.

    The reader extends imageio's ImageReader to support the reading of GRASS raster data.

    Since:
    3.0
    Author:
    Andrea Antonello (www.hydrologis.com)
    See Also:
    ImageReader, GrassBinaryRasterReadHandler, GrassBinaryImageMetadata
    • Field Summary

      Fields 
      Modifier and Type Field Description
      ColorModel ccmdl
      the ColorModel to be used for the read raster.
      • Fields inherited from class ImageReader

        availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      void dispose()
      Cleans this GrassBinaryImageReader up.
      int getHeight​(int imageIndex)  
      IIOMetadata getImageMetadata​(int imageIndex)  
      Iterator<ImageTypeSpecifier> getImageTypes​(int imageIndex)  
      int getNumImages​(boolean allowSearch)  
      GrassBinaryRasterReadHandler getRasterReader()
      A simple method which returns the proper GrassBinaryRasterReadHandler used to perform reading operations
      IIOMetadata getStreamMetadata()  
      int getWidth​(int imageIndex)  
      BufferedImage read​(int imageIndex)  
      BufferedImage read​(int imageIndex, ImageReadParam param)  
      BufferedImage read​(int imageIndex, ImageReadParam param, boolean useSubSamplingAsRequestedRowcols, boolean castDoubleToFloating, ProgressListener monitor)
      Performs the read method adding the possibility to override subsampling.
      Raster readRaster​(int imageIndex, ImageReadParam param)  
      void reset()
      void setCastDoubleToFloating​(boolean castDoubleToFloating)  
      void setInput​(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
      This method set the input only if the input object is a File.
      void setMonitor​(ProgressListener monitor)  
      void setUseSubSamplingAsRequestedRowcols​(boolean useSubSamplingAsRequestedRowcols)  
      • Methods inherited from class ImageReader

        addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDefaultReadParam, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isRandomAccessEasy, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ccmdl

        public ColorModel ccmdl
        the ColorModel to be used for the read raster.
    • Constructor Detail

      • GrassBinaryImageReader

        public GrassBinaryImageReader​(GrassBinaryImageReaderSpi originatingProvider)
        constructs an ImageReader able to read grass raster maps.
        Parameters:
        originatingProvider - the service provider interface for the reader.
    • Method Detail

      • setInput

        public void setInput​(Object input,
                             boolean seekForwardOnly,
                             boolean ignoreMetadata)
        This method set the input only if the input object is a File.
        Overrides:
        setInput in class ImageReader
      • setUseSubSamplingAsRequestedRowcols

        public void setUseSubSamplingAsRequestedRowcols​(boolean useSubSamplingAsRequestedRowcols)
      • setCastDoubleToFloating

        public void setCastDoubleToFloating​(boolean castDoubleToFloating)
      • getHeight

        public int getHeight​(int imageIndex)
                      throws IOException
        Specified by:
        getHeight in class ImageReader
        Throws:
        IOException
      • getWidth

        public int getWidth​(int imageIndex)
                     throws IOException
        Specified by:
        getWidth in class ImageReader
        Throws:
        IOException
      • getNumImages

        public int getNumImages​(boolean allowSearch)
                         throws IOException
        Specified by:
        getNumImages in class ImageReader
        Throws:
        IOException
      • getImageTypes

        public Iterator<ImageTypeSpecifier> getImageTypes​(int imageIndex)
                                                   throws IOException
        Specified by:
        getImageTypes in class ImageReader
        Throws:
        IOException
      • getStreamMetadata

        public IIOMetadata getStreamMetadata()
                                      throws IOException
        Specified by:
        getStreamMetadata in class ImageReader
        Throws:
        IOException
      • getImageMetadata

        public IIOMetadata getImageMetadata​(int imageIndex)
                                     throws IOException
        Specified by:
        getImageMetadata in class ImageReader
        Throws:
        IOException
      • read

        public BufferedImage read​(int imageIndex,
                                  ImageReadParam param,
                                  boolean useSubSamplingAsRequestedRowcols,
                                  boolean castDoubleToFloating,
                                  ProgressListener monitor)
                           throws IOException
        Performs the read method adding the possibility to override subsampling.
        Parameters:
        imageIndex - same as read(int, ImageReadParam)
        param - same as read(int, ImageReadParam)
        useSubSamplingAsRequestedRowcols - a flag that gives the possibility to bypass the imageio subsampling mechanism. With GRASS maps this is often more performant in some boundary situations. In the case this flag is set to true, the subsampling values will be handled as the requested columns and rows.
        castDoubleToFloating - a flag that gives the possibility to force the reading of a map as a floating point map. This is necessary right now because of a imageio bug: https://jai-imageio-core.dev.java.net/issues/show_bug.cgi?id=180
        Returns:
        same as read(int, ImageReadParam)
        Throws:
        IOException - same as read(int, ImageReadParam)
      • read

        public BufferedImage read​(int imageIndex,
                                  ImageReadParam param)
                           throws IOException
        Specified by:
        read in class ImageReader
        Throws:
        IOException
      • read

        public BufferedImage read​(int imageIndex)
                           throws IOException
        Overrides:
        read in class ImageReader
        Throws:
        IOException
      • readRaster

        public Raster readRaster​(int imageIndex,
                                 ImageReadParam param)
                          throws IOException
        Overrides:
        readRaster in class ImageReader
        Throws:
        IOException
      • dispose

        public void dispose()
        Cleans this GrassBinaryImageReader up.
        Overrides:
        dispose in class ImageReader
      • abort

        public void abort()
        Request to abort any current read operation.
        Overrides:
        abort in class ImageReader
      • abortRequested

        protected boolean abortRequested()
        Checks if a request to abort the current read operation has been made.
        Overrides:
        abortRequested in class ImageReader