LSSTApplications  18.1.0
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< MaskPixelT > lsst::daf::base::Citizen

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 MaskPixelT SinglePixel
 A single Pixel of the same type as those in the ImageBase. More...
 
typedef MaskPixelT Pixel
 A pixel in this ImageBase. More...
 
typedef Reference< MaskPixelT >::type PixelReference
 A Reference to a PixelT. More...
 
typedef ConstReference< MaskPixelT >::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< MaskPixelT, 2, 1 > Array
 A mutable ndarray representation of the image. More...
 
typedef ndarray::Array< MaskPixelT const, 2, 1 > ConstArray
 An immutable ndarray representation of the image. More...
 
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback) (const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback) (const Citizen *ptr)
 

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...
 
ImageBaseoperator<<= (const ImageBase &rhs)
 Set the lhs's pixel values to equal the rhs's. 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
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. More...
 
PixelConstReference get0 (int x, int y) const
 
PixelConstReference get0 (int x, int y, CheckIndices const &check) const
 
void set0 (int x, int y, const MaskPixelT v)
 
void set0 (int x, int y, const MaskPixelT v, CheckIndices const &check)
 

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...
 
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
Census

Provide a list of current Citizens

static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector< const Citizen * > * census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
callbackIDs

Set callback Ids.

The old Id is returned

static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
callbacks

Set the New/Delete callback functions; in each case the previously installed callback is returned.

These callback functions return a value which is Added to the previously registered id.

The default callback functions are called default{New,Delete}Callback; you may want to set a break point in these callbacks from your favourite debugger

static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. 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 78 of file Mask.h.

Member Typedef Documentation

◆ Array

typedef ndarray::Array<MaskPixelT , 2, 1> lsst::afw::image::ImageBase< MaskPixelT >::Array
inherited

A mutable ndarray representation of the image.

Definition at line 150 of file ImageBase.h.

◆ const_iterator

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

An STL compliant const iterator.

Definition at line 128 of file ImageBase.h.

◆ const_reverse_iterator

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

An STL compliant const reverse iterator.

Definition at line 132 of file ImageBase.h.

◆ const_x_iterator

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

A const iterator for traversing the pixels in a row.

Definition at line 142 of file ImageBase.h.

◆ const_xy_locator

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

A const_xy_locator.

Definition at line 124 of file ImageBase.h.

◆ const_y_iterator

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

A const iterator for traversing the pixels in a column.

Definition at line 148 of file ImageBase.h.

◆ ConstArray

typedef ndarray::Array<MaskPixelT const, 2, 1> lsst::afw::image::ImageBase< MaskPixelT >::ConstArray
inherited

An immutable ndarray representation of the image.

Definition at line 152 of file ImageBase.h.

◆ fast_iterator

typedef x_iterator lsst::afw::image::ImageBase< MaskPixelT >::fast_iterator
inherited

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

The order of pixel access is undefined

Definition at line 138 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 82 of file Mask.h.

◆ iterator

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

An STL compliant iterator.

Definition at line 126 of file ImageBase.h.

◆ MaskPlaneDict

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

Definition at line 80 of file Mask.h.

◆ memCallback

typedef memId(* lsst::daf::base::Citizen::memCallback) (const Citizen *ptr)
inherited

Definition at line 61 of file Citizen.h.

◆ memId

typedef unsigned long lsst::daf::base::Citizen::memId
inherited

Type of the block's ID.

Definition at line 58 of file Citizen.h.

◆ memNewCallback

typedef memId(* lsst::daf::base::Citizen::memNewCallback) (const memId cid)
inherited

A function used to register a callback.

Definition at line 60 of file Citizen.h.

◆ Pixel

typedef MaskPixelT lsst::afw::image::ImageBase< MaskPixelT >::Pixel
inherited

A pixel in this ImageBase.

Definition at line 116 of file ImageBase.h.

◆ PixelConstReference

typedef ConstReference<MaskPixelT >::type lsst::afw::image::ImageBase< MaskPixelT >::PixelConstReference
inherited

A ConstReference to a PixelT.

Definition at line 120 of file ImageBase.h.

◆ PixelReference

typedef Reference<MaskPixelT >::type lsst::afw::image::ImageBase< MaskPixelT >::PixelReference
inherited

A Reference to a PixelT.

Definition at line 118 of file ImageBase.h.

◆ reverse_iterator

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

An STL compliant reverse iterator.

Definition at line 130 of file ImageBase.h.

◆ SinglePixel

typedef MaskPixelT lsst::afw::image::ImageBase< MaskPixelT >::SinglePixel
inherited

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

Definition at line 114 of file ImageBase.h.

◆ x_iterator

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

An iterator for traversing the pixels in a row.

Definition at line 134 of file ImageBase.h.

◆ xy_locator

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

An xy_locator.

Definition at line 122 of file ImageBase.h.

◆ xy_x_iterator

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

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

Definition at line 140 of file ImageBase.h.

◆ xy_y_iterator

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

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

Definition at line 146 of file ImageBase.h.

◆ y_iterator

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

An iterator for traversing the pixels in a column.

Definition at line 144 of file ImageBase.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
magicSentinel 

Definition at line 88 of file Citizen.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 72 of file Mask.cc.

