|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.coords.WCSTransform
public class WCSTransform
A port of pieces of the WCSTools library version 2.6, originally written in C. WCSTranform is the main class. It can construct a proper transform using a WCSKeywordProvider object. The methods pix2wcs and wcs2pix do the actual conversions between image pixel values and WCS coordinates.
In porting the code to Java, I attempted to change as little as possible, hoping that this would make it easier to keep up-to-date with the C version.
See the WCSTools page for more information.
Original file:
libwcs/wcs.c
February 6, 1998
By Doug Mink, Harvard-Smithsonian Center for Astrophysics
This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.
Field Summary | |
---|---|
static java.lang.String |
NO_WCS_IN_HEADER_MESSAGE
Message if header does not contain a valid World Coordinate System |
Constructor Summary | |
---|---|
WCSTransform(double cra,
double cdec,
double xsecpix,
double ysecpix,
double xrpix,
double yrpix,
int nxpix,
int nypix,
double rotate,
int equinox,
double epoch,
java.lang.String proj)
Constructs a new WCSTransform. |
|
WCSTransform(WCSKeywordProvider head)
Constructs a new WCSTransform using data from the specified FITS Header. |
Method Summary | |
---|---|
static double |
deghr(double x)
|
static double |
degrad(double x)
Conversions among hours of RA, degrees and radians. |
double |
getEquinox()
Return the equinox used for coordinates (usually the equionx of the image) |
double |
getHeight()
Return the image height in pixels. |
double |
getHeightInDeg()
return the height in deg |
java.awt.geom.Point2D.Double |
getImageCenter()
Return the center coordinates in image pixels. |
java.awt.geom.Point2D.Double |
getWCSCenter()
Return the center RA,DEC coordinates in deg. |
double |
getWidth()
Return the image width in pixels. |
double |
getWidthInDeg()
return the width in deg |
static double |
hrdeg(double x)
|
static double |
hrrad(double x)
|
void |
imageToWorldCoords(java.awt.geom.Point2D.Double p,
boolean isDistance)
Convert the given image coordinates to world coordinates degrees in the equinox of the current image. |
boolean |
isValid()
|
boolean |
isWCS()
Return true if world coordinates conversion is available. |
java.awt.geom.Point2D.Double |
pix2wcs(double xpix,
double ypix)
Converts pixel coordinates to World Coordinates. |
static double |
raddeg(double x)
|
static double |
radhr(double x)
|
java.awt.geom.Point2D.Double |
wcs2pix(double xpos,
double ypos)
Converts World Coordinates to pixel coordinates. |
double |
wcsdist(double x1,
double y1,
double x2,
double y2)
Compute distance in degrees between two sky coordinates (RA,Dec) or (Long,Lat) in degrees |
void |
wcseq(WCSKeywordProvider head)
|
protected void |
wcsfull()
Set the RA and Dec of the image center, plus size in degrees |
void |
wcsshift(double rra,
double rdec,
java.lang.String coorsys)
Reset the center of a WCS structure. |
void |
wcssize()
Return RA and Dec of image center, plus size in RA and Dec |
void |
worldToImageCoords(java.awt.geom.Point2D.Double p,
boolean isDistance)
Convert the given world coordinates (degrees, in the equinox of the current image) to image coordinates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NO_WCS_IN_HEADER_MESSAGE
Constructor Detail |
---|
public WCSTransform(WCSKeywordProvider head)
head
- provides the required WCS keywords and associated values
java.lang.IllegalArgumentException
- if the header does not contain a valid World Coordinate System.public WCSTransform(double cra, double cdec, double xsecpix, double ysecpix, double xrpix, double yrpix, int nxpix, int nypix, double rotate, int equinox, double epoch, java.lang.String proj)
cra
- Center right ascension in degreescdec
- Center declination in degreesxsecpix
- Number of arcseconds per pixel along x-axisysecpix
- Number of arcseconds per pixel along y-axisxrpix
- Reference pixel X coordinateyrpix
- Reference pixel Y coordinatenxpix
- Number of pixels along x-axisnypix
- Number of pixels along y-axisrotate
- Rotation angle (clockwise positive) in degreesequinox
- Equinox of coordinates, 1950 and 2000 supportedepoch
- Epoch of coordinates, used for FK4/FK5 conversion no effect if 0proj
- ProjectionMethod Detail |
---|
public static double degrad(double x)
public static double raddeg(double x)
public static double hrdeg(double x)
public static double deghr(double x)
public static double hrrad(double x)
public static double radhr(double x)
public double getEquinox()
getEquinox
in interface WorldCoordinateConverter
public java.awt.geom.Point2D.Double getWCSCenter()
getWCSCenter
in interface WorldCoordinateConverter
public java.awt.geom.Point2D.Double getImageCenter()
getImageCenter
in interface WorldCoordinateConverter
public boolean isWCS()
isWCS
in interface WorldCoordinateConverter
public void imageToWorldCoords(java.awt.geom.Point2D.Double p, boolean isDistance)
imageToWorldCoords
in interface WorldCoordinateConverter
p
- The point to convert.isDistance
- True if p should be interpreted as a distance instead
of a point.public void worldToImageCoords(java.awt.geom.Point2D.Double p, boolean isDistance)
worldToImageCoords
in interface WorldCoordinateConverter
p
- The point to convert.isDistance
- True if p should be interpreted as a distance instead
of a point.public double getWidthInDeg()
getWidthInDeg
in interface WorldCoordinateConverter
public double getHeightInDeg()
getHeightInDeg
in interface WorldCoordinateConverter
public double getWidth()
getWidth
in interface WorldCoordinateConverter
public double getHeight()
getHeight
in interface WorldCoordinateConverter
public void wcseq(WCSKeywordProvider head)
public boolean isValid()
public void wcsshift(double rra, double rdec, java.lang.String coorsys)
rra
- Reference pixel right ascension in degreesrdec
- Reference pixel declination in degreescoorsys
- FK4 or FK5 coordinates (1950 or 2000)public void wcssize()
protected void wcsfull()
public double wcsdist(double x1, double y1, double x2, double y2)
public java.awt.geom.Point2D.Double pix2wcs(double xpix, double ypix)
public java.awt.geom.Point2D.Double wcs2pix(double xpos, double ypos)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |