File MaskedImageFitsReader.h

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace afw
namespace image
class MaskedImageFitsReader
#include <MaskedImageFitsReader.h>

A FITS reader class for MaskedImages and their components.

All MaskedImageFitsReader methods provide strong exception safety, but exceptions thrown by the internal fits::Fits object itself may change its status variable or HDU pointer; MaskedImageFitsReader guards against this by resetting those before any use of the Fits object.

Unnamed Group

std::string readImageDType() const

Read a string describing the pixel type of the on-disk image plane.

Return

A string of the form [u](int|float)<bits> (e.g. “uint16”, “float64”).

std::string readMaskDType() const
std::string readVarianceDType() const

Unnamed Group

std::shared_ptr<daf::base::PropertyList> readPrimaryMetadata()

Read the FITS header of one of the HDUs.

std::shared_ptr<daf::base::PropertyList> readImageMetadata()
std::shared_ptr<daf::base::PropertyList> readMaskMetadata()
std::shared_ptr<daf::base::PropertyList> readVarianceMetadata()

Unnamed Group

template<typename ImagePixelT>
Image<ImagePixelT> readImage(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool allowUnsafe = false)

Read the image plane.

In Python, this templated method is wrapped with an additional

dtype argument to provide the type to read. This defaults to the type of the on-disk image.
Parameters
  • bbox: A bounding box used to defined a subimage, or an empty box (default) to read the whole image.

  • origin: Coordinate system convention for the given box.

  • allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.

template<typename ImagePixelT>
ndarray::Array<ImagePixelT, 2, 2> readImageArray(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool allowUnsafe = false)

Unnamed Group

template<typename VariancePixelT>
Image<VariancePixelT> readVariance(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool allowUnsafe = false)

Read the variance plane.

In Python, this templated method is wrapped with an additional

dtype argument to provide the type to read. This defaults to the type of the on-disk image.
Parameters
  • bbox: A bounding box used to defined a subimage, or an empty box (default) to read the whole image.

  • origin: Coordinate system convention for the given box.

  • allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.

template<typename VariancePixelT>
ndarray::Array<VariancePixelT, 2, 2> readVarianceArray(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool allowUnsafe = false)

Public Functions

MaskedImageFitsReader(std::string const &fileName, int hdu = fits::DEFAULT_HDU)

Construct a FITS reader object.

Parameters
  • fileName: Name of a file to open.

  • hdu: HDU index for the image plane, where 0 is the primary HDU and DEFAULT_HDU is the first non-empty HDU.

MaskedImageFitsReader(fits::MemFileManager &manager, int hdu = fits::DEFAULT_HDU)

Construct a FITS reader object.

Parameters
  • manager: Memory block containing a FITS file.

  • hdu: HDU index for the image plane, where 0 is the primary HDU and DEFAULT_HDU is the first non-empty HDU.

MaskedImageFitsReader(fits::Fits *fitsFile)

Construct a FITS reader object.

Parameters
  • fitsFile: Pointer to a CFITSIO file object. Lifetime will not be managed by the Reader object.

MaskedImageFitsReader(MaskedImageFitsReader const&)
MaskedImageFitsReader(MaskedImageFitsReader&&)
MaskedImageFitsReader &operator=(MaskedImageFitsReader const&)
MaskedImageFitsReader &operator=(MaskedImageFitsReader&&)
~MaskedImageFitsReader()
lsst::geom::Box2I readBBox(ImageOrigin origin = PARENT)

Read the bounding box of the on-disk image.

Parameters
  • origin: Coordinate system convention for the returned box. If LOCAL, the returned box will always have a minimum of (0, 0).

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.

Parameters
  • bbox: A bounding box used to defined a subimage, or an empty box (default) to use the whole image.

  • origin: Coordinate system convention for the given box. Ignored if bbox is empty.

template<typename MaskPixelT>
Mask<MaskPixelT> readMask(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool conformMasks = false, bool allowUnsafe = false)

Read the mask plane.

In Python, this templated method is wrapped with an additional

dtype argument to provide the type to read. This defaults to the type of the on-disk image.
Parameters
  • bbox: A bounding box used to defined a subimage, or an empty box (default) to read the whole image.

  • origin: Coordinate system convention for the given box.

  • conformMasks: If True, conform the global mask dict to match this file.

  • allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.

template<typename MaskPixelT>
ndarray::Array<MaskPixelT, 2, 2> readMaskArray(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool allowUnsafe = false)

Read the mask plane.

In Python, this templated method is wrapped with an additional

dtype argument to provide the type to read. This defaults to the type of the on-disk image.
Parameters
  • bbox: A bounding box used to defined a subimage, or an empty box (default) to read the whole image.

  • origin: Coordinate system convention for the given box.

  • allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.

template<typename ImagePixelT, typename MaskPixelT = MaskPixel, typename VariancePixelT = VariancePixel>
MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT> read(lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool conformMasks = false, bool needAllHdus = false, bool allowUnsafe = false)

Read the full MaskedImage.

In Python, this templated method is wrapped with an additional

dtype argument to provide the type to read (for the image plane). This defaults to the type of the on-disk image.
Parameters
  • bbox: A bounding box used to defined a subimage, or an empty box (default) to read the whole image.

  • origin: Coordinate system convention for the given box.

  • conformMasks: If True, conform the global mask dict to match this file.

  • needAllHdus: If True, refuse to read the image if the mask or variance plane is not present (the image plane is always required).

  • allowUnsafe: Permit reading into the requested pixel type even when on-disk values may overflow or truncate.

std::string getFileName() const

Return the name of the file this reader targets.

Private Functions

fits::Fits *_getFitsFile()

Private Members

std::shared_ptr<daf::base::PropertyList> _imageMetadata
std::shared_ptr<daf::base::PropertyList> _maskMetadata
std::shared_ptr<daf::base::PropertyList> _varianceMetadata
ImageFitsReader _imageReader
MaskFitsReader _maskReader
ImageFitsReader _varianceReader

Friends

friend lsst::afw::image::ExposureFitsReader