LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+a41d3748ce,g1470d8bcf6+6be6c9203b,g2079a07aa2+14824f138e,g212a7c68fe+a4f2ea4efa,g2305ad1205+72971fe858,g295015adf3+ab2c85acae,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+31b3a28dff,g487adcacf7+082e807817,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+b2918d57ae,g5a732f18d5+66d966b544,g64a986408d+a41d3748ce,g858d7b2824+a41d3748ce,g8a8a8dda67+a6fc98d2e7,g99cad8db69+7fe4acdf18,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+84af8b3ff8,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gba4ed39666+9664299f35,gbb8dafda3b+d8d527deb2,gc07e1c2157+b2dbe6b631,gc120e1dc64+61440b2abb,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+31b3a28dff,gdaeeff99f8+a38ce5ea23,ge6526c86ff+39927bb362,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+a41d3748ce,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
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< PixelT >

Classes

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

Public Types

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

Public Member Functions

 Mask (unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to 0x0.
 
 Mask (unsigned int width, unsigned int height, MaskPixelT initialValue, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to a specified value.
 
 Mask (lsst::geom::Extent2I const &dimensions=lsst::geom::Extent2I(), MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to 0x0.
 
 Mask (lsst::geom::Extent2I const &dimensions, MaskPixelT initialValue, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to a specified value.
 
 Mask (lsst::geom::Box2I const &bbox, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to 0x0.
 
 Mask (lsst::geom::Box2I const &bbox, MaskPixelT initialValue, MaskPlaneDict const &planeDefs=MaskPlaneDict())
 Construct a Mask initialized to a specified value.
 
 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.
 
 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.
 
 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.
 
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.
 
 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.
 
 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.
 
Maskoperator|= (MaskPixelT const rhs)
 OR a bitmask into a Mask.
 
Maskoperator&= (Mask const &rhs)
 AND a Mask into a Mask.
 
Maskoperator&= (MaskPixelT const rhs)
 AND a bitmask into a Mask.
 
Mask subset (lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
 Return a subimage corresponding to the given box.
 
Mask operator[] (lsst::geom::Box2I const &bbox) const
 Return a subimage corresponding to the given box (interpreted as PARENT coordinates).
 
Maskoperator^= (Mask const &rhs)
 XOR a Mask into a Mask.
 
Maskoperator^= (MaskPixelT const rhs)
 XOR a bitmask into a Mask.
 
ImageBase< MaskPixelT >::PixelReference operator() (int x, int y)
 get a reference to the specified pixel
 
ImageBase< MaskPixelT >::PixelConstReference operator() (int x, int y) const
 get the specified pixel (const version)
 
bool operator() (int x, int y, int plane) const
 is the specified mask plane set in the specified pixel?
 
ImageBase< MaskPixelT >::PixelReference operator() (int x, int y, CheckIndices const &check)
 get a reference to the specified pixel checking array bounds
 
ImageBase< MaskPixelT >::PixelConstReference operator() (int x, int y, CheckIndices const &check) const
 get the specified pixel with array checking (const version)
 
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?
 
void writeFits (std::string const &fileName, daf::base::PropertySet const *metadata=nullptr, std::string const &mode="w") const
 Write a mask to a regular FITS file.
 
void writeFits (fits::MemFileManager &manager, daf::base::PropertySet const *metadata=nullptr, std::string const &mode="w") const
 Write a mask to a FITS RAM file.
 
void writeFits (fits::Fits &fitsfile, daf::base::PropertySet const *metadata=nullptr) const
 Write a mask to an open FITS file object.
 
void writeFits (std::string const &filename, fits::ImageWriteOptions const &options, std::string const &mode="w", daf::base::PropertySet const *header=nullptr) const
 Write a mask to a regular FITS file.
 
void writeFits (fits::MemFileManager &manager, fits::ImageWriteOptions const &options, std::string const &mode="w", daf::base::PropertySet const *header=nullptr) const
 Write a mask to a FITS RAM file.
 
void writeFits (fits::Fits &fitsfile, fits::ImageWriteOptions const &options, daf::base::PropertySet const *header=nullptr) const
 Write a mask to an open FITS file object.
 
std::string getAsString (int x, int y)
 
void clearAllMaskPlanes ()
 Clear all the pixels.
 
void clearMaskPlane (int plane)
 Clear the specified bit in all pixels.
 
void 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)
 
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.
 
MaskPlaneDict constgetMaskPlaneDict () const
 Return the Mask's maskPlaneDict.
 
void printMaskPlanes () const
 print the mask plane dictionary to std::cout
 
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.
 
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.
 
PixelReference get (lsst::geom::Point2I const &index, ImageOrigin origin)
 Return a reference to a single pixel (with no bounds check).
 
PixelConstReference get (lsst::geom::Point2I const &index, ImageOrigin origin) const
 Return a const reference to a single pixel (with no bounds check).
 
PixelReference operator[] (lsst::geom::Point2I const &index)
 Return a reference to a single pixel in PARENT coordinates (with no bounds check).
 
PixelConstReference operator[] (lsst::geom::Point2I const &index) const
 Return a reference to a single pixel in PARENT coordinates (with no bounds check).
 
int getWidth () const
 Return the number of columns in the image.
 
int getHeight () const
 Return the number of rows in the image.
 
int getArea () const
 Return the area of the image.
 
int getX0 () const
 Return the image's column-origin.
 
int getY0 () const
 Return the image's row-origin.
 
lsst::geom::Point2I getXY0 () const
 Return the image's origin.
 
std::pair< int, doublepositionToIndex (double const pos, lsst::afw::image::xOrY const xy) const
 Convert image position to index (nearest integer and fractional parts)
 
double indexToPosition (double ind, lsst::afw::image::xOrY const xy) const
 Convert image index to image position.
 
lsst::geom::Extent2I getDimensions () const
 Return the image's size; useful for passing to constructors.
 
void swap (ImageBase &rhs)
 
Array getArray ()
 
ConstArray getArray () const
 
iterator begin () const
 Return an STL compliant iterator to the start of the image.
 
fast_iterator begin (bool contiguous) const
 Return a fast STL compliant iterator to the start of the image which must be contiguous.
 
iterator end () const
 Return an STL compliant iterator to the end of the image.
 
fast_iterator end (bool contiguous) const
 Return a fast STL compliant iterator to the end of the image which must be contiguous.
 
reverse_iterator rbegin () const
 Return an STL compliant reverse iterator to the start of the image.
 
reverse_iterator rend () const
 Return an STL compliant reverse iterator to the end of the image.
 
iterator at (int x, int y) const
 Return an STL compliant iterator at the point (x, y)
 
x_iterator row_begin (int y) const
 Return an x_iterator to the start of the y'th row.
 
x_iterator row_end (int y) const
 Return an x_iterator to the end of the y'th row.
 
x_iterator x_at (int x, int y) const
 Return an x_iterator to the point (x, y) in the image.
 
y_iterator col_begin (int x) const
 Return an y_iterator to the start of the y'th row.
 
y_iterator col_end (int x) const
 Return an y_iterator to the start of the y'th row.
 
y_iterator y_at (int x, int y) const
 Return an y_iterator to the point (x, y) in the image.
 
xy_locator xy_at (int x, int y) const
 Return an xy_locator at the point (x, y) in the image.
 
void setXY0 (lsst::geom::Point2I const origin)
 Set the ImageBase's origin.
 
void setXY0 (int const x0, int const y0)
 Set the ImageBase's origin.
 
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.
 
static Mask readFits (std::string const &filename, int hdu=fits::DEFAULT_HDU)
 Read a Mask from a regular FITS file.
 
static Mask readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read a Mask from a FITS RAM file.
 
static std::string interpret (MaskPixelT value)
 Interpret a mask value as a comma-separated list of mask plane names.
 
static MaskPlaneDict parseMaskPlaneMetadata (std::shared_ptr< lsst::daf::base::PropertySet const > metadata)
 Given a PropertySet that contains the MaskPlane assignments, setup the MaskPlanes.
 
static void clearMaskPlaneDict ()
 Reset the maskPlane dictionary.
 
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.
 
static MaskPixelT getPlaneBitMask (const std::string &name)
 Return the bitmask corresponding to a plane name.
 
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.
 
template<typename SinglePixelT >
static SinglePixel PixelCast (SinglePixelT rhs)
 Convert a type to our SinglePixel type.
 

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

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::Array = typename ndarray::Array<PixelT, 2, 1>
inherited

A mutable ndarray representation of the image.

Definition at line 149 of file ImageBase.h.

◆ const_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::const_iterator = typename _const_view_t::iterator
inherited

An STL compliant const iterator.

Definition at line 127 of file ImageBase.h.

◆ const_reverse_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::const_reverse_iterator = typename _const_view_t::reverse_iterator
inherited

An STL compliant const reverse iterator.

Definition at line 131 of file ImageBase.h.

◆ const_x_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::const_x_iterator = typename _const_view_t::x_iterator
inherited

A const iterator for traversing the pixels in a row.

Definition at line 141 of file ImageBase.h.

◆ const_xy_locator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::const_xy_locator = typename _view_t::xy_locator::const_t
inherited

A const_xy_locator.

Definition at line 123 of file ImageBase.h.

◆ const_y_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::const_y_iterator = typename _const_view_t::y_iterator
inherited

A const iterator for traversing the pixels in a column.

Definition at line 147 of file ImageBase.h.

◆ ConstArray

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::ConstArray = typename ndarray::Array<const PixelT, 2, 1>
inherited

An immutable ndarray representation of the image.

Definition at line 151 of file ImageBase.h.

◆ fast_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::fast_iterator = x_iterator
inherited

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>
using lsst::afw::image::Mask< MaskPixelT >::image_category = detail::Mask_tag

Definition at line 81 of file Mask.h.

◆ iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::iterator = typename _view_t::iterator
inherited

An STL compliant iterator.

Definition at line 125 of file ImageBase.h.

◆ MaskPlaneDict

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

Definition at line 79 of file Mask.h.

◆ Pixel

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::Pixel = PixelT
inherited

A pixel in this ImageBase.

Definition at line 115 of file ImageBase.h.

◆ PixelConstReference

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::PixelConstReference = typename ConstReference<PixelT>::type
inherited

A ConstReference to a PixelT.

Definition at line 119 of file ImageBase.h.

◆ PixelReference

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::PixelReference = typename Reference<PixelT>::type
inherited

A Reference to a PixelT.

Definition at line 117 of file ImageBase.h.

◆ reverse_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::reverse_iterator = typename _view_t::reverse_iterator
inherited

An STL compliant reverse iterator.

Definition at line 129 of file ImageBase.h.

◆ SinglePixel

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::SinglePixel = PixelT
inherited

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

Definition at line 113 of file ImageBase.h.

◆ x_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::x_iterator = typename _view_t::x_iterator
inherited

An iterator for traversing the pixels in a row.

Definition at line 133 of file ImageBase.h.

◆ xy_locator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::xy_locator = typename _view_t::xy_locator
inherited

An xy_locator.

Definition at line 121 of file ImageBase.h.

◆ xy_x_iterator

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::xy_x_iterator = typename _view_t::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

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::xy_y_iterator = typename _view_t::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

template<typename PixelT >
using lsst::afw::image::ImageBase< PixelT >::y_iterator = typename _view_t::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 62 of file Mask.cc.

64 _initializePlanes(planeDefs);
65 *this = 0x0;
66}
typename ndarray::Array< PixelT, 2, 1 > Array
A mutable ndarray representation of the image.
Definition ImageBase.h:149

◆ 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 69 of file Mask.cc.

72 _initializePlanes(planeDefs);
73 *this = initialValue;
74}

◆ 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 77 of file Mask.cc.

78 : ImageBase<MaskPixelT>(dimensions) {
79 _initializePlanes(planeDefs);
80 *this = 0x0;
81}

◆ 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 84 of file Mask.cc.

86 : ImageBase<MaskPixelT>(dimensions) {
87 _initializePlanes(planeDefs);
88 *this = initialValue;
89}

◆ 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 92 of file Mask.cc.

94 _initializePlanes(planeDefs);
95 *this = 0x0;
96}
AmpInfoBoxKey bbox
Definition Amplifier.cc:117

◆ 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 99 of file Mask.cc.

101 _initializePlanes(planeDefs);
102 *this = initialValue;
103}

◆ 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) {}
The base class for all image classed (Image, Mask, MaskedImage, ...)
Definition ImageBase.h:102

