Template Class MaskedImage

Class Documentation

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
class MaskedImage

A class to manipulate images, masks, and variance as a single object.

Public Types

typedef std::shared_ptr<image::Image<ImagePixelT>> ImagePtr

shared pointer to the Image

typedef std::shared_ptr<image::Mask<MaskPixelT>> MaskPtr

shared pointer to the Mask

typedef std::shared_ptr<image::Image<VariancePixelT>> VariancePtr

shared pointer to the variance Image

typedef Mask<MaskPixelT>::MaskPlaneDict MaskPlaneDict

The Mask’s MaskPlaneDict.

typedef lsst::afw::image::Image<VariancePixelT> Variance
typedef lsst::afw::image::Image<ImagePixelT> Image
typedef lsst::afw::image::Mask<MaskPixelT> Mask
typedef detail::MaskedImage_tag image_category
typedef lsst::afw::image::pixel::Pixel<ImagePixelT, MaskPixelT, VariancePixelT> Pixel

A Pixel in the MaskedImage.

typedef lsst::afw::image::pixel::SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> SinglePixel

A single Pixel of the same type as those in the MaskedImage.

typedef MaskedImageIterator<typename Image::iterator, typename Mask::iterator, typename Variance::iterator> iterator
typedef const_MaskedImageIterator<typename Image::iterator, typename Mask::iterator, typename Variance::iterator> const_iterator
typedef MaskedImageIterator<typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator> reverse_iterator
typedef MaskedImageIterator<typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator> x_iterator

An iterator to a row of a MaskedImage.

typedef const_MaskedImageIterator<typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator> const_x_iterator

A const_iterator to a row of a MaskedImage.

typedef x_iterator fast_iterator

A fast STL compliant iterator for contiguous images N.b. The order of pixel access is undefined

typedef MaskedImageIterator<typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator> y_iterator

An iterator to a column of a MaskedImage.

typedef const_MaskedImageIterator<typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator> const_y_iterator

A const_iterator to a column of a MaskedImage.

typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator> xy_locator

A locator for a MaskedImage.

typedef const_MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator> const_xy_locator

A const_locator for a MaskedImage.

typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator>::x_iterator xy_x_iterator

an x_iterator associated with an xy_locator

typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator>::y_iterator xy_y_iterator

an y_iterator associated with an xy_locator

Public Functions

MaskedImage(unsigned int width, unsigned int height, MaskPlaneDict const &planeDict = MaskPlaneDict())

Construct from a supplied dimensions. The Image, Mask, and Variance will be set to zero

Parameters
  • width: number of columns

  • height: number of rows

  • planeDict: Make Mask conform to this mask layout (ignore if empty)

MaskedImage(lsst::geom::Extent2I const &dimensions = lsst::geom::Extent2I(), MaskPlaneDict const &planeDict = MaskPlaneDict())

Construct from a supplied dimensions. The Image, Mask, and Variance will be set to zero

Parameters
  • dimensions: Number of columns, rows in image

  • planeDict: Make Mask conform to this mask layout (ignore if empty)

MaskedImage(ImagePtr image, MaskPtr mask = MaskPtr(), VariancePtr variance = VariancePtr())

Construct from a supplied Image and optional Mask and Variance. The Mask and Variance will be set to zero if omitted

Parameters
  • image: Image

  • mask: Mask

  • variance: Variance Mask

MaskedImage(lsst::geom::Box2I const &bbox, MaskPlaneDict const &planeDict = MaskPlaneDict())

Create an MaskedImage of the specified size

The Image, Mask, and Variance will be set to zero

Note

Many lsst::afw::image and lsst::afw::math objects define a dimensions member which may be conveniently used to make objects of an appropriate size

Parameters
  • bbox: dimensions of image: width x height

  • planeDict: Make Mask conform to this mask layout (ignore if empty)

