jsky.image.fits.codec
Class FITSDecoder

java.lang.Object
  extended by com.sun.media.jai.codec.ImageDecoderImpl
      extended by jsky.image.fits.codec.FITSDecoder
All Implemented Interfaces:
com.sun.media.jai.codec.ImageDecoder

public class FITSDecoder
extends com.sun.media.jai.codec.ImageDecoderImpl

An ImageDecoder for the FITS file format.

Version:
$Revision: 1.1 $
Author:
Allan Brighton

Field Summary
 
Fields inherited from class com.sun.media.jai.codec.ImageDecoderImpl
input, param
 
Constructor Summary
FITSDecoder(com.sun.media.jai.codec.SeekableStream input, com.sun.media.jai.codec.ImageDecodeParam param)
          Constructor
 
Method Summary
 java.awt.image.RenderedImage decodeAsRenderedImage()
          Returns a RenderedImage that contains the decoded contents of the SeekableStream associated with this ImageDecoder.
 java.awt.image.RenderedImage decodeAsRenderedImage(int page)
          Returns a RenderedImage that contains the decoded contents of the SeekableStream associated with this ImageDecoder.
 int getNumPages()
          Returns the number of pages (FITS extensions) present in the current stream.
 
Methods inherited from class com.sun.media.jai.codec.ImageDecoderImpl
decodeAsRaster, decodeAsRaster, getInputStream, getParam, setParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FITSDecoder

public FITSDecoder(com.sun.media.jai.codec.SeekableStream input,
                   com.sun.media.jai.codec.ImageDecodeParam param)
            throws java.io.IOException,
                   nom.tam.fits.FitsException
Constructor

Throws:
java.io.IOException
nom.tam.fits.FitsException
Method Detail

decodeAsRenderedImage

public java.awt.image.RenderedImage decodeAsRenderedImage()
                                                   throws java.io.IOException
Returns a RenderedImage that contains the decoded contents of the SeekableStream associated with this ImageDecoder. Only the first page of a multi-page image is decoded.

Specified by:
decodeAsRenderedImage in interface com.sun.media.jai.codec.ImageDecoder
Overrides:
decodeAsRenderedImage in class com.sun.media.jai.codec.ImageDecoderImpl
Throws:
java.io.IOException

decodeAsRenderedImage

public java.awt.image.RenderedImage decodeAsRenderedImage(int page)
                                                   throws java.io.IOException
Returns a RenderedImage that contains the decoded contents of the SeekableStream associated with this ImageDecoder. The given page of a multi-page image is decoded. If the page does not exist, an IOException will be thrown. Page numbering begins at zero.

Specified by:
decodeAsRenderedImage in interface com.sun.media.jai.codec.ImageDecoder
Specified by:
decodeAsRenderedImage in class com.sun.media.jai.codec.ImageDecoderImpl
Throws:
java.io.IOException

getNumPages

public int getNumPages()
                throws java.io.IOException
Returns the number of pages (FITS extensions) present in the current stream.

Note: The FITS codec defines properties, such as "#num_pages", "#fits_image", and "#preview_image" that give direct access to the FITS HDUs, so that you can tell ahead of time if an HDU contains an image or an ASCII or binary table.

Specified by:
getNumPages in interface com.sun.media.jai.codec.ImageDecoder
Overrides:
getNumPages in class com.sun.media.jai.codec.ImageDecoderImpl
Throws:
java.io.IOException