◆ 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 111 of file Mask.cc.

112 : 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 115 of file Mask.cc.

115: Mask(rhs, false) {}
Mask(unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
Construct a Mask initialized to 0x0.
Definition Mask.cc:62

◆ ~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 106 of file Mask.cc.

108 : 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 121 of file Mask.cc.

static std::shared_ptr< MaskDict > getDefault()
Definition MaskDict.cc:115

Member Function Documentation

◆ _allocateView()

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

Definition at line 45 of file Image.cc.

46 {
47 if (dimensions.getX() < 0 || dimensions.getY() < 0) {
48 throw LSST_EXCEPT(pex::exceptions::LengthError,
49 str(boost::format("Both width and height must be non-negative: %d, %d") %
50 dimensions.getX() % dimensions.getY()));
51 }
52 if (dimensions.getX() != 0 && dimensions.getY() > std::numeric_limits<int>::max() / dimensions.getX()) {
53 throw LSST_EXCEPT(pex::exceptions::LengthError,
54 str(boost::format("Image dimensions (%d x %d) too large; int overflow detected.") %
55 dimensions.getX() % dimensions.getY()));
56 }
58 ndarray::SimpleManager<PixelT>::allocate(dimensions.getX() * dimensions.getY());
59 manager = r.first;
60 return boost::gil::interleaved_view(dimensions.getX(), dimensions.getY(),
61 (typename _view_t::value_type*)r.second,
62 dimensions.getX() * sizeof(PixelT));
63}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48

◆ _getRawView()

template<typename PixelT >
_view_t lsst::afw::image::ImageBase< PixelT >::_getRawView ( ) const
inlineprotectedinherited

Definition at line 465 of file ImageBase.h.

465{ return _gilView; }

◆ _makeSubView()

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

Definition at line 65 of file Image.cc.

67 {
68 if (offset.getX() < 0 || offset.getY() < 0 || offset.getX() + dimensions.getX() > view.width() ||
69 offset.getY() + dimensions.getY() > view.height()) {
70 throw LSST_EXCEPT(
71 pex::exceptions::LengthError,
72 (boost::format(
73 "Box2I(Point2I(%d,%d),lsst::geom::Extent2I(%d,%d)) doesn't fit in image %dx%d") %
74 offset.getX() % offset.getY() % dimensions.getX() % dimensions.getY() % view.width() %
75 view.height())
76 .str());
77 }
78 if (dimensions.getX() == 0 && dimensions.getY() == 0
79 && view.width() == 0 && view.height() == 0) {
80 // Getting a zero-extent subview of a zero-extent view returns itself
81 return view;
82 } else {
83 return boost::gil::subimage_view(view, offset.getX(), offset.getY(), dimensions.getX(),
84 dimensions.getY());
85 }
86}

◆ addMaskPlane()

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

Definition at line 264 of file Mask.cc.

264 {
265 int id = getMaskPlaneNoThrow(name); // see if the plane is already available
266
267 if (id < 0) { // doesn't exist
268 id = _maskPlaneDict()->getUnusedPlane();
269 }
270
271 // build new entry, adding the plane to all Masks where this is no contradiction
272
273 if (id >= getNumPlanesMax()) { // Max number of planes is already allocated
275 str(boost::format("Max number of planes (%1%) already used") % getNumPlanesMax()));
276 }
277
279
280 return id;
281}
table::Key< int > id
Definition Detector.cc:162
static int getNumPlanesMax()
Definition Mask.h:498
static void addAllMasksPlane(std::string const &name, int bitId)
Definition MaskDict.cc:127
Reports errors that are due to events beyond the control of the program.
Definition Runtime.h:104

