LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
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"
33 
34 namespace lsst { namespace afw {
35 
36 namespace cameraGeom {
37 class Detector;
38 }
39 
40 namespace detection {
41 class Psf;
42 }
43 
44 namespace geom { namespace polygon {
45 class Polygon;
46 }}
47 
48 namespace fits {
49 class Fits;
50 }
51 
52 namespace image {
53 
54 class Calib;
55 class Wcs;
56 class ApCorrMap;
57 
80 class ExposureInfo {
81 public:
82 
84  bool hasWcs() const { return static_cast<bool>(_wcs); }
85 
87  PTR(Wcs) getWcs() { return _wcs; }
88 
90  CONST_PTR(Wcs) getWcs() const { return _wcs; }
91 
93  void setWcs(CONST_PTR(Wcs) wcs) { _wcs = _cloneWcs(wcs); }
94 
96  bool hasDetector() const { return static_cast<bool>(_detector); }
97 
100 
102  void setDetector(CONST_PTR(cameraGeom::Detector) detector) { _detector = detector; }
103 
105  Filter getFilter() const { return _filter; }
106 
108  void setFilter(Filter const& filter) { _filter = filter; }
109 
111  bool hasCalib() const { return static_cast<bool>(_calib); }
112 
114  PTR(Calib) getCalib() { return _calib; }
115 
117  CONST_PTR(Calib) getCalib() const { return _calib; }
118 
120  void setCalib(CONST_PTR(Calib) calib) { _calib = _cloneCalib(calib); }
121 
124 
126  void setMetadata(PTR(daf::base::PropertySet) metadata) { _metadata = metadata; }
127 
129  bool hasPsf() const { return static_cast<bool>(_psf); }
130 
132  PTR(detection::Psf) getPsf() const { return _psf; }
133 
136  // Psfs are immutable, so this is always safe; it'd be better to always just pass around
137  // const or non-const pointers, instead of both, but this is more backwards-compatible.
138  _psf = boost::const_pointer_cast<detection::Psf>(psf);
139  }
140 
142  bool hasValidPolygon() const { return static_cast<bool>(_validPolygon);}
143 
146 
149 
151  bool hasApCorrMap() const { return static_cast<bool>(_apCorrMap); }
152 
155 
157  PTR(ApCorrMap const) getApCorrMap() const { return _apCorrMap; }
158 
160  void setApCorrMap(PTR(ApCorrMap) apCorrMap) { _apCorrMap = apCorrMap; }
161 
168  void initApCorrMap();
169 
171  bool hasCoaddInputs() const { return static_cast<bool>(_coaddInputs); }
172 
174  void setCoaddInputs(PTR(CoaddInputs) coaddInputs) { _coaddInputs = coaddInputs; }
175 
178 
186  explicit ExposureInfo(
187  CONST_PTR(Wcs) const & wcs = CONST_PTR(Wcs)(),
189  CONST_PTR(Calib) const & calib = CONST_PTR(Calib)(),
192  Filter const & filter = Filter(),
193  PTR(daf::base::PropertySet) const & metadata = PTR(daf::base::PropertySet)(),
194  PTR(CoaddInputs) const & coaddInputs = PTR(CoaddInputs)(),
195  PTR(ApCorrMap) const & apCorrMap = PTR(ApCorrMap)()
196  );
197 
199  ExposureInfo(ExposureInfo const & other);
200 
202  ExposureInfo(ExposureInfo const & other, bool copyMetadata);
203 
205  ExposureInfo & operator=(ExposureInfo const & other);
206 
207  // Destructor defined in source file because we need access to destructors of forward-declared components
208  ~ExposureInfo();
209 
210 private:
211 
212  template <typename ImageT, typename MaskT, typename VarianceT> friend class Exposure;
213 
227  struct FitsWriteData {
232  table::io::OutputArchive archive;
233  };
234 
243  FitsWriteData _startWriteFits(geom::Point2I const & xy0=geom::Point2I()) const;
244 
257  void _finishWriteFits(fits::Fits & fitsfile, FitsWriteData const & data) const;
258 
266  void _readFits(
267  fits::Fits & fitsfile,
268  PTR(daf::base::PropertySet) metadata,
269  PTR(daf::base::PropertySet) imageMetadata
270  );
271 
272  static PTR(Calib) _cloneCalib(CONST_PTR(Calib) calib);
273  static PTR(Wcs) _cloneWcs(CONST_PTR(Wcs) wcs);
274  static PTR(ApCorrMap) _cloneApCorrMap(PTR(ApCorrMap const) apCorrMap);
275 
277  PTR(detection::Psf) _psf;
279  CONST_PTR(cameraGeom::Detector) _detector;
280  CONST_PTR(geom::polygon::Polygon) _validPolygon;
282  PTR(daf::base::PropertySet) _metadata;
285 };
286 
287 }}} // lsst::afw::image
288 
289 #endif // !LSST_AFW_IMAGE_ExposureInfo_h_INCLUDED
void setDetector(boost::shared_ptr< cameraGeom::Detector const > detector)
Set the exposure&#39;s Detector information.
Definition: ExposureInfo.h:102
bool hasWcs() const
Does this exposure have a Wcs?
Definition: ExposureInfo.h:84
void setWcs(boost::shared_ptr< Wcs const > wcs)
Set the coordinate system of the exposure.
Definition: ExposureInfo.h:93
boost::shared_ptr< daf::base::PropertyList > varianceMetadata
Definition: ExposureInfo.h:231
A coordinate class intended to represent absolute positions.
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
bool hasCoaddInputs() const
Does this exposure have coadd provenance catalogs?
Definition: ExposureInfo.h:171
bool hasApCorrMap() const
Return true if the exposure has an aperture correction map.
Definition: ExposureInfo.h:151
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:42
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:48
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Definition: ExposureInfo.cc:66
#define CONST_PTR(...)
Definition: base.h:47
void setPsf(boost::shared_ptr< detection::Psf const > psf)
Set the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:135
void setValidPolygon(boost::shared_ptr< geom::polygon::Polygon const > polygon)
Set the exposure&#39;s valid Polygon.
Definition: ExposureInfo.h:148
tbl::Key< int > wcs
void setCoaddInputs(boost::shared_ptr< CoaddInputs > coaddInputs)
Set the exposure&#39;s coadd provenance catalogs.
Definition: ExposureInfo.h:174
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
boost::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure&#39;s Detector information.
Definition: ExposureInfo.h:99
Point< int, 2 > Point2I
Definition: PSF.h:39
boost::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
Definition: ExposureInfo.h:123
boost::shared_ptr< daf::base::PropertyList > imageMetadata
Definition: ExposureInfo.h:229
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
A simple Persistable struct containing ExposureCatalogs that record the inputs to a coadd...
Definition: CoaddInputs.h:46
boost::shared_ptr< daf::base::PropertyList > maskMetadata
Definition: ExposureInfo.h:230
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
bool hasPsf() const
Does this exposure have a Psf?
Definition: ExposureInfo.h:129
void setFilter(Filter const &filter)
Set the exposure&#39;s filter.
Definition: ExposureInfo.h:108
boost::shared_ptr< Calib > getCalib()
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:114
void setMetadata(boost::shared_ptr< daf::base::PropertySet > metadata)
Set the flexible metadata.
Definition: ExposureInfo.h:126
ExposureInfo & operator=(ExposureInfo const &other)
Assignment; deep-copies all components except the metadata.
A struct passed back and forth between Exposure and ExposureInfo when writing FITS files...
Definition: ExposureInfo.h:227
boost::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:87
boost::shared_ptr< daf::base::PropertyList > metadata
Definition: ExposureInfo.h:228
void _readFits(fits::Fits &fitsfile, boost::shared_ptr< daf::base::PropertySet > metadata, boost::shared_ptr< daf::base::PropertySet > imageMetadata)
Read from a FITS file and metadata.
void setCalib(boost::shared_ptr< Calib const > calib)
Set the Exposure&#39;s Calib object.
Definition: ExposureInfo.h:120
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Definition: ExposureInfo.h:142
Holds an integer identifier for an LSST filter.
Definition: Filter.h:107
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:60
boost::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Return the valid Polygon.
Definition: ExposureInfo.h:145
void setApCorrMap(boost::shared_ptr< ApCorrMap > apCorrMap)
Set the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:160
boost::shared_ptr< detection::Psf > getPsf() const
Return the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:132
boost::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:177
Class for storing generic metadata.
Definition: PropertySet.h:82
ExposureInfo(boost::shared_ptr< Wcs const > const &wcs=boost::shared_ptr< Wcs const >(), boost::shared_ptr< detection::Psf const > const &psf=boost::shared_ptr< detection::Psf const >(), boost::shared_ptr< Calib const > const &calib=boost::shared_ptr< Calib const >(), boost::shared_ptr< cameraGeom::Detector const > const &detector=boost::shared_ptr< cameraGeom::Detector const >(), boost::shared_ptr< geom::polygon::Polygon const > const &polygon=boost::shared_ptr< geom::polygon::Polygon const >(), Filter const &filter=Filter(), boost::shared_ptr< daf::base::PropertySet > const &metadata=boost::shared_ptr< daf::base::PropertySet >(), boost::shared_ptr< CoaddInputs > const &coaddInputs=boost::shared_ptr< CoaddInputs >(), boost::shared_ptr< ApCorrMap > const &apCorrMap=boost::shared_ptr< ApCorrMap >())
Construct an ExposureInfo from its various components.
Definition: ExposureInfo.cc:73
bool hasCalib() const
Does this exposure have a Calib?
Definition: ExposureInfo.h:111
FitsWriteData _startWriteFits(geom::Point2I const &xy0=geom::Point2I()) const
Start the process of writing an exposure to FITS.
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:54
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
A collection of all the things that make an Exposure different from a MaskedImage.
Definition: ExposureInfo.h:80
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
void _finishWriteFits(fits::Fits &fitsfile, FitsWriteData const &data) const
Write any additional non-image HDUs to a FITS file.
Filter getFilter() const
Return the exposure&#39;s filter.
Definition: ExposureInfo.h:105
bool hasDetector() const
Does this exposure have Detector information?
Definition: ExposureInfo.h:96
boost::shared_ptr< ApCorrMap > getApCorrMap()
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:154
Class encapsulating an identifier for an LSST filter.