lsst.afw  14.0-38-g278b05818
ExposureInfo.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*- // fixed format comment for emacs
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2013 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
25 #define LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
26 
27 #include "lsst/base.h"
28 #include "lsst/daf/base.h"
29 #include "lsst/afw/geom/Point.h"
30 #include "lsst/afw/image/Filter.h"
34 
35 namespace lsst {
36 namespace afw {
37 
38 namespace cameraGeom {
39 class Detector;
40 }
41 
42 namespace detection {
43 class Psf;
44 }
45 
46 namespace geom {
47 namespace polygon {
48 class Polygon;
49 }
50 }
51 
52 namespace fits {
53 class Fits;
54 }
55 
56 namespace image {
57 
58 class Calib;
59 class Wcs;
60 class ApCorrMap;
61 class VisitInfo;
62 class TransmissionCurve;
63 
87 class ExposureInfo {
88 public:
90  bool hasWcs() const { return static_cast<bool>(_wcs); }
91 
93  std::shared_ptr<Wcs> getWcs() { return _wcs; }
94 
96  std::shared_ptr<Wcs const> getWcs() const { return _wcs; }
97 
99  void setWcs(std::shared_ptr<Wcs const> wcs) { _wcs = _cloneWcs(wcs); }
100 
102  bool hasDetector() const { return static_cast<bool>(_detector); }
103 
106 
108  void setDetector(std::shared_ptr<cameraGeom::Detector const> detector) { _detector = detector; }
109 
111  Filter getFilter() const { return _filter; }
112 
114  void setFilter(Filter const& filter) { _filter = filter; }
115 
117  bool hasCalib() const { return static_cast<bool>(_calib); }
118 
120  std::shared_ptr<Calib> getCalib() { return _calib; }
121 
123  std::shared_ptr<Calib const> getCalib() const { return _calib; }
124 
126  void setCalib(std::shared_ptr<Calib const> calib) { _calib = _cloneCalib(calib); }
127 
130 
132  void setMetadata(std::shared_ptr<daf::base::PropertySet> metadata) { _metadata = metadata; }
133 
135  bool hasPsf() const { return static_cast<bool>(_psf); }
136 
139 
142  // Psfs are immutable, so this is always safe; it'd be better to always just pass around
143  // const or non-const pointers, instead of both, but this is more backwards-compatible.
145  }
146 
148  bool hasValidPolygon() const { return static_cast<bool>(_validPolygon); }
149 
152 
154  void setValidPolygon(std::shared_ptr<geom::polygon::Polygon const> polygon) { _validPolygon = polygon; }
155 
157  bool hasApCorrMap() const { return static_cast<bool>(_apCorrMap); }
158 
160  std::shared_ptr<ApCorrMap> getApCorrMap() { return _apCorrMap; }
161 
163  std::shared_ptr<ApCorrMap const> getApCorrMap() const { return _apCorrMap; }
164 
166  void setApCorrMap(std::shared_ptr<ApCorrMap> apCorrMap) { _apCorrMap = apCorrMap; }
167 
174  void initApCorrMap();
175 
177  bool hasCoaddInputs() const { return static_cast<bool>(_coaddInputs); }
178 
180  void setCoaddInputs(std::shared_ptr<CoaddInputs> coaddInputs) { _coaddInputs = coaddInputs; }
181 
183  std::shared_ptr<CoaddInputs> getCoaddInputs() const { return _coaddInputs; }
184 
187 
189  bool hasVisitInfo() const { return static_cast<bool>(_visitInfo); }
190 
192  void setVisitInfo(std::shared_ptr<image::VisitInfo const> const visitInfo) { _visitInfo = visitInfo; }
193 
195  bool hasTransmissionCurve() const { return static_cast<bool>(_transmissionCurve); }
196 
198  std::shared_ptr<TransmissionCurve const> getTransmissionCurve() const { return _transmissionCurve; }
199 
202 
203 
211  explicit ExposureInfo(
219  Filter const& filter = Filter(), std::shared_ptr<daf::base::PropertySet> const& metadata =
227  );
228 
230  ExposureInfo(ExposureInfo const& other);
231 
233  ExposureInfo(ExposureInfo const& other, bool copyMetadata);
234 
236  ExposureInfo& operator=(ExposureInfo const& other);
237 
238  // Destructor defined in source file because we need access to destructors of forward-declared components
239  ~ExposureInfo();
240 
241 private:
242  template <typename ImageT, typename MaskT, typename VarianceT>
243  friend class Exposure;
244 
258  struct FitsWriteData {
263  table::io::OutputArchive archive;
264  };
265 
274  FitsWriteData _startWriteFits(geom::Point2I const& xy0 = geom::Point2I()) const;
275 
289  void _finishWriteFits(fits::Fits& fitsfile, FitsWriteData const& data) const;
290 
298  void _readFits(fits::Fits& fitsfile, std::shared_ptr<daf::base::PropertySet> metadata,
300 
302  static std::shared_ptr<Wcs> _cloneWcs(std::shared_ptr<Wcs const> wcs);
303  static std::shared_ptr<ApCorrMap> _cloneApCorrMap(std::shared_ptr<ApCorrMap const> apCorrMap);
304 
307  std::shared_ptr<Calib> _calib;
310  Filter _filter;
312  std::shared_ptr<CoaddInputs> _coaddInputs;
313  std::shared_ptr<ApCorrMap> _apCorrMap;
315  std::shared_ptr<TransmissionCurve const> _transmissionCurve;
316 };
317 }
318 }
319 } // lsst::afw::image
320 
321 #endif // !LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
void setMetadata(std::shared_ptr< daf::base::PropertySet > metadata)
Set the flexible metadata.
Definition: ExposureInfo.h:132
std::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:93
bool hasTransmissionCurve() const
Does this exposure have a transmission curve?
Definition: ExposureInfo.h:195
void setCalib(std::shared_ptr< Calib const > calib)
Set the Exposure&#39;s Calib object.
Definition: ExposureInfo.h:126
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:76
void setVisitInfo(std::shared_ptr< image::VisitInfo const > const visitInfo)
Set the exposure&#39;s visit info.
Definition: ExposureInfo.h:192
void setWcs(std::shared_ptr< Wcs const > wcs)
Set the coordinate system of the exposure.
Definition: ExposureInfo.h:99
bool hasCalib() const
Does this exposure have a Calib?
Definition: ExposureInfo.h:117
std::shared_ptr< image::VisitInfo const > getVisitInfo() const
Return the exposure&#39;s visit info.
Definition: ExposureInfo.h:186
bool hasPsf() const
Does this exposure have a Psf?
Definition: ExposureInfo.h:135
std::shared_ptr< ApCorrMap > getApCorrMap()
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:160
void setDetector(std::shared_ptr< cameraGeom::Detector const > detector)
Set the exposure&#39;s Detector information.
Definition: ExposureInfo.h:108
bool hasDetector() const
Does this exposure have Detector information?
Definition: ExposureInfo.h:102
void setCoaddInputs(std::shared_ptr< CoaddInputs > coaddInputs)
Set the exposure&#39;s coadd provenance catalogs.
Definition: ExposureInfo.h:180
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:280
bool hasWcs() const
Does this exposure have a Wcs?
Definition: ExposureInfo.h:90
A multi-catalog archive object used to save table::io::Persistable objects.
Definition: OutputArchive.h:34
void setValidPolygon(std::shared_ptr< geom::polygon::Polygon const > polygon)
Set the exposure&#39;s valid Polygon.
Definition: ExposureInfo.h:154
bool hasApCorrMap() const
Return true if the exposure has an aperture correction map.
Definition: ExposureInfo.h:157
bool hasVisitInfo() const
Does this exposure have visit info?
Definition: ExposureInfo.h:189
void setPsf(std::shared_ptr< detection::Psf const > psf)
Set the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:141
A base class for image defects.
std::shared_ptr< detection::Psf > getPsf() const
Return the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:138
void setTransmissionCurve(std::shared_ptr< TransmissionCurve const > tc)
Set the exposure&#39;s transmission curve.
Definition: ExposureInfo.h:201
void setFilter(Filter const &filter)
Set the exposure&#39;s filter.
Definition: ExposureInfo.h:114
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Definition: ExposureInfo.h:148
T const_pointer_cast(T... args)
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Return the valid Polygon.
Definition: ExposureInfo.h:151
Holds an integer identifier for an LSST filter.
Definition: Filter.h:134
std::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
Definition: ExposureInfo.h:129
std::shared_ptr< Calib const > getCalib() const
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:123
std::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure&#39;s Detector information.
Definition: ExposureInfo.h:105
std::shared_ptr< Calib > getCalib()
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:120
void setApCorrMap(std::shared_ptr< ApCorrMap > apCorrMap)
Set the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:166
std::shared_ptr< ApCorrMap const > getApCorrMap() const
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:163
std::shared_ptr< Wcs const > getWcs() const
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:96
A collection of all the things that make an Exposure different from a MaskedImage.
Definition: ExposureInfo.h:87
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:70
std::shared_ptr< CoaddInputs > getCoaddInputs() const
Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null)...
Definition: ExposureInfo.h:183
Filter getFilter() const
Return the exposure&#39;s filter.
Definition: ExposureInfo.h:111
bool hasCoaddInputs() const
Does this exposure have coadd provenance catalogs?
Definition: ExposureInfo.h:177
std::shared_ptr< TransmissionCurve const > getTransmissionCurve() const
Return the exposure&#39;s transmission curve.
Definition: ExposureInfo.h:198