◆ 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 573 of file Mask.cc.

573 {
574 if (!metadata) {
575 throw LSST_EXCEPT(pexExcept::InvalidParameterError, "Null std::shared_ptr<PropertySet>");
576 }
577
578 // First, clear existing MaskPlane metadata
580 NameList paramNames = metadata->paramNames(false);
581 for (auto const &paramName : paramNames) {
582 if (paramName.compare(0, maskPlanePrefix.size(), maskPlanePrefix) == 0) {
583 metadata->remove(paramName);
584 }
585 }
586
587 MaskPlaneDict const& mpd = _maskPlaneDict()->getMaskPlaneDict();
588
589 // Add new MaskPlane metadata
590 for (auto const &i : mpd) {
591 std::string const& planeName = i.first;
592 int const planeNumber = i.second;
593
594 if (planeName != "") {
595 metadata->add(maskPlanePrefix + planeName, planeNumber);
596 }
597 }
598}
detail::MaskPlaneDict MaskPlaneDict
Definition Mask.h:79
virtual void remove(std::string const &name)
Remove all values for a property name (possibly hierarchical).
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::vector< std::string > paramNames(bool topLevelOnly=true) const
A variant of names that excludes the names of subproperties.
Reports invalid arguments.
Definition Runtime.h:66
T size(T... args)

