26 #ifndef LSST_AFW_IMAGE_WCS_H
27 #define LSST_AFW_IMAGE_WCS_H
51 namespace formatters {
113 typedef std::shared_ptr<Wcs>
Ptr;
125 Eigen::Matrix2d const & CD,
126 std::
string const &
ctype1="RA---TAN", std::
string const &
ctype2="DEC--TAN",
127 double equinox=2000, std::
string const & raDecSys="
ICRS",
128 std::
string const & cunits1="deg", std::
string const & cunits2="deg"
134 bool operator==(Wcs const & other) const;
135 bool operator!=(Wcs const & other)
const {
return !(*
this == other); }
196 double pixel1,
double pixel2, geom::
Angle& sky1, geom::
Angle& sky2
344 Eigen::Matrix2d const & CD,
346 double equinox, std::
string const & raDecSys,
347 std::
string const & cunits1, std::
string const & cunits2
395 coord::
Coord const & coord,
396 geom::AngleUnit skyUnit
401 coord::
Coord const & coord,
402 geom::AngleUnit skyUnit
433 double CD11,
double CD12,
double CD21,
double CD22);
458 virtual
PTR(afw::geom::XYTransform)
clone() const;
465 bool const _isSameSkySystem;
471 #endif // LSST_AFW_IMAGE_WCS_H
double getEquinox() const
virtual bool hasDistortion() const
A coordinate class intended to represent absolute positions.
#define LSST_PERSIST_FORMATTER(formatter...)
Macro used to connect the persistable class with the Formatter and boost::serialization.
lsst::afw::coord::Coord Coord
geom::AffineTransform linearizePixelToSky(coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
Return the local linear approximation to Wcs::pixelToSky at a point given in sky coordinates.
An object passed to Persistable::write to allow it to persist itself.
virtual void pixelToSkyImpl(double pixel1, double pixel2, geom::Angle skyTmp[2]) const
Class for storing ordered metadata with comments.
geom::Point2D skyToPixel(geom::Angle sky1, geom::Angle sky2) const
Convert from sky coordinates (e.g.
std::shared_ptr< Persistable > Ptr
Wcs & operator=(const Wcs &)
virtual bool _isSubset(Wcs const &other) const
boost::shared_ptr< afw::coord::Coord > makeCorrectCoord(geom::Angle sky0, geom::Angle sky1) const
Given a sky position, use the values stored in ctype and radesys to return the correct sub-class of C...
void initWcsLibFromFits(boost::shared_ptr< lsst::daf::base::PropertySet const > const &fitsMetadata)
Parse a fits header, extract the relevant metadata and create a Wcs object.
boost::shared_ptr< lsst::daf::base::PropertyList > createTrivialWcsAsPropertySet(std::string const &wcsName, int const x0, int const y0)
Define a trivial WCS that maps the lower left corner (LLC) pixel of an image to a given value...
table::PointKey< double > crval
void initWcsLib(geom::Point2D const &crval, geom::Point2D const &crpix, Eigen::Matrix2d const &CD, std::string const &ctype1, std::string const &ctype2, double equinox, std::string const &raDecSys, std::string const &cunits1, std::string const &cunits2)
Manually initialise a wcs struct using values passed by the constructor.
virtual geom::AffineTransform linearizeSkyToPixelInternal(geom::Point2D const &pix, coord::Coord const &coord, geom::AngleUnit skyUnit) const
Implementation for the overloaded public linearizeSkyToPixel methods, requiring both a pixel coordina...
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
geom::Point2D skyToIntermediateWorldCoord(coord::Coord const &coord) const
Convert from sky coordinates (e.g.
Implementation of the WCS standard for a any projection.
afw::coord::CoordSystem getCoordSystem() const
virtual Ptr clone(void) const
boost::shared_ptr< coord::Coord > pixelToSky(double pix1, double pix2) const
Convert from pixel position to sky coordinates (e.g.
table::Key< std::string > ctype2
bool _mayBePersistable() const
Perform basic checks on whether *this might be persistable.
boost::shared_ptr< afw::coord::Coord > convertCoordToSky(coord::Coord const &coord) const
Given a Coord (as a shared pointer), return the sky position in the correct coordinate system for thi...
A class used to convert scalar POD types such as double to Angle.
virtual void shiftReferencePixel(double dx, double dy)
Move the pixel reference position by (dx, dy)
virtual geom::Point2D skyToPixelImpl(geom::Angle sky1, geom::Angle sky2) const
std::shared_ptr< Wcs > Ptr
table::Key< table::Array< Kernel::Pixel > > image
A base class for objects that can be persisted via afw::table::io Archive classes.
virtual std::string getPythonModule() const
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
afw::table::PointKey< int > dimensions
friend boost::shared_ptr< Wcs > makeWcs(boost::shared_ptr< lsst::daf::base::PropertySet > const &fitsMetadata, bool stripMetadata)
Create a Wcs of the correct class using a FITS header.
A class representing an Angle.
afwGeom::Point2I getImageXY0FromMetadata(std::string const &wcsName, lsst::daf::base::PropertySet *metadata)
Return a Point2I(x0, y0) given a PropertySet containing a suitable WCS (e.g.
Interface for Persistable base class.
virtual void rotateImageBy90(int nQuarter, lsst::afw::geom::Extent2I dimensions) const
Rotate image by nQuarter times 90 degrees.
table::Key< double > equinox
bool isSameSkySystem(Wcs const &wcs) const
Return true if a WCS has the same coordinate system and equinox as this one.
Eigen::Matrix2d getCDMatrix() const
Returns the CD matrix.
geom::Angle pixelScale() const
Returns the pixel scale [Angle/pixel].
Wcs()
Construct an invalid Wcs given no arguments.
lsst::afw::geom::Point2D getPixelOrigin() const
Returns CRPIX (corrected to LSST convention).
virtual void flipImage(int flipLR, int flipTB, lsst::afw::geom::Extent2I dimensions) const
Flip CD matrix around the y-axis.
boost::shared_ptr< lsst::afw::coord::Coord > getSkyOrigin() const
Returns CRVAL. This need not be the centre of the image.
virtual geom::AffineTransform linearizePixelToSkyInternal(geom::Point2D const &pix, coord::Coord const &coord, geom::AngleUnit skyUnit) const
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
bool _skyAxesSwapped
if true then the sky axes are swapped
bool isFlipped() const
Does the Wcs follow the convention of North=Up, East=Left?
Base class for all records.
int _wcshdrCtrl
Controls messages to stderr from wcshdr (0 for none); see wcshdr.h for details.
geom::LinearTransform getLinearTransform() const
Return the linear part of the Wcs, the CD matrix in FITS-speak, as an AffineTransform.
int _relax
Degree of permissiveness for wcspih (0 for strict); see wcshdr.h for details.
lsst::afw::geom::Angle Angle
Class for storing generic metadata.
int _wcsfixCtrl
Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes.
virtual bool isPersistable() const
Whether the Wcs is persistable using afw::table::io archives.
double pixArea(lsst::afw::geom::Point2D pix00) const
Sky area covered by a pixel at position pix00 in units of square degrees.
geom::AffineTransform linearizeSkyToPixel(coord::Coord const &coord, geom::AngleUnit skyUnit=geom::degrees) const
Return the local linear approximation to Wcs::skyToPixel at a point given in sky coordinates.
lsst::afw::image::XYTransformFromWcsPair XYTransformFromWcsPair
Point< double, 2 > Point2D
table::PointKey< int > pixel
virtual boost::shared_ptr< lsst::daf::base::PropertyList > getFitsMetadata() const
Return a PropertyList containing FITS header keywords that can be used to save the Wcs...
Base class for all persistable classes.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
#define CONST_PTR(...)
A shared pointer to a const object.
int stripWcsKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > const &metadata, boost::shared_ptr< Wcs const > const &wcs)
Strip keywords from the input metadata that are related to the generated Wcs.
This is the base class for spherical coordinates.
A coordinate class intended to represent offsets and dimensions.
A CRTP facade class for subclasses of Persistable.
Extent< int, 2 > Extent2I
table::Key< std::string > ctype1
coord::CoordSystem _coordSystem
virtual void shiftReferencePixel(geom::Extent2D const &d)
table::PointKey< double > crpix
Functions to handle coordinates.
std::shared_ptr< Wcs const > ConstPtr