edu.jhu.pha.sdss.fits
Class FITSImage

java.lang.Object
  extended byjava.awt.Image
      extended byjava.awt.image.BufferedImage
          extended byedu.jhu.pha.sdss.fits.FITSImage
All Implemented Interfaces:
java.awt.image.RenderedImage, java.awt.image.WritableRenderedImage
Direct Known Subclasses:
SlowFITSImage

public class FITSImage
extends java.awt.image.BufferedImage

   Current Version
   ===============
   ID:            $Id: FITSImage.html,v 1.1 2004/07/23 22:04:49 carliles Exp $
   Revision:      $Revision: 1.1 $
   Date/time:     $Date: 2004/07/23 22:04:49 $
   
The scaling algorithms offered are linear, log, square root, square, histogram equalization, and inverse hyperbolic sine. Note that the histogram equalization algorithm is just that; it works to fit the values to a uniform distribution curve. The inverse hyperbolic sine scaling has linear behavior below the sigma parameter and logarithmic behavior above the sigma parameter.


Nested Class Summary
static class FITSImage.DataTypeNotSupportedException
           
static class FITSImage.NoImageDataFoundException
           
 
Field Summary
static int SCALE_ASINH
           
static int SCALE_HISTOGRAM_EQUALIZATION
           
static int SCALE_LINEAR
           
static int SCALE_LOG
           
static int SCALE_SQUARE
           
static int SCALE_SQUARE_ROOT
           
 
Fields inherited from class java.awt.image.BufferedImage
TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE, TYPE_BYTE_BINARY, TYPE_BYTE_GRAY, TYPE_BYTE_INDEXED, TYPE_CUSTOM, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE, TYPE_INT_BGR, TYPE_INT_RGB, TYPE_USHORT_555_RGB, TYPE_USHORT_565_RGB, TYPE_USHORT_GRAY
 
Fields inherited from class java.awt.Image
SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
Constructor Summary
FITSImage(java.io.File file)
           
FITSImage(java.io.File file, int scaleMethod)
           
FITSImage(nom.tam.fits.Fits fits)
           
FITSImage(nom.tam.fits.Fits fits, java.awt.image.BufferedImage[] scaledImages, int scaleMethod)
           
FITSImage(nom.tam.fits.Fits fits, int scaleMethod)
           
FITSImage(java.lang.String filename)
           
FITSImage(java.lang.String filename, int scaleMethod)
           
FITSImage(java.net.URL url)
           
FITSImage(java.net.URL url, int scaleMethod)
           
 
Method Summary
 java.awt.image.WritableRaster copyData(java.awt.image.WritableRaster outRaster)
           
 java.awt.Graphics2D createGraphics()
           
static java.awt.image.BufferedImage[] createScaledImages(nom.tam.fits.ImageHDU hdu)
           
static java.awt.image.BufferedImage[] createScaledImages(nom.tam.fits.ImageHDU hdu, Histogram hist, double min, double max, double sigma)
           
 void flush()
           
 java.awt.image.WritableRaster getAlphaRaster()
           
 java.awt.image.ColorModel getColorModel()
           
 java.awt.image.Raster getData()
           
 java.awt.image.Raster getData(java.awt.Rectangle rect)
           
 nom.tam.fits.Fits getFits()
           
 java.awt.Graphics getGraphics()
           
 int getHeight()
           
 int getHeight(java.awt.image.ImageObserver observer)
           
 Histogram getHistogram()
           
 nom.tam.fits.ImageHDU getImageHDU()
           
 int getMinTileX()
           
 int getMinTileY()
           
 int getMinX()
           
 int getMinY()
           
 int getNumXTiles()
           
 int getNumYTiles()
           
 double getOriginalValue(int x, int y)
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.Object getProperty(java.lang.String name, java.awt.image.ImageObserver observer)
           
 java.lang.String[] getPropertyNames()
           
 java.awt.image.WritableRaster getRaster()
           
 int getRGB(int x, int y)
           
 int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
           
 java.awt.image.SampleModel getSampleModel()
           
 int getScaleMethod()
           