MaskedImage(std::string const &fileName, std::shared_ptr<daf::base::PropertySet> metadata = std::shared_ptr<daf::base::PropertySet>(), lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool conformMasks = false, bool needAllHdus = false, std::shared_ptr<daf::base::PropertySet> imageMetadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<daf::base::PropertySet> maskMetadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<daf::base::PropertySet> varianceMetadata = std::shared_ptr<daf::base::PropertySet>(), bool allowUnsafe = false)

Construct a MaskedImage by reading a regular FITS file.

Parameters
  • [in] fileName: File to read.

  • [inout] metadata: Metadata read from the primary HDU header.

  • [in] bbox: If non-empty, read only the pixels within the bounding box.

  • [in] origin: Coordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.

  • [in] conformMasks: If true, make Mask conform to the mask layout in the file.

  • [in] needAllHdus: If true, throw fits::FitsError if the mask and/or variance plane is missing. If false, silently initialize them to zero.

  • [inout] imageMetadata: Metadata read from the image HDU header.

  • [inout] maskMetadata: Metadata read from the mask HDU header.

  • [inout] varianceMetadata: Metadata read from the variance HDU header.

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

MaskedImage(fits::MemFileManager &manager, std::shared_ptr<daf::base::PropertySet> metadata = std::shared_ptr<daf::base::PropertySet>(), lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool conformMasks = false, bool needAllHdus = false, std::shared_ptr<daf::base::PropertySet> imageMetadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<daf::base::PropertySet> maskMetadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<daf::base::PropertySet> varianceMetadata = std::shared_ptr<daf::base::PropertySet>(), bool allowUnsafe = false)

Construct a MaskedImage by reading a FITS image in memory.

Parameters
  • [in] manager: An object that manages the memory buffer to read.

  • [inout] metadata: Metadata read from the primary HDU header.

  • [in] bbox: If non-empty, read only the pixels within the bounding box.

  • [in] origin: Coordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.

  • [in] conformMasks: If true, make Mask conform to the mask layout in the file.

  • [in] needAllHdus: If true, throw fits::FitsError if the mask and/or variance plane is missing. If false, silently initialize them to zero.

  • [inout] imageMetadata: Metadata read from the image HDU header.

  • [inout] maskMetadata: Metadata read from the mask HDU header.

  • [inout] varianceMetadata: Metadata read from the variance HDU header.

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

MaskedImage(fits::Fits &fitsfile, std::shared_ptr<daf::base::PropertySet> metadata = std::shared_ptr<daf::base::PropertySet>(), lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT, bool conformMasks = false, bool needAllHdus = false, std::shared_ptr<daf::base::PropertySet> imageMetadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<daf::base::PropertySet> maskMetadata = std::shared_ptr<daf::base::PropertySet>(), std::shared_ptr<daf::base::PropertySet> varianceMetadata = std::shared_ptr<daf::base::PropertySet>(), bool allowUnsafe = false)

Construct a MaskedImage from an already-open FITS object.

Parameters
  • [in] fitsfile: A FITS object to read from. Current HDU is ignored.

  • [inout] metadata: Metadata read from the primary HDU header.

  • [in] bbox: If non-empty, read only the pixels within the bounding box.

  • [in] origin: Coordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.

  • [in] conformMasks: If true, make Mask conform to the mask layout in the file.

  • [in] needAllHdus: If true, throw fits::FitsError if the mask and/or variance plane is missing. If false, silently initialize them to zero.

  • [inout] imageMetadata: Metadata read from the image HDU header.

  • [inout] maskMetadata: Metadata read from the mask HDU header.

  • [inout] varianceMetadata: Metadata read from the variance HDU header.

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

MaskedImage(MaskedImage const &rhs, bool const deep = false)

Copy constructor; shallow, unless deep is true.

Parameters
  • rhs: Image to copy

  • deep: Make deep copy?

MaskedImage(MaskedImage &&rhs)
MaskedImage(MaskedImage const &rhs, lsst::geom::Box2I const &bbox, ImageOrigin const origin = PARENT, bool const deep = false)

Copy constructor of the pixels specified by bbox; shallow, unless deep is true.

Parameters
  • rhs: MaskedImage to copy

  • bbox: Specify desired region

  • origin: Specify the coordinate system of the bbox

  • deep: If false, new ImageBase shares storage with rhs; if true make a new, standalone, MaskedImage

