LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.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.
71 
72  ~ExposureFitsReader() noexcept;
73 
75 
81  std::string readImageDType() const;
82  std::string readMaskDType() const;
83  std::string readVarianceDType() const;
85 
94 
102  lsst::geom::Point2I readXY0(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(),
103  ImageOrigin origin = PARENT);
104 
111  std::shared_ptr<daf::base::PropertyList> readMetadata();
112 
114  std::shared_ptr<afw::geom::SkyWcs> readWcs();
115 
117  Filter readFilter();
118 
120  std::shared_ptr<PhotoCalib> readPhotoCalib();
121 
123  std::shared_ptr<detection::Psf> readPsf();
124 
126  std::shared_ptr<afw::geom::polygon::Polygon> readValidPolygon();
127 
129  std::shared_ptr<ApCorrMap> readApCorrMap();
130 
132  std::shared_ptr<CoaddInputs> readCoaddInputs();
133 
135  std::shared_ptr<VisitInfo> readVisitInfo();
136 
139 
141  std::shared_ptr<cameraGeom::Detector> readDetector();
142 
144  std::map<std::string, std::shared_ptr<table::io::Persistable>> readExtraComponents();
145 
147  std::shared_ptr<ExposureInfo> readExposureInfo();
148 
150 
163  template <typename ImagePixelT>
164  Image<ImagePixelT> readImage(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(),
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>
187  Mask<MaskPixelT> readMask(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(),
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>
223  Image<VariancePixelT> readVariance(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(),
224  ImageOrigin origin = PARENT, bool allowUnsafe = false);
225  template <typename VariancePixelT>
226  ndarray::Array<VariancePixelT, 2, 2> readVarianceArray(
227  lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT,
228  bool allowUnsafe = false);
230 
246  template <typename ImagePixelT, typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
247  MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT> readMaskedImage(
248  lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT,
249  bool conformMasks = false, bool allowUnsafe = false);
250 
266  template <typename ImagePixelT, typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
267  Exposure<ImagePixelT, MaskPixelT, VariancePixelT> read(
268  lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT,
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
lsst::afw::image::ExposureFitsReader::operator=
ExposureFitsReader & operator=(ExposureFitsReader const &)=delete
lsst::afw::image
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
Definition: imageAlgorithm.dox:1
lsst::afw::image::ExposureFitsReader::readMaskedImage
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.
Definition: ExposureFitsReader.cc:465
std::string
STL class.
lsst::afw::image::ExposureFitsReader::ExposureFitsReader
ExposureFitsReader(std::string const &fileName)
Construct a FITS reader object.
Definition: ExposureFitsReader.cc:263
lsst::afw::image::Mask
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
lsst::afw::image::Exposure
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Definition: Exposure.h:72
lsst::afw::image::ExposureFitsReader::readFilter
Filter readFilter()
Read the Exposure's filter.
Definition: ExposureFitsReader.cc:299
lsst::afw::image::ExposureFitsReader::readVariance
Image< VariancePixelT > readVariance(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
Definition: ExposureFitsReader.cc:452
lsst::afw::fits::Fits
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
lsst::afw::image::ExposureFitsReader::ExposureFitsReader
ExposureFitsReader(ExposureFitsReader &&)=delete
lsst::afw::image::Filter
Holds an integer identifier for an LSST filter.
Definition: Filter.h:141
lsst::afw::image::ExposureFitsReader::readMaskArray
ndarray::Array< MaskPixelT, 2, 2 > readMaskArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the mask plane.
Definition: ExposureFitsReader.cc:446
lsst::afw::image::ExposureFitsReader::readBBox
lsst::geom::Box2I readBBox(ImageOrigin origin=PARENT)
Read the bounding box of the on-disk image.
Definition: ExposureFitsReader.cc:271
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::image::ExposureFitsReader::readExtraComponents
std::map< std::string, std::shared_ptr< table::io::Persistable > > readExtraComponents()
Read the Exposure's non-standard components.
Definition: ExposureFitsReader.cc:350
lsst::afw::fits::MemFileManager
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:121
lsst::afw::image::ExposureFitsReader::readDetector
std::shared_ptr< cameraGeom::Detector > readDetector()
Read the Exposure's detector.
Definition: ExposureFitsReader.cc:345
lsst::afw::image::ExposureFitsReader::readVarianceDType
std::string readVarianceDType() const
Read a string describing the pixel type of the on-disk image plane.
Definition: ExposureFitsReader.cc:283
lsst::afw::image::ExposureFitsReader::readExposureInfo
std::shared_ptr< ExposureInfo > readExposureInfo()
Read the ExposureInfo containing all non-image components.
Definition: ExposureFitsReader.cc:355
ndarray
Definition: SpanSetFunctorGetters.h:303
lsst::afw::image::MaskedImage
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
lsst::afw::image::ExposureFitsReader::readMetadata
std::shared_ptr< daf::base::PropertyList > readMetadata()
Read the flexible metadata associated with the Exposure.
Definition: ExposureFitsReader.cc:285
lsst::afw::image::VisitInfo
Information about a single exposure of an imaging camera.
Definition: VisitInfo.h:68
lsst::afw::image::ExposureInfo
A collection of all the things that make an Exposure different from a MaskedImage.
Definition: ExposureInfo.h:86
lsst::afw::image::ExposureFitsReader::readWcs
std::shared_ptr< afw::geom::SkyWcs > readWcs()
Read the Exposure's world coordinate system.
Definition: ExposureFitsReader.cc:290
lsst::afw::image::ExposureFitsReader::readCoaddInputs
std::shared_ptr< CoaddInputs > readCoaddInputs()
Read the Exposure's coadd input catalogs.
Definition: ExposureFitsReader.cc:329
lsst::afw::image::ExposureFitsReader::readImage
Image< ImagePixelT > readImage(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
Definition: ExposureFitsReader.cc:428
MaskedImageFitsReader.h
lsst::afw::image::ExposureFitsReader::readMaskDType
std::string readMaskDType() const
Read a string describing the pixel type of the on-disk image plane.
Definition: ExposureFitsReader.cc:281
lsst::afw::image::VariancePixel
float VariancePixel
default type for MaskedImage variance images
Definition: LsstImageTypes.h:35
lsst::afw::image::ExposureFitsReader::readMask
Mask< MaskPixelT > readMask(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
Read the mask plane.
Definition: ExposureFitsReader.cc:440
lsst::afw::image::PhotoCalib
The photometric calibration of an exposure.
Definition: PhotoCalib.h:114
std::int32_t
lsst::afw::image::ExposureFitsReader::readXY0
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.
Definition: ExposureFitsReader.cc:275
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::afw::image::ExposureFitsReader::readApCorrMap
std::shared_ptr< ApCorrMap > readApCorrMap()
Read the Exposure's aperture correction map.
Definition: ExposureFitsReader.cc:324
lsst::afw::image::TransmissionCurve
A spatially-varying transmission curve as a function of wavelength.
Definition: TransmissionCurve.h:61
lsst::geom
Definition: AffineTransform.h:36
lsst::afw::image::ExposureFitsReader
A FITS reader class for Exposures and their components.
Definition: ExposureFitsReader.h:42
lsst::afw::image::ExposureFitsReader::readTransmissionCurve
std::shared_ptr< TransmissionCurve > readTransmissionCurve()
Read the Exposure's transmission curve.
Definition: ExposureFitsReader.cc:339
ExposureInfo.h
lsst::afw::image::MaskedImageFitsReader::getFileName
std::string getFileName() const
Return the name of the file this reader targets.
Definition: MaskedImageFitsReader.h:230
std
STL namespace.
lsst::afw::image::CoaddInputs
A simple Persistable struct containing ExposureCatalogs that record the inputs to a coadd.
Definition: CoaddInputs.h:49
lsst::afw::image::ExposureFitsReader::readImageDType
std::string readImageDType() const
Read a string describing the pixel type of the on-disk image plane.
Definition: ExposureFitsReader.cc:279
lsst::afw::image::ExposureFitsReader::readVisitInfo
std::shared_ptr< VisitInfo > readVisitInfo()
Read the Exposure's visit metadata.
Definition: ExposureFitsReader.cc:334
lsst::geom::Point2I
Point< int, 2 > Point2I
Definition: Point.h:321
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
lsst::afw::image::PARENT
@ PARENT
Definition: ImageBase.h:94
lsst::afw::image::ExposureFitsReader::readValidPolygon
std::shared_ptr< afw::geom::polygon::Polygon > readValidPolygon()
Read the polygon describing the region of validity for the Exposure.
Definition: ExposureFitsReader.cc:318
lsst::afw::image::ExposureFitsReader::ExposureFitsReader
ExposureFitsReader(ExposureFitsReader const &)=delete
lsst::afw::image::ExposureFitsReader::operator=
ExposureFitsReader & operator=(ExposureFitsReader &&)=delete
lsst::afw::image::ImageOrigin
ImageOrigin
Definition: ImageBase.h:94
lsst::afw::image::ExposureFitsReader::readPsf
std::shared_ptr< detection::Psf > readPsf()
Read the Exposure's point-spread function.
Definition: ExposureFitsReader.cc:313
lsst::afw::image::ExposureFitsReader::readPhotoCalib
std::shared_ptr< PhotoCalib > readPhotoCalib()
Read the Exposure's photometric calibration.
Definition: ExposureFitsReader.cc:304
lsst::afw::image::ExposureFitsReader::read
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.
Definition: ExposureFitsReader.cc:473
lsst::afw::image::ApCorrMap
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Definition: ApCorrMap.h:45
lsst::afw::image::Image
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:58
std::unique_ptr
STL class.
lsst::afw::image::ExposureFitsReader::readVarianceArray
ndarray::Array< VariancePixelT, 2, 2 > readVarianceArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the variance plane.
Definition: ExposureFitsReader.cc:458
Exposure.h
lsst::afw::image::ExposureFitsReader::getFileName
std::string getFileName() const
Return the name of the file this reader targets.
Definition: ExposureFitsReader.h:274
lsst::afw::image::ExposureFitsReader::readImageArray
ndarray::Array< ImagePixelT, 2, 2 > readImageArray(lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool allowUnsafe=false)
Read the image plane.
Definition: ExposureFitsReader.cc:434
lsst::afw::image::ExposureFitsReader::~ExposureFitsReader
~ExposureFitsReader() noexcept
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117