73  : ImageBase<MaskPixelT>(lsst::geom::ExtentI(width, height)) {
74  _initializePlanes(planeDefs);
75  *this = 0x0;
76 }
Extent< int, 2 > ExtentI
Definition: Extent.h:396

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

81  : ImageBase<MaskPixelT>(lsst::geom::ExtentI(width, height)) {
82  _initializePlanes(planeDefs);
83  *this = initialValue;
84 }
Extent< int, 2 > ExtentI
Definition: Extent.h:396

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

88  : ImageBase<MaskPixelT>(dimensions) {
89  _initializePlanes(planeDefs);
90  *this = 0x0;
91 }
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49

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

96  : ImageBase<MaskPixelT>(dimensions) {
97  _initializePlanes(planeDefs);
98  *this = initialValue;
99 }
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49

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

103  : ImageBase<MaskPixelT>(bbox) {
104  _initializePlanes(planeDefs);
105  *this = 0x0;
106 }
table::Box2IKey bbox
Definition: Detector.cc:169

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

110  : ImageBase<MaskPixelT>(bbox) {
111  _initializePlanes(planeDefs);
112  *this = initialValue;
113 }
table::Box2IKey bbox
Definition: Detector.cc:169

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

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

122  : 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 125 of file Mask.cc.

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

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

118  : ImageBase<MaskPixelT>(rhs, bbox, origin, deep), _maskDict(rhs._maskDict) {}
table::Box2IKey bbox
Definition: Detector.cc:169

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

133  : image::ImageBase<MaskPixelT>(array, deep, xy0), _maskDict(detail::MaskDict::getDefault()) {}
static std::shared_ptr< MaskDict > getDefault()
Definition: MaskDict.cc:115

Member Function Documentation

◆ _allocateView()

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

Definition at line 58 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 }
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
T max(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ _getRawView()

_view_t lsst::afw::image::ImageBase< MaskPixelT >::_getRawView ( ) const
inlineprotectedinherited

Definition at line 483 of file ImageBase.h.

483 { return _gilView; }

◆ _makeSubView()

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

Definition at line 78 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 }
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ addMaskPlane()

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

Definition at line 271 of file Mask.cc.

271  {
272  int id = getMaskPlaneNoThrow(name); // see if the plane is already available
273 
274  if (id < 0) { // doesn't exist
275  id = _maskPlaneDict()->getUnusedPlane();
276  }
277 
278  // build new entry, adding the plane to all Masks where this is no contradiction
279 
280  if (id >= getNumPlanesMax()) { // Max number of planes is already allocated
282  str(boost::format("Max number of planes (%1%) already used") % getNumPlanesMax()));
283  }
284 
286 
287  return id;
288 }
table::Key< int > id
Definition: Detector.cc:166
static void addAllMasksPlane(std::string const &name, int bitId)
Definition: MaskDict.cc:127
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
static int getNumPlanesMax()
Definition: Mask.h:492
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 580 of file Mask.cc.

