30 #ifndef LSST_AFW_IMAGE_MASK_H
31 #define LSST_AFW_IMAGE_MASK_H
37 #include "boost/cstdint.hpp"
38 #include "boost/shared_ptr.hpp"
51 namespace formatters {
52 template<
typename>
class MaskFormatter;
92 template<
typename MaskPixelT=lsst::afw::image::MaskPixel>
95 typedef boost::shared_ptr<Mask>
Ptr;
96 typedef boost::shared_ptr<const Mask>
ConstPtr;
102 template<
typename MaskPT=MaskPixelT>
112 unsigned int width,
unsigned int height,
116 unsigned int width,
unsigned int height,
117 MaskPixelT initialValue,
126 MaskPixelT initialValue,
153 std::string
const & fileName,
int hdu=0,
157 bool conformMasks=
false
183 bool conformMasks=
false
206 bool conformMasks=
false
210 template<
typename OtherPixelT>
215 Mask(
const Mask& src,
const bool deep=
false);
220 const bool deep=
false
237 static MaskPixelT
getPlaneBitMask(
const std::vector<std::string> &names);
258 std::string
const& fileName,
260 std::string
const& mode=
"w"
273 std::string
const& mode=
"w"
310 static std::string
interpret(MaskPixelT value);
370 #endif // LSST_AFW_IMAGE_MASK_H
static MaskPlaneDict parseMaskPlaneMetadata(boost::shared_ptr< lsst::daf::base::PropertySet const >)
Given a PropertySet that contains the MaskPlane assignments, setup the MaskPlanes.
static void clearMaskPlaneDict()
Reset the maskPlane dictionary.
ImageBase< MaskPixelT >::PixelReference operator()(int x, int y)
get a reference to the specified pixel
boost::shared_ptr< const Mask > ConstPtr
table::Key< std::string > name
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; optionall...
MaskPlaneDict const & getMaskPlaneDict() const
std::map< std::string, int > MaskPlaneDict
void operator^=(Mask const &rhs)
XOR a Mask into a Mask.
static Mask readFits(fits::MemFileManager &manager, int hdu=0)
Read a Mask from a FITS RAM file.
static void addMaskPlanesToMetadata(boost::shared_ptr< lsst::daf::base::PropertySet >)
Given a PropertySet, replace any existing MaskPlane assignments with the current ones.
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
static void removeMaskPlane(const std::string &name)
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
The base class for all image classed (Image, Mask, MaskedImage, ...)
static int addMaskPlane(const std::string &name)
void setMaskPlaneValues(const int plane, const int x0, const int x1, const int y)
Set the bit specified by "planeId" for pixels (x0, y) ... (x1, y)
boost::shared_ptr< detail::MaskDict > _maskDict
boost::shared_ptr< Mask > Ptr
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
static MaskPixelT getBitMask(int plane)
Return the bitmask corresponding to plane ID.
afw::table::PointKey< int > dimensions
void clearAllMaskPlanes()
Clear all the pixels.
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
Represent a 2-dimensional array of bitmask pixels.
Lifetime-management for memory that goes into FITS memory files.
static std::string interpret(MaskPixelT value)
Interpret a mask value as a comma-separated list of mask plane names.
detail::MaskPlaneDict MaskPlaneDict
static int getNumPlanesMax()
void _initializePlanes(MaskPlaneDict const &planeDefs)
Initialise mask planes; called by constructors.
A class used to request that array accesses be checked.
void operator|=(Mask const &rhs)
OR a Mask into a Mask.
Interface for Persistable base class.
static int getMaskPlaneNoThrow(const std::string &name)
Return the mask plane number corresponding to a plane name, or -1 if not found.
Mask & operator=(MaskPixelT const rhs)
static const std::string maskPlanePrefix
A multidimensional strided array.
void operator&=(Mask const &rhs)
AND a Mask into a Mask.
Mask(unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
Construct a Mask initialized to 0x0.
void checkMaskDictionaries(Mask const &other)
void writeFits(std::string const &fileName, boost::shared_ptr< lsst::daf::base::PropertySet const > metadata=boost::shared_ptr< lsst::daf::base::PropertySet >(), std::string const &mode="w") const
Write a mask to a regular FITS file.
void clearMaskPlane(int plane)
Clear the specified bit in all pixels.
std::string getAsString(int x, int y)
Class for storing generic metadata.
static MaskPixelT getBitMaskNoThrow(int plane)
Return the bitmask corresponding to a plane ID, or 0 if invalid.
void conformMaskPlanes(const MaskPlaneDict &masterPlaneDict)
Adjust this mask to conform to the standard Mask class's mask plane dictionary, adding any new mask p...
Mask< MaskPT > type
Return the desired type.
afw::table::Key< double > b
static boost::shared_ptr< detail::MaskDict > _maskPlaneDict()
Interface for PropertySet class.
static int _setMaskPlaneDict(MaskPlaneDict const &mpd)
A templated class to return this classes' type (present in Image/Mask/MaskedImage) ...
void printMaskPlanes() const
print the mask plane dictionary to std::cout
detail::Mask_tag image_category
Definition of default types for Masks and Variance Images.
static Mask readFits(std::string const &filename, int hdu=0)
Read a Mask from a regular FITS file.
_view_t _getRawView() const
Include files required for standard LSST Exception handling.
static int getNumPlanesUsed()
Reset the maskPlane dictionary.
Mask(Mask< OtherPixelT > const &rhs, const bool deep)