jfits
Class AbstractFitsShape

java.lang.Object
  extended by jfits.AbstractFitsShape
All Implemented Interfaces:
Shape, FitsShape
Direct Known Subclasses:
FitsAnnulus, FitsCircle, FitsLine, FitsRectangle

public abstract class AbstractFitsShape
extends Object
implements FitsShape

Basic implementation for FitsShape. Supports statistic and ADU retrieval, but postpones principal axis.


Field Summary
private  List<Vector3D> cache
          The last ADUS retrieved.
private  Shape generic
          The normalized generic shape.
private  nom.tam.fits.ImageHDU hdu
          The image data I am registered to.
private  AffineTransform last
          Cache last requests for speedup.
 
Constructor Summary
protected AbstractFitsShape(nom.tam.fits.Fits fits, Shape like)
          Constructs a new abstract fits shape specifiying the fits object and the generic shape.
protected AbstractFitsShape(nom.tam.fits.ImageHDU fits, Shape like)
          Constructs a new abstract fits shape specifiying the fits object and the generic shape.
protected AbstractFitsShape(Shape like)
          Constructs a new abstract fits shape specifiying the generic shape.
 
Method Summary
 boolean contains(double x, double y)
          Passes to our generic shape.
 boolean contains(double x, double y, double w, double h)
          Passes to our generic shape.
 boolean contains(Point2D p)
          Passes to our generic shape.
 boolean contains(Rectangle2D r)
          Passes to our generic shape.
 List<Vector3D> getAdus(AffineTransform at)
          Transforms the generic shape to match the FITS geometry, then greps all underlying adus whose central coordinate (image+0.5, FITS convention -0.5) lies within the shape.
 Rectangle getBounds()
          Passes to our generic shape.
 Rectangle2D getBounds2D()
          Passes to our generic shape.
protected  Shape getFitsShape(AffineTransform at)
          We use the user-supplied transform to get a true shape that can be applied to ther underlying fits.
 PathIterator getPathIterator(AffineTransform at)
          Passes to our generic shape.
 PathIterator getPathIterator(AffineTransform at, double flatness)
          Passes to our generic shape.
 Statistic getStatistic(AffineTransform at)
          Generates the statistic out of the specified transform.
 boolean intersects(double x, double y, double w, double h)
          Passes to our generic shape.
 boolean intersects(Rectangle2D r)
          Passes to our generic shape.
 void registerFits(nom.tam.fits.Fits i)
          Registers a fits object.
 void registerFits(nom.tam.fits.ImageHDU i)
          Registers the image data to this shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jfits.FitsShape
getPrincipal, isClosed
 

Field Detail

hdu

private nom.tam.fits.ImageHDU hdu
The image data I am registered to.


generic

private Shape generic
The normalized generic shape.


last

private AffineTransform last
Cache last requests for speedup.


cache

private List<Vector3D> cache
The last ADUS retrieved.

Constructor Detail

AbstractFitsShape

protected AbstractFitsShape(Shape like)
Constructs a new abstract fits shape specifiying the generic shape.


AbstractFitsShape

protected AbstractFitsShape(nom.tam.fits.Fits fits,
                            Shape like)
                     throws nom.tam.fits.FitsException
Constructs a new abstract fits shape specifiying the fits object and the generic shape. Always uses the first image HDU found in the image. If that is not the intended behaviour, either use the constructor with the ImageHDU specified, or register the image hdu later.

Throws:
nom.tam.fits.FitsException

AbstractFitsShape

protected AbstractFitsShape(nom.tam.fits.ImageHDU fits,
                            Shape like)
                     throws nom.tam.fits.FitsException
Constructs a new abstract fits shape specifiying the fits object and the generic shape. Always uses the first image HDU found in the image. If that is not the intended behaviour, either use the constructor with the ImageHDU specified, or register the image hdu later.

Throws:
nom.tam.fits.FitsException
Method Detail

getBounds

public Rectangle getBounds()
Passes to our generic shape.

Specified by:
getBounds in interface Shape

getBounds2D

public Rectangle2D getBounds2D()
Passes to our generic shape.

Specified by:
getBounds2D in interface Shape

contains

public boolean contains(double x,
                        double y)
Passes to our generic shape.

Specified by:
contains in interface Shape

contains

public boolean contains(Point2D p)
Passes to our generic shape.

Specified by:
contains in interface Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Passes to our generic shape.

Specified by:
intersects in interface Shape

intersects

public boolean intersects(Rectangle2D r)
Passes to our generic shape.

Specified by:
intersects in interface Shape

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Passes to our generic shape.

Specified by:
contains in interface Shape

contains

public boolean contains(Rectangle2D r)
Passes to our generic shape.

Specified by:
contains in interface Shape

getPathIterator

public PathIterator getPathIterator(AffineTransform at)
Passes to our generic shape.

Specified by:
getPathIterator in interface Shape

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Passes to our generic shape.

Specified by:
getPathIterator in interface Shape

registerFits

public void registerFits(nom.tam.fits.Fits i)
                  throws nom.tam.fits.FitsException
Registers a fits object. This method scans for the first valid image HDU and uses this as the base. If this behaviour is not intended, use the image-hdu specific method.

Specified by:
registerFits in interface FitsShape
Throws:
nom.tam.fits.FitsException

registerFits

public void registerFits(nom.tam.fits.ImageHDU i)
                  throws nom.tam.fits.FitsException
Registers the image data to this shape.

Specified by:
registerFits in interface FitsShape
Throws:
nom.tam.fits.FitsException
See Also:
FitsShape.registerFits(Fits)

getStatistic

public Statistic getStatistic(AffineTransform at)
                       throws nom.tam.fits.FitsException
Generates the statistic out of the specified transform.

Specified by:
getStatistic in interface FitsShape
Parameters:
at - How the generic shape is transformed to FITS space.
Throws:
nom.tam.fits.FitsException

getAdus

public List<Vector3D> getAdus(AffineTransform at)
                       throws nom.tam.fits.FitsException
Transforms the generic shape to match the FITS geometry, then greps all underlying adus whose central coordinate (image+0.5, FITS convention -0.5) lies within the shape.

Specified by:
getAdus in interface FitsShape
Parameters:
at - How the generic shape is transformed to FITS space.
Throws:
nom.tam.fits.FitsException

getFitsShape

protected Shape getFitsShape(AffineTransform at)
We use the user-supplied transform to get a true shape that can be applied to ther underlying fits. If no transform was specified, we use the generic shape as-is, which is probably not what you want.