580  {
581  if (!metadata) {
582  throw LSST_EXCEPT(pexExcept::InvalidParameterError, "Null std::shared_ptr<PropertySet>");
583  }
584 
585  // First, clear existing MaskPlane metadata
586  typedef std::vector<std::string> NameList;
587  NameList paramNames = metadata->paramNames(false);
588  for (NameList::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i) {
589  if (i->compare(0, maskPlanePrefix.size(), maskPlanePrefix) == 0) {
590  metadata->remove(*i);
591  }
592  }
593 
594  MaskPlaneDict const& mpd = _maskPlaneDict()->getMaskPlaneDict();
595 
596  // Add new MaskPlane metadata
597  for (MaskPlaneDict::const_iterator i = mpd.begin(); i != mpd.end(); ++i) {
598  std::string const& planeName = i->first;
599  int const planeNumber = i->second;
600 
601  if (planeName != "") {
602  metadata->add(maskPlanePrefix + planeName, planeNumber);
603  }
604  }
605 }
detail::MaskPlaneDict MaskPlaneDict
Definition: Mask.h:80
STL class.
T size(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Reports invalid arguments.
Definition: Runtime.h:66

◆ assign()

void lsst::afw::image::ImageBase< MaskPixelT >::assign ( ImageBase< MaskPixelT > 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 177 of file Image.cc.

177  {
178  auto lhsDim = bbox.isEmpty() ? getDimensions() : bbox.getDimensions();
179  if (lhsDim != rhs.getDimensions()) {
180  throw LSST_EXCEPT(pex::exceptions::LengthError,
181  (boost::format("Dimension mismatch: %dx%d v. %dx%d") % lhsDim.getX() %
182  lhsDim.getY() % rhs.getWidth() % rhs.getHeight())
183  .str());
184  }
185  if (bbox.isEmpty()) {
186  copy_pixels(rhs._gilView, _gilView);
187  } else {
188  auto lhsOff = (origin == PARENT) ? bbox.getMin() - _origin : lsst::geom::Extent2I(bbox.getMin());
189  auto lhsGilView = _makeSubView(lhsDim, lhsOff, _gilView);
190  copy_pixels(rhs._gilView, lhsGilView);
191  }
192 }
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
table::Box2IKey bbox
Definition: Detector.cc:169
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Extent< int, 2 > Extent2I
Definition: Extent.h:397
lsst::geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: ImageBase.h:374
static _view_t _makeSubView(lsst::geom::Extent2I const &dimensions, lsst::geom::Extent2I const &offset, const _view_t &view)
Definition: Image.cc:78

◆ at()

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

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

Definition at line 295 of file Image.cc.

295  {
296  return _gilView.at(x, y);
297 }
int y
Definition: SpanSet.cc:49
double x

◆ begin() [1/2]

ImageBase< MaskPixelT >::iterator lsst::afw::image::ImageBase< MaskPixelT >::begin ( ) const
inherited

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

275  {
276  return _gilView.begin();
277 }

◆ begin() [2/2]

ImageBase< MaskPixelT >::fast_iterator lsst::afw::image::ImageBase< MaskPixelT >::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 300 of file Image.cc.

300  {
301  if (!contiguous) {
302  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Only contiguous == true makes sense");
303  }
304  if (!this->isContiguous()) {
305  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Image's pixels are not contiguous");
306  }
307 
308  return row_begin(0);
309 }
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y&#39;th row.
Definition: ImageBase.h:419
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ census() [1/3]

int lsst::daf::base::Citizen::census ( int  ,
memId  startingMemId = 0 
)
staticinherited

How many active Citizens are there?

Parameters
startingMemIdDon't print Citizens with lower IDs

Definition at line 238 of file Citizen.cc.

240  {
241  if (startingMemId == 0) { // easy
242  ReadGuard guard(citizenLock);
243  return _activeCitizens.size();
244  }
245 
246  int n = 0;
247  ReadGuard guard(citizenLock);
248  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
249  if (cur->first->_CitizenId >= startingMemId) {
250  n++;
251  }
252  }
253 
254  return n;
255 }
T end(T... args)
T size(T... args)
T begin(T... args)

◆ census() [2/3]

void lsst::daf::base::Citizen::census ( std::ostream stream,
memId  startingMemId = 0 
)
staticinherited

Print a list of all active Citizens to stream, sorted by ID.

Parameters
streamstream to print to
startingMemIdDon't print Citizens with lower IDs

Definition at line 259 of file Citizen.cc.

261  {
262  ReadGuard guard(citizenLock);
263 
265 
266  for (std::vector<Citizen const*>::const_iterator citizen = leaks->begin(), end = leaks->end();
267  citizen != end; ++citizen) {
268  if ((*citizen)->getId() >= startingMemId) {
269  stream << (*citizen)->repr() << "\n";
270  }
271  }
272 }
STL class.
STL class.
T begin(T... args)
int end
static const std::vector< const Citizen * > * census()
Return a (newly allocated) std::vector of active Citizens sorted by ID.
Definition: Citizen.cc:287

◆ census() [3/3]

std::vector< dafBase::Citizen const * > const * lsst::daf::base::Citizen::census ( )
staticinherited

Return a (newly allocated) std::vector of active Citizens sorted by ID.

You are responsible for deleting it; or you can say std::unique_ptr<std::vector<Citizen const*> const> leaks(Citizen::census()); and not bother (that becomes std::unique_ptr in C++11)

Definition at line 287 of file Citizen.cc.

287  {
289  ReadGuard guard(citizenLock);
290  vec->reserve(_activeCitizens.size());
291 
292  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
293  vec->push_back(dynamic_cast<Citizen const*>(cur->first));
294  }
295 
296  std::sort(vec->begin(), vec->end(), cmpId);
297 
298  return vec;
299 }
T end(T... args)
T push_back(T... args)
T size(T... args)
STL class.
T begin(T... args)
T sort(T... args)
T reserve(T... args)

◆ clearAllMaskPlanes()

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

Clear all the pixels.

Definition at line 402 of file Mask.cc.

402  {
403  *this = 0;
404 }

◆ clearMaskPlane()

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

Clear the specified bit in all pixels.

Definition at line 407 of file Mask.cc.

407  {
408  *this &= ~getBitMask(planeId);
409 }

◆ clearMaskPlaneDict()

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

Reset the maskPlane dictionary.

Definition at line 397 of file Mask.cc.

397  {
398  _maskPlaneDict()->clear();
399 }

◆ col_begin()

y_iterator lsst::afw::image::ImageBase< MaskPixelT >::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 431 of file ImageBase.h.

431 { return _gilView.col_begin(x); }
double x

◆ col_end()

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

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

Definition at line 434 of file ImageBase.h.

434 { return _gilView.col_end(x); }
double 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 412 of file Mask.cc.

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

◆ end() [1/2]

ImageBase< MaskPixelT >::iterator lsst::afw::image::ImageBase< MaskPixelT >::end ( ) const
inherited

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

Definition at line 280 of file Image.cc.

280  {
281  return _gilView.end();
282 }

◆ end() [2/2]

ImageBase< MaskPixelT >::fast_iterator lsst::afw::image::ImageBase< MaskPixelT >::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 312 of file Image.cc.

312  {
313  if (!contiguous) {
314  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Only contiguous == true makes sense");
315  }
316  if (!this->isContiguous()) {
317  throw LSST_EXCEPT(pex::exceptions::RuntimeError, "Image's pixels are not contiguous");
318  }
319 
320  return row_end(getHeight() - 1);
321 }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
x_iterator row_end(int y) const
Return an x_iterator to the end of the y&#39;th row.
Definition: ImageBase.h:422

◆ get() [1/2]

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

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

Definition at line 234 of file Image.cc.