◆ assign()

template<typename PixelT >
void lsst::afw::image::ImageBase< PixelT >::assign ( ImageBase< PixelT > 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 153 of file Image.cc.

153 {
154 auto lhsDim = bbox.isEmpty() ? getDimensions() : bbox.getDimensions();
155 if (lhsDim != rhs.getDimensions()) {
156 throw LSST_EXCEPT(pex::exceptions::LengthError,
157 (boost::format("Dimension mismatch: %dx%d v. %dx%d") % lhsDim.getX() %
158 lhsDim.getY() % rhs.getWidth() % rhs.getHeight())
159 .str());
160 }
161 if (bbox.isEmpty()) {
162 copy_pixels(rhs._gilView, _gilView);
163 } else {
164 auto lhsOff = (origin == PARENT) ? bbox.getMin() - _origin : lsst::geom::Extent2I(bbox.getMin());
165 auto lhsGilView = _makeSubView(lhsDim, lhsOff, _gilView);
166 copy_pixels(rhs._gilView, lhsGilView);
167 }
168}
static _view_t _makeSubView(lsst::geom::Extent2I const &dimensions, lsst::geom::Extent2I const &offset, const _view_t &view)
Definition Image.cc:65
lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
Definition ImageBase.h:356
Extent< int, 2 > Extent2I
Definition Extent.h:397

◆ at()

template<typename PixelT >
ImageBase< PixelT >::iterator lsst::afw::image::ImageBase< PixelT >::at ( int x,
int y ) const
inherited

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

Definition at line 270 of file Image.cc.

270 {
271 return _gilView.at(x, y);
272}
int y
Definition SpanSet.cc:48

◆ begin() [1/2]

template<typename PixelT >
ImageBase< PixelT >::iterator lsst::afw::image::ImageBase< PixelT >::begin ( ) const
inherited

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

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

Definition at line 250 of file Image.cc.

250 {
251 return _gilView.begin();
252}

◆ begin() [2/2]

template<typename PixelT >
ImageBase< PixelT >::fast_iterator lsst::afw::image::ImageBase< PixelT >::begin ( bool contiguous) const
inherited

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 275 of file Image.cc.

275 {
276 if (!contiguous) {
277 throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Only contiguous == true makes sense");
278 }
279 if (!this->isContiguous()) {
280 throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Image's pixels are not contiguous");
281 }
282
283 return row_begin(0);
284}
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
Definition ImageBase.h:401

◆ clearAllMaskPlanes()

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

Clear all the pixels.

Definition at line 395 of file Mask.cc.

395 {
396 *this = 0;
397}

◆ clearMaskPlane()

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

Clear the specified bit in all pixels.

Definition at line 400 of file Mask.cc.

400 {
401 *this &= ~getBitMask(planeId);
402}

◆ clearMaskPlaneDict()

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

Reset the maskPlane dictionary.

Definition at line 390 of file Mask.cc.

390 {
391 _maskPlaneDict()->clear();
392}

◆ col_begin()

template<typename PixelT >
y_iterator lsst::afw::image::ImageBase< PixelT >::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 413 of file ImageBase.h.

413{ return _gilView.col_begin(x); }

◆ col_end()

template<typename PixelT >
y_iterator lsst::afw::image::ImageBase< PixelT >::col_end ( int x) const
inlineinherited

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

Definition at line 416 of file ImageBase.h.

416{ 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 405 of file Mask.cc.

405 {
407
408 if (*_maskDict == *currentMD) {
409 if (*detail::MaskDict::getDefault() == *_maskDict) {
410 return; // nothing to do
411 }
412 } else {
413 //
414 // Find out which planes need to be permuted
415 //
416 MaskPixelT keepBitmask = 0; // mask of bits to keep
417 MaskPixelT canonicalMask[sizeof(MaskPixelT) * 8]; // bits in lsst::afw::image::Mask that should be
418 MaskPixelT currentMask[sizeof(MaskPixelT) * 8]; // mapped to these bits
419 int numReMap = 0;
420
421 for (auto const &i : currentPlaneDict) {
422 std::string const name = i.first; // name of mask plane
423 int const currentPlaneNumber = i.second; // plane number currently in use
424 int canonicalPlaneNumber = getMaskPlaneNoThrow(name); // plane number in lsst::afw::image::Mask
425
426 if (canonicalPlaneNumber < 0) { // no such plane; add it
428 }
429
431 keepBitmask |= getBitMask(canonicalPlaneNumber); // bit is unchanged, so preserve it
432 } else {
434 currentMask[numReMap] = getBitMaskNoThrow(currentPlaneNumber);
435 numReMap++;
436 }
437 }
438
439 // Now loop over all pixels in Mask
440 if (numReMap > 0) {
441 for (int r = 0; r != this->getHeight(); ++r) { // "this->": Meyers, Effective C++, Item 43
442 for (typename Mask::x_iterator ptr = this->row_begin(r), end = this->row_end(r); ptr != end;
443 ++ptr) {
444 MaskPixelT const pixel = *ptr;
445
446 MaskPixelT newPixel = pixel & keepBitmask; // value of invariant mask bits
447 for (int i = 0; i < numReMap; i++) {
448 if (pixel & currentMask[i]) newPixel |= canonicalMask[i];
449 }
450
451 *ptr = newPixel;
452 }
453 }
454 }
455 }
456 // We've made the planes match the current mask dictionary
457 _maskDict = detail::MaskDict::getDefault();
458}
uint64_t * ptr
Definition RangeSet.cc:95
iterator end() const
Return an STL compliant iterator to the end of the image.
Definition Image.cc:255
int getHeight() const
Return the number of rows in the image.
Definition ImageBase.h:296
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
Definition ImageBase.h:404
typename _view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition ImageBase.h:133
static int addMaskPlane(const std::string &name)
Definition Mask.cc:264
static std::shared_ptr< MaskDict > copyOrGetDefault(MaskPlaneDict const &dict)
Definition MaskDict.cc:111

◆ end() [1/2]

template<typename PixelT >
ImageBase< PixelT >::iterator lsst::afw::image::ImageBase< PixelT >::end ( ) const
inherited

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

Definition at line 255 of file Image.cc.

255 {
256 return _gilView.end();
257}

◆ end() [2/2]

template<typename PixelT >
ImageBase< PixelT >::fast_iterator lsst::afw::image::ImageBase< PixelT >::end ( bool contiguous) const
inherited

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 287 of file Image.cc.

287 {
288 if (!contiguous) {
289 throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Only contiguous == true makes sense");
290 }
291 if (!this->isContiguous()) {
292 throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Image's pixels are not contiguous");
293 }
294
295 return row_end(getHeight() - 1);
296}

◆ get() [1/2]

template<typename PixelT >
ImageBase< PixelT >::PixelReference lsst::afw::image::ImageBase< PixelT >::get ( lsst::geom::Point2I const & index,
ImageOrigin origin )
inherited

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

Definition at line 209 of file Image.cc.

210 {
211 int x = index.getX();
212 int y = index.getY();
213 if (origin == PARENT) {
214 x -= getX0();
215 y -= getY0();
216 }
217 return _gilView(x, y)[0];
218}
int getX0() const
Return the image's column-origin.
Definition ImageBase.h:306
int getY0() const
Return the image's row-origin.
Definition ImageBase.h:314

◆ get() [2/2]

template<typename PixelT >
ImageBase< PixelT >::PixelConstReference lsst::afw::image::ImageBase< PixelT >::get ( lsst::geom::Point2I const & index,
ImageOrigin origin ) const
inherited

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

Definition at line 221 of file Image.cc.

222 {
223 int x = index.getX();
224 int y = index.getY();
225 if (origin == PARENT) {
226 x -= getX0();
227 y -= getY0();
228 }
229 return _gilView(x, y)[0];
230}

◆ getArea()

template<typename PixelT >
int lsst::afw::image::ImageBase< PixelT >::getArea ( ) const
inlineinherited

Return the area of the image.

Definition at line 298 of file ImageBase.h.

298{ return getWidth()*getHeight(); }
int getWidth() const
Return the number of columns in the image.
Definition ImageBase.h:294

◆ getArray() [1/2]

template<typename PixelT >
ImageBase< PixelT >::Array lsst::afw::image::ImageBase< PixelT >::getArray ( )
inherited

Definition at line 476 of file ImageBase.h.

476 {
477 int rowStride = 1;
478 PixelT * data = nullptr;
479 if (getArea() > 0) {
480 data = reinterpret_cast<PixelT*>(row_begin(0));
481 }
482 if (getHeight() > 1) {
483 rowStride = reinterpret_cast<PixelT*>(row_begin(1)) - reinterpret_cast<PixelT*>(row_begin(0));
484 }
485 return ndarray::external(data,
486 ndarray::makeVector(getHeight(), getWidth()), ndarray::makeVector(rowStride, 1),
487 this->_manager);
488}
char * data
Definition BaseRecord.cc:61
int getArea() const
Return the area of the image.
Definition ImageBase.h:298

◆ getArray() [2/2]

template<typename PixelT >
ImageBase< PixelT >::ConstArray lsst::afw::image::ImageBase< PixelT >::getArray ( ) const
inherited

Definition at line 491 of file ImageBase.h.

491 {
492 int rowStride = 1;
493 PixelT * data = nullptr;
494 if (getArea() > 0) {
495 data = reinterpret_cast<PixelT*>(row_begin(0));
496 }
497 if (getHeight() > 1) {
498 rowStride = reinterpret_cast<PixelT*>(row_begin(1)) - reinterpret_cast<PixelT*>(row_begin(0));
499 }
500 return ndarray::external(data,
501 ndarray::makeVector(getHeight(), getWidth()), ndarray::makeVector(rowStride, 1),
502 this->_manager);
503}

◆ getAsString()

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

Definition at line 448 of file Mask.h.

448{ return interpret((*this)(x, y)); }
static std::string interpret(MaskPixelT value)
Interpret a mask value as a comma-separated list of mask plane names.
Definition Mask.cc:249

◆ getBBox()

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

Definition at line 445 of file ImageBase.h.

445 {
446 if (origin == PARENT) {
447 return lsst::geom::Box2I(_origin, getDimensions());
448 } else
450 }
An integer coordinate rectangle.
Definition Box.h:55

◆ getDimensions()

template<typename PixelT >
lsst::geom::Extent2I lsst::afw::image::ImageBase< PixelT >::getDimensions ( ) const
inlineinherited

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

Definition at line 356 of file ImageBase.h.

◆ getHeight()

template<typename PixelT >
int lsst::afw::image::ImageBase< PixelT >::getHeight ( ) const
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 354 of file Mask.cc.

354 {
355 int const plane = getMaskPlaneNoThrow(name);
356
357 if (plane < 0) {
359 str(boost::format("Invalid mask plane name: %s") % name));
360 } else {
361 return plane;
362 }
363}