static java.lang.String[] getScaleNames()
           
 java.awt.image.ImageProducer getSource()
           
 java.util.Vector getSources()
           
 java.awt.image.BufferedImage getSubimage(int x, int y, int w, int h)
           
 java.awt.image.Raster getTile(int tileX, int tileY)
           
 int getTileGridXOffset()
           
 int getTileGridYOffset()
           
 int getTileHeight()
           
 int getTileWidth()
           
 int getType()
           
 int getWidth()
           
 int getWidth(java.awt.image.ImageObserver observer)
           
 java.awt.image.WritableRaster getWritableTile(int tileX, int tileY)
           
 java.awt.Point[] getWritableTileIndices()
           
 boolean hasTileWriters()
           
 boolean isAlphaPremultiplied()
           
 boolean isTileWritable(int tileX, int tileY)
           
 void releaseWritableTile(int tileX, int tileY)
           
 void rescale(double min, double max, double sigma)
          Rescales the image with the given min and max range values.
static java.lang.String revision()
           
 void setData(java.awt.image.Raster r)
           
 void setRGB(int x, int y, int rgb)
           
 void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
           
 void setScaleMethod(int scaleMethod)
          scaleMethod must be one of SCALE_LINEAR, SCALE_LOG, etc.
 java.lang.String toString()
           
 
Methods inherited from class java.awt.image.BufferedImage
addTileObserver, coerceData, removeTileObserver
 
Methods inherited from class java.awt.Image
getScaledInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCALE_LINEAR

public static final int SCALE_LINEAR
See Also:
Constant Field Values

SCALE_LOG

public static final int SCALE_LOG
See Also:
Constant Field Values

SCALE_SQUARE_ROOT

public static final int SCALE_SQUARE_ROOT
See Also:
Constant Field Values

SCALE_SQUARE

public static final int SCALE_SQUARE
See Also:
Constant Field Values

SCALE_HISTOGRAM_EQUALIZATION

public static final int SCALE_HISTOGRAM_EQUALIZATION
See Also:
Constant Field Values

SCALE_ASINH

public static final int SCALE_ASINH
See Also:
Constant Field Values
Constructor Detail

FITSImage

public FITSImage(nom.tam.fits.Fits fits)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(nom.tam.fits.Fits fits,
                 int scaleMethod)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(nom.tam.fits.Fits fits,
                 java.awt.image.BufferedImage[] scaledImages,
                 int scaleMethod)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(java.io.File file)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(java.io.File file,
                 int scaleMethod)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(java.lang.String filename)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(java.lang.String filename,
                 int scaleMethod)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(java.net.URL url)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException

FITSImage

public FITSImage(java.net.URL url,
                 int scaleMethod)
          throws nom.tam.fits.FitsException,
                 FITSImage.DataTypeNotSupportedException,
                 FITSImage.NoImageDataFoundException,
                 java.io.IOException
Method Detail

getScaleNames

public static java.lang.String[] getScaleNames()
Returns:
Printable names of the different scaling algorithms, indexed as SCALE_LINEAR, SCALE_LOG, etc.

getFits

public nom.tam.fits.Fits getFits()

getImageHDU

public nom.tam.fits.ImageHDU getImageHDU()

getHistogram

public Histogram getHistogram()

getOriginalValue

public double getOriginalValue(int x,
                               int y)
                        throws nom.tam.fits.FitsException
Returns:
The actual data value at postion (x, y), with bZero and bScale applied.
Throws:
nom.tam.fits.FitsException

getScaleMethod

public int getScaleMethod()
Returns:
One of SCALE_LINEAR, SCALE_LOG, etc.

setScaleMethod

public void setScaleMethod(int scaleMethod)
scaleMethod must be one of SCALE_LINEAR, SCALE_LOG, etc. The image must be redrawn after this method is called for the change to be visible.


rescale

public void rescale(double min,
                    double max,
                    double sigma)
             throws nom.tam.fits.FitsException,
                    FITSImage.DataTypeNotSupportedException,
                    FITSImage.NoImageDataFoundException,
                    java.io.IOException
