it.geosolutions.imageio.plugins.jp2k
Class JP2KKakaduImageReader

Object
  extended by ImageReader
      extended by JP2KKakaduImageReader

public class JP2KKakaduImageReader
extends ImageReader

JP2KakaduImageReader is a ImageReader able to create RenderedImage from JP2 files, leveraging on Kdu_jni bindings.

Author:
Simone Giannecchini, GeoSolutions., Daniele Romagnoli, GeoSolutions.

Field Summary
 
Fields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales
 
Constructor Summary
protected JP2KKakaduImageReader(ImageReaderSpi originatingProvider)
           
 
Method Summary
protected  void checkImageIndex(int imageIndex)
          Checks if the specified ImageIndex is valid.
 void dispose()
          Disposes all the resources, native and non, used by this ImageReader subclass.
 ImageReadParam getDefaultReadParam()
          Build a default JP2KKakaduImageReadParam
 int getHeight(int imageIndex)
          Returns the height in pixel of the image
 IIOMetadata getImageMetadata(int imageIndex)
          Returns an IIOMetadata object containing metadata associated with the given image.
 Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
          Returns an Iterator containing possible image types to which the given image may be decoded, in the form of ImageTypeSpecifierss.
 int getNumImages(boolean allowSearch)
          Returns the number of images contained in the source.
 int getSourceDWTLevels(int imageIndex)
          returns the number of source DWT levels for the specified image.
 IIOMetadata getStreamMetadata()
          Returns an IIOMetadata object representing the metadata associated with the input source as a whole.
 int getTileHeight(int imageIndex)
          Returns the height of a tile
 int getTileWidth(int imageIndex)
          Returns the width of a tile
 int getWidth(int imageIndex)
          Returns the width in pixel of the image
 BufferedImage read(int imageIndex, ImageReadParam param)
          Read the image and returns it as a complete BufferedImage, using a supplied ImageReadParam.
 void reset()
          Reset main values
 void setInput(Object input, boolean seekForwardOnly, boolean ignoreMetadata)
           
 
Methods inherited from class ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, 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, setInput, setInput, setLocale
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JP2KKakaduImageReader

protected JP2KKakaduImageReader(ImageReaderSpi originatingProvider)
Method Detail

checkImageIndex

protected void checkImageIndex(int imageIndex)
Checks if the specified ImageIndex is valid.

Parameters:
imageIndex - the specified imageIndex
Throws:
IndexOutOfBoundsException - if imageIndex is lower than 0 or if is greater than the max number (-1) of images available within the data source contained within the source

getHeight

public int getHeight(int imageIndex)
              throws IOException
Returns the height in pixel of the image

Specified by:
getHeight in class ImageReader
Parameters:
the - index of the selected image
Throws:
IOException

getWidth

public int getWidth(int imageIndex)
             throws IOException
Returns the width in pixel of the image

Specified by:
getWidth in class ImageReader
Parameters:
the - index of the selected image
Throws:
IOException

getImageMetadata

public IIOMetadata getImageMetadata(int imageIndex)
                             throws IOException
Returns an IIOMetadata object containing metadata associated with the given image.

Specified by:
getImageMetadata in class ImageReader
Parameters:
imageIndex - the index of the image whose metadata is to be retrieved.
Returns:
an IIOMetadata object.
Throws:
IOException
See Also:
ImageReader.getImageMetadata(int)

getStreamMetadata

public IIOMetadata getStreamMetadata()
                              throws IOException
Returns an IIOMetadata object representing the metadata associated with the input source as a whole.

Specified by:
getStreamMetadata in class ImageReader
Returns:
an IIOMetadata object.
Throws:
IOException
See Also:
ImageReader.getStreamMetadata()

getImageTypes

public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
                                           throws IOException
Returns an Iterator containing possible image types to which the given image may be decoded, in the form of ImageTypeSpecifierss. At least one legal image type will be returned. This implementation simply returns an ImageTypeSpecifier set in compliance with the property of the dataset contained within the underlying data source.

Specified by:
getImageTypes in class ImageReader
Parameters:
imageIndex - the index of the image to be retrieved.
Returns:
an Iterator containing possible image types to which the given image may be decoded, in the form of ImageTypeSpecifierss
Throws:
IOException
See Also:
ImageReader.getImageTypes(int)

getNumImages

public int getNumImages(boolean allowSearch)
                 throws IOException
Returns the number of images contained in the source.

Specified by:
getNumImages in class ImageReader
Throws:
IOException

read

public BufferedImage read(int imageIndex,
                          ImageReadParam param)
                   throws IOException
Read the image and returns it as a complete BufferedImage, using a supplied ImageReadParam.

Specified by:
read in class ImageReader
Parameters:
imageIndex - the index of the desired image.
Throws:
IOException

setInput

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

dispose

public void dispose()
Disposes all the resources, native and non, used by this ImageReader subclass.

Overrides:
dispose in class ImageReader

getTileHeight

public int getTileHeight(int imageIndex)
                  throws IOException
Returns the height of a tile

Overrides:
getTileHeight in class ImageReader
Parameters:
the - index of the selected image
Throws:
IOException

getTileWidth

public int getTileWidth(int imageIndex)
                 throws IOException
Returns the width of a tile

Overrides:
getTileWidth in class ImageReader
Parameters:
the - index of the selected image
Throws:
IOException

getDefaultReadParam

public ImageReadParam getDefaultReadParam()
Build a default JP2KKakaduImageReadParam

Overrides:
getDefaultReadParam in class ImageReader

getSourceDWTLevels

public int getSourceDWTLevels(int imageIndex)
returns the number of source DWT levels for the specified image.

Returns:
the number of source DWT levels.

reset

public void reset()
Reset main values

Overrides:
reset in class ImageReader


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.