◆ getMaskPlaneDict()

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

Return the Mask's maskPlaneDict.

Definition at line 297 of file Mask.cc.

297 {
298 return _maskDict->getMaskPlaneDict();
299}

◆ getNumPlanesMax()

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

Definition at line 498 of file Mask.h.

498{ return 8 * sizeof(MaskPixelT); }

◆ getNumPlanesUsed()

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

Definition at line 385 of file Mask.cc.

385 {
386 return _maskPlaneDict()->size();
387}

◆ 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 371 of file Mask.cc.

371 {
372 return getBitMask(getMaskPlane(name));
373}
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Definition Mask.cc:354

◆ 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 376 of file Mask.cc.

376 {
377 MaskPixelT mpix = 0x0;
378 for (auto const &it : name) {
379 mpix |= getBitMask(getMaskPlane(it));
380 }
381 return mpix;
382}

◆ getWidth()

template<typename PixelT >
int lsst::afw::image::ImageBase< PixelT >::getWidth ( ) const
inlineinherited

Return the number of columns in the image.

Definition at line 294 of file ImageBase.h.

294{ return _gilView.width(); }

◆ getX0()

template<typename PixelT >
int lsst::afw::image::ImageBase< PixelT >::getX0 ( ) const
inlineinherited

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 306 of file ImageBase.h.

