LSSTApplications  16.0-11-g09ed895+2,16.0-11-g12e47bd,16.0-11-g9bb73b2+6,16.0-12-g5c924a4+6,16.0-14-g9a974b3+1,16.0-15-g1417920+1,16.0-15-gdd5ca33+1,16.0-16-gf0259e2,16.0-17-g31abd91+7,16.0-17-g7d7456e+7,16.0-17-ga3d2e9f+13,16.0-18-ga4d4bcb+1,16.0-18-gd06566c+1,16.0-2-g0febb12+21,16.0-2-g9d5294e+69,16.0-2-ga8830df+6,16.0-20-g21842373+7,16.0-24-g3eae5ec,16.0-28-gfc9ea6c+4,16.0-29-ge8801f9,16.0-3-ge00e371+34,16.0-4-g18f3627+13,16.0-4-g5f3a788+20,16.0-4-ga3eb747+10,16.0-4-gabf74b7+29,16.0-4-gb13d127+6,16.0-49-g42e581f7+6,16.0-5-g27fb78a+7,16.0-5-g6a53317+34,16.0-5-gb3f8a4b+87,16.0-6-g9321be7+4,16.0-6-gcbc7b31+42,16.0-6-gf49912c+29,16.0-7-gd2eeba5+51,16.0-71-ge89f8615e,16.0-8-g21fd5fe+29,16.0-8-g3a9f023+20,16.0-8-g4734f7a+1,16.0-8-g5858431+3,16.0-9-gf5c1f43+8,master-gd73dc1d098+1,w.2019.01
LSSTDataManagementBasePackage
ExposureFitsReader.h
Go to the documentation of this file.
1 /*
2  * Developed for the LSST Data Management System.
3  * This product includes software developed by the LSST Project
4  * (https://www.lsst.org).
5  * See the COPYRIGHT file at the top-level directory of this distribution
6  * for details of code ownership.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef LSST_AFW_IMAGE_EXPOSUREFITSREADER_H
23 #define LSST_AFW_IMAGE_EXPOSUREFITSREADER_H
24 
25 
29 
30 namespace lsst { namespace afw { namespace image {
31 
42 public:
43 
49  explicit ExposureFitsReader(std::string const& fileName);
50 
56  explicit ExposureFitsReader(fits::MemFileManager& manager);
57 
64  explicit ExposureFitsReader(fits::Fits * fitsFile);
65 
66  // FITS readers are not copyable, movable, or assignable.
67  ExposureFitsReader(ExposureFitsReader const &) = delete;
71 
72  ~ExposureFitsReader() noexcept;
73 
75 
82  std::string readMaskDType() const;
85 
94 
104  ImageOrigin origin=PARENT
105  );
106 
114 
117 
119  Filter readFilter();
120 
123 
126 
129 
132 
135 
138 
141 
144 
147 
149 
162  template <typename ImagePixelT>
164  ImageOrigin origin=PARENT, bool allowUnsafe=false);
165  template <typename ImagePixelT>
166  ndarray::Array<ImagePixelT, 2, 2> readImageArray(lsst::geom::Box2I const & bbox=lsst::geom::Box2I(),
167  ImageOrigin origin=PARENT, bool allowUnsafe=false);
169 
185  template <typename MaskPixelT>
187  ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false);
188 
202  template <typename MaskPixelT>
203  ndarray::Array<MaskPixelT, 2, 2> readMaskArray(lsst::geom::Box2I const & bbox=lsst::geom::Box2I(),
204  ImageOrigin origin=PARENT, bool allowUnsafe=false);
205 
207 
220  template <typename VariancePixelT>
222  ImageOrigin origin=PARENT, bool allowUnsafe=false);
223  template <typename VariancePixelT>
224  ndarray::Array<VariancePixelT, 2, 2> readVarianceArray(lsst::geom::Box2I const & bbox=lsst::geom::Box2I(),
225  ImageOrigin origin=PARENT, bool allowUnsafe=false);
227 
243  template <typename ImagePixelT, typename MaskPixelT=MaskPixel, typename VariancePixelT=VariancePixel>
246  bool conformMasks=false, bool allowUnsafe=false
247  );
248 
264  template <typename ImagePixelT, typename MaskPixelT=MaskPixel, typename VariancePixelT=VariancePixel>
267  bool conformMasks=false, bool allowUnsafe=false
268  );
269 
273  std::string getFileName() const { return _maskedImageReader.getFileName(); }
274 
275 private:
276 
277  class MetadataReader;
278  class ArchiveReader;
279 
280  void _ensureReaders();
281 
282  fits::Fits * _getFitsFile() { return _maskedImageReader._getFitsFile(); }
283 
284  MaskedImageFitsReader _maskedImageReader;
285  std::unique_ptr<MetadataReader> _metadataReader;
286  std::unique_ptr<ArchiveReader> _archiveReader;
287 };
288 
289 }}} // namespace lsst::afw::image
290 
291 #endif // !LSST_AFW_IMAGE_EXPOSUREFITSREADER_H
lsst::geom::Box2I readBBox(ImageOrigin origin=PARENT)
Read the bounding box of the on-disk image.
std::string getFileName() const
Return the name of the file this reader targets.
std::shared_ptr< ExposureInfo > readExposureInfo()
Read the ExposureInfo containing all non-image components.
Image< VariancePixelT > readVariance(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
std::shared_ptr< Calib > readCalib()
Read the Exposure&#39;s photometric calibration.
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:72
std::shared_ptr< CoaddInputs > readCoaddInputs()
Read the Exposure&#39;s coadd input catalogs.
ndarray::Array< VariancePixelT, 2, 2 > readVarianceArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
std::shared_ptr< VisitInfo > readVisitInfo()
Read the Exposure&#39;s visit metadata.
Image< ImagePixelT > readImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
ExposureFitsReader(std::string const &fileName)
Construct a FITS reader object.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:296
ExposureFitsReader & operator=(ExposureFitsReader const &)=delete
std::string readImageDType() const
Read a string describing the pixel type of the on-disk image plane.
STL class.
Filter readFilter()
Read the Exposure&#39;s filter.
std::string getFileName() const
Return the name of the file this reader targets.
std::shared_ptr< afw::geom::polygon::Polygon > readValidPolygon()
Read the polygon describing the region of validity for the Exposure.
A base class for image defects.
Definition: cameraGeom.dox:3
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:78
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:120
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:74
table::Box2IKey bbox
Definition: Detector.cc:166
std::string readMaskDType() const
Read a string describing the pixel type of the on-disk image plane.
Holds an integer identifier for an LSST filter.
Definition: Filter.h:141
std::shared_ptr< afw::geom::SkyWcs > readWcs()
Read the Exposure&#39;s world coordinate system.
std::shared_ptr< ApCorrMap > readApCorrMap()
Read the Exposure&#39;s aperture correction map.
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > readMaskedImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the MaskedImage.
STL class.
std::string readVarianceDType() const
Read a string describing the pixel type of the on-disk image plane.
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
A FITS reader class for MaskedImages and their components.
lsst::geom::Point2I readXY0(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
Read the image origin from the on-disk image or a subimage thereof.
A FITS reader class for Exposures and their components.
std::shared_ptr< cameraGeom::Detector > readDetector()
Read the Exposure&#39;s detector.
ndarray::Array< MaskPixelT, 2, 2 > readMaskArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the mask plane.
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.
std::shared_ptr< daf::base::PropertyList > readMetadata()
Read the flexible metadata associated with the Exposure.
std::shared_ptr< detection::Psf > readPsf()
Read the Exposure&#39;s point-spread function.
Mask< MaskPixelT > readMask(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the mask plane.
std::shared_ptr< TransmissionCurve > readTransmissionCurve()
Read the Exposure&#39;s transmission curve.
An integer coordinate rectangle.
Definition: Box.h:54
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:59