234  {
235  int x = index.getX();
236  int y = index.getY();
237  if (origin == PARENT) {
238  x -= getX0();
239  y -= getY0();
240  }
241  return _gilView(x, y)[0];
242 }
int y
Definition: SpanSet.cc:49
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
double x
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332

◆ get() [2/2]

ImageBase< MaskPixelT >::PixelConstReference lsst::afw::image::ImageBase< MaskPixelT >::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 246 of file Image.cc.

246  {
247  int x = index.getX();
248  int y = index.getY();
249  if (origin == PARENT) {
250  x -= getX0();
251  y -= getY0();
252  }
253  return _gilView(x, y)[0];
254 }
int y
Definition: SpanSet.cc:49
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
double x
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332

◆ get0() [1/2]

PixelConstReference lsst::afw::image::ImageBase< MaskPixelT >::get0 ( int  x,
int  y 
) const
inlineinherited
Deprecated:
Deprecated in 16.0.

No timeline for removal. Replaced by get(Point2I, ImageOrigin).Return a reference to the pixel (x, y)

Definition at line 291 of file ImageBase.h.

291 { return operator()(x - getX0(), y - getY0()); }
int y
Definition: SpanSet.cc:49
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
double x
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ get0() [2/2]

PixelConstReference lsst::afw::image::ImageBase< MaskPixelT >::get0 ( int  x,
int  y,
CheckIndices const &  check 
) const
inlineinherited
Deprecated:
Deprecated in 16.0.

No timeline for removal. Replaced by get(Point2I, ImageOrigin).Return a reference to the pixel (x, y)

Definition at line 292 of file ImageBase.h.

292  {
293  return operator()(x - getX0(), y - getY0(), check);
294  }
int y
Definition: SpanSet.cc:49
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
double x
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ getArray() [1/2]

ImageBase< MaskPixelT >::Array lsst::afw::image::ImageBase< MaskPixelT >::getArray ( )
inherited

Definition at line 494 of file ImageBase.h.

494  {
495  int rowStride = reinterpret_cast<PixelT*>(row_begin(1)) - reinterpret_cast<PixelT*>(row_begin(0));
496  return ndarray::external(reinterpret_cast<PixelT*>(row_begin(0)),
497  ndarray::makeVector(getHeight(), getWidth()), ndarray::makeVector(rowStride, 1),
498  this->_manager);
499 }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y&#39;th row.
Definition: ImageBase.h:419
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:314

◆ getArray() [2/2]

ImageBase< MaskPixelT >::ConstArray lsst::afw::image::ImageBase< MaskPixelT >::getArray ( ) const
inherited

Definition at line 502 of file ImageBase.h.

502  {
503  int rowStride = reinterpret_cast<PixelT*>(row_begin(1)) - reinterpret_cast<PixelT*>(row_begin(0));
504  return ndarray::external(reinterpret_cast<PixelT*>(row_begin(0)),
505  ndarray::makeVector(getHeight(), getWidth()), ndarray::makeVector(rowStride, 1),
506  this->_manager);
507 }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y&#39;th row.
Definition: ImageBase.h:419
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:314

◆ getAsString()

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

Definition at line 442 of file Mask.h.

442 { 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:256
int y
Definition: SpanSet.cc:49
double x

◆ getBBox()

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

Definition at line 463 of file ImageBase.h.

463  {
464  if (origin == PARENT) {
465  return lsst::geom::Box2I(_origin, getDimensions());
466  } else
468  }
lsst::geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: ImageBase.h:374
An integer coordinate rectangle.
Definition: Box.h:54

◆ getDimensions()

lsst::geom::Extent2I lsst::afw::image::ImageBase< MaskPixelT >::getDimensions ( ) const
inlineinherited

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

Definition at line 374 of file ImageBase.h.

374 { return lsst::geom::Extent2I(getWidth(), getHeight()); }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
Extent< int, 2 > Extent2I
Definition: Extent.h:397
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:314

◆ getHeight()

int lsst::afw::image::ImageBase< MaskPixelT >::getHeight ( ) const
inlineinherited

Return the number of rows in the image.

Definition at line 316 of file ImageBase.h.

316 { return _gilView.height(); }

◆ getId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getId ( ) const
inherited

Return the Citizen's ID.

Definition at line 206 of file Citizen.cc.

206 { return _CitizenId; }

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

361  {
362  int const plane = getMaskPlaneNoThrow(name);
363 
364  if (plane < 0) {
366  str(boost::format("Invalid mask plane name: %s") % name));
367  } else {
368  return plane;
369  }
370 }
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Reports invalid arguments.
Definition: Runtime.h:66

◆ getMaskPlaneDict()

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

Return the Mask's maskPlaneDict.

Definition at line 304 of file Mask.cc.

304  {
305  return _maskDict->getMaskPlaneDict();
306 }

◆ getNextMemId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getNextMemId ( )
staticinherited

Return the memId of the next object to be allocated.

Definition at line 209 of file Citizen.cc.

209 { return _nextMemId(); }

◆ getNumPlanesMax()

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

Definition at line 492 of file Mask.h.

492 { return 8 * sizeof(MaskPixelT); }

◆ getNumPlanesUsed()

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

Definition at line 392 of file Mask.cc.

392  {
393  return _maskPlaneDict()->size();
394 }