306{ return _origin.getX(); }

◆ getXY0()

template<typename PixelT >
lsst::geom::Point2I lsst::afw::image::ImageBase< PixelT >::getXY0 ( ) const
inlineinherited

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 323 of file ImageBase.h.

323{ return _origin; }

◆ getY0()

template<typename PixelT >
int lsst::afw::image::ImageBase< PixelT >::getY0 ( ) const
inlineinherited

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 314 of file ImageBase.h.

314{ return _origin.getY(); }

◆ indexToPosition()

template<typename PixelT >
double lsst::afw::image::ImageBase< PixelT >::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 349 of file ImageBase.h.

351 {
352 return ind + PixelZeroPos + (xy == X ? getX0() : getY0());
353 }
const double PixelZeroPos
position of center of pixel 0
Definition ImageUtils.h:44

◆ 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 249 of file Mask.cc.

249 {
250 std::string result = "";
251 MaskPlaneDict const& mpd = _maskPlaneDict()->getMaskPlaneDict();
252 for (auto const &iter : mpd) {
253 if (value & getBitMask(iter.second)) {
254 if (result.size() > 0) {
255 result += ",";
256 }
257 result += iter.first;
258 }
259 }
260 return result;
261}
py::object result
Definition _schema.cc:429

◆ isContiguous()

