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
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
lsst::afw::image::Mask< MaskPixelT > Class Template Reference

Represent a 2-dimensional array of bitmask pixels. More...

#include <Mask.h>

Inheritance diagram for lsst::afw::image::Mask< MaskPixelT >:
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >

Classes

struct  ImageTypeFactory
 A templated class to return this classes' type (present in Image/Mask/MaskedImage) More...
 

Public Types

typedef detail::MaskPlaneDict MaskPlaneDict
 
typedef detail::Mask_tag image_category
 
typedef lsst::afw::image::MaskPixel SinglePixel
 A single Pixel of the same type as those in the ImageBase. More...
 
typedef lsst::afw::image::MaskPixel Pixel
 A pixel in this ImageBase. More...
 
typedef Reference< lsst::afw::image::MaskPixel >::type PixelReference
 A Reference to a PixelT. More...
 
typedef ConstReference< lsst::afw::image::MaskPixel >::type PixelConstReference
 A ConstReference to a PixelT. More...
 
typedef _view_t::xy_locator xy_locator
 An xy_locator. More...
 
typedef _view_t::xy_locator::const_t const_xy_locator
 A const_xy_locator. More...
 
typedef _view_t::iterator iterator
 An STL compliant iterator. More...
 
typedef _const_view_t::iterator const_iterator
 An STL compliant const iterator. More...
 
typedef _view_t::reverse_iterator reverse_iterator
 An STL compliant reverse iterator. More...
 
typedef _const_view_t::reverse_iterator const_reverse_iterator
 An STL compliant const reverse iterator. More...
 
typedef _view_t::x_iterator x_iterator
 An iterator for traversing the pixels in a row. More...
 
typedef x_iterator fast_iterator
 A fast STL compliant iterator for contiguous images N.b. More...
 
typedef _view_t::x_iterator xy_x_iterator
 An iterator for traversing the pixels in a row, created from an xy_locator. More...
 
typedef _const_view_t::x_iterator const_x_iterator
 A const iterator for traversing the pixels in a row. More...
 
typedef _view_t::y_iterator y_iterator
 An iterator for traversing the pixels in a column. More...
 
typedef _view_t::y_iterator xy_y_iterator
 An iterator for traversing the pixels in a row, created from an xy_locator. More...
 
typedef _const_view_t::y_iterator const_y_iterator
 A const iterator for traversing the pixels in a column. More...
 
typedef ndarray::Array< lsst::afw::image::MaskPixel, 2, 1 > Array
 A mutable ndarray representation of the image. More...
 
typedef ndarray::Array< lsst::afw::image::MaskPixel const, 2, 1 > ConstArray
 An immutable ndarray representation of the image. More...
 

