public class WCSTransform extends Object implements WorldCoordinateConverter
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.
Modifier and Type | Field and Description |
---|---|
static String |
NO_WCS_IN_HEADER_MESSAGE
Message if header does not contain a valid World Coordinate System
|
Constructor and Description |
---|
WCSTransform(double cra,
double cdec,
double xsecpix,
double ysecpix,
double xrpix,
double yrpix,
int nxpix,
int nypix,
double rotate,
int equinox,
double epoch,
String proj)
Constructs a new WCSTransform.
|
WCSTransform(WCSKeywordProvider head)
Constructs a new WCSTransform using data from the specified FITS Header.
|
Modifier and Type | Method and Description |
---|---|
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
|
Point2D.Double |
getImageCenter()
Return the center coordinates in image pixels.
|
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(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.
|
Point2D.Double |
pix2wcs(double xpix,
double ypix)
Converts pixel coordinates to World Coordinates.
|
static double |
raddeg(double x) |
static double |
radhr(double x) |
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,
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(Point2D.Double p,
boolean isDistance)
Convert the given world coordinates (degrees, in the equinox of the current image)
to image coordinates.
|
public static final String NO_WCS_IN_HEADER_MESSAGE
public WCSTransform(WCSKeywordProvider head)
head
- provides the required WCS keywords and associated valuesIllegalArgumentException
- 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, 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 X 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
- Projectionpublic 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 Point2D.Double getWCSCenter()
getWCSCenter
in interface WorldCoordinateConverter
public Point2D.Double getImageCenter()
getImageCenter
in interface WorldCoordinateConverter
public boolean isWCS()
isWCS
in interface WorldCoordinateConverter
public void imageToWorldCoords(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(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, String coorsys)
rra
- Reference pixel right ascension in degreesdec
- 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 Point2D.Double pix2wcs(double xpix, double ypix)
public Point2D.Double wcs2pix(double xpos, double ypos)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.