template<typename PixelT >
bool lsst::afw::image::ImageBase< PixelT >::isContiguous ( ) const
inlineprotectedinherited

Definition at line 467 of file ImageBase.h.

467{ return begin() + getWidth() * getHeight() == end(); }
iterator begin() const
Return an STL compliant iterator to the start of the image.
Definition Image.cc:250

◆ 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 529 of file Mask.cc.

529 {
530 checkMaskDictionaries(rhs);
531
532 if (this->getDimensions() != rhs.getDimensions()) {
534 str(boost::format("Images are of different size, %dx%d v %dx%d") %
535 this->getWidth() % this->getHeight() % rhs.getWidth() % rhs.getHeight()));
536 }
537 transform_pixels(_getRawView(), rhs._getRawView(), _getRawView(),
538 [](MaskPixelT const& l, MaskPixelT const& r) -> MaskPixelT { return l & r; });
539 return *this;
540}
_view_t _getRawView() const
Definition ImageBase.h:465
Reports attempts to exceed implementation-defined length limits for some classes.
Definition Runtime.h:76

◆ 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 523 of file Mask.cc.

523 {
524 transform_pixels(_getRawView(), _getRawView(), [&val](MaskPixelT const& l) { return l & val; });
525 return *this;
526}
ImageT val
Definition CR.cc:146

◆ 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 461 of file Mask.cc.

461 {
463}
PixelReference operator()(int x, int y)
Return a reference to the pixel (x, y) in LOCAL coordinates.
Definition Image.cc:171

◆ 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 472 of file Mask.cc.

472 {
474}

◆ 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 466 of file Mask.cc.

467 {
468 return this->ImageBase<MaskPixelT>::operator()(x, y, check);
469}

◆ 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 477 of file Mask.cc.

478 {
479 return this->ImageBase<MaskPixelT>::operator()(x, y, check);
480}

◆ 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 483 of file Mask.cc.

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

◆ 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 489 of file Mask.cc.

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

◆ operator=() [1/3]

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

Definition at line 139 of file Mask.cc.

139 {
140 Mask tmp(rhs);
141 swap(tmp); // See Meyers, Effective C++, Item 11
142
143 return *this;
144}
void swap(Mask &rhs)
Definition Mask.cc:126

◆ operator=() [2/3]

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

Definition at line 147 of file Mask.cc.

147 {
148 return *this = rhs;
149}

◆ operator=() [3/3]

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

Definition at line 152 of file Mask.cc.

152 {
153 fill_pixels(_getRawView(), rhs);
154
155 return *this;
156}

◆ 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); }
Mask subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition Mask.h:276

◆ operator[]() [2/3]

template<typename PixelT >
PixelReference lsst::afw::image::ImageBase< PixelT >::operator[] ( lsst::geom::Point2I const & index)
inlineinherited

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); }
PixelReference get(lsst::geom::Point2I const &index, ImageOrigin origin)
Return a reference to a single pixel (with no bounds check).
Definition Image.cc:209

◆ operator[]() [3/3]

template<typename PixelT >
PixelConstReference lsst::afw::image::ImageBase< PixelT >::operator[] ( lsst::geom::Point2I const & index) const
inlineinherited

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 550 of file Mask.cc.

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

◆ 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 543 of file Mask.cc.

543 {
545 [&val](MaskPixelT const& l) -> MaskPixelT { return l ^ val; });
546 return *this;
547}

◆ 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 509 of file Mask.cc.

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

◆ 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 502 of file Mask.cc.

502 {
504 [&val](MaskPixelT const& l) -> MaskPixelT { return l | val; });
505 return *this;
506}

◆ 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 601 of file Mask.cc.

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

◆ PixelCast()

template<typename PixelT >
template<typename SinglePixelT >
static SinglePixel lsst::afw::image::ImageBase< PixelT >::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 }
PixelT SinglePixel
A single Pixel of the same type as those in the ImageBase.
Definition ImageBase.h:113

◆ positionToIndex()

template<typename PixelT >
std::pair< int, double > lsst::afw::image::ImageBase< PixelT >::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 330 of file ImageBase.h.

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

◆ printMaskPlanes()

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

print the mask plane dictionary to std::cout

Definition at line 642 of file Mask.cc.

642 {
643 _maskDict->print();
644}

