45template <
typename ImageT,
typename MaskT,
typename VarianceT>
50template <
typename ImageT,
typename MaskT,
typename VarianceT>
55template <
typename ImageT,
typename MaskT,
typename VarianceT>
60template <
typename ImageT,
typename MaskT,
typename VarianceT>
65template <
typename ImageT,
typename MaskT,
typename VarianceT>
67 : _maskedImage(maskedImage), _info(info ? info :
std::make_shared<
ExposureInfo>()) {}
69template <
typename ImageT,
typename MaskT,
typename VarianceT>
71 : _maskedImage(
src.getMaskedImage(), deep), _info(new
ExposureInfo(*
src.getInfo(), deep)) {}
73template <
typename ImageT,
typename MaskT,
typename VarianceT>
76template <
typename ImageT,
typename MaskT,
typename VarianceT>
79 : _maskedImage(
src.getMaskedImage(),
bbox, origin, deep),
82template <
typename ImageT,
typename MaskT,
typename VarianceT>
87 *
this = reader.
read<ImageT, MaskT, VarianceT>(
bbox, origin, conformMasks, allowUnsafe);
90template <
typename ImageT,
typename MaskT,
typename VarianceT>
92 ImageOrigin origin,
bool conformMasks,
bool allowUnsafe)
95 *
this = reader.
read<ImageT, MaskT, VarianceT>(
bbox, origin, conformMasks, allowUnsafe);
98template <
typename ImageT,
typename MaskT,
typename VarianceT>
100 ImageOrigin origin,
bool conformMasks,
bool allowUnsafe) {
102 *
this = reader.read<ImageT, MaskT, VarianceT>(
bbox, origin, conformMasks, allowUnsafe);
105template <
typename ImageT,
typename MaskT,
typename VarianceT>
110template <
typename ImageT,
typename MaskT,
typename VarianceT>
112 _maskedImage = maskedImage;
115template <
typename ImageT,
typename MaskT,
typename VarianceT>
118 if (_info->hasWcs()) {
120 auto newWcs = _info->getWcs()->copyAtShiftedPixelOrigin(shift);
121 _info->setWcs(newWcs);
123 _maskedImage.setXY0(origin);
126template <
typename ImageT,
typename MaskT,
typename VarianceT>
127Exposure<ImageT, MaskT, VarianceT> &Exposure<ImageT, MaskT, VarianceT>::operator=(Exposure
const &) =
default;
128template <
typename ImageT,
typename MaskT,
typename VarianceT>
129Exposure<ImageT, MaskT, VarianceT> &Exposure<ImageT, MaskT, VarianceT>::operator=(Exposure &&) =
default;
133template <
typename ImageT,
typename MaskT,
typename VarianceT>
135 fits::Fits fitsfile(fileName,
"w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
139template <
typename ImageT,
typename MaskT,
typename VarianceT>
141 fits::Fits fitsfile(manager,
"w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
145template <
typename ImageT,
typename MaskT,
typename VarianceT>
152template <
typename ImageT,
typename MaskT,
typename VarianceT>
157 fits::Fits fitsfile(fileName,
"w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
158 writeFits(fitsfile, imageOptions, maskOptions, varianceOptions);
161template <
typename ImageT,
typename MaskT,
typename VarianceT>
166 fits::Fits fitsfile(manager,
"w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
167 writeFits(fitsfile, imageOptions, maskOptions, varianceOptions);
170template <
typename ImageT,
typename MaskT,
typename VarianceT>
175 ExposureInfo::FitsWriteData
data = _info->_startWriteFits(getXY0());
176 _maskedImage.writeFits(fitsfile, imageOptions, maskOptions, varianceOptions,
data.metadata,
177 data.imageMetadata,
data.maskMetadata,
data.varianceMetadata);
178 _info->_finishWriteFits(fitsfile,
data);
190template <
class ExposureT>
191void _copyCommonPixels(ExposureT &destination, ExposureT
const &source) {
193 overlapBox.
clip(source.getBBox());
197 typename ExposureT::MaskedImageT overlapPixels(source.getMaskedImage(), overlapBox);
198 destination.getMaskedImage().assign(overlapPixels, overlapBox);
203template <
typename ImageT,
typename MaskT,
typename VarianceT>
211 return getCutout(pixelCenter, size);
214template <
typename ImageT,
typename MaskT,
typename VarianceT>
219 buffer <<
"Point " << center <<
" lies at pixel " << center <<
", which lies outside Exposure "
223 if (size[0] <= 0 || size[1] <= 0) {
225 buffer <<
"Cannot create bounding box with dimensions " << size;
231 auto copyInfo = std::make_shared<ExposureInfo>(*getInfo());
233 blank = math::edgePixel<MaskedImageT>(
237 _copyCommonPixels(cutout, *
this);
241template <
typename ImageT,
typename MaskT,
typename VarianceT>
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
afw::table::PointKey< int > dimensions
std::shared_ptr< RecordT > src
table::Key< table::Array< std::uint8_t > > wcs
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Lifetime-management for memory that goes into FITS memory files.
A FITS reader class for Exposures and their components.
Exposure< ImagePixelT, MaskPixelT, VariancePixelT > read(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the full Exposure.
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Exposure(unsigned int width, unsigned int height, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
Construct an Exposure with a blank MaskedImage of specified size (default 0x0) and a SkyWcs (which ma...
A collection of all the things that make an Exposure different from a MaskedImage.
A class to manipulate images, masks, and variance as a single object.
A floating-point coordinate rectangle geometry.
An integer coordinate rectangle.
void clip(Box2I const &other) noexcept
Shrink this to ensure that other.contains(*this).
bool isEmpty() const noexcept
Return true if the box contains no points.
static Box2I makeCenteredBox(Point2D const ¢er, Extent const &size)
Create a box centered as closely as possible on a particular point.
Extent2I const getDimensions() const noexcept
Point2D const getCenter() const noexcept
1-d interval accessors
Point in an unspecified spherical coordinate system.
Reports invalid arguments.
Reports errors in the logical structure of the program.
Extent< double, 2 > Extent2D
Options for writing an image to FITS.
typename ImageT::image_category image_category