Class MaskedImageFitsReader

Class Documentation

class MaskedImageFitsReader

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.