27 #include "boost/format.hpp" 30 #include "boost/algorithm/string/trim.hpp" 32 #include "lsst/daf/base/PropertySet.h" 33 #include "lsst/daf/base/PropertyList.h" 34 #include "lsst/pex/exceptions.h" 49 template <
typename ImageT,
typename MaskT,
typename VarianceT>
51 std::shared_ptr<Wcs const> wcs)
52 : daf::base::Citizen(typeid(this)), _maskedImage(width, height), _info(new
ExposureInfo(wcs)) {}
54 template <
typename ImageT,
typename MaskT,
typename VarianceT>
56 : daf::base::Citizen(typeid(this)), _maskedImage(dimensions), _info(new
ExposureInfo(wcs)) {}
58 template <
typename ImageT,
typename MaskT,
typename VarianceT>
60 : daf::base::Citizen(typeid(this)), _maskedImage(bbox), _info(new
ExposureInfo(wcs)) {}
62 template <
typename ImageT,
typename MaskT,
typename VarianceT>
64 : daf::base::Citizen(typeid(this)), _maskedImage(maskedImage), _info(new
ExposureInfo(wcs)) {}
66 template <
typename ImageT,
typename MaskT,
typename VarianceT>
68 : daf::base::Citizen(typeid(this)),
69 _maskedImage(maskedImage),
72 template <
typename ImageT,
typename MaskT,
typename VarianceT>
74 : daf::base::Citizen(typeid(this)),
78 template <
typename ImageT,
typename MaskT,
typename VarianceT>
81 : daf::base::Citizen(typeid(this)),
85 template <
typename ImageT,
typename MaskT,
typename VarianceT>
88 : daf::base::Citizen(typeid(this)), _maskedImage(), _info(new
ExposureInfo()) {
90 _readFits(fitsfile, bbox, origin, conformMasks);
93 template <
typename ImageT,
typename MaskT,
typename VarianceT>
96 : daf::base::Citizen(typeid(this)), _maskedImage(), _info(new
ExposureInfo()) {
98 _readFits(fitsfile, bbox, origin, conformMasks);
101 template <
typename ImageT,
typename MaskT,
typename VarianceT>
104 : daf::base::Citizen(typeid(this)) {
105 _readFits(fitsfile, bbox, origin, conformMasks);
108 template <
typename ImageT,
typename MaskT,
typename VarianceT>
113 _maskedImage =
MaskedImageT(fitsfile, metadata, bbox, origin, conformMasks,
false, imageMetadata);
114 _info->_readFits(fitsfile, metadata, imageMetadata);
117 template <
typename ImageT,
typename MaskT,
typename VarianceT>
122 template <
typename ImageT,
typename MaskT,
typename VarianceT>
124 _maskedImage = maskedImage;
127 template <
typename ImageT,
typename MaskT,
typename VarianceT>
131 _info->getWcs()->shiftReferencePixel(origin.getX() - old.getX(), origin.getY() - old.getY());
132 _maskedImage.
setXY0(origin);
137 template <
typename ImageT,
typename MaskT,
typename VarianceT>
143 template <
typename ImageT,
typename MaskT,
typename VarianceT>
149 template <
typename ImageT,
typename MaskT,
typename VarianceT>
151 ExposureInfo::FitsWriteData data = _info->_startWriteFits(
getXY0());
152 _maskedImage.
writeFits(fitsfile, data.metadata, data.imageMetadata, data.maskMetadata,
153 data.varianceMetadata);
154 _info->_finishWriteFits(fitsfile, data);
afw::table::PointKey< int > dimensions
virtual ~Exposure()
Destructor.
A class to contain the data, WCS, and other information needed to describe an image of the sky...
std::shared_ptr< ExposureInfo > getInfo()
Get the ExposureInfo that aggregates all the non-image components. Never null.
void setXY0(geom::Point2I const &origin)
Set the Exposure's origin (including correcting the Wcs)
Exposure(unsigned int width, unsigned int height, std::shared_ptr< Wcs const > wcs=std::shared_ptr< Wcs const >())
Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a Wcs (which may b...
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
MaskedImage< ImageT, MaskT, VarianceT > MaskedImageT
An integer coordinate rectangle.
A base class for image defects.
MaskedImageT getMaskedImage()
Return the MaskedImage.
Lifetime-management for memory that goes into FITS memory files.
void setMaskedImage(MaskedImageT &maskedImage)
Set the MaskedImage of the Exposure.
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
geom::Point2I getXY0() const
Return the Exposure's origin.
void setXY0(int const x0, int const y0)
Set the MaskedImage's origin.
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
A collection of all the things that make an Exposure different from a MaskedImage.
lsst::daf::base::PropertyList PropertyList
geom::Point2I getXY0() const
Return the image's origin.