Rescales the image with the given min and max range values. sigma is used for the inverse hyperbolic sine scaling as the value (in the range of the data values with bZero and bScale applied) at which the behavior becomes more logarithmic and less linear. The image must be redrawn after this method is called for the change to be visible.

Throws:
nom.tam.fits.FitsException
FITSImage.DataTypeNotSupportedException
FITSImage.NoImageDataFoundException
java.io.IOException

copyData

public java.awt.image.WritableRaster copyData(java.awt.image.WritableRaster outRaster)

createGraphics

public java.awt.Graphics2D createGraphics()

flush

public void flush()

getAlphaRaster

public java.awt.image.WritableRaster getAlphaRaster()

getColorModel

public java.awt.image.ColorModel getColorModel()

getData

public java.awt.image.Raster getData()

getData

public java.awt.image.Raster getData(java.awt.Rectangle rect)

getGraphics

public java.awt.Graphics getGraphics()

getHeight

public int getHeight()

getHeight

public int getHeight(java.awt.image.ImageObserver observer)

getMinTileX

public int getMinTileX()

getMinTileY

public int getMinTileY()

getMinX

public int getMinX()

getMinY

public int getMinY()

getNumXTiles

public int getNumXTiles()

getNumYTiles

public int getNumYTiles()

getProperty

public java.lang.Object getProperty(java.lang.String name)

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.awt.image.ImageObserver observer)

getPropertyNames

public java.lang.String[] getPropertyNames()

getRaster

public java.awt.image.WritableRaster getRaster()

getRGB

public int getRGB(int x,
                  int y)

getRGB

public int[] getRGB(int startX,
                    int startY,
                    int w,
                    int h,
                    int[] rgbArray,
                    int offset,
                    int scansize)

getSampleModel

public java.awt.image.SampleModel getSampleModel()

getSource

public java.awt.image.ImageProducer getSource()

getSources

public java.util.Vector getSources()

getSubimage

public java.awt.image.BufferedImage getSubimage(int x,
                                                int y,
                                                int w,
                                                int h)

getTile

public java.awt.image.Raster getTile(int tileX,
                                     int tileY)

getTileGridXOffset

public int getTileGridXOffset()

getTileGridYOffset

public int getTileGridYOffset()

getTileHeight

public int getTileHeight()

getTileWidth

public int getTileWidth()

getType

public int getType()

getWidth

public int getWidth()

getWidth

public int getWidth(java.awt.image.ImageObserver observer)

getWritableTile

public java.awt.image.WritableRaster getWritableTile(int tileX,
                                                     int tileY)

getWritableTileIndices

public java.awt.Point[] getWritableTileIndices()

hasTileWriters

public boolean hasTileWriters()

isAlphaPremultiplied

public boolean isAlphaPremultiplied()

isTileWritable

public boolean isTileWritable(int tileX,
                              int tileY)

releaseWritableTile

public void releaseWritableTile(int tileX,
                                int tileY)

setData

public void setData(java.awt.image.Raster r)

setRGB

public void setRGB(int x,
                   int y,
                   int rgb)

setRGB

public void setRGB(int startX,
                   int startY,
                   int w,
                   int h,
                   int[] rgbArray,
                   int offset,
                   int scansize)

toString

public java.lang.String toString()

createScaledImages

public static java.awt.image.BufferedImage[] createScaledImages(nom.tam.fits.ImageHDU hdu)
                                                         throws nom.tam.fits.FitsException,
                                                                FITSImage.DataTypeNotSupportedException
Returns:
An array of BufferedImages from hdu with intensity values scaled to short range using linear, log, square root, and square scales, in that order.
Throws:
nom.tam.fits.FitsException
FITSImage.DataTypeNotSupportedException

createScaledImages

public static java.awt.image.BufferedImage[] createScaledImages(nom.tam.fits.ImageHDU hdu,
                                                                Histogram hist,
                                                                double min,
                                                                double max,
                                                                double sigma)
                                                         throws nom.tam.fits.FitsException,
                                                                FITSImage.DataTypeNotSupportedException
Throws:
nom.tam.fits.FitsException
FITSImage.DataTypeNotSupportedException

revision

public static java.lang.String revision()
Returns:
CVS Revision number.