template<typename OtherPixelT>
MaskedImage(MaskedImage<OtherPixelT, MaskPixelT, VariancePixelT> const &rhs, const bool deep)

Parameters
  • rhs: Input image

  • deep: Must be true; needed to disambiguate

generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/2 conversions between N ImageBase types.

We only support converting the Image part

MaskedImage &operator=(MaskedImage const &rhs)

Make the lhs use the rhs’s pixels

If you are copying a scalar value, a simple lhs = scalar; is OK, but this is probably not the function that you want to use with an image. To copy pixel values from the rhs use assign(rhs)

Parameters
  • rhs: Right hand side

MaskedImage &operator=(MaskedImage &&rhs)
virtual ~MaskedImage()
void swap(MaskedImage &rhs)
MaskedImage &operator=(Pixel const &rhs)

Set the pixels in the MaskedImage to the rhs.

MaskedImage &operator=(SinglePixel const &rhs)

Set the pixels in the MaskedImage to the rhs.

MaskedImage subset(lsst::geom::Box2I const &bbox, ImageOrigin origin = PARENT) const

Return a subimage corresponding to the given box.

This method is wrapped as

getitem in Python.
Return

A subimage view into this.

Parameters
  • bbox: Bounding box of the subimage returned.

  • origin: Origin bbox is rleative to; PARENT accounts for xy0, LOCAL does not.

Note

This method permits mutable views to be obtained from const references to images (just as the copy constructor does). This is an intrinsic flaw in Image’s design.

MaskedImage operator[](lsst::geom::Box2I const &bbox) const

Return a subimage corresponding to the given box (interpreted as PARENT coordinates).

MaskedImage &operator<<=(MaskedImage const &rhs)

Copy the pixels from the rhs to the lhs

Note

operator=() is not equivalent to this command

void assign(MaskedImage const &rhs, lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), ImageOrigin origin = PARENT)

Copy pixels from another masked image to a specified subregion of this masked image.

Parameters
  • [in] rhs: source image whose pixels are to be copied into this image (the destination)

  • [in] bbox: subregion of this image to set; if empty (the default) then all pixels are set

  • [in] origin: origin of bbox: if PARENT then the lower left pixel of this image is at xy0 if LOCAL then the lower left pixel of this image is at 0,0

Exceptions
  • lsst::pex::exceptions::LengthError: if the dimensions of rhs and the specified subregion of this image do not match.

MaskedImage &operator+=(ImagePixelT const rhs)

Add a scalar rhs to a MaskedImage.

MaskedImage &operator+=(MaskedImage const &rhs)

Add a MaskedImage rhs to a MaskedImage

The image and variances are added; the masks are ORd together

Note

The pixels in the two images are taken to be independent. There is a Pixel operation (plus) which models the covariance, but this is not (yet?) available as full-MaskedImage operators

MaskedImage &operator+=(lsst::afw::image::Image<ImagePixelT> const &rhs)
MaskedImage &operator+=(lsst::afw::math::Function2<double> const &function)
void scaledPlus(double const c, MaskedImage const &rhs)

Add a scaled MaskedImage c*rhs to a MaskedImage

The image and variances are added; the masks are ORd together

Note

The pixels in the two images are taken to be independent. There is a Pixel operation (plus) which models the covariance, but this is not (yet?) available as full-MaskedImage operators

MaskedImage &operator-=(ImagePixelT const rhs)

Subtract a scalar rhs from a MaskedImage.

MaskedImage &operator-=(MaskedImage const &rhs)

Subtract a MaskedImage rhs from a MaskedImage

The images are subtracted; the masks are ORd together; and the variances are added

Note

the pixels in the two images are taken to be independent

MaskedImage &operator-=(lsst::afw::image::Image<ImagePixelT> const &rhs)
MaskedImage &operator-=(lsst::afw::math::Function2<double> const &function)
void scaledMinus(double const c, MaskedImage const &rhs)

Subtract a scaled MaskedImage c*rhs from a MaskedImage