Public Member Functions

 Mask (unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to 0x0. More...
 
 Mask (unsigned int width, unsigned int height, MaskPixelT initialValue, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to a specified value. More...
 
 Mask (lsst::geom::Extent2I const &dimensions=lsst::geom::Extent2I(), MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to 0x0. More...
 
 Mask (lsst::geom::Extent2I const &dimensions, MaskPixelT initialValue, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to a specified value. More...
 
 Mask (lsst::geom::Box2I const &bbox, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to 0x0. More...
 
 Mask (lsst::geom::Box2I const &bbox, MaskPixelT initialValue, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to a specified value. More...
 
 Mask (std::string const &fileName, int hdu=fits::DEFAULT_HDU, std::shared_ptr< lsst::daf::base::PropertySet > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Construct a Mask by reading a regular FITS file. More...
 
 Mask (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU, std::shared_ptr< lsst::daf::base::PropertySet > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Construct a Mask by reading a FITS image in memory. More...
 
 Mask (fits::Fits &fitsfile, std::shared_ptr< lsst::daf::base::PropertySet > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool allowUnsafe=false)
 Construct a Mask from an already-open FITS object. More...
 
template<typename OtherPixelT >
 Mask (Mask< OtherPixelT > const &rhs, const bool deep)
 
 Mask (const Mask &src, const bool deep=false)
 Construct a Mask from another Mask. More...
 
 Mask (Mask &&src)
 
 ~Mask () override
 
 Mask (const Mask &src, const lsst::geom::Box2I &bbox, ImageOrigin const origin=PARENT, const bool deep=false)
 Construct a Mask from a subregion of another Mask. More...
 
 Mask (ndarray::Array< MaskPixelT, 2, 1 > const &array, bool deep=false, lsst::geom::Point2I const &xy0=lsst::geom::Point2I())
 
void swap (Mask &rhs)
 
Maskoperator= (MaskPixelT const rhs)
 
Maskoperator= (const Mask &rhs)
 
Maskoperator= (Mask &&rhs)
 
Maskoperator|= (Mask const &rhs)
 OR a Mask into a Mask. More...
 
Maskoperator|= (MaskPixelT const rhs)
 OR a bitmask into a Mask. More...
 
Maskoperator&= (Mask const &rhs)
 AND a Mask into a Mask. More...
 
Maskoperator&= (MaskPixelT const rhs)
 AND a bitmask into a Mask. More...
 
Mask subset (lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
 Return a subimage corresponding to the given box. More...
 
Mask operator[] (lsst::geom::Box2I const &bbox) const
 Return a subimage corresponding to the given box (interpreted as PARENT coordinates). More...
 
Maskoperator^= (Mask const &rhs)
 XOR a Mask into a Mask. More...
 
Maskoperator^= (MaskPixelT const rhs)
 XOR a bitmask into a Mask. More...
 
ImageBase< MaskPixelT >::PixelReference operator() (int x, int y)
 get a reference to the specified pixel More...
 
ImageBase< MaskPixelT >::PixelConstReference operator() (int x, int y) const
 get the specified pixel (const version) More...
 
bool operator() (int x, int y, int plane) const
 is the specified mask plane set in the specified pixel? More...
 
ImageBase< MaskPixelT >::PixelReference operator() (int x, int y, CheckIndices const &check)
 get a reference to the specified pixel checking array bounds More...
 
ImageBase< MaskPixelT >::PixelConstReference operator() (int x, int y, CheckIndices const &check) const
 get the specified pixel with array checking (const version) More...
 
bool operator() (int x, int y, int plane, CheckIndices const &check) const
 is the specified mask plane set in the specified pixel, checking array bounds? More...
 
void writeFits (std::string const &fileName, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), std::string const &mode="w") const
 Write a mask to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet >(), std::string const &mode="w") const
 Write a mask to a FITS RAM file. More...
 
void writeFits (fits::Fits &fitsfile, std::shared_ptr< lsst::daf::base::PropertySet const > metadata=std::shared_ptr< lsst::daf::base::PropertySet const >()) const
 Write a mask to an open FITS file object. More...
 
void writeFits (std::string const &filename, fits::ImageWriteOptions const &options, std::string const &mode="w", std::shared_ptr< daf::base::PropertySet const > header=nullptr) const
 Write a mask to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, fits::ImageWriteOptions const &options, std::string const &mode="w", std::shared_ptr< daf::base::PropertySet const > header=nullptr) const
 Write a mask to a FITS RAM file. More...
 
void writeFits (fits::Fits &fitsfile, fits::ImageWriteOptions const &options, std::shared_ptr< daf::base::PropertySet const > header=nullptr) const
 Write a mask to an open FITS file object. More...
 
std::string getAsString (int x, int y)
 
void clearAllMaskPlanes ()
 Clear all the pixels. More...
 
void clearMaskPlane (int plane)
 Clear the specified bit in all pixels. More...
 
void setMaskPlaneValues (const int plane, const int x0, const int x1, const int y)
 Set the bit specified by "planeId" for pixels (x0, y) ... More...
 
void removeAndClearMaskPlane (const std::string &name, bool const removeFromDefault=false)
 Clear all pixels of the specified mask and remove the plane from the mask plane dictionary; optionally remove the plane from the default dictionary too. More...
 
MaskPlaneDict const & getMaskPlaneDict () const
 Return the Mask's maskPlaneDict. More...
 
void printMaskPlanes () const
 print the mask plane dictionary to std::cout More...
 
void conformMaskPlanes (const MaskPlaneDict &masterPlaneDict)
 Adjust this mask to conform to the standard Mask class's mask plane dictionary, adding any new mask planes to the standard. More...
 
void assign (ImageBase const &rhs, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
 Copy pixels from another image to a specified subregion of this image. More...
 
PixelReference get (lsst::geom::Point2I const &index, ImageOrigin origin)
 Return a reference to a single pixel (with no bounds check). More...
 
PixelConstReference get (lsst::geom::Point2I const &index, ImageOrigin origin) const
 Return a const reference to a single pixel (with no bounds check). More...
 
PixelReference operator[] (lsst::geom::Point2I const &index)
 Return a reference to a single pixel in PARENT coordinates (with no bounds check). More...
 
PixelConstReference operator[] (lsst::geom::Point2I const &index) const
 Return a reference to a single pixel in PARENT coordinates (with no bounds check). More...
 
int getWidth () const
 Return the number of columns in the image. More...
 
int getHeight () const
 Return the number of rows in the image. More...
 
int getX0 () const
 Return the image's column-origin. More...
 
int getY0 () const
 Return the image's row-origin. More...
 
lsst::geom::Point2I getXY0 () const
 Return the image's origin. More...
 
std::pair< int, double > positionToIndex (double const pos, lsst::afw::image::xOrY const xy) const
 Convert image position to index (nearest integer and fractional parts) More...
 
double indexToPosition (double ind, lsst::afw::image::xOrY const xy) const
 Convert image index to image position. More...
 
lsst::geom::Extent2I getDimensions () const
 Return the image's size; useful for passing to constructors. More...
 
void swap (ImageBase &rhs)
 
Array getArray ()
 
ConstArray getArray () const
 
iterator begin () const
 Return an STL compliant iterator to the start of the image. More...
 
fast_iterator begin (bool contiguous) const
 Return a fast STL compliant iterator to the start of the image which must be contiguous. More...
 
iterator end () const
 Return an STL compliant iterator to the end of the image. More...
 
fast_iterator end (bool contiguous) const
 Return a fast STL compliant iterator to the end of the image which must be contiguous. More...
 
reverse_iterator rbegin () const
 Return an STL compliant reverse iterator to the start of the image. More...
 
reverse_iterator rend () const
 Return an STL compliant reverse iterator to the end of the image. More...
 
iterator at (int x, int y) const
 Return an STL compliant iterator at the point (x, y) More...
 
x_iterator row_begin (int y) const
 Return an x_iterator to the start of the y'th row. More...
 
x_iterator row_end (int y) const
 Return an x_iterator to the end of the y'th row. More...
 
x_iterator x_at (int x, int y) const
 Return an x_iterator to the point (x, y) in the image. More...
 
y_iterator col_begin (int x) const
 Return an y_iterator to the start of the y'th row. More...
 
y_iterator col_end (int x) const
 Return an y_iterator to the start of the y'th row. More...
 
y_iterator y_at (int x, int y) const
 Return an y_iterator to the point (x, y) in the image. More...
 
xy_locator xy_at (int x, int y) const
 Return an xy_locator at the point (x, y) in the image. More...
 
void setXY0 (lsst::geom::Point2I const origin)
 Set the ImageBase's origin. More...
 
void setXY0 (int const x0, int const y0)
 Set the ImageBase's origin. More...
 
lsst::geom::Box2I getBBox (ImageOrigin origin=PARENT) const
 

Static Public Member Functions

static MaskPixelT getPlaneBitMask (const std::vector< std::string > &names)
 Return the bitmask corresponding to a vector of plane names OR'd together. More...
 
static Mask readFits (std::string const &filename, int hdu=fits::DEFAULT_HDU)
 Read a Mask from a regular FITS file. More...
 
static Mask readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read a Mask from a FITS RAM file. More...
 
static std::string interpret (MaskPixelT value)
 Interpret a mask value as a comma-separated list of mask plane names. More...
 
static MaskPlaneDict parseMaskPlaneMetadata (std::shared_ptr< lsst::daf::base::PropertySet const > metadata)
 Given a PropertySet that contains the MaskPlane assignments, setup the MaskPlanes. More...
 
static void clearMaskPlaneDict ()
 Reset the maskPlane dictionary. More...
 
static int addMaskPlane (const std::string &name)
 
static void removeMaskPlane (const std::string &name)
 
static int getMaskPlane (const std::string &name)
 Return the mask plane number corresponding to a plane name. More...
 
static MaskPixelT getPlaneBitMask (const std::string &name)
 Return the bitmask corresponding to a plane name. More...
 
static int getNumPlanesMax ()
 
static int getNumPlanesUsed ()
 
static void addMaskPlanesToMetadata (std::shared_ptr< lsst::daf::base::PropertySet >)
 Given a PropertySet, replace any existing MaskPlane assignments with the current ones. More...
 
static SinglePixel PixelCast (SinglePixelT rhs)
 Convert a type to our SinglePixel type. More...
 

Protected Member Functions

_view_t _getRawView () const
 
bool isContiguous () const
 

Static Protected Member Functions

static _view_t _allocateView (lsst::geom::Extent2I const &dimensions, Manager::Ptr &manager)
 
static _view_t _makeSubView (lsst::geom::Extent2I const &dimensions, lsst::geom::Extent2I const &offset, const _view_t &view)
 

Friends

class MaskFitsReader
 

Detailed Description

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
class lsst::afw::image::Mask< MaskPixelT >

Represent a 2-dimensional array of bitmask pixels.

Some mask planes are always defined (although you can add more with Mask::addMaskPlane):

Definition at line 77 of file Mask.h.

Member Typedef Documentation

◆ Array

A mutable ndarray representation of the image.

Definition at line 149 of file ImageBase.h.

◆ const_iterator

typedef _const_view_t::iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::const_iterator
inherited

An STL compliant const iterator.

Definition at line 127 of file ImageBase.h.

◆ const_reverse_iterator

typedef _const_view_t::reverse_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::const_reverse_iterator
inherited

An STL compliant const reverse iterator.

Definition at line 131 of file ImageBase.h.

◆ const_x_iterator

typedef _const_view_t::x_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::const_x_iterator
inherited

A const iterator for traversing the pixels in a row.

Definition at line 141 of file ImageBase.h.

◆ const_xy_locator

typedef _view_t::xy_locator::const_t lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::const_xy_locator
inherited

A const_xy_locator.

Definition at line 123 of file ImageBase.h.

◆ const_y_iterator

typedef _const_view_t::y_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::const_y_iterator
inherited

A const iterator for traversing the pixels in a column.

Definition at line 147 of file ImageBase.h.

◆ ConstArray

An immutable ndarray representation of the image.

Definition at line 151 of file ImageBase.h.

◆ fast_iterator

A fast STL compliant iterator for contiguous images N.b.

The order of pixel access is undefined

Definition at line 137 of file ImageBase.h.

◆ image_category

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
typedef detail::Mask_tag lsst::afw::image::Mask< MaskPixelT >::image_category

Definition at line 81 of file Mask.h.

◆ iterator

typedef _view_t::iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::iterator
inherited

An STL compliant iterator.

Definition at line 125 of file ImageBase.h.

◆ MaskPlaneDict

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
typedef detail::MaskPlaneDict lsst::afw::image::Mask< MaskPixelT >::MaskPlaneDict

Definition at line 79 of file Mask.h.

◆ Pixel

A pixel in this ImageBase.

Definition at line 115 of file ImageBase.h.

◆ PixelConstReference

A ConstReference to a PixelT.

Definition at line 119 of file ImageBase.h.

◆ PixelReference

A Reference to a PixelT.

Definition at line 117 of file ImageBase.h.

◆ reverse_iterator

typedef _view_t::reverse_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::reverse_iterator
inherited

An STL compliant reverse iterator.

Definition at line 129 of file ImageBase.h.

◆ SinglePixel

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

Definition at line 113 of file ImageBase.h.

◆ x_iterator

typedef _view_t::x_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::x_iterator
inherited

An iterator for traversing the pixels in a row.

Definition at line 133 of file ImageBase.h.

◆ xy_locator

typedef _view_t::xy_locator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::xy_locator
inherited

An xy_locator.

Definition at line 121 of file ImageBase.h.

◆ xy_x_iterator

typedef _view_t::x_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::xy_x_iterator
inherited

An iterator for traversing the pixels in a row, created from an xy_locator.

Definition at line 139 of file ImageBase.h.

◆ xy_y_iterator

typedef _view_t::y_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::xy_y_iterator
inherited

An iterator for traversing the pixels in a row, created from an xy_locator.

Definition at line 145 of file ImageBase.h.

◆ y_iterator

typedef _view_t::y_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::y_iterator
inherited

An iterator for traversing the pixels in a column.

Definition at line 143 of file ImageBase.h.

Constructor & Destructor Documentation

◆ Mask() [1/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( unsigned int  width,
unsigned int  height,
MaskPlaneDict const &  planeDefs = MaskPlaneDict() 
)
explicit

Construct a Mask initialized to 0x0.

Parameters
widthnumber of columns
heightnumber of rows
planeDefsdesired mask planes

Definition at line 69 of file Mask.cc.

70  : ImageBase<MaskPixelT>(lsst::geom::ExtentI(width, height)) {
71  _initializePlanes(planeDefs);
72  *this = 0x0;
73 }

◆ Mask() [2/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( unsigned int  width,
unsigned int  height,
MaskPixelT  initialValue,
MaskPlaneDict const &  planeDefs = MaskPlaneDict() 
)
explicit

Construct a Mask initialized to a specified value.

Parameters
widthnumber of columns
heightnumber of rows
initialValueInitial value
planeDefsdesired mask planes

Definition at line 76 of file Mask.cc.

78  : ImageBase<MaskPixelT>(lsst::geom::ExtentI(width, height)) {
79  _initializePlanes(planeDefs);
80  *this = initialValue;
81 }

◆ Mask() [3/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( lsst::geom::Extent2I const &  dimensions = lsst::geom::Extent2I(),
MaskPlaneDict const &  planeDefs = MaskPlaneDict() 
)
explicit

Construct a Mask initialized to 0x0.

Parameters
dimensionsNumber of columns, rows
planeDefsdesired mask planes

Definition at line 84 of file Mask.cc.

85  : ImageBase<MaskPixelT>(dimensions) {
86  _initializePlanes(planeDefs);
87  *this = 0x0;
88 }

◆ Mask() [4/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( lsst::geom::Extent2I const &  dimensions,
MaskPixelT  initialValue,
MaskPlaneDict const &  planeDefs = MaskPlaneDict() 
)
explicit

Construct a Mask initialized to a specified value.

Parameters
dimensionsNumber of columns, rows
initialValueInitial value
planeDefsdesired mask planes

Definition at line 91 of file Mask.cc.

93  : ImageBase<MaskPixelT>(dimensions) {
94  _initializePlanes(planeDefs);
95  *this = initialValue;
96 }

◆ Mask() [5/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( lsst::geom::Box2I const &  bbox,
MaskPlaneDict const &  planeDefs = MaskPlaneDict() 
)
explicit

Construct a Mask initialized to 0x0.

Parameters
bboxDesired number of columns/rows and origin
planeDefsdesired mask planes

Definition at line 99 of file Mask.cc.

100  : ImageBase<MaskPixelT>(bbox) {
101  _initializePlanes(planeDefs);
102  *this = 0x0;
103 }

◆ Mask() [6/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( lsst::geom::Box2I const &  bbox,
MaskPixelT  initialValue,
MaskPlaneDict const &  planeDefs = MaskPlaneDict() 
)
explicit

Construct a Mask initialized to a specified value.

Parameters
bboxDesired number of columns/rows and origin
initialValueInitial value
planeDefsdesired mask planes

Definition at line 106 of file Mask.cc.

107  : ImageBase<MaskPixelT>(bbox) {
108  _initializePlanes(planeDefs);
109  *this = initialValue;
110 }

◆ Mask() [7/14]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
lsst::afw::image::Mask< MaskPixelT >::Mask ( std::string const &  fileName,
int  hdu = fits::DEFAULT_HDU,
std::shared_ptr< lsst::daf::base::PropertySet metadata = std::shared_ptrlsst::daf::base::PropertySet >(),
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  allowUnsafe = false 
)
explicit

Construct a Mask by reading a regular FITS file.

Parameters
[in]fileNameFile to read.
[in]hduHDU to read, 0-indexed (i.e. 0=Primary HDU). The special value of afw::fits::DEFAULT_HDU reads the Primary HDU unless it is empty, in which case it reads the first extension HDU.
[in,out]metadataMetadata read from the header (may be null).
[in]bboxIf non-empty, read only the pixels within the bounding box.
[in]originCoordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.
[in]conformMasksIf true, make Mask conform to the mask layout in the file.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

The meaning of the bitplanes is given in the header. If conformMasks is false (default), the bitvalues will be changed to match those in Mask's plane dictionary. If it's true, the bitvalues will be left alone, but Mask's dictionary will be modified to match the on-disk version.

◆ Mask() [8/14]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
lsst::afw::image::Mask< MaskPixelT >::Mask ( fits::MemFileManager manager,
int  hdu = fits::DEFAULT_HDU,
std::shared_ptr< lsst::daf::base::PropertySet metadata = std::shared_ptrlsst::daf::base::PropertySet >(),
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  allowUnsafe = false 
)
explicit

Construct a Mask by reading a FITS image in memory.

Parameters
[in]managerAn object that manages the memory buffer to read.
[in]hduHDU to read, 0-indexed (i.e. 0=Primary HDU). The special value of afw::fits::DEFAULT_HDU reads the Primary HDU unless it is empty, in which case it reads the first extension HDU.
[in,out]metadataMetadata read from the header (may be null).
[in]bboxIf non-empty, read only the pixels within the bounding box.
[in]originCoordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.
[in]conformMasksIf true, make Mask conform to the mask layout in the file.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

The meaning of the bitplanes is given in the header. If conformMasks is false (default), the bitvalues will be changed to match those in Mask's plane dictionary. If it's true, the bitvalues will be left alone, but Mask's dictionary will be modified to match the on-disk version.

◆ Mask() [9/14]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
lsst::afw::image::Mask< MaskPixelT >::Mask ( fits::Fits fitsfile,
std::shared_ptr< lsst::daf::base::PropertySet metadata = std::shared_ptrlsst::daf::base::PropertySet >(),
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  allowUnsafe = false 
)
explicit

Construct a Mask from an already-open FITS object.

Parameters
[in]fitsfileA FITS object to read from, already at the desired HDU.
[in,out]metadataMetadata read from the header (may be null).
[in]bboxIf non-empty, read only the pixels within the bounding box.
[in]originCoordinate system of the bounding box; if PARENT, the bounding box should take into account the xy0 saved with the image.
[in]conformMasksIf true, make Mask conform to the mask layout in the file.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

The meaning of the bitplanes is given in the header. If conformMasks is false (default), the bitvalues will be changed to match those in Mask's plane dictionary. If it's true, the bitvalues will be left alone, but Mask's dictionary will be modified to match the on-disk version.

◆ Mask() [10/14]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
template<typename OtherPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( Mask< OtherPixelT > const &  rhs,
const bool  deep 
)
inline

Definition at line 220 of file Mask.h.

221  : image::ImageBase<MaskPixelT>(rhs, deep), _maskDict(rhs._maskDict) {}

◆ Mask() [11/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( const Mask< MaskPixelT > &  src,
const bool  deep = false 
)

Construct a Mask from another Mask.

Parameters
srcmask to copy
deepdeep copy? (construct a view with shared pixels if false)

Definition at line 118 of file Mask.cc.

119  : ImageBase<MaskPixelT>(rhs, deep), _maskDict(rhs._maskDict) {}

◆ Mask() [12/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( Mask< MaskPixelT > &&  src)

Definition at line 122 of file Mask.cc.

122 : Mask(rhs, false) {}

◆ ~Mask()

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::~Mask ( )
overridedefault

◆ Mask() [13/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( const Mask< MaskPixelT > &  src,
const lsst::geom::Box2I bbox,
ImageOrigin const  origin = PARENT,
const bool  deep = false 
)

Construct a Mask from a subregion of another Mask.

Parameters
srcmask to copy
bboxsubregion to copy
origincoordinate system of the bbox
deepdeep copy? (construct a view with shared pixels if false)

Definition at line 113 of file Mask.cc.

115  : ImageBase<MaskPixelT>(rhs, bbox, origin, deep), _maskDict(rhs._maskDict) {}

◆ Mask() [14/14]

template<typename MaskPixelT >
lsst::afw::image::Mask< MaskPixelT >::Mask ( ndarray::Array< MaskPixelT, 2, 1 > const &  array,
bool  deep = false,
lsst::geom::Point2I const &  xy0 = lsst::geom::Point2I() 
)
explicit

Definition at line 128 of file Mask.cc.

130  : image::ImageBase<MaskPixelT>(array, deep, xy0), _maskDict(detail::MaskDict::getDefault()) {}

Member Function Documentation

◆ _allocateView()

ImageBase< lsst::afw::image::MaskPixel >::_view_t lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::_allocateView ( lsst::geom::Extent2I const &  dimensions,
Manager::Ptr &  manager 
)
staticprotectedinherited

Definition at line 459 of file Image.cc.

59  {
60  if (dimensions.getX() < 0 || dimensions.getY() < 0) {
61  throw LSST_EXCEPT(pex::exceptions::LengthError,
62  str(boost::format("Both width and height must be non-negative: %d, %d") %
63  dimensions.getX() % dimensions.getY()));
64  }
65  if (dimensions.getX() != 0 && dimensions.getY() > std::numeric_limits<int>::max() / dimensions.getX()) {
66  throw LSST_EXCEPT(pex::exceptions::LengthError,
67  str(boost::format("Image dimensions (%d x %d) too large; int overflow detected.") %
68  dimensions.getX() % dimensions.getY()));
69  }
71  ndarray::SimpleManager<PixelT>::allocate(dimensions.getX() * dimensions.getY());
72  manager = r.first;
73  return boost::gil::interleaved_view(dimensions.getX(), dimensions.getY(),
74  (typename _view_t::value_type*)r.second,
75  dimensions.getX() * sizeof(PixelT));
76 }

◆ _getRawView()

_view_t lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::_getRawView
inlineprotectedinherited

Definition at line 463 of file ImageBase.h.

463 { return _gilView; }

◆ _makeSubView()

ImageBase< lsst::afw::image::MaskPixel >::_view_t lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::_makeSubView ( lsst::geom::Extent2I const &  dimensions,
lsst::geom::Extent2I const &  offset,
const _view_t &  view 
)
staticprotectedinherited

Definition at line 460 of file Image.cc.

80  {
81  if (offset.getX() < 0 || offset.getY() < 0 || offset.getX() + dimensions.getX() > view.width() ||
82  offset.getY() + dimensions.getY() > view.height()) {
83  throw LSST_EXCEPT(
84  pex::exceptions::LengthError,
86  "Box2I(Point2I(%d,%d),lsst::geom::Extent2I(%d,%d)) doesn't fit in image %dx%d") %
87  offset.getX() % offset.getY() % dimensions.getX() % dimensions.getY() % view.width() %
88  view.height())
89  .str());
90  }
91  return boost::gil::subimage_view(view, offset.getX(), offset.getY(), dimensions.getX(),
92  dimensions.getY());
93 }

◆ addMaskPlane()

template<typename MaskPixelT >
int lsst::afw::image::Mask< MaskPixelT >::addMaskPlane ( const std::string name)
static

Definition at line 267 of file Mask.cc.

267  {
268  int id = getMaskPlaneNoThrow(name); // see if the plane is already available
269 
270  if (id < 0) { // doesn't exist
271  id = _maskPlaneDict()->getUnusedPlane();
272  }
273 
274  // build new entry, adding the plane to all Masks where this is no contradiction
275 
276  if (id >= getNumPlanesMax()) { // Max number of planes is already allocated
278  str(boost::format("Max number of planes (%1%) already used") % getNumPlanesMax()));
279  }
280 
282 
283  return id;
284 }

◆ addMaskPlanesToMetadata()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::addMaskPlanesToMetadata ( std::shared_ptr< lsst::daf::base::PropertySet metadata)
static

Given a PropertySet, replace any existing MaskPlane assignments with the current ones.

Definition at line 576 of file Mask.cc.

576  {
577  if (!metadata) {
578  throw LSST_EXCEPT(pexExcept::InvalidParameterError, "Null std::shared_ptr<PropertySet>");
579  }
580 
581  // First, clear existing MaskPlane metadata
582  typedef std::vector<std::string> NameList;
583  NameList paramNames = metadata->paramNames(false);
584  for (NameList::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i) {
585  if (i->compare(0, maskPlanePrefix.size(), maskPlanePrefix) == 0) {
586  metadata->remove(*i);
587  }
588  }
589 
590  MaskPlaneDict const& mpd = _maskPlaneDict()->getMaskPlaneDict();
591 
592  // Add new MaskPlane metadata
593  for (MaskPlaneDict::const_iterator i = mpd.begin(); i != mpd.end(); ++i) {
594  std::string const& planeName = i->first;
595  int const planeNumber = i->second;
596 
597  if (planeName != "") {
598  metadata->add(maskPlanePrefix + planeName, planeNumber);
599  }
600  }
601 }

◆ assign()

void lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::assign ( ImageBase< lsst::afw::image::MaskPixel > const &  rhs,
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT 
)
inherited

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

Parameters
[in]rhssource image whose pixels are to be copied into this image (the destination)
[in]bboxsubregion of this image to set; if empty (the default) then all pixels are set
[in]originorigin 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::LengthErrorif the dimensions of rhs and the specified subregion of this image do not match.

Definition at line 267 of file Image.cc.

160  {
161  auto lhsDim = bbox.isEmpty() ? getDimensions() : bbox.getDimensions();
162  if (lhsDim != rhs.getDimensions()) {
163  throw LSST_EXCEPT(pex::exceptions::LengthError,
164  (boost::format("Dimension mismatch: %dx%d v. %dx%d") % lhsDim.getX() %
165  lhsDim.getY() % rhs.getWidth() % rhs.getHeight())
166  .str());
167  }
168  if (bbox.isEmpty()) {
169  copy_pixels(rhs._gilView, _gilView);
170  } else {
171  auto lhsOff = (origin == PARENT) ? bbox.getMin() - _origin : lsst::geom::Extent2I(bbox.getMin());
172  auto lhsGilView = _makeSubView(lhsDim, lhsOff, _gilView);
173  copy_pixels(rhs._gilView, lhsGilView);
174  }
175 }

◆ at()

Return an STL compliant iterator at the point (x, y)

Definition at line 376 of file Image.cc.

277  {
278  return _gilView.at(x, y);
279 }

◆ begin() [1/2]

Return an STL compliant iterator to the start of the image.

Note that this isn't especially efficient; see imageIterators for a discussion

Definition at line 368 of file Image.cc.

257  {
258  return _gilView.begin();
259 }

◆ begin() [2/2]

Return a fast STL compliant iterator to the start of the image which must be contiguous.

Parameters
contiguousPixels are contiguous (must be true)
Exceptions
lsst::pex::exceptions::RuntimeErrorArgument contiguous is false, or the pixels are not in fact contiguous

Definition at line 385 of file Image.cc.

282  {
283  if (!contiguous) {
284  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Only contiguous == true makes sense");
285  }
286  if (!this->isContiguous()) {
287  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Image's pixels are not contiguous");
288  }
289 
290  return row_begin(0);
291 }

◆ clearAllMaskPlanes()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::clearAllMaskPlanes

Clear all the pixels.

Definition at line 398 of file Mask.cc.

398  {
399  *this = 0;
400 }

◆ clearMaskPlane()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::clearMaskPlane ( int  plane)

Clear the specified bit in all pixels.

Definition at line 403 of file Mask.cc.

403  {
404  *this &= ~getBitMask(planeId);
405 }

◆ clearMaskPlaneDict()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::clearMaskPlaneDict
static

Reset the maskPlane dictionary.

Definition at line 393 of file Mask.cc.

393  {
394  _maskPlaneDict()->clear();
395 }

◆ col_begin()

y_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::col_begin ( int  x) const
inlineinherited

Return an y_iterator to the start of the y'th row.

Incrementing an y_iterator moves it up the column

Definition at line 411 of file ImageBase.h.

411 { return _gilView.col_begin(x); }

◆ col_end()

y_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::col_end ( int  x) const
inlineinherited

Return an y_iterator to the start of the y'th row.

Definition at line 414 of file ImageBase.h.

414 { return _gilView.col_end(x); }

◆ conformMaskPlanes()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::conformMaskPlanes ( const MaskPlaneDict masterPlaneDict)

Adjust this mask to conform to the standard Mask class's mask plane dictionary, adding any new mask planes to the standard.

Ensures that this mask (presumably from some external source) has the same plane assignments as the Mask class. If a change in plane assignments is needed, the bits within each pixel are permuted as required. The provided masterPlaneDict describes the true state of the bits in this Mask's pixels and overrides its current MaskDict

Any new mask planes found in this mask are added to unused slots in the Mask class's mask plane dictionary.

Parameters
masterPlaneDictmask plane dictionary currently in use for this mask

Definition at line 408 of file Mask.cc.

408  {
410 
411  if (*_maskDict == *currentMD) {
412  if (*detail::MaskDict::getDefault() == *_maskDict) {
413  return; // nothing to do
414  }
415  } else {
416  //
417  // Find out which planes need to be permuted
418  //
419  MaskPixelT keepBitmask = 0; // mask of bits to keep
420  MaskPixelT canonicalMask[sizeof(MaskPixelT) * 8]; // bits in lsst::afw::image::Mask that should be
421  MaskPixelT currentMask[sizeof(MaskPixelT) * 8]; // mapped to these bits
422  int numReMap = 0;
423 
424  for (MaskPlaneDict::const_iterator i = currentPlaneDict.begin(); i != currentPlaneDict.end(); i++) {
425  std::string const name = i->first; // name of mask plane
426  int const currentPlaneNumber = i->second; // plane number currently in use
427  int canonicalPlaneNumber = getMaskPlaneNoThrow(name); // plane number in lsst::afw::image::Mask
428 
429  if (canonicalPlaneNumber < 0) { // no such plane; add it
430  canonicalPlaneNumber = addMaskPlane(name);
431  }
432 
433  if (canonicalPlaneNumber == currentPlaneNumber) {
434  keepBitmask |= getBitMask(canonicalPlaneNumber); // bit is unchanged, so preserve it
435  } else {
436  canonicalMask[numReMap] = getBitMask(canonicalPlaneNumber);
437  currentMask[numReMap] = getBitMaskNoThrow(currentPlaneNumber);
438  numReMap++;
439  }
440  }
441 
442  // Now loop over all pixels in Mask
443  if (numReMap > 0) {
444  for (int r = 0; r != this->getHeight(); ++r) { // "this->": Meyers, Effective C++, Item 43
445  for (typename Mask::x_iterator ptr = this->row_begin(r), end = this->row_end(r); ptr != end;
446  ++ptr) {
447  MaskPixelT const pixel = *ptr;
448 
449  MaskPixelT newPixel = pixel & keepBitmask; // value of invariant mask bits
450  for (int i = 0; i < numReMap; i++) {
451  if (pixel & currentMask[i]) newPixel |= canonicalMask[i];
452  }
453 
454  *ptr = newPixel;
455  }
456  }
457  }
458  }
459  // We've made the planes match the current mask dictionary
460  _maskDict = detail::MaskDict::getDefault();
461 }

◆ end() [1/2]

Return an STL compliant iterator to the end of the image.

Definition at line 370 of file Image.cc.

262  {
263  return _gilView.end();
264 }

◆ end() [2/2]

Return a fast STL compliant iterator to the end of the image which must be contiguous.

Parameters
contiguousPixels are contiguous (must be true)
Exceptions
lsst::pex::exceptions::RuntimeErrorArgument contiguous is false, or the pixels are not in fact contiguous

Definition at line 393 of file Image.cc.

294  {
295  if (!contiguous) {
296  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Only contiguous == true makes sense");
297  }
298  if (!this->isContiguous()) {
299  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Image's pixels are not contiguous");
300  }
301 
302  return row_end(getHeight() - 1);
303 }

◆ get() [1/2]

Return a reference to a single pixel (with no bounds check).

Definition at line 282 of file Image.cc.

217  {
218  int x = index.getX();
219  int y = index.getY();
220  if (origin == PARENT) {
221  x -= getX0();
222  y -= getY0();
223  }
224  return _gilView(x, y)[0];
225 }

◆ get() [2/2]

Return a const reference to a single pixel (with no bounds check).

Definition at line 285 of file Image.cc.

229  {
230  int x = index.getX();
231  int y = index.getY();
232  if (origin == PARENT) {
233  x -= getX0();
234  y -= getY0();
235  }
236  return _gilView(x, y)[0];
237 }

◆ getArray() [1/2]

Definition at line 358 of file ImageBase.h.

474  {
475  int rowStride = reinterpret_cast<PixelT*>(row_begin(1)) - reinterpret_cast<PixelT*>(row_begin(0));
476  return ndarray::external(reinterpret_cast<PixelT*>(row_begin(0)),
477  ndarray::makeVector(getHeight(), getWidth()), ndarray::makeVector(rowStride, 1),
478  this->_manager);
479 }

◆ getArray() [2/2]

Definition at line 359 of file ImageBase.h.

482  {
483  int rowStride = reinterpret_cast<PixelT*>(row_begin(1)) - reinterpret_cast<PixelT*>(row_begin(0));
484  return ndarray::external(reinterpret_cast<PixelT*>(row_begin(0)),
485  ndarray::makeVector(getHeight(), getWidth()), ndarray::makeVector(rowStride, 1),
486  this->_manager);
487 }

◆ getAsString()

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
std::string lsst::afw::image::Mask< MaskPixelT >::getAsString ( int  x,
int  y 
)
inline

Definition at line 439 of file Mask.h.

439 { return interpret((*this)(x, y)); }

◆ getBBox()

lsst::geom::Box2I lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getBBox ( ImageOrigin  origin = PARENT) const
inlineinherited

Definition at line 443 of file ImageBase.h.

443  {
444  if (origin == PARENT) {
445  return lsst::geom::Box2I(_origin, getDimensions());
446  } else
448  }

◆ getDimensions()

Return the image's size; useful for passing to constructors.

Definition at line 354 of file ImageBase.h.

354 { return lsst::geom::Extent2I(getWidth(), getHeight()); }

◆ getHeight()

int lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getHeight
inlineinherited

Return the number of rows in the image.

Definition at line 296 of file ImageBase.h.

296 { return _gilView.height(); }

◆ getMaskPlane()

template<typename MaskPixelT >
int lsst::afw::image::Mask< MaskPixelT >::getMaskPlane ( const std::string name)
static

Return the mask plane number corresponding to a plane name.

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif plane is invalid

Definition at line 357 of file Mask.cc.

357  {
358  int const plane = getMaskPlaneNoThrow(name);
359 
360  if (plane < 0) {
362  str(boost::format("Invalid mask plane name: %s") % name));
363  } else {
364  return plane;
365  }
366 }

◆ getMaskPlaneDict()

template<typename MaskPixelT >
detail::MaskPlaneDict const & lsst::afw::image::Mask< MaskPixelT >::getMaskPlaneDict

Return the Mask's maskPlaneDict.

Definition at line 300 of file Mask.cc.

300  {
301  return _maskDict->getMaskPlaneDict();
302 }

◆ getNumPlanesMax()

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
static int lsst::afw::image::Mask< MaskPixelT >::getNumPlanesMax ( )
inlinestatic

Definition at line 489 of file Mask.h.

489 { return 8 * sizeof(MaskPixelT); }

◆ getNumPlanesUsed()

template<typename MaskPixelT >
int lsst::afw::image::Mask< MaskPixelT >::getNumPlanesUsed
static

Definition at line 388 of file Mask.cc.

388  {
389  return _maskPlaneDict()->size();
390 }

◆ getPlaneBitMask() [1/2]

template<typename MaskPixelT >
MaskPixelT lsst::afw::image::Mask< MaskPixelT >::getPlaneBitMask ( const std::string name)
static

Return the bitmask corresponding to a plane name.

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif plane is invalid

Definition at line 374 of file Mask.cc.

374  {
375  return getBitMask(getMaskPlane(name));
376 }

◆ getPlaneBitMask() [2/2]

template<typename MaskPixelT >
MaskPixelT lsst::afw::image::Mask< MaskPixelT >::getPlaneBitMask ( const std::vector< std::string > &  names)
static

Return the bitmask corresponding to a vector of plane names OR'd together.

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif plane is invalid

Definition at line 379 of file Mask.cc.

379  {
380  MaskPixelT mpix = 0x0;
381  for (std::vector<std::string>::const_iterator it = name.begin(); it != name.end(); ++it) {
382  mpix |= getBitMask(getMaskPlane(*it));
383  }
384  return mpix;
385 }

◆ getWidth()

int lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getWidth
inlineinherited

Return the number of columns in the image.

Definition at line 294 of file ImageBase.h.

294 { return _gilView.width(); }

◆ getX0()

Return the image's column-origin.

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

Definition at line 304 of file ImageBase.h.

304 { return _origin.getX(); }

◆ getXY0()

Return the image's origin.

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

Definition at line 321 of file ImageBase.h.

321 { return _origin; }

◆ getY0()

Return the image's row-origin.

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

Definition at line 312 of file ImageBase.h.

312 { return _origin.getY(); }

◆ indexToPosition()

double lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::indexToPosition ( double  ind,
lsst::afw::image::xOrY const  xy 
) const
inlineinherited

Convert image index to image position.

The LSST indexing convention is:

  • the index of the bottom left pixel is 0,0
  • the position of the center of the bottom left pixel is PixelZeroPos, PixelZeroPos
Returns
image position
Parameters
indimage index
xyIs this a column or row coordinate?

Definition at line 347 of file ImageBase.h.

349  {
350  return ind + PixelZeroPos + (xy == X ? getX0() : getY0());
351  }

◆ interpret()

template<typename MaskPixelT >
std::string lsst::afw::image::Mask< MaskPixelT >::interpret ( MaskPixelT  value)
static

Interpret a mask value as a comma-separated list of mask plane names.

Definition at line 252 of file Mask.cc.

252  {
253  std::string result = "";
254  MaskPlaneDict const& mpd = _maskPlaneDict()->getMaskPlaneDict();
255  for (MaskPlaneDict::const_iterator iter = mpd.begin(); iter != mpd.end(); ++iter) {
256  if (value & getBitMask(iter->second)) {
257  if (result.size() > 0) {
258  result += ",";
259  }
260  result += iter->first;
261  }
262  }
263  return result;
264 }

◆ isContiguous()

bool lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::isContiguous
inlineprotectedinherited

Definition at line 465 of file ImageBase.h.

465 { return begin() + getWidth() * getHeight() == end(); }

◆ operator&=() [1/2]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator&= ( Mask< MaskPixelT > const &  rhs)

AND a Mask into a Mask.

Definition at line 532 of file Mask.cc.

532  {
533  checkMaskDictionaries(rhs);
534 
535  if (this->getDimensions() != rhs.getDimensions()) {
537  str(boost::format("Images are of different size, %dx%d v %dx%d") %
538  this->getWidth() % this->getHeight() % rhs.getWidth() % rhs.getHeight()));
539  }
540  transform_pixels(_getRawView(), rhs._getRawView(), _getRawView(),
541  [](MaskPixelT const& l, MaskPixelT const& r) -> MaskPixelT { return l & r; });
542  return *this;
543 }

◆ operator&=() [2/2]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator&= ( MaskPixelT const  rhs)

AND a bitmask into a Mask.

Definition at line 526 of file Mask.cc.

526  {
527  transform_pixels(_getRawView(), _getRawView(), [&val](MaskPixelT const& l) { return l & val; });
528  return *this;
529 }

◆ operator()() [1/6]

template<typename MaskPixelT >
ImageBase< MaskPixelT >::PixelReference lsst::afw::image::Mask< MaskPixelT >::operator() ( int  x,
int  y 
)

get a reference to the specified pixel

Parameters
xx index
yy index

Definition at line 464 of file Mask.cc.

464  {
465  return this->ImageBase<MaskPixelT>::operator()(x, y);
466 }

◆ operator()() [2/6]

template<typename MaskPixelT >
ImageBase< MaskPixelT >::PixelConstReference lsst::afw::image::Mask< MaskPixelT >::operator() ( int  x,
int  y 
) const

get the specified pixel (const version)

Parameters
xx index
yy index

Definition at line 475 of file Mask.cc.

475  {
476  return this->ImageBase<MaskPixelT>::operator()(x, y);
477 }

◆ operator()() [3/6]

template<typename MaskPixelT >
ImageBase< MaskPixelT >::PixelReference lsst::afw::image::Mask< MaskPixelT >::operator() ( int  x,
int  y,
CheckIndices const &  check 
)

get a reference to the specified pixel checking array bounds

Parameters
xx index
yy index
checkCheck array bounds?

Definition at line 469 of file Mask.cc.

470  {
471  return this->ImageBase<MaskPixelT>::operator()(x, y, check);
472 }

◆ operator()() [4/6]

template<typename MaskPixelT >
ImageBase< MaskPixelT >::PixelConstReference lsst::afw::image::Mask< MaskPixelT >::operator() ( int  x,
int  y,
CheckIndices const &  check 
) const

get the specified pixel with array checking (const version)

Parameters
xx index
yy index
checkCheck array bounds?

Definition at line 480 of file Mask.cc.

481  {
482  return this->ImageBase<MaskPixelT>::operator()(x, y, check);
483 }

◆ operator()() [5/6]

template<typename MaskPixelT >
bool lsst::afw::image::Mask< MaskPixelT >::operator() ( int  x,
int  y,
int  plane 
) const

is the specified mask plane set in the specified pixel?

Parameters
xx index
yy index
planeplane ID

Definition at line 486 of file Mask.cc.

486  {
487  // !! converts an int to a bool
488  return !!(this->ImageBase<MaskPixelT>::operator()(x, y) & getBitMask(planeId));
489 }

◆ operator()() [6/6]

template<typename MaskPixelT >
bool lsst::afw::image::Mask< MaskPixelT >::operator() ( int  x,
int  y,
int  plane,
CheckIndices const &  check 
) const

is the specified mask plane set in the specified pixel, checking array bounds?

Parameters
xx index
yy index
planeplane ID
checkCheck array bounds?

Definition at line 492 of file Mask.cc.

492  {
493  // !! converts an int to a bool
494  return !!(this->ImageBase<MaskPixelT>::operator()(x, y, check) & getBitMask(planeId));
495 }

◆ operator=() [1/3]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator= ( const Mask< MaskPixelT > &  rhs)

Definition at line 146 of file Mask.cc.

146  {
147  Mask tmp(rhs);
148  swap(tmp); // See Meyers, Effective C++, Item 11
149 
150  return *this;
151 }

◆ operator=() [2/3]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator= ( Mask< MaskPixelT > &&  rhs)

Definition at line 154 of file Mask.cc.

154  {
155  return *this = rhs;
156 }

◆ operator=() [3/3]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator= ( MaskPixelT const  rhs)

Definition at line 159 of file Mask.cc.

159  {
160  fill_pixels(_getRawView(), rhs);
161 
162  return *this;
163 }

◆ operator[]() [1/3]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
Mask lsst::afw::image::Mask< MaskPixelT >::operator[] ( lsst::geom::Box2I const &  bbox) const
inline

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

Definition at line 281 of file Mask.h.

281 { return subset(bbox); }

◆ operator[]() [2/3]

Return a reference to a single pixel in PARENT coordinates (with no bounds check).

Definition at line 288 of file ImageBase.h.

288 { return get(index, PARENT); }

◆ operator[]() [3/3]

Return a reference to a single pixel in PARENT coordinates (with no bounds check).

Definition at line 291 of file ImageBase.h.

291 { return get(index, PARENT); }

◆ operator^=() [1/2]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator^= ( Mask< MaskPixelT > const &  rhs)

XOR a Mask into a Mask.

Definition at line 553 of file Mask.cc.

553  {
554  checkMaskDictionaries(rhs);
555 
556  if (this->getDimensions() != rhs.getDimensions()) {
558  str(boost::format("Images are of different size, %dx%d v %dx%d") %
559  this->getWidth() % this->getHeight() % rhs.getWidth() % rhs.getHeight()));
560  }
561  transform_pixels(_getRawView(), rhs._getRawView(), _getRawView(),
562  [](MaskPixelT const& l, MaskPixelT const& r) -> MaskPixelT { return l ^ r; });
563  return *this;
564 }

◆ operator^=() [2/2]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator^= ( MaskPixelT const  rhs)

XOR a bitmask into a Mask.

Definition at line 546 of file Mask.cc.

546  {
547  transform_pixels(_getRawView(), _getRawView(),
548  [&val](MaskPixelT const& l) -> MaskPixelT { return l ^ val; });
549  return *this;
550 }

◆ operator|=() [1/2]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator|= ( Mask< MaskPixelT > const &  rhs)

OR a Mask into a Mask.

Definition at line 512 of file Mask.cc.

512  {
513  checkMaskDictionaries(rhs);
514 
515  if (this->getDimensions() != rhs.getDimensions()) {
517  str(boost::format("Images are of different size, %dx%d v %dx%d") %
518  this->getWidth() % this->getHeight() % rhs.getWidth() % rhs.getHeight()));
519  }
520  transform_pixels(_getRawView(), rhs._getRawView(), _getRawView(),
521  [](MaskPixelT const& l, MaskPixelT const& r) -> MaskPixelT { return l | r; });
522  return *this;
523 }

◆ operator|=() [2/2]

template<typename MaskPixelT >
Mask< MaskPixelT > & lsst::afw::image::Mask< MaskPixelT >::operator|= ( MaskPixelT const  rhs)

OR a bitmask into a Mask.

Definition at line 505 of file Mask.cc.

505  {
506  transform_pixels(_getRawView(), _getRawView(),
507  [&val](MaskPixelT const& l) -> MaskPixelT { return l | val; });
508  return *this;
509 }

◆ parseMaskPlaneMetadata()

template<typename MaskPixelT >
Mask< MaskPixelT >::MaskPlaneDict lsst::afw::image::Mask< MaskPixelT >::parseMaskPlaneMetadata ( std::shared_ptr< lsst::daf::base::PropertySet const >  metadata)
static

Given a PropertySet that contains the MaskPlane assignments, setup the MaskPlanes.

Parameters
metadatametadata from a Mask
Returns
a dictionary of mask plane name: plane ID

Definition at line 604 of file Mask.cc.

605  {
606  MaskPlaneDict newDict;
607 
608  // First, clear existing MaskPlane metadata
609  typedef std::vector<std::string> NameList;
610  NameList paramNames = metadata->paramNames(false);
611  int numPlanesUsed = 0; // number of planes used
612 
613  // Iterate over childless properties with names starting with maskPlanePrefix
614  for (NameList::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i) {
615  if (i->compare(0, maskPlanePrefix.size(), maskPlanePrefix) == 0) {
616  // split off maskPlanePrefix to obtain plane name
617  std::string planeName = i->substr(maskPlanePrefix.size());
618  int const planeId = metadata->getAsInt(*i);
619 
620  MaskPlaneDict::const_iterator plane = newDict.find(planeName);
621  if (plane != newDict.end() && planeId != plane->second) {
622  throw LSST_EXCEPT(pexExcept::RuntimeError, "File specifies plane " + planeName + " twice");
623  }
624  for (MaskPlaneDict::const_iterator j = newDict.begin(); j != newDict.end(); ++j) {
625  if (planeId == j->second) {
627  str(boost::format("File specifies plane %s has same value (%d) as %s") %
628  planeName % planeId % j->first));
629  }
630  }
631  // build new entry
632  if (numPlanesUsed >= getNumPlanesMax()) {
633  // Max number of planes already allocated
634  throw LSST_EXCEPT(
636  str(boost::format("Max number of planes (%1%) already used") % getNumPlanesMax()));
637  }
638  newDict[planeName] = planeId;
639  }
640  }
641  return newDict;
642 }

◆ PixelCast()

static SinglePixel lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::PixelCast ( SinglePixelT  rhs)
inlinestaticinherited

Convert a type to our SinglePixel type.

Definition at line 158 of file ImageBase.h.

158  {
159  return SinglePixel(rhs);
160  }

◆ positionToIndex()

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

Convert image position to index (nearest integer and fractional parts)

Returns
std::pair(nearest integer index, fractional part)
Parameters
posimage position
xyIs this a column or row coordinate?

Definition at line 328 of file ImageBase.h.

331  {
332  double const fullIndex = pos - PixelZeroPos - (xy == X ? getX0() : getY0());
333  int const roundedIndex = static_cast<int>(fullIndex + 0.5);
334  double const residual = fullIndex - roundedIndex;
335  return std::pair<int, double>(roundedIndex, residual);
336  }

◆ printMaskPlanes()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::printMaskPlanes

print the mask plane dictionary to std::cout

Definition at line 645 of file Mask.cc.

645  {
646  _maskDict->print();
647 }

◆ rbegin()

Return an STL compliant reverse iterator to the start of the image.

Definition at line 372 of file Image.cc.

267  {
268  return _gilView.rbegin();
269 }

◆ readFits() [1/2]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
static Mask lsst::afw::image::Mask< MaskPixelT >::readFits ( fits::MemFileManager manager,
int  hdu = fits::DEFAULT_HDU 
)
inlinestatic

Read a Mask from a FITS RAM file.

Parameters
[in]managerObject that manages the memory to be read.
[in]hduNumber of the "header-data unit" to read (where 0 is the Primary HDU). The default value of afw::fits::DEFAULT_HDU is interpreted as "the first HDU with NAXIS != 0".

Definition at line 433 of file Mask.h.

433  {
434  return Mask<MaskPixelT>(manager, hdu);
435  }

◆ readFits() [2/2]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
static Mask lsst::afw::image::Mask< MaskPixelT >::readFits ( std::string const &  filename,
int  hdu = fits::DEFAULT_HDU 
)
inlinestatic

Read a Mask from a regular FITS file.

Parameters
[in]filenameName of the file to read.
[in]hduNumber of the "header-data unit" to read (where 0 is the Primary HDU). The default value of afw::fits::DEFAULT_HDU is interpreted as "the first HDU with NAXIS != 0".

Definition at line 421 of file Mask.h.

421  {
422  return Mask<MaskPixelT>(filename, hdu);
423  }

◆ removeAndClearMaskPlane()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::removeAndClearMaskPlane ( const std::string name,
bool const  removeFromDefault = false 
)

Clear all pixels of the specified mask and remove the plane from the mask plane dictionary; optionally remove the plane from the default dictionary too.

Parameters
nameof maskplane
removeFromDefaultremove from default mask plane dictionary too
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif plane is invalid

Definition at line 316 of file Mask.cc.

318  {
319  clearMaskPlane(getMaskPlane(name)); // clear this bits in this Mask
320 
321  if (_maskDict == detail::MaskDict::getDefault() && removeFromDefault) { // we are the default
322  ;
323  } else {
324  _maskDict = _maskDict->clone();
325  }
326 
327  _maskDict->erase(name);
328 
329  if (removeFromDefault && detail::MaskDict::getDefault()->getMaskPlane(name) >= 0) {
331  }
332 }

◆ removeMaskPlane()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::removeMaskPlane ( const std::string name)
static

Definition at line 305 of file Mask.cc.

305  {
308  str(boost::format("Plane %s doesn't exist in the default Mask") % name));
309  }
310 
311  detail::MaskDict::detachDefault(); // leave current Masks alone
312  _maskPlaneDict()->erase(name);
313 }

◆ rend()

Return an STL compliant reverse iterator to the end of the image.

Definition at line 374 of file Image.cc.

272  {
273  return _gilView.rend();
274 }

◆ row_begin()

x_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::row_begin ( int  y) const
inlineinherited

Return an x_iterator to the start of the y'th row.

Incrementing an x_iterator moves it across the row

Definition at line 399 of file ImageBase.h.

399 { return _gilView.row_begin(y); }

◆ row_end()

x_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::row_end ( int  y) const
inlineinherited

Return an x_iterator to the end of the y'th row.

Definition at line 402 of file ImageBase.h.

402 { return _gilView.row_end(y); }

◆ setMaskPlaneValues()

template<typename MaskPixelT >
void lsst::afw::image::Mask< MaskPixelT >::setMaskPlaneValues ( const int  plane,
const int  x0,
const int  x1,
const int  y 
)

Set the bit specified by "planeId" for pixels (x0, y) ...

(x1, y)

Definition at line 567 of file Mask.cc.

567  {
568  MaskPixelT const bitMask = getBitMask(planeId);
569 
570  for (int x = x0; x <= x1; x++) {
571  operator()(x, y) = operator()(x, y) | bitMask;
572  }
573 }

◆ setXY0() [1/2]

void lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::setXY0 ( int const  x0,
int const  y0 
)
inlineinherited

Set the ImageBase'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.

Definition at line 441 of file ImageBase.h.

441 { setXY0(lsst::geom::Point2I(x0, y0)); }

◆ setXY0() [2/2]

void lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::setXY0 ( lsst::geom::Point2I const  origin)
inlineinherited

Set the ImageBase'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.

Definition at line 432 of file ImageBase.h.

432 { _origin = origin; }

◆ subset()

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
Mask lsst::afw::image::Mask< MaskPixelT >::subset ( lsst::geom::Box2I const &  bbox,
ImageOrigin  origin = PARENT 
) const
inline

Return a subimage corresponding to the given box.

Parameters
bboxBounding box of the subimage returned.
originOrigin bbox is rleative to; PARENT accounts for xy0, LOCAL does not.
Returns
A subimage view into this.

This method is wrapped as getitem in Python.

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.

Definition at line 276 of file Mask.h.

276  {
277  return Mask(*this, bbox, origin, false);
278  }

◆ swap() [1/2]

Definition at line 356 of file Image.cc.

240  {
241  using std::swap; // See Meyers, Effective C++, Item 25
242 
243  swap(_manager, rhs._manager); // just swapping the pointers
244  swap(_gilView, rhs._gilView);
245  swap(_origin, rhs._origin);
246 }

◆ swap() [2/2]

template<typename PixelT >
void lsst::afw::image::Mask< PixelT >::swap ( Mask< MaskPixelT > &  rhs)

Definition at line 133 of file Mask.cc.

133  {
134  using std::swap; // See Meyers, Effective C++, Item 25
135 
137  swap(_maskDict, rhs._maskDict);
138 }

◆ writeFits() [1/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::Fits fitsfile,
fits::ImageWriteOptions const &  options,
std::shared_ptr< daf::base::PropertySet const >  header = nullptr 
) const

Write a mask to an open FITS file object.

Parameters
[in]fitsfileA FITS file already open to the desired HDU.
[in]optionsOptions controlling writing of FITS image.
[in]headerAdditional values to write to the header (may be null).

◆ writeFits() [2/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::Fits fitsfile,
std::shared_ptr< lsst::daf::base::PropertySet const >  metadata = std::shared_ptrlsst::daf::base::PropertySet const >() 
) const

Write a mask to an open FITS file object.

Parameters
[in]fitsfileA FITS file already open to the desired HDU.
[in]metadataAdditional values to write to the header (may be null).

◆ writeFits() [3/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::MemFileManager manager,
fits::ImageWriteOptions const &  options,
std::string const &  mode = "w",
std::shared_ptr< daf::base::PropertySet const >  header = nullptr 
) const

Write a mask to a FITS RAM file.

Parameters
[in]managerManager object for the memory block to write to.
[in]optionsOptions controlling writing of FITS image.
[in]mode"w"=Create a new file; "a"=Append a new HDU.
[in]headerAdditional values to write to the header (may be null).

◆ writeFits() [4/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::MemFileManager manager,
std::shared_ptr< lsst::daf::base::PropertySet const >  metadata = std::shared_ptrlsst::daf::base::PropertySet >(),
std::string const &  mode = "w" 
) const

Write a mask to a FITS RAM file.

Parameters
[in]managerManager object for the memory block to write to.
[in]metadataAdditional values to write to the header (may be null).
[in]mode"w"=Create a new file; "a"=Append a new HDU.

◆ writeFits() [5/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( std::string const &  filename,
fits::ImageWriteOptions const &  options,
std::string const &  mode = "w",
std::shared_ptr< daf::base::PropertySet const >  header = nullptr 
) const

Write a mask to a regular FITS file.

Parameters
[in]filenameName of the file to write.
[in]optionsOptions controlling writing of FITS image.
[in]mode"w"=Create a new file; "a"=Append a new HDU.
[in]headerAdditional values to write to the header (may be null).

◆ writeFits() [6/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( std::string const &  fileName,
std::shared_ptr< lsst::daf::base::PropertySet const >  metadata = std::shared_ptrlsst::daf::base::PropertySet >(),
std::string const &  mode = "w" 
) const

Write a mask to a regular FITS file.

Parameters
[in]fileNameName of the file to write.
[in]metadataAdditional values to write to the header (may be null).
[in]mode"w"=Create a new file; "a"=Append a new HDU.

◆ x_at()

x_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::x_at ( int  x,
int  y 
) const
inlineinherited

Return an x_iterator to the point (x, y) in the image.

Definition at line 405 of file ImageBase.h.

405 { return _gilView.x_at(x, y); }

◆ xy_at()

xy_locator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::xy_at ( int  x,
int  y 
) const
inlineinherited

Return an xy_locator at the point (x, y) in the image.

Locators may be used to access a patch in an image

Definition at line 423 of file ImageBase.h.

423 { return xy_locator(_gilView.xy_at(x, y)); }

◆ y_at()

y_iterator lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::y_at ( int  x,
int  y 
) const
inlineinherited

Return an y_iterator to the point (x, y) in the image.

Definition at line 417 of file ImageBase.h.

417 { return _gilView.y_at(x, y); }

Friends And Related Function Documentation

◆ MaskFitsReader

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
friend class MaskFitsReader
friend

Definition at line 521 of file Mask.h.


The documentation for this class was generated from the following files:
y
int y
Definition: SpanSet.cc:49
lsst::daf::base::PropertySet::getAsInt
int getAsInt(std::string const &name) const
Get the last value for a bool/char/short/int property name (possibly hierarchical).
std::string
STL class.
std::shared_ptr
STL class.
lsst::afw::image::Mask::interpret
static std::string interpret(MaskPixelT value)
Interpret a mask value as a comma-separated list of mask plane names.
Definition: Mask.cc:252
lsst::afw::image::Mask::getNumPlanesMax
static int getNumPlanesMax()
Definition: Mask.h:489
std::pair
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::isContiguous
bool isContiguous() const
Definition: ImageBase.h:465
std::vector< std::string >
lsst::afw::image::PixelZeroPos
const double PixelZeroPos
position of center of pixel 0
Definition: ImageUtils.h:44
lsst::daf::base::PropertySet::add
void add(std::string const &name, T const &value)
Append a single value to the vector of values for a property name (possibly hierarchical).
std::string::size
T size(T... args)
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::end
iterator end() const
Return an STL compliant iterator to the end of the image.
Definition: Image.cc:262
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::row_begin
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
Definition: ImageBase.h:399
lsst::ip::diffim::detail::PixelT
float PixelT
Definition: AssessSpatialKernelVisitor.cc:208
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::_getRawView
_view_t _getRawView() const
Definition: ImageBase.h:463
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::xy_locator
_view_t::xy_locator xy_locator
An xy_locator.
Definition: ImageBase.h:121
lsst.pex.config.history.format
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
val
ImageT val
Definition: CR.cc:146
lsst::afw::image::detail::MaskDict::addAllMasksPlane
static void addAllMasksPlane(std::string const &name, int bitId)
Definition: MaskDict.cc:127
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
lsst::afw::image::X
@ X
Definition: ImageUtils.h:36
lsst::afw::image::Mask::getMaskPlane
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Definition: Mask.cc:357
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getHeight
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:296
lsst::afw::image::Mask::Mask
Mask(unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
Construct a Mask initialized to 0x0.
Definition: Mask.cc:69
lsst::afw::image::Mask::MaskPlaneDict
detail::MaskPlaneDict MaskPlaneDict
Definition: Mask.h:79
lsst::afw::image::ImageBase::operator()
PixelReference operator()(int x, int y)
Return a reference to the pixel (x, y) in LOCAL coordinates.
Definition: Image.cc:178
lsst::afw::image::Mask::swap
void swap(Mask &rhs)
Definition: Mask.cc:133
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::begin
iterator begin() const
Return an STL compliant iterator to the start of the image.
Definition: Image.cc:257
id
table::Key< int > id
Definition: Detector.cc:162
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::row_end
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
Definition: ImageBase.h:402
x
double x
Definition: ChebyshevBoundedField.cc:277
lsst::afw::image::detail::MaskDict::detachDefault
static std::shared_ptr< MaskDict > detachDefault()
Definition: MaskDict.cc:123
lsst.pex::exceptions::LengthError
Reports attempts to exceed implementation-defined length limits for some classes.
Definition: Runtime.h:76
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::_makeSubView
static _view_t _makeSubView(lsst::geom::Extent2I const &dimensions, lsst::geom::Extent2I const &offset, const _view_t &view)
Definition: Image.cc:78
ptr
uint64_t * ptr
Definition: RangeSet.cc:88
dimensions
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
pixel
table::PointKey< int > pixel
Definition: DeltaFunctionKernel.cc:101
result
py::object result
Definition: _schema.cc:429
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::x_iterator
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:133
lsst::daf::base::PropertySet::paramNames
std::vector< std::string > paramNames(bool topLevelOnly=true) const
A variant of names that excludes the names of subproperties.
lsst::daf::base::PropertySet::remove
virtual void remove(std::string const &name)
Remove all values for a property name (possibly hierarchical).
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
std::swap
T swap(T... args)
std::string::substr
T substr(T... args)
lsst::afw::image::detail::MaskDict::getDefault
static std::shared_ptr< MaskDict > getDefault()
Definition: MaskDict.cc:115
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getX0
int getX0() const
Return the image's column-origin.
Definition: ImageBase.h:304
lsst::afw::image::Mask::addMaskPlane
static int addMaskPlane(const std::string &name)
Definition: Mask.cc:267
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::SinglePixel
lsst::afw::image::MaskPixel SinglePixel
A single Pixel of the same type as those in the ImageBase.
Definition: ImageBase.h:113
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getDimensions
lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
Definition: ImageBase.h:354
lsst::afw::image::Mask::removeMaskPlane
static void removeMaskPlane(const std::string &name)
Definition: Mask.cc:305
lsst::afw::image::Mask::subset
Mask subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition: Mask.h:276
lsst.pex::exceptions::InvalidParameterError
Reports invalid arguments.
Definition: Runtime.h:66
lsst::geom::Extent2I
Extent< int, 2 > Extent2I
Definition: Extent.h:397
lsst::geom::Point< int, 2 >
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
lsst::afw::image::PARENT
@ PARENT
Definition: ImageBase.h:94
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::setXY0
void setXY0(lsst::geom::Point2I const origin)
Set the ImageBase's origin.
Definition: ImageBase.h:432
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getY0
int getY0() const
Return the image's row-origin.
Definition: ImageBase.h:312
lsst::afw::image::Mask::operator()
ImageBase< MaskPixelT >::PixelReference operator()(int x, int y)
get a reference to the specified pixel
Definition: Mask.cc:464
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::swap
void swap(ImageBase &rhs)
Definition: Image.cc:240
lsst::afw::image::ImageBase
The base class for all image classed (Image, Mask, MaskedImage, ...)
Definition: ImageBase.h:102
lsst::afw::image::Mask::clearMaskPlane
void clearMaskPlane(int plane)
Clear the specified bit in all pixels.
Definition: Mask.cc:403
lsst::geom::Extent< int, 2 >
std::numeric_limits
astshim.fitsChanContinued.iter
def iter(self)
Definition: fitsChanContinued.py:88
lsst::afw::image::detail::MaskDict::copyOrGetDefault
static std::shared_ptr< MaskDict > copyOrGetDefault(MaskPlaneDict const &dict)
Definition: MaskDict.cc:111
lsst::afw::image::ImageBase< lsst::afw::image::MaskPixel >::getWidth
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:294
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
lsst.pex::exceptions::RuntimeError
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104