◆ getPlaneBitMask() [1/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 383 of file Mask.cc.

383  {
384  MaskPixelT mpix = 0x0;
385  for (std::vector<std::string>::const_iterator it = name.begin(); it != name.end(); ++it) {
386  mpix |= getBitMask(getMaskPlane(*it));
387  }
388  return mpix;
389 }
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Definition: Mask.cc:361
STL class.

◆ getPlaneBitMask() [2/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 378 of file Mask.cc.

378  {
379  return getBitMask(getMaskPlane(name));
380 }
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Definition: Mask.cc:361

◆ getWidth()

int lsst::afw::image::ImageBase< MaskPixelT >::getWidth ( ) const
inlineinherited

Return the number of columns in the image.

Definition at line 314 of file ImageBase.h.

314 { return _gilView.width(); }

◆ getX0()

int lsst::afw::image::ImageBase< MaskPixelT >::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 324 of file ImageBase.h.

324 { return _origin.getX(); }

◆ getXY0()

lsst::geom::Point2I lsst::afw::image::ImageBase< MaskPixelT >::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 341 of file ImageBase.h.

341 { return _origin; }

◆ getY0()

int lsst::afw::image::ImageBase< MaskPixelT >::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 332 of file ImageBase.h.

332 { return _origin.getY(); }

◆ hasBeenCorrupted()

bool lsst::daf::base::Citizen::hasBeenCorrupted ( )
staticinherited

Check all allocated blocks for corruption.

Definition at line 316 of file Citizen.cc.

316  {
317  ReadGuard guard(citizenLock);
318  for (table::iterator cur = _activeCitizens.begin(); cur != _activeCitizens.end(); cur++) {
319  if (cur->first->_hasBeenCorrupted()) {
320  return true;
321  }
322  }
323  for (table::iterator cur = _persistentCitizens.begin(); cur != _persistentCitizens.end(); cur++) {
324  if (cur->first->_hasBeenCorrupted()) {
325  return true;
326  }
327  }
328 
329  return false;
330 }
T end(T... args)
T begin(T... args)

◆ indexToPosition()

double lsst::afw::image::ImageBase< MaskPixelT >::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 367 of file ImageBase.h.

369  {
370  return ind + PixelZeroPos + (xy == X ? getX0() : getY0());
371  }
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332
const double PixelZeroPos
position of center of pixel 0
Definition: ImageUtils.h:44

◆ init()

int lsst::daf::base::Citizen::init ( )
staticinherited

Called once when the memory system is being initialised.

Definition at line 196 of file Citizen.cc.

196  {
197  volatile int dummy = 1;
198  return dummy;
199 }

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

256  {
257  std::string result = "";
258  MaskPlaneDict const& mpd = _maskPlaneDict()->getMaskPlaneDict();
259  for (MaskPlaneDict::const_iterator iter = mpd.begin(); iter != mpd.end(); ++iter) {
260  if (value & getBitMask(iter->second)) {
261  if (result.size() > 0) {
262  result += ",";
263  }
264  result += iter->first;
265  }
266  }
267  return result;
268 }
py::object result
Definition: schema.cc:418
detail::MaskPlaneDict MaskPlaneDict
Definition: Mask.h:80
STL class.
T size(T... args)

◆ isContiguous()

bool lsst::afw::image::ImageBase< MaskPixelT >::isContiguous ( ) const
inlineprotectedinherited

Definition at line 485 of file ImageBase.h.

485 { return begin() + getWidth() * getHeight() == end(); }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
iterator end() const
Return an STL compliant iterator to the end of the image.
Definition: Image.cc:280
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:314
iterator begin() const
Return an STL compliant iterator to the start of the image.
Definition: Image.cc:275

◆ markPersistent()

void lsst::daf::base::Citizen::markPersistent ( void  )
inherited

Mark a Citizen as persistent and not destroyed until process end.

Definition at line 225 of file Citizen.cc.

225  {
226  WriteGuard guard(citizenLock);
227  _persistentCitizens[this] = _activeCitizens[this];
228  _activeCitizens.erase(this);
229 }
T erase(T... args)

◆ operator &=() [1/2]

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

AND a Mask into a Mask.

◆ operator &=() [2/2]

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

AND a bitmask into a Mask.

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

468  {
469  return this->ImageBase<MaskPixelT>::operator()(x, y);
470 }
int y
Definition: SpanSet.cc:49
double x
PixelReference operator()(int x, int y)
Definition: Image.cc:195

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

479  {
480  return this->ImageBase<MaskPixelT>::operator()(x, y);
481 }
int y
Definition: SpanSet.cc:49
double x
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ operator()() [3/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 490 of file Mask.cc.

490  {
491  // !! converts an int to a bool
492  return !!(this->ImageBase<MaskPixelT>::operator()(x, y) & getBitMask(planeId));
493 }
int y
Definition: SpanSet.cc:49
double x
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ operator()() [4/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 473 of file Mask.cc.

474  {
475  return this->ImageBase<MaskPixelT>::operator()(x, y, check);
476 }
int y
Definition: SpanSet.cc:49
double x
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ operator()() [5/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 484 of file Mask.cc.

485  {
486  return this->ImageBase<MaskPixelT>::operator()(x, y, check);
487 }
int y
Definition: SpanSet.cc:49
double x
PixelReference operator()(int x, int y)
Definition: Image.cc:195

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

496  {
497  // !! converts an int to a bool
498  return !!(this->ImageBase<MaskPixelT>::operator()(x, y, check) & getBitMask(planeId));
499 }
int y
Definition: SpanSet.cc:49
double x
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ operator<<=()

ImageBase< MaskPixelT > & lsst::afw::image::ImageBase< MaskPixelT >::operator<<= ( const ImageBase< MaskPixelT > &  rhs)
inherited

Set the lhs's pixel values to equal the rhs's.

Deprecated:
use assign(rhs) instead

Definition at line 171 of file Image.cc.

171  {
172  assign(rhs);
173  return *this;
174 }
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.
Definition: Image.cc:177

◆ operator=() [1/3]

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

Definition at line 162 of file Mask.cc.

162  {
163  fill_pixels(_getRawView(), rhs);
164 
165  return *this;
166 }

◆ operator=() [2/3]

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

Definition at line 149 of file Mask.cc.

149  {
150  Mask tmp(rhs);
151  swap(tmp); // See Meyers, Effective C++, Item 11
152 
153  return *this;
154 }
Mask(unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
Construct a Mask initialized to 0x0.
Definition: Mask.cc:72
void swap(Mask &rhs)
Definition: Mask.cc:136

◆ operator=() [3/3]

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

Definition at line 157 of file Mask.cc.

157  {
158  return *this = rhs;
159 }

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

282  {
283  return subset(bbox);
284  }
table::Box2IKey bbox
Definition: Detector.cc:169
Mask subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition: Mask.h:277

◆ operator[]() [2/3]

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

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

Definition at line 308 of file ImageBase.h.

308 { return get(index, PARENT); }

◆ operator[]() [3/3]

PixelConstReference lsst::afw::image::ImageBase< MaskPixelT >::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 311 of file ImageBase.h.

311 { 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 557 of file Mask.cc.

557  {
558  checkMaskDictionaries(rhs);
559 
560  if (this->getDimensions() != rhs.getDimensions()) {
562  str(boost::format("Images are of different size, %dx%d v %dx%d") %
563  this->getWidth() % this->getHeight() % rhs.getWidth() % rhs.getHeight()));
564  }
565  transform_pixels(_getRawView(), rhs._getRawView(), _getRawView(),
566  [](MaskPixelT const& l, MaskPixelT const& r) -> MaskPixelT { return l ^ r; });
567  return *this;
568 }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
Reports attempts to exceed implementation-defined length limits for some classes. ...
Definition: Runtime.h:76
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:314
lsst::geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: ImageBase.h:374

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

550  {
551  transform_pixels(_getRawView(), _getRawView(),
552  [&val](MaskPixelT const& l) -> MaskPixelT { return l ^ val; });
553  return *this;
554 }
ImageT val
Definition: CR.cc:146

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

516  {
517  checkMaskDictionaries(rhs);
518 
519  if (this->getDimensions() != rhs.getDimensions()) {
521  str(boost::format("Images are of different size, %dx%d v %dx%d") %
522  this->getWidth() % this->getHeight() % rhs.getWidth() % rhs.getHeight()));
523  }
524  transform_pixels(_getRawView(), rhs._getRawView(), _getRawView(),
525  [](MaskPixelT const& l, MaskPixelT const& r) -> MaskPixelT { return l | r; });
526  return *this;
527 }
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:316
Reports attempts to exceed implementation-defined length limits for some classes. ...
Definition: Runtime.h:76
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:314
lsst::geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: ImageBase.h:374

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

509  {
510  transform_pixels(_getRawView(), _getRawView(),
511  [&val](MaskPixelT const& l) -> MaskPixelT { return l | val; });
512  return *this;
513 }
ImageT val
Definition: CR.cc:146

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

609  {
610  MaskPlaneDict newDict;
611 
612  // First, clear existing MaskPlane metadata
613  typedef std::vector<std::string> NameList;
614  NameList paramNames = metadata->paramNames(false);
615  int numPlanesUsed = 0; // number of planes used
616 
617  // Iterate over childless properties with names starting with maskPlanePrefix
618  for (NameList::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i) {
619  if (i->compare(0, maskPlanePrefix.size(), maskPlanePrefix) == 0) {
620  // split off maskPlanePrefix to obtain plane name
621  std::string planeName = i->substr(maskPlanePrefix.size());
622  int const planeId = metadata->getAsInt(*i);
623 
624  MaskPlaneDict::const_iterator plane = newDict.find(planeName);
625  if (plane != newDict.end() && planeId != plane->second) {
626  throw LSST_EXCEPT(pexExcept::RuntimeError, "File specifies plane " + planeName + " twice");
627  }
628  for (MaskPlaneDict::const_iterator j = newDict.begin(); j != newDict.end(); ++j) {
629  if (planeId == j->second) {
631  str(boost::format("File specifies plane %s has same value (%d) as %s") %
632  planeName % planeId % j->first));
633  }
634  }
635  // build new entry
636  if (numPlanesUsed >= getNumPlanesMax()) {
637  // Max number of planes already allocated
638  throw LSST_EXCEPT(
640  str(boost::format("Max number of planes (%1%) already used") % getNumPlanesMax()));
641  }
642  newDict[planeName] = planeId;
643  }
644  }
645  return newDict;
646 }
detail::MaskPlaneDict MaskPlaneDict
Definition: Mask.h:80
STL class.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
T size(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
static int getNumPlanesMax()
Definition: Mask.h:492
T substr(T... args)
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104

◆ PixelCast()

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

Convert a type to our SinglePixel type.

Definition at line 159 of file ImageBase.h.

159  {
160  return SinglePixel(rhs);
161  }
MaskPixelT SinglePixel
A single Pixel of the same type as those in the ImageBase.
Definition: ImageBase.h:114

◆ positionToIndex()

std::pair<int, double> lsst::afw::image::ImageBase< MaskPixelT >::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 348 of file ImageBase.h.

351  {
352  double const fullIndex = pos - PixelZeroPos - (xy == X ? getX0() : getY0());
353  int const roundedIndex = static_cast<int>(fullIndex + 0.5);
354  double const residual = fullIndex - roundedIndex;
355  return std::pair<int, double>(roundedIndex, residual);
356  }
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332
const double PixelZeroPos
position of center of pixel 0
Definition: ImageUtils.h:44

◆ printMaskPlanes()

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

print the mask plane dictionary to std::cout

Definition at line 649 of file Mask.cc.

649  {
650  _maskDict->print();
651 }

◆ rbegin()

ImageBase< MaskPixelT >::reverse_iterator lsst::afw::image::ImageBase< MaskPixelT >::rbegin ( ) const
inherited

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

Definition at line 285 of file Image.cc.

285  {
286  return _gilView.rbegin();
287 }

◆ readFits() [1/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 424 of file Mask.h.

424  {
425  return Mask<MaskPixelT>(filename, hdu);
426  }

◆ readFits() [2/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 436 of file Mask.h.

436  {
437  return Mask<MaskPixelT>(manager, hdu);
438  }

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

322  {
323  clearMaskPlane(getMaskPlane(name)); // clear this bits in this Mask
324 
325  if (_maskDict == detail::MaskDict::getDefault() && removeFromDefault) { // we are the default
326  ;
327  } else {
328  _maskDict = _maskDict->clone();
329  }
330 
331  _maskDict->erase(name);
332 
333  if (removeFromDefault && detail::MaskDict::getDefault()->getMaskPlane(name) >= 0) {
334  removeMaskPlane(name);
335  }
336 }
static std::shared_ptr< MaskDict > getDefault()
Definition: MaskDict.cc:115
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Definition: Mask.cc:361
static void removeMaskPlane(const std::string &name)
Definition: Mask.cc:309
void clearMaskPlane(int plane)
Clear the specified bit in all pixels.
Definition: Mask.cc:407

◆ removeMaskPlane()

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

Definition at line 309 of file Mask.cc.

309  {
310  if (detail::MaskDict::getDefault()->getMaskPlane(name) < 0) {
312  str(boost::format("Plane %s doesn't exist in the default Mask") % name));
313  }
314 
315  detail::MaskDict::detachDefault(); // leave current Masks alone
316  _maskPlaneDict()->erase(name);
317 }
static std::shared_ptr< MaskDict > getDefault()
Definition: MaskDict.cc:115
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Definition: Mask.cc:361
static std::shared_ptr< MaskDict > detachDefault()
Definition: MaskDict.cc:123
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Reports invalid arguments.
Definition: Runtime.h:66

◆ rend()

ImageBase< MaskPixelT >::reverse_iterator lsst::afw::image::ImageBase< MaskPixelT >::rend ( ) const
inherited

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

Definition at line 290 of file Image.cc.

290  {
291  return _gilView.rend();
292 }

◆ repr()

std::string lsst::daf::base::Citizen::repr ( ) const
inherited

Return a string representation of a Citizen.

Definition at line 219 of file Citizen.cc.

219  {
220  return boost::str(boost::format("%d: %08x %s") % _CitizenId % this %
221  lsst::utils::demangleType(_typeName));
222 }
std::string demangleType(std::string const _typeName)
Definition: Demangle.cc:113
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168

◆ row_begin()

x_iterator lsst::afw::image::ImageBase< MaskPixelT >::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 419 of file ImageBase.h.

419 { return _gilView.row_begin(y); }
int y
Definition: SpanSet.cc:49

◆ row_end()

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

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

Definition at line 422 of file ImageBase.h.

422 { return _gilView.row_end(y); }
int y
Definition: SpanSet.cc:49

◆ set0() [1/2]

void lsst::afw::image::ImageBase< MaskPixelT >::set0 ( int  x,
int  y,
const MaskPixelT  v 
)
inlineinherited
Deprecated:
Deprecated in 16.0.

No timeline for removal. Replaced by get(Point2I, ImageOrigin).Return a reference to the pixel (x, y)

Definition at line 295 of file ImageBase.h.

295 { operator()(x - getX0(), y - getY0()) = v; }
int y
Definition: SpanSet.cc:49
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
double x
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ set0() [2/2]

void lsst::afw::image::ImageBase< MaskPixelT >::set0 ( int  x,
int  y,
const MaskPixelT  v,
CheckIndices const &  check 
)
inlineinherited
Deprecated:
Deprecated in 16.0.

No timeline for removal. Replaced by get(Point2I, ImageOrigin).Return a reference to the pixel (x, y)

Definition at line 296 of file ImageBase.h.

296  {
297  operator()(x - getX0(), y - getY0(), check) = v;
298  }
int y
Definition: SpanSet.cc:49
int getX0() const
Return the image&#39;s column-origin.
Definition: ImageBase.h:324
double x
int getY0() const
Return the image&#39;s row-origin.
Definition: ImageBase.h:332
PixelReference operator()(int x, int y)
Definition: Image.cc:195

◆ setCorruptionCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setCorruptionCallback ( Citizen::memCallback  func)
staticinherited

Set the CorruptionCallback function.

Parameters
funcfunction be called when block is found to be corrupted

Definition at line 391 of file Citizen.cc.

393  {
394  Citizen::memCallback old = _corruptionCallback;
395  _corruptionCallback = func;
396 
397  return old;
398 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:61

◆ setDeleteCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setDeleteCallback ( Citizen::memCallback  func)
staticinherited

Set the DeleteCallback function.

Parameters
funcfunction be called when desired block is deleted

Definition at line 381 of file Citizen.cc.

383  {
384  Citizen::memCallback old = _deleteCallback;
385  _deleteCallback = func;
386 
387  return old;
388 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:61

◆ setDeleteCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setDeleteCallbackId ( Citizen::memId  id)
staticinherited

Call the current DeleteCallback when block is deleted.

Parameters
idDesired ID

Definition at line 347 of file Citizen.cc.

348  {
349  WriteGuard guard(citizenLock);
350  Citizen::memId oldId = _deleteId;
351  _deleteId = id;
352 
353  return oldId;
354 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:58
table::Key< int > id
Definition: Detector.cc:166

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

571  {
572  MaskPixelT const bitMask = getBitMask(planeId);
573 
574  for (int x = x0; x <= x1; x++) {
575  operator()(x, y) = operator()(x, y) | bitMask;
576  }
577 }
int y
Definition: SpanSet.cc:49
ImageBase< MaskPixelT >::PixelReference operator()(int x, int y)
get a reference to the specified pixel
Definition: Mask.cc:468
double x

◆ setNewCallback()

dafBase::Citizen::memNewCallback lsst::daf::base::Citizen::setNewCallback ( Citizen::memNewCallback  func)
staticinherited

Set the NewCallback function.

Parameters
funcThe new function to be called when a designated block is allocated

Definition at line 371 of file Citizen.cc.

373  {
374  Citizen::memNewCallback old = _newCallback;
375  _newCallback = func;
376 
377  return old;
378 }
memId(* memNewCallback)(const memId cid)
A function used to register a callback.
Definition: Citizen.h:60

◆ setNewCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setNewCallbackId ( Citizen::memId  id)
staticinherited

Call the NewCallback when block is allocated.

Parameters
idDesired ID

Definition at line 337 of file Citizen.cc.

338  {
339  WriteGuard guard(citizenLock);
340  Citizen::memId oldId = _newId;
341  _newId = id;
342 
343  return oldId;
344 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:58
table::Key< int > id
Definition: Detector.cc:166

◆ setXY0() [1/2]

void lsst::afw::image::ImageBase< MaskPixelT >::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 452 of file ImageBase.h.

452 { _origin = origin; }

◆ setXY0() [2/2]

void lsst::afw::image::ImageBase< MaskPixelT >::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 461 of file ImageBase.h.

461 { setXY0(lsst::geom::Point2I(x0, y0)); }
void setXY0(lsst::geom::Point2I const origin)
Set the ImageBase&#39;s origin.
Definition: ImageBase.h:452

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

277  {
278  return Mask(*this, bbox, origin, false);
279  }
Mask(unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
Construct a Mask initialized to 0x0.
Definition: Mask.cc:72
table::Box2IKey bbox
Definition: Detector.cc:169

◆ swap() [1/2]

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

Definition at line 136 of file Mask.cc.

136  {
137  using std::swap; // See Meyers, Effective C++, Item 25
138 
140  swap(_maskDict, rhs._maskDict);
141 }
T swap(T... args)
void swap(ImageBase &rhs)
Definition: Image.cc:258
void swap(Mask &rhs)
Definition: Mask.cc:136

◆ swap() [2/2]

void lsst::afw::image::ImageBase< MaskPixelT >::swap ( ImageBase< MaskPixelT > &  rhs)
inherited

Definition at line 258 of file Image.cc.

258  {
259  using std::swap; // See Meyers, Effective C++, Item 25
260 
261  swap(_manager, rhs._manager); // just swapping the pointers
262  swap(_gilView, rhs._gilView);
263  swap(_origin, rhs._origin);
264 }
T swap(T... args)

◆ writeFits() [1/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.

◆ writeFits() [2/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() [3/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() [4/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() [5/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() [6/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).

◆ x_at()

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

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

Definition at line 425 of file ImageBase.h.

425 { return _gilView.x_at(x, y); }
int y
Definition: SpanSet.cc:49
double x

◆ xy_at()

xy_locator lsst::afw::image::ImageBase< MaskPixelT >::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 443 of file ImageBase.h.

443 { return xy_locator(_gilView.xy_at(x, y)); }
int y
Definition: SpanSet.cc:49
double x
_view_t::xy_locator xy_locator
An xy_locator.
Definition: ImageBase.h:122

◆ y_at()

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

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

Definition at line 437 of file ImageBase.h.

437 { return _gilView.y_at(x, y); }
int y
Definition: SpanSet.cc:49
double x

Friends And Related Function Documentation

◆ MaskFitsReader

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

Definition at line 525 of file Mask.h.


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