lsst.afw  14.0-23-g38c323faa+3
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 
86 class ExposureInfo {
87 public:
89  bool hasWcs() const { return static_cast<bool>(_wcs); }
90 
92  std::shared_ptr<Wcs> getWcs() { return _wcs; }
93 
95  std::shared_ptr<Wcs const> getWcs() const { return _wcs; }
96 
98  void setWcs(std::shared_ptr<Wcs const> wcs) { _wcs = _cloneWcs(wcs); }
99 
101  bool hasDetector() const { return static_cast<bool>(_detector); }
102 
105 
107  void setDetector(std::shared_ptr<cameraGeom::Detector const> detector) { _detector = detector; }
108 
110  Filter getFilter() const { return _filter; }
111 
113  void setFilter(Filter const& filter) { _filter = filter; }
114 
116  bool hasCalib() const { return static_cast<bool>(_calib); }
117 
119  std::shared_ptr<Calib> getCalib() { return _calib; }
120 
122  std::shared_ptr<Calib const> getCalib() const { return _calib; }
123 
125  void setCalib(std::shared_ptr<Calib const> calib) { _calib = _cloneCalib(calib); }
126 
129 
131  void setMetadata(std::shared_ptr<daf::base::PropertySet> metadata) { _metadata = metadata; }
132 
134  bool hasPsf() const { return static_cast<bool>(_psf); }
135 
138 
141  // Psfs are immutable, so this is always safe; it'd be better to always just pass around
142  // const or non-const pointers, instead of both, but this is more backwards-compatible.
144  }
145 
147  bool hasValidPolygon() const { return static_cast<bool>(_validPolygon); }
148 
151 
153  void setValidPolygon(std::shared_ptr<geom::polygon::Polygon const> polygon) { _validPolygon = polygon; }
154 
156  bool hasApCorrMap() const { return static_cast<bool>(_apCorrMap); }
157 
159  std::shared_ptr<ApCorrMap> getApCorrMap() { return _apCorrMap; }
160 
162  std::shared_ptr<ApCorrMap const> getApCorrMap() const { return _apCorrMap; }
163 
165  void setApCorrMap(std::shared_ptr<ApCorrMap> apCorrMap) { _apCorrMap = apCorrMap; }
166 
173  void initApCorrMap();
174 
176  bool hasCoaddInputs() const { return static_cast<bool>(_coaddInputs); }
177 
179  void setCoaddInputs(std::shared_ptr<CoaddInputs> coaddInputs) { _coaddInputs = coaddInputs; }
180 
182  std::shared_ptr<CoaddInputs> getCoaddInputs() const { return _coaddInputs; }
183 
186 
188  bool hasVisitInfo() const { return static_cast<bool>(_visitInfo); }
189 
191  void setVisitInfo(std::shared_ptr<image::VisitInfo const> const visitInfo) { _visitInfo = visitInfo; }
192 
200  explicit ExposureInfo(
208  Filter const& filter = Filter(), std::shared_ptr<daf::base::PropertySet> const& metadata =
214 
216  ExposureInfo(ExposureInfo const& other);
217 
219  ExposureInfo(ExposureInfo const& other, bool copyMetadata);
220 
222  ExposureInfo& operator=(ExposureInfo const& other);
223 
224  // Destructor defined in source file because we need access to destructors of forward-declared components
225  ~ExposureInfo();
226 
227 private:
228  template <typename ImageT, typename MaskT, typename VarianceT>
229  friend class Exposure;
230 
244  struct FitsWriteData {
249  table::io::OutputArchive archive;
250  };
251 
260  FitsWriteData _startWriteFits(geom::Point2I const& xy0 = geom::Point2I()) const;
261 
275  void _finishWriteFits(fits::Fits& fitsfile, FitsWriteData const& data) const;
276 
284  void _readFits(fits::Fits& fitsfile, std::shared_ptr<daf::base::PropertySet> metadata,
286 
288  static std::shared_ptr<Wcs> _cloneWcs(std::shared_ptr<Wcs const> wcs);
289  static std::shared_ptr<ApCorrMap> _cloneApCorrMap(std::shared_ptr<ApCorrMap const> apCorrMap);
290 
293  std::shared_ptr<Calib> _calib;
296  Filter _filter;
298  std::shared_ptr<CoaddInputs> _coaddInputs;
299  std::shared_ptr<ApCorrMap> _apCorrMap;
301 };
302 }
303 }
304 } // lsst::afw::image
305 
306 #endif // !LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
void setMetadata(std::shared_ptr< daf::base::PropertySet > metadata)
Set the flexible metadata.
Definition: ExposureInfo.h:131
std::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:92
void setCalib(std::shared_ptr< Calib const > calib)
Set the Exposure&#39;s Calib object.
Definition: ExposureInfo.h:125
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:191
void setWcs(std::shared_ptr< Wcs const > wcs)
Set the coordinate system of the exposure.
Definition: ExposureInfo.h:98
bool hasCalib() const
Does this exposure have a Calib?
Definition: ExposureInfo.h:116
std::shared_ptr< image::VisitInfo const > getVisitInfo() const
Return the exposure&#39;s visit info.
Definition: ExposureInfo.h:185
bool hasPsf() const
Does this exposure have a Psf?
Definition: ExposureInfo.h:134
std::shared_ptr< ApCorrMap > getApCorrMap()
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:159
void setDetector(std::shared_ptr< cameraGeom::Detector const > detector)
Set the exposure&#39;s Detector information.
Definition: ExposureInfo.h:107
bool hasDetector() const
Does this exposure have Detector information?
Definition: ExposureInfo.h:101
void setCoaddInputs(std::shared_ptr< CoaddInputs > coaddInputs)
Set the exposure&#39;s coadd provenance catalogs.
Definition: ExposureInfo.h:179
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:279
bool hasWcs() const
Does this exposure have a Wcs?
Definition: ExposureInfo.h:89
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:153
bool hasApCorrMap() const
Return true if the exposure has an aperture correction map.
Definition: ExposureInfo.h:156
bool hasVisitInfo() const
Does this exposure have visit info?
Definition: ExposureInfo.h:188
void setPsf(std::shared_ptr< detection::Psf const > psf)
Set the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:140
A base class for image defects.
std::shared_ptr< detection::Psf > getPsf() const
Return the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:137
void setFilter(Filter const &filter)
Set the exposure&#39;s filter.
Definition: ExposureInfo.h:113
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Definition: ExposureInfo.h:147
T const_pointer_cast(T... args)
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Return the valid Polygon.
Definition: ExposureInfo.h:150
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:128
std::shared_ptr< Calib const > getCalib() const
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:122
std::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure&#39;s Detector information.
Definition: ExposureInfo.h:104
std::shared_ptr< Calib > getCalib()
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:119
void setApCorrMap(std::shared_ptr< ApCorrMap > apCorrMap)
Set the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:165
std::shared_ptr< ApCorrMap const > getApCorrMap() const
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:162
std::shared_ptr< Wcs const > getWcs() const
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:95
A collection of all the things that make an Exposure different from a MaskedImage.
Definition: ExposureInfo.h:86
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:182
Filter getFilter() const
Return the exposure&#39;s filter.
Definition: ExposureInfo.h:110
bool hasCoaddInputs() const
Does this exposure have coadd provenance catalogs?
Definition: ExposureInfo.h:176