Class ImageBaseFitsReader

Inheritance Relationships

Derived Types

Class Documentation

class ImageBaseFitsReader

Base class for image FITS readers.

This class should be considered an implementation detail of ImageFitsReader and MaskFitsReader that provides their common methods, not the definition of an interface.

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

Subclassed by lsst::afw::image::ImageFitsReader, lsst::afw::image::MaskFitsReader

Public Functions

ImageBaseFitsReader(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, where 0 is the primary HDU and DEFAULT_HDU is the first non-empty HDU.

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

Construct a FITS reader object.

Parameters
  • manager: Memory block containing a FITS file.

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

ImageBaseFitsReader(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.

ImageBaseFitsReader(ImageBaseFitsReader const&)
ImageBaseFitsReader(ImageBaseFitsReader&&)
ImageBaseFitsReader &operator=(ImageBaseFitsReader const&)
ImageBaseFitsReader &operator=(ImageBaseFitsReader&&)
std::string readDType() const

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

Return

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

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.

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

Read the image’s FITS header.

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

Read the image’s data array.

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.

int getHdu() const

Return the HDU this reader targets.

std::string getFileName() const

Return the name of the file this reader targets.

Protected Functions

~ImageBaseFitsReader()