The images are subtracted; the masks are ORd together; and the variances are added

Note

the pixels in the two images are taken to be independent

MaskedImage &operator*=(ImagePixelT const rhs)
MaskedImage &operator*=(MaskedImage const &rhs)
MaskedImage &operator*=(lsst::afw::image::Image<ImagePixelT> const &rhs)
void scaledMultiplies(double const c, MaskedImage const &rhs)
MaskedImage &operator/=(ImagePixelT const rhs)
MaskedImage &operator/=(MaskedImage const &rhs)
MaskedImage &operator/=(lsst::afw::image::Image<ImagePixelT> const &rhs)
void scaledDivides(double const c, MaskedImage const &rhs)
void writeFits(std::string const &fileName, std::shared_ptr<daf::base::PropertySet const> metadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> imageMetadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> maskMetadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> varianceMetadata = std::shared_ptr<daf::base::PropertySet const>()) const

Write a MaskedImage to a regular FITS file.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the “INHERIT=’T’” convention to indicate that the primary metadata applies to those HDUs as well.

Parameters
  • [in] fileName: Name of the file to write. When writing separate files, this is the “base” of the filename (e.g. foo reads foo_{img.msk.var}.fits).

  • [in] metadata: Additional values to write to the primary HDU header (may be null).

  • [in] imageMetadata: Metadata to be written to the image header.

  • [in] maskMetadata: Metadata to be written to the mask header.

  • [in] varianceMetadata: Metadata to be written to the variance header.

void writeFits(fits::MemFileManager &manager, std::shared_ptr<daf::base::PropertySet const> metadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> imageMetadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> maskMetadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> varianceMetadata = std::shared_ptr<daf::base::PropertySet const>()) const

Write a MaskedImage to a FITS RAM file.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the “INHERIT=’T’” convention to indicate that the primary metadata applies to those HDUs as well.

Parameters
  • [in] manager: Manager object for the memory block to write to.

  • [in] metadata: Additional values to write to the primary HDU header (may be null).

  • [in] imageMetadata: Metadata to be written to the image header.

  • [in] maskMetadata: Metadata to be written to the mask header.

  • [in] varianceMetadata: Metadata to be written to the variance header.

void writeFits(fits::Fits &fitsfile, std::shared_ptr<daf::base::PropertySet const> metadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> imageMetadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> maskMetadata = std::shared_ptr<daf::base::PropertySet const>(), std::shared_ptr<daf::base::PropertySet const> varianceMetadata = std::shared_ptr<daf::base::PropertySet const>()) const

Write a MaskedImage to a FITS file.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the “INHERIT=’T’” convention to indicate that the primary metadata applies to those HDUs as well.

Parameters
  • [in] fitsfile: An empty FITS file object.

  • [in] metadata: Additional values to write to the primary HDU header (may be null).

  • [in] imageMetadata: Metadata to be written to the image header.

  • [in] maskMetadata: Metadata to be written to the mask header.

  • [in] varianceMetadata: Metadata to be written to the variance header.

