LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
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 
28 
29 namespace lsst {
30 namespace afw {
31 namespace image {
32 
43 public:
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 
103  ImageOrigin origin = PARENT);
104 
112 
115 
117  Filter readFilter();
118 
121 
124 
127 
130 
133 
136 
139 
142 
145 
148 
150 
163  template <typename ImagePixelT>
165  ImageOrigin origin = PARENT, bool allowUnsafe = false);
166  template <typename ImagePixelT>
167  ndarray::Array<ImagePixelT, 2, 2> readImageArray(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(),
168  ImageOrigin origin = PARENT, bool allowUnsafe = false);
170 
186  template <typename MaskPixelT>
188  ImageOrigin origin = PARENT, bool conformMasks = false,
189  bool allowUnsafe = false);
190 
204  template <typename MaskPixelT>
205  ndarray::Array<MaskPixelT, 2, 2> readMaskArray(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(),
206  ImageOrigin origin = PARENT, bool allowUnsafe = false);
207 
209 
222  template <typename VariancePixelT>
224  ImageOrigin origin = PARENT, bool allowUnsafe = false);
225  template <typename VariancePixelT>
226  ndarray::Array<VariancePixelT, 2, 2> readVarianceArray(
228  bool allowUnsafe = false);
230 
246  template <typename ImagePixelT, typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
249  bool conformMasks = false, bool allowUnsafe = false);
250 
266  template <typename ImagePixelT, typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
269  bool conformMasks = false, bool allowUnsafe = false);
270 
274  std::string getFileName() const { return _maskedImageReader.getFileName(); }
275 
276 private:
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 image
290 } // namespace afw
291 } // namespace lsst
292 
293 #endif // !LSST_AFW_IMAGE_EXPOSUREFITSREADER_H
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
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.
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:297
std::shared_ptr< PhotoCalib > readPhotoCalib()
Read the Exposure&#39;s photometric calibration.
ExposureFitsReader & operator=(ExposureFitsReader const &)=delete
STL class.
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::map< std::string, std::shared_ptr< table::io::Persistable > > readExtraComponents()
Read the Exposure&#39;s non-standard components.
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.
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:121
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
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.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
std::shared_ptr< TransmissionCurve > readTransmissionCurve()
Read the Exposure&#39;s transmission curve.
An integer coordinate rectangle.
Definition: Box.h:55
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:58