it.geosolutions.imageio.plugins.netcdf
Class NetCDFImageReader

Object
  extended by ImageReader
      extended by BaseImageReader
          extended by NetCDFImageReader
All Implemented Interfaces:
CancelTask

public class NetCDFImageReader
extends BaseImageReader
implements CancelTask

Base implementation for NetCDF-CF image flat reader. Pixels are assumed organized according the COARDS convention (a precursor of CF Metadata conventions), i.e. in (t,z,y,x) order, where x varies faster. The image is created from the two last dimensions (x,y). Each ImageIndex corresponds to a 2D-slice of NetCDF. NetCDFImageReader is a ImageReader able to create RenderedImage from NetCDF-CF sources.

Author:
Alessio Fabiani, GeoSolutions, Simoe Giannecchini, GeoSolutions

Field Summary
protected static Logger LOGGER
           
 
Fields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
 
Constructor Summary
NetCDFImageReader(ImageReaderSpi originatingProvider)
          Explicit Constructor getting ImageReaderSpi originatingProvider as actual parameter.
 
Method Summary
 void dispose()
          Allows any resources held by this reader to be released.
 int getHeight(int imageIndex)
           
 IIOMetadata getImageMetadata(int imageIndex)
           
 Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
           
 IIOMetadata getStreamMetadata()
           
protected  NetCDFImageReader.NetCDFVariableWrapper getVariableWrapper(int imageIndex)
           
 int getWidth(int imageIndex)
           
protected  void initialize()
          Initialize main properties for this reader.
 boolean isCancel()
          Invoked by the NetCDF library during read operation in order to check if the task has been canceled.
 BufferedImage read(int imageIndex, ImageReadParam param)
           
 void setError(String message)
          Invoked by the NetCDF library when an error occurred during the read operation.
 void setInput(Object input)
           
 void setInput(Object input, boolean seekForwardOnly)
           
 void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
           
 
Methods inherited from class BaseImageReader
checkImageIndex, getNumImages, setNumImages
 
Methods inherited from class ImageReader
abort, abortRequested, 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, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readRaster, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, reset, setLocale
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER
Constructor Detail

NetCDFImageReader

public NetCDFImageReader(ImageReaderSpi originatingProvider)
Explicit Constructor getting ImageReaderSpi originatingProvider as actual parameter.

Parameters:
originatingProvider - ImageReaderSpi
Method Detail

initialize

protected void initialize()
Initialize main properties for this reader.

Throws:
exception - InvalidRangeException

getVariableWrapper

protected NetCDFImageReader.NetCDFVariableWrapper getVariableWrapper(int imageIndex)

getImageMetadata

public IIOMetadata getImageMetadata(int imageIndex)
                             throws IOException
Specified by:
getImageMetadata in class ImageReader
Throws:
IOException
See Also:
ImageReader.getImageMetadata(int)

getStreamMetadata

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

read

public BufferedImage read(int imageIndex,
                          ImageReadParam param)
                   throws IOException
Specified by:
read in class ImageReader
Throws:
IOException
See Also:
ImageReader.read(int, javax.imageio.ImageReadParam)

dispose

public void dispose()
Allows any resources held by this reader to be released.
TODO: To grant thread safety, we may prevent a user call of this method.

Overrides:
dispose in class BaseImageReader
Throws:
IOException

setError

public void setError(String message)
Invoked by the NetCDF library when an error occurred during the read operation. Users should not invoke this method directly.

Specified by:
setError in interface CancelTask

isCancel

public boolean isCancel()
Invoked by the NetCDF library during read operation in order to check if the task has been canceled. Users should not invoke this method directly.

Specified by:
isCancel in interface CancelTask

getHeight

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

getImageTypes

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

getWidth

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

setInput

public void setInput(Object input,
                     boolean seekForwardOnly,
                     boolean ignoreMetadata)
Overrides:
setInput in class ImageReader

setInput

public void setInput(Object input,
                     boolean seekForwardOnly)
Overrides:
setInput in class ImageReader

setInput

public void setInput(Object input)
Overrides:
setInput in class ImageReader


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.