void writeFits(std::string const &fileName, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions, std::shared_ptr<daf::base::PropertySet const> metadata = nullptr, std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr, std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr, std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const

Write a MaskedImage to a FITS file.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the “INHERIT=’T’” convention to indicate that the primary metadata applies to those HDUs as well.

Parameters
  • [in] fileName: Name of the file to write.

  • [in] imageOptions: Options controlling writing of image as FITS.

  • [in] maskOptions: Options controlling writing of mask as FITS.

  • [in] varianceOptions: Options controlling writing of variance as FITS.

  • [in] metadata: Additional values to write to the primary HDU header (may be null).

  • [in] imageMetadata: Metadata to be written to the image header.

  • [in] maskMetadata: Metadata to be written to the mask header.

  • [in] varianceMetadata: Metadata to be written to the variance header.

void writeFits(fits::MemFileManager &manager, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions, std::shared_ptr<daf::base::PropertySet const> metadata = nullptr, std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr, std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr, std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const

Write a MaskedImage to a FITS file.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the “INHERIT=’T’” convention to indicate that the primary metadata applies to those HDUs as well.

Parameters
  • [in] manager: Manager object for the memory block to write to.

  • [in] imageOptions: Options controlling writing of image as FITS.

  • [in] maskOptions: Options controlling writing of mask as FITS.

  • [in] varianceOptions: Options controlling writing of variance as FITS.

  • [in] metadata: Additional values to write to the primary HDU header (may be null).

  • [in] imageMetadata: Metadata to be written to the image header.

  • [in] maskMetadata: Metadata to be written to the mask header.

  • [in] varianceMetadata: Metadata to be written to the variance header.

void writeFits(fits::Fits &fitsfile, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions, std::shared_ptr<daf::base::PropertySet const> metadata = nullptr, std::shared_ptr<daf::base::PropertySet const> imageMetadata = nullptr, std::shared_ptr<daf::base::PropertySet const> maskMetadata = nullptr, std::shared_ptr<daf::base::PropertySet const> varianceMetadata = nullptr) const

Write a MaskedImage to a FITS file.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the “INHERIT=’T’” convention to indicate that the primary metadata applies to those HDUs as well.

Parameters
  • [in] fitsfile: An empty FITS file object.

  • [in] imageOptions: Options controlling writing of image as FITS.

  • [in] maskOptions: Options controlling writing of mask as FITS.

  • [in] varianceOptions: Options controlling writing of variance as FITS.

  • [in] metadata: Additional values to write to the primary HDU header (may be null).

  • [in] imageMetadata: Metadata to be written to the image header.

  • [in] maskMetadata: Metadata to be written to the mask header.

  • [in] varianceMetadata: Metadata to be written to the variance header.

ImagePtr getImage() const

Return a (shared_ptr to) the MaskedImage’s image.

void setImage(Image const &other)

Set the image plane’s pixel values to those of another Image.

This copies pixel values, not pointers.

Exceptions
  • pex::exceptions::LengthError: if dimensions do not match.

MaskPtr getMask() const

Return a (shared_ptr to) the MaskedImage’s mask.

void setMask(Mask const &other)

Set the mask plane’s pixel values to those of another Mask.

This copies pixel values, not pointers.

Exceptions
  • pex::exceptions::LengthError: if dimensions do not match.

void setVariance(Variance const &other)

Set the variance plane’s pixel values to those of another Image.

This copies pixel values, not pointers.

Exceptions
  • pex::exceptions::LengthError: if dimensions do not match.

VariancePtr getVariance() const

Return a (shared_ptr to) the MaskedImage’s variance.

int getWidth() const

Return the number of columns in the image.

int getHeight() const

Return the number of rows in the image.

lsst::geom::Extent2I getDimensions() const
lsst::geom::Box2I getBBox(ImageOrigin const origin = PARENT) const
int getX0() const

Return the image’s column-origin

This will usually be 0 except for images created using the MaskedImage(fileName, hdu, BBox, mode) ctor or MaskedImage(ImageBase, BBox) cctor The origin can be reset with setXY0()

int getY0() const

Return the image’s row-origin

This will usually be 0 except for images created using the MaskedImage(fileName, hdu, BBox, mode) ctor or MaskedImage(ImageBase, BBox) cctor The origin can be reset with setXY0()

lsst::geom::Point2I getXY0() const

Return the image’s origin

This will usually be (0, 0) except for images created using the MaskedImage(fileName, hdu, BBox, mode) ctor or MaskedImage(ImageBase, BBox) cctor The origin can be reset with setXY0

void setXY0(int const x0, int const y0)

Set the MaskedImage’s origin

The origin is usually set by the constructor, so you shouldn’t need this function

Note

There are use cases (e.g. memory overlays) that may want to set these values, but don’t do so unless you are an Expert.

void setXY0(lsst::geom::Point2I const origin)

Set the MaskedImage’s origin

The origin is usually set by the constructor, so you shouldn’t need this function

Note

There are use cases (e.g. memory overlays) that may want to set these values, but don’t do so unless you are an Expert.

double indexToPosition(double ind, lsst::afw::image::xOrY const xy) const

Parameters
  • ind: image index

  • xy: Is this a column or row coordinate?

Convert image index to image position (see Image::indexToPosition)

Return

image position

std::pair<int, double> positionToIndex(double const pos, lsst::afw::image::xOrY const xy) const

Parameters
  • pos: image position

  • xy: Is this a column or row coordinate?

Convert image position to index (see Image::positionToIndex)

Return

std::pair(nearest integer index, fractional part)

iterator begin() const

Return an iterator to the start of the image.

iterator end() const

Return an iterator to the end of the image.

iterator at(int const x, int const y) const

Return an iterator at the point (x, y)

reverse_iterator rbegin() const

Return a reverse_iterator to the start of the image.

reverse_iterator rend() const

Return a reverse_iterator to the end of the image.

fast_iterator begin(bool contiguous) const

Fast iterators to contiguous images

Return a fast iterator to the start of the image, which must be contiguous Note that the order in which pixels are visited is undefined.

Parameters
  • contiguous: Pixels are contiguous (must be true)

Exceptions
  • lsst::pex::exceptions::RuntimeError: Argument contiguous is false, or the pixels are not in fact contiguous

fast_iterator end(bool contiguous) const

Return a fast iterator to the end of the image, which must be contiguous Note that the order in which pixels are visited is undefined.

Parameters
  • contiguous: Pixels are contiguous (must be true)

Exceptions
  • lsst::pex::exceptions::RuntimeError: Argument contiguous is false, or the pixels are not in fact contiguous

x_iterator row_begin(int y) const

Return an x_iterator to the start of the image.

x_iterator row_end(int y) const

Return an x_iterator to the end of the image.

x_iterator x_at(int x, int y) const

Return an x_iterator at the point (x, y)

y_iterator col_begin(int x) const

Return an y_iterator to the start of the image.

y_iterator col_end(int x) const

Return an y_iterator to the end of the image.

y_iterator y_at(int x, int y) const

Return an y_iterator at the point (x, y)

xy_locator xy_at(int x, int y) const

Return an xy_locator at the point (x, y)

Public Static Functions

static MaskedImage readFits(std::string const &filename)

Read a MaskedImage from a regular FITS file.

Parameters
  • [in] filename: Name of the file to read.

static MaskedImage readFits(fits::MemFileManager &manager)

Read a MaskedImage from a FITS RAM file.

Parameters
  • [in] manager: Object that manages the memory to be read.

template<typename ImageIterator, typename MaskIterator, typename VarianceIterator>
class const_MaskedImageIterator : public lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>::MaskedImageIteratorBase<detail::const_iterator_type<ImageIterator>::type, detail::const_iterator_type<MaskIterator>::type, detail::const_iterator_type<VarianceIterator>::type, ConstReference>

An const iterator to the MaskedImage.

An const iterator for a MaskedImage.

Public Functions

template<>
const_MaskedImageIterator(MaskedImageIterator<ImageIterator, MaskIterator, VarianceIterator> const &iter)
template<>
const_MaskedImageIterator &operator+(std::ptrdiff_t delta)

Return a const_MaskedImageIterator that’s delta beyond this.

template<typename ImageLocator, typename MaskLocator, typename VarianceLocator>
class const_MaskedImageLocator : public lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>::MaskedImageLocatorBase<detail::const_locator_type<ImageLocator>::type, detail::const_locator_type<MaskLocator>::type, detail::const_locator_type<VarianceLocator>::type, ConstReference>

A const locator for the MaskedImage.

A const locator for a MaskedImage.

Public Functions

template<>
const_MaskedImageLocator(MaskedImageLocator<ImageLocator, MaskLocator, VarianceLocator> const &iter)
template<typename ImagePT = ImagePixelT, typename MaskPT = MaskPixelT, typename VarPT = VariancePixelT>
struct ImageTypeFactory

A templated class to return this classes’ type (present in Image/Mask/MaskedImage)

Public Types

template<>
typedef MaskedImage<ImagePT, MaskPT, VarPT> type

Return the desired type.

template<typename ImageIterator, typename MaskIterator, typename VarianceIterator>
class MaskedImageIterator : public lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>::MaskedImageIteratorBase<ImageIterator, MaskIterator, VarianceIterator>

An iterator to the MaskedImage.

An iterator for a MaskedImage.

Subclassed by lsst::afw::math::MaskedVector< EntryT >::iterator

Public Functions

template<>
MaskedImageIterator(ImageIterator &img, MaskIterator &msk, VarianceIterator &var)
template<>
MaskedImageIterator operator+(std::ptrdiff_t delta)

Return a MaskedImageIterator that’s delta beyond this.

template<typename ImageIterator, typename MaskIterator, typename VarianceIterator, template<typename> class Ref = Reference>
class MaskedImageIteratorBase

The base class for MaskedImageIterators (const and non-const)

Public Types

template<>
typedef boost::zip_iterator<IMV_iterator_tuple>::reference IMV_tuple

The underlying iterator tuple

Note

not really for public consumption; could be made protected

template<>
typedef Pixel type

Type pointed to by the iterator.

Public Functions

template<>
MaskedImageIteratorBase(ImageIterator const &img, MaskIterator const &msk, VarianceIterator const &var)

Construct a MaskedImageIteratorBase from the image/mask/variance iterators.

template<>
Ref<ImagePixelT>::type image()

Return (a reference to) the image part of the Pixel pointed at by the iterator.

template<>
Ref<MaskPixelT>::type mask()

Return (a reference to) the mask part of the Pixel pointed at by the iterator.

template<>
Ref<VariancePixelT>::type variance()

Return (a reference to) the variance part of the Pixel pointed at by the iterator.

template<>
const IMV_iterator_tuple get_iterator_tuple() const

Return the underlying iterator tuple

Note

not really for public consumption; could be made protected

template<>
MaskedImageIteratorBase &operator+=(std::ptrdiff_t delta)

Increment the iterator by delta

Parameters
  • delta: how far to move the iterator

template<>
MaskedImageIteratorBase &operator-=(std::ptrdiff_t delta)

Decrement the iterator by delta

Parameters
  • delta: how far to move the iterator

template<>
MaskedImageIteratorBase &operator++()

Increment the iterator (prefix)

template<>
MaskedImageIteratorBase operator++(int)

Increment the iterator (postfix)

template<>
std::ptrdiff_t operator-(MaskedImageIteratorBase const &rhs)

Return the distance between two iterators.

template<>
bool operator==(MaskedImageIteratorBase const &rhs)

Return true if the lhs equals the rhs.

template<>
bool operator!=(MaskedImageIteratorBase const &rhs)

Return true if the lhs doesn’t equal the rhs.

template<>
bool operator<(MaskedImageIteratorBase const &rhs)

Return true if the lhs is less than the rhs.

template<>
operator Pixel() const

Convert an iterator to a Pixel.

template<>
Pixel operator*()

Dereference the iterator, returning a Pixel.

template<>
const Pixel operator*() const

Dereference the iterator, returning a const Pixel.

Protected Attributes

template<>
boost::zip_iterator<IMV_iterator_tuple> _iter

Friends

friend lsst::afw::image::MaskedImage::const_MaskedImageIterator

The underlying const iterator tuple

Note

not really for public consumption; could be made protected

template<typename ImageLocator, typename MaskLocator, typename VarianceLocator>
class MaskedImageLocator : public lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>::MaskedImageLocatorBase<ImageLocator, MaskLocator, VarianceLocator>

A locator for the MaskedImage.

A locator for a MaskedImage.

Public Functions

template<>
MaskedImageLocator(ImageLocator &img, MaskLocator &msk, VarianceLocator &var)
template<typename ImageLocator, typename MaskLocator, typename VarianceLocator, template<typename> class Ref = Reference>
class MaskedImageLocatorBase

The base class for MaskedImageLocators (const and non-const)

Public Types

template<>
typedef boost::tuple<typename ImageLocator::cached_location_t, typename MaskLocator::cached_location_t, typename VarianceLocator::cached_location_t> IMVCachedLocation
template<>
typedef _x_or_y_iterator<apply_x> x_iterator

An x_iterator that provides a view of the xy_locator (i.e. advancing one advances the other)

template<>
typedef _x_or_y_iterator<apply_y> y_iterator

A y_iterator that provides a view of the xy_locator (i.e. advancing one advances the other)

template<>
typedef boost::mpl::vector<ImagePixelT, MaskPixelT, VariancePixelT> PixelTVec

Public Functions

template<>
MaskedImageLocatorBase(ImageLocator const &img, MaskLocator const &msk, VarianceLocator const &var)

Construct a MaskedImageLocator from image/mask/variance locators.

template<>
Pixel operator*()

Dereference a locator, returning a Pixel.

template<>
Pixel operator()(int x, int y)

Dereference a locator, returning a Pixel offset by (x, y) from the locator.

template<>
Pixel operator[](cached_location_t const &cached_loc)

Dereference a locator, returning a Pixel offset by the amount set when we created the cached_location_t

template<>
x_iterator x()

Return an iterator that can be used to move (or dereference) a locator

Note

this x_locator is xy_locator::x_locator, not MaskedImage::x_locator

template<>
y_iterator y()

Return an iterator that can be used to move (or dereference) a locator

Note

this y_locator is xy_locator::y_locator, not MaskedImage::y_locator

template<>
cached_location_t cache_location(int x, int y) const

Create a cached_location_t offset by (x, y) from locator.

template<typename N>
Ref<typename boost::mpl::at<PixelTVec, N>::type>::type apply_IMV(cached_location_t const &cached_loc)
template<typename N>
Ref<typename boost::mpl::at<PixelTVec, N>::type>::type apply_IMV()
template<typename N>
Ref<typename boost::mpl::at<PixelTVec, N>::type>::type apply_IMV(int x, int y)
template<>
Ref<ImagePixelT>::type image(cached_location_t const &cached_loc)

Return a reference to the image at the offset set when we created the cached_location_t

template<>
Ref<ImagePixelT>::type image()

Return a reference to the image at the current position of the locator.

template<>
Ref<ImagePixelT>::type image(int x, int y)

Return a reference to the image offset by (x, y) from the current position of the locator.

template<>
Ref<MaskPixelT>::type mask(cached_location_t const &cached_loc)

Return a reference to the mask at the offset set when we created the cached_location_t

template<>
Ref<MaskPixelT>::type mask()

Return a reference to the mask at the current position of the locator.

template<>
Ref<MaskPixelT>::type mask(int x, int y)

Return a reference to the mask offset by (x, y) from the current position of the locator.

template<>
Ref<VariancePixelT>::type variance(cached_location_t const &cached_loc)

Return a reference to the variance at the offset set when we created the cached_location_t

template<>
Ref<VariancePixelT>::type variance()

Return a reference to the variance at the current position of the locator.

template<>
Ref<VariancePixelT>::type variance(int x, int y)

Return a reference to the variance offset by (x, y) from the current position of the locator.

template<>
bool operator==(MaskedImageLocatorBase const &rhs)

Return true iff two locators are equal.

template<>
bool operator!=(MaskedImageLocatorBase const &rhs)

Return true iff two locators are not equal.

template<>
bool operator<(MaskedImageLocatorBase const &rhs)

Return true iff lhs is less than rhs.

template<>
MaskedImageLocatorBase &operator+=(pair2I const &p)

Increment the locator’s x and y positions by p

template<>
MaskedImageLocatorBase &operator+=(detail::difference_type p)

Increment the locator’s x and y positions by p

template<>
IMVLocator const &getLoc() const

Protected Attributes

template<>
IMVLocator _loc
class cached_location_t

A saved relative position, providing efficient access to neighbouring pixels.

Public Functions

template<>
template<>
cached_location_t(IMVLocator const &loc, int x, int y)

Create a cached_location_t that can be used to access pixels (x, y) away from loc

Public Members

template<>
template<>
IMVCachedLocation _imv

Friends

friend lsst::afw::image::MaskedImage::const_MaskedImageLocator