LSST Applications g063fba187b+eddd1b24d7,g0f08755f38+4a855ab515,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+062a45aee3,g1dcb35cd9c+45d3fa5522,g20f6ffc8e0+4a855ab515,g217e2c1bcf+f55e51b560,g28da252d5a+7d8e536cc7,g2bbee38e9b+2d92fc7d83,g2bc492864f+2d92fc7d83,g3156d2b45e+6e55a43351,g32e5bea42b+625186cc6b,g347aa1857d+2d92fc7d83,g35bb328faa+a8ce1bb630,g3a166c0a6a+2d92fc7d83,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+1af189bab1,g7af13505b9+7b6a50a2f8,g80478fca09+6174b7f182,g82479be7b0+5b71efbaf0,g858d7b2824+4a855ab515,g9125e01d80+a8ce1bb630,ga5288a1d22+61618a97c4,gb58c049af0+d64f4d3760,gc28159a63d+2d92fc7d83,gc5452a3dca+f4add4ffd5,gcab2d0539d+d9f5af7f69,gcf0d15dbbd+6c7e0a19ec,gda6a2b7d83+6c7e0a19ec,gdaeeff99f8+1711a396fd,ge79ae78c31+2d92fc7d83,gef2f8181fd+55fff6f525,gf0baf85859+c1f95f4921,gfa517265be+4a855ab515,gfa999e8aa5+17cd334064,w.2024.51
LSST Data Management Base Package
Loading...
Searching...
No Matches
Exposure.h
Go to the documentation of this file.
1// -*- LSST-C++ -*- // fixed format comment for emacs
2
3/*
4 * LSST Data Management System
5 * Copyright 2008, 2009, 2010 LSST Corporation.
6 *
7 * This product includes software developed by the
8 * LSST Project (http://www.lsst.org/).
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the LSST License Statement and
21 * the GNU General Public License along with this program. If not,
22 * see <http://www.lsstcorp.org/LegalNotices/>.
23 */
24
25#ifndef LSST_AFW_IMAGE_EXPOSURE_H
26#define LSST_AFW_IMAGE_EXPOSURE_H
27
28#include <memory>
29
30#include "lsst/base.h"
31#include "lsst/daf/base.h"
34#include "lsst/geom/Extent.h"
36
37namespace lsst {
38namespace afw {
39namespace image {
40
70template <typename ImageT, typename MaskT = lsst::afw::image::MaskPixel,
71 typename VarianceT = lsst::afw::image::VariancePixel>
72class Exposure {
73public:
75
76 // Class Constructors and Destructor
84 explicit Exposure(unsigned int width, unsigned int height,
86
93 explicit Exposure(lsst::geom::Extent2I const& dimensions = lsst::geom::Extent2I(),
95
101 explicit Exposure(lsst::geom::Box2I const& bbox,
103
109 explicit Exposure(MaskedImageT& maskedImage,
111
119 explicit Exposure(MaskedImageT& maskedImage, std::shared_ptr<ExposureInfo> info);
120
132 explicit Exposure(std::string const& fileName, lsst::geom::Box2I const& bbox = lsst::geom::Box2I(),
133 ImageOrigin origin = PARENT, bool conformMasks = false, bool allowUnsafe = false);
134
147 ImageOrigin origin = PARENT, bool conformMasks = false, bool allowUnsafe = false);
148
160 explicit Exposure(fits::Fits& fitsfile, lsst::geom::Box2I const& bbox = lsst::geom::Box2I(),
161 ImageOrigin origin = PARENT, bool conformMasks = false, bool allowUnsafe = false);
162
168 Exposure(Exposure const& src, bool const deep = false);
170
181 Exposure(Exposure const& src, lsst::geom::Box2I const& bbox, ImageOrigin const origin = PARENT,
182 bool const deep = false);
183
188 template <typename OtherPixelT>
190 const bool deep
191 )
192 : _maskedImage(rhs.getMaskedImage(), deep), _info(new ExposureInfo(*rhs.getInfo(), deep)) {
193 if (not deep) {
195 "Exposure's converting copy constructor must make a deep copy");
196 }
197 }
198
201
215 Exposure subset(lsst::geom::Box2I const& bbox, ImageOrigin origin = PARENT) const {
216 return Exposure(*this, bbox, origin, false);
217 }
218
221
225
226 // Get Members
228 MaskedImageT getMaskedImage() { return _maskedImage; }
230 MaskedImageT getMaskedImage() const { return _maskedImage; }
231
232 std::shared_ptr<geom::SkyWcs const> getWcs() const { return _info->getWcs(); }
233
234 std::shared_ptr<ApCorrMap const> getApCorrMap() const { return _info->getApCorrMap(); }
235
238 return _info->getDetector();
239 }
241 std::shared_ptr<FilterLabel const> getFilter() const { return _info->getFilter(); }
243 std::shared_ptr<lsst::daf::base::PropertySet> getMetadata() const { return _info->getMetadata(); }
244 void setMetadata(std::shared_ptr<lsst::daf::base::PropertySet> metadata) { _info->setMetadata(metadata); }
245
247 int getWidth() const { return _maskedImage.getWidth(); }
249 int getHeight() const { return _maskedImage.getHeight(); }
251 lsst::geom::Extent2I getDimensions() const { return _maskedImage.getDimensions(); }
252
258 int getX0() const { return _maskedImage.getX0(); }
264 int getY0() const { return _maskedImage.getY0(); }
265
273 lsst::geom::Point2I getXY0() const { return _maskedImage.getXY0(); }
274
275 lsst::geom::Box2I getBBox(ImageOrigin const origin = PARENT) const {
276 return _maskedImage.getBBox(origin);
277 }
286 void setXY0(lsst::geom::Point2I const& origin);
287
288 // Set Members
291 void setMaskedImage(MaskedImageT& maskedImage);
292 void setWcs(std::shared_ptr<geom::SkyWcs> wcs) { _info->setWcs(wcs); }
295 _info->setDetector(detector);
296 }
297
299 void setFilter(std::shared_ptr<FilterLabel const> filterLabel) { _info->setFilter(filterLabel); }
300
302 void setPhotoCalib(std::shared_ptr<PhotoCalib const> photoCalib) { _info->setPhotoCalib(photoCalib); }
304 std::shared_ptr<PhotoCalib const> getPhotoCalib() const { return _info->getPhotoCalib(); }
305
308
311
313 bool hasPsf() const { return _info->hasPsf(); }
314
316 bool hasWcs() const { return _info->hasWcs(); }
317
320
323
326
328 void setInfo(std::shared_ptr<ExposureInfo> exposureInfo) { _info = exposureInfo; }
329
344 void writeFits(std::string const& fileName) const;
345
353 void writeFits(fits::MemFileManager& manager) const;
354
362 void writeFits(fits::Fits& fitsfile) const;
363
372 void writeFits(std::string const& fileName, fits::ImageWriteOptions const& imageOptions,
373 fits::ImageWriteOptions const& maskOptions,
374 fits::ImageWriteOptions const& varianceOptions) const;
375
384 void writeFits(fits::MemFileManager& manager, fits::ImageWriteOptions const& imageOptions,
385 fits::ImageWriteOptions const& maskOptions,
386 fits::ImageWriteOptions const& varianceOptions) const;
387
396 void writeFits(fits::Fits& fitsfile, fits::ImageWriteOptions const& imageOptions,
397 fits::ImageWriteOptions const& maskOptions,
398 fits::ImageWriteOptions const& varianceOptions) const;
399
405 static Exposure readFits(std::string const& filename) {
406 return Exposure<ImageT, MaskT, VarianceT>(filename);
407 }
408
416 }
417
434 Exposure getCutout(lsst::geom::SpherePoint const& center, lsst::geom::Extent2I const& size) const;
435
453 Exposure getCutout(lsst::geom::Point2D const& center, lsst::geom::Extent2I const& size) const;
454
470 Exposure getCutout(lsst::geom::Box2I const& box) const;
471
472private:
473 void _readFits(fits::Fits& fitsfile, lsst::geom::Box2I const& bbox, ImageOrigin origin,
474 bool conformMasks);
475
476 MaskedImageT _maskedImage;
478};
479
483template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
492} // namespace image
493} // namespace afw
494} // namespace lsst
495
496#endif // LSST_AFW_IMAGE_EXPOSURE_H
AmpInfoBoxKey bbox
Definition Amplifier.cc:117
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
std::shared_ptr< RecordT > src
Definition Match.cc:48
Basic LSST definitions.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition fits.h:308
Lifetime-management for memory that goes into FITS memory files.
Definition fits.h:125
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Definition Exposure.h:72
MaskedImageT getMaskedImage()
Return the MaskedImage.
Definition Exposure.h:228
std::shared_ptr< ApCorrMap const > getApCorrMap() const
Definition Exposure.h:234
void setPsf(std::shared_ptr< lsst::afw::detection::Psf const > psf)
Set the Exposure's Psf.
Definition Exposure.h:307
bool hasWcs() const
Does this Exposure have a Wcs?
Definition Exposure.h:316
Exposure getCutout(lsst::geom::SpherePoint const &center, lsst::geom::Extent2I const &size) const
Return an Exposure that is a small cutout of the original.
Definition Exposure.cc:204
int getHeight() const
Return the Exposure's height.
Definition Exposure.h:249
Exposure(Exposure< OtherPixelT, MaskT, VarianceT > const &rhs, const bool deep)
generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/...
Definition Exposure.h:189
std::shared_ptr< lsst::afw::cameraGeom::Detector const > getDetector() const
Return the Exposure's Detector information.
Definition Exposure.h:237
std::shared_ptr< ExposureInfo > getInfo()
Get the ExposureInfo that aggregates all the non-image components. Never null.
Definition Exposure.h:322
void setDetector(std::shared_ptr< lsst::afw::cameraGeom::Detector const > detector)
Set the Exposure's Detector information.
Definition Exposure.h:294
void writeFits(std::string const &fileName) const
Write an Exposure to a regular multi-extension FITS file.
Definition Exposure.cc:134
std::shared_ptr< lsst::daf::base::PropertySet > getMetadata() const
Return flexible metadata.
Definition Exposure.h:243
std::shared_ptr< lsst::afw::detection::Psf const > getPsf() const
Return the Exposure's Psf object.
Definition Exposure.h:310
std::shared_ptr< ExposureInfo const > getInfo() const
Get the ExposureInfo that aggregates all the non-image components. Never null.
Definition Exposure.h:325
MaskedImageT getMaskedImage() const
Return the MaskedImage.
Definition Exposure.h:230
void setPhotoCalib(std::shared_ptr< PhotoCalib const > photoCalib)
Set the Exposure's PhotoCalib object.
Definition Exposure.h:302
int getWidth() const
Return the Exposure's width.
Definition Exposure.h:247
int getY0() const
Return the Exposure's row-origin.
Definition Exposure.h:264
Exposure subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition Exposure.h:215
void setInfo(std::shared_ptr< ExposureInfo > exposureInfo)
Set the ExposureInfo that aggregates all the non-image components.
Definition Exposure.h:328
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...
Definition Exposure.cc:46
void setMetadata(std::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition Exposure.h:244
std::shared_ptr< PhotoCalib const > getPhotoCalib() const
Return the Exposure's PhotoCalib object.
Definition Exposure.h:304
int getX0() const
Return the Exposure's column-origin.
Definition Exposure.h:258
std::shared_ptr< FilterLabel const > getFilter() const
Return the Exposure's filter information.
Definition Exposure.h:241
Exposure operator[](lsst::geom::Box2I const &bbox) const
Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
Definition Exposure.h:220
lsst::geom::Extent2I getDimensions() const
Return the Exposure's size.
Definition Exposure.h:251
bool hasPsf() const
Does this Exposure have a Psf?
Definition Exposure.h:313
void setFilter(std::shared_ptr< FilterLabel const > filterLabel)
Set the Exposure's filter information.
Definition Exposure.h:299
static Exposure readFits(fits::MemFileManager &manager)
Read an Exposure from a FITS RAM file.
Definition Exposure.h:414
void setWcs(std::shared_ptr< geom::SkyWcs > wcs)
Definition Exposure.h:292
std::shared_ptr< geom::SkyWcs const > getWcs() const
Definition Exposure.h:232
Exposure & operator=(Exposure &&)
Exposure & operator=(Exposure const &)
lsst::geom::Point2I getXY0() const
Return the Exposure's origin.
Definition Exposure.h:273
void setXY0(lsst::geom::Point2I const &origin)
Set the Exposure's origin (including correcting the Wcs)
Definition Exposure.cc:116
static Exposure readFits(std::string const &filename)
Read an Exposure from a regular FITS file.
Definition Exposure.h:405
void setMaskedImage(MaskedImageT &maskedImage)
Set the MaskedImage of the Exposure.
Definition Exposure.cc:111
MaskedImage< ImageT, MaskT, VarianceT > MaskedImageT
Definition Exposure.h:74
void setApCorrMap(std::shared_ptr< ApCorrMap const > apCorrMap)
Set the Exposure's aperture correction map.
Definition Exposure.h:319
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Definition Exposure.h:275
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.
Definition MaskedImage.h:74
int getX0() const
Return the image's column-origin.
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
int getHeight() const
Return the number of rows in the image.
int getY0() const
Return the image's row-origin.
lsst::geom::Extent2I getDimensions() const
lsst::geom::Point2I getXY0() const
Return the image's origin.
int getWidth() const
Return the number of columns in the image.
An integer coordinate rectangle.
Definition Box.h:55
Point in an unspecified spherical coordinate system.
Definition SpherePoint.h:57
Reports invalid arguments.
Definition Runtime.h:66
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
float VariancePixel
default type for MaskedImage variance images
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
A function to return an Exposure of the correct type (cf.
Definition Exposure.h:484
Options for writing an image to FITS.
Definition fits.h:223
Key< int > psf
Definition Exposure.cc:65
Key< int > apCorrMap
Definition Exposure.cc:68