◆ rbegin()

template<typename PixelT >
ImageBase< PixelT >::reverse_iterator lsst::afw::image::ImageBase< PixelT >::rbegin ( ) const
inherited

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

Definition at line 260 of file Image.cc.

260 {
261 return _gilView.rbegin();
262}

◆ 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 442 of file Mask.h.

442 {
443 return Mask<MaskPixelT>(manager, hdu);
444 }

◆ 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 430 of file Mask.h.

430 {
431 return Mask<MaskPixelT>(filename, hdu);
432 }

◆ 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 313 of file Mask.cc.

315 {
316 clearMaskPlane(getMaskPlane(name)); // clear this bits in this Mask
317
318 if (_maskDict == detail::MaskDict::getDefault() && removeFromDefault) { // we are the default
319 ;
320 } else {
321 _maskDict = _maskDict->clone();
322 }
323
324 _maskDict->erase(name);
325
327 removeMaskPlane(name);
328 }
329}
static void removeMaskPlane(const std::string &name)
Definition Mask.cc:302
void clearMaskPlane(int plane)
Clear the specified bit in all pixels.
Definition Mask.cc:400

◆ removeMaskPlane()

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

Definition at line 302 of file Mask.cc.

302 {
305 str(boost::format("Plane %s doesn't exist in the default Mask") % name));
306 }
307
308 detail::MaskDict::detachDefault(); // leave current Masks alone
309 _maskPlaneDict()->erase(name);
310}
static std::shared_ptr< MaskDict > detachDefault()
Definition MaskDict.cc:123

◆ rend()

template<typename PixelT >
ImageBase< PixelT >::reverse_iterator lsst::afw::image::ImageBase< PixelT >::rend ( ) const
inherited

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

Definition at line 265 of file Image.cc.

265 {
266 return _gilView.rend();
267}

◆ row_begin()

template<typename PixelT >
x_iterator lsst::afw::image::ImageBase< PixelT >::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 401 of file ImageBase.h.

401{ return _gilView.row_begin(y); }

◆ row_end()

template<typename PixelT >
x_iterator lsst::afw::image::ImageBase< PixelT >::row_end ( int y) const
inlineinherited

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

Definition at line 404 of file ImageBase.h.

404{ 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 564 of file Mask.cc.

564 {
565 MaskPixelT const bitMask = getBitMask(planeId);
566
567 for (int x = x0; x <= x1; x++) {
569 }
570}
ImageBase< MaskPixelT >::PixelReference operator()(int x, int y)
get a reference to the specified pixel
Definition Mask.cc:461

◆ setXY0() [1/2]

template<typename PixelT >
void lsst::afw::image::ImageBase< PixelT >::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 443 of file ImageBase.h.

443{ setXY0(lsst::geom::Point2I(x0, y0)); }
void setXY0(lsst::geom::Point2I const origin)
Set the ImageBase's origin.
Definition ImageBase.h:434

◆ setXY0() [2/2]

template<typename PixelT >
void lsst::afw::image::ImageBase< PixelT >::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 434 of file ImageBase.h.

434{ _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]

template<typename PixelT >
void lsst::afw::image::ImageBase< PixelT >::swap ( ImageBase< PixelT > & rhs)
inherited

Definition at line 233 of file Image.cc.

233 {
234 using std::swap; // See Meyers, Effective C++, Item 25
235
236 swap(_manager, rhs._manager); // just swapping the pointers
237 swap(_gilView, rhs._gilView);
238 swap(_origin, rhs._origin);
239}
void swap(ImageBase &rhs)
Definition Image.cc:233
T swap(T... args)

◆ swap() [2/2]

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

Definition at line 126 of file Mask.cc.

126 {
127 using std::swap; // See Meyers, Effective C++, Item 25
128
130 swap(_maskDict, rhs._maskDict);
131}

◆ writeFits() [1/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::Fits & fitsfile,
daf::base::PropertySet const * metadata = nullptr ) 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() [2/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::Fits & fitsfile,
fits::ImageWriteOptions const & options,
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() [3/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( fits::MemFileManager & manager,
daf::base::PropertySet const * metadata = nullptr,
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() [4/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",
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() [5/6]

template<typename MaskPixelT = lsst::afw::image::MaskPixel>
void lsst::afw::image::Mask< MaskPixelT >::writeFits ( std::string const & fileName,
daf::base::PropertySet const * metadata = nullptr,
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.

◆ writeFits() [6/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",
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).

◆ x_at()

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

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

Definition at line 407 of file ImageBase.h.

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

◆ xy_at()

template<typename PixelT >
xy_locator lsst::afw::image::ImageBase< PixelT >::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 425 of file ImageBase.h.

425{ return xy_locator(_gilView.xy_at(x, y)); }
typename _view_t::xy_locator xy_locator
An xy_locator.
Definition ImageBase.h:121

◆ y_at()

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

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

Definition at line 419 of file ImageBase.h.

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

Friends And Related Symbol Documentation

◆ MaskFitsReader

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

Definition at line 530 of file Mask.h.


The documentation for this class was generated from the following files: