30 #ifndef LSST_AFW_IMAGE_MASK_H
31 #define LSST_AFW_IMAGE_MASK_H
50 namespace formatters {
51 template<
typename>
class MaskFormatter;
91 template<
typename MaskPixelT=lsst::afw::image::MaskPixel>
94 typedef std::shared_ptr<Mask>
Ptr;
101 template<
typename MaskPT=MaskPixelT>
111 unsigned int width,
unsigned int height,
115 unsigned int width,
unsigned int height,
116 MaskPixelT initialValue,
125 MaskPixelT initialValue,
152 std::string
const & fileName,
int hdu=0,
156 bool conformMasks=
false
182 bool conformMasks=
false
205 bool conformMasks=
false
209 template<
typename OtherPixelT>
214 Mask(
const Mask& src,
const bool deep=
false);
219 const bool deep=
false
222 explicit Mask(ndarray::Array<MaskPixelT,2,1>
const & array,
bool deep=
false,
236 static MaskPixelT
getPlaneBitMask(
const std::vector<std::string> &names);
257 std::string
const& fileName,
259 std::string
const& mode=
"w"
272 std::string
const& mode=
"w"
309 static std::string
interpret(MaskPixelT value);
369 #endif // LSST_AFW_IMAGE_MASK_H
static std::string interpret(MaskPixelT value)
Interpret a mask value as a comma-separated list of mask plane names.
void _initializePlanes(MaskPlaneDict const &planeDefs)
Initialise mask planes; called by constructors.
static void clearMaskPlaneDict()
Reset the maskPlane dictionary.
table::Key< std::string > name
Interface for Persistable base class.
static MaskPixelT getBitMaskNoThrow(int plane)
Return the bitmask corresponding to a plane ID, or 0 if invalid.
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.
static int getMaskPlane(const std::string &name)
Return the mask plane number corresponding to a plane name.
Mask(Mask< OtherPixelT > const &rhs, const bool deep)
void operator|=(Mask const &rhs)
OR a Mask into a Mask.
void operator&=(Mask const &rhs)
AND a Mask into a Mask.
std::map< std::string, int > MaskPlaneDict
Mask & operator=(MaskPixelT const rhs)
std::string getAsString(int x, int y)
static int _setMaskPlaneDict(MaskPlaneDict const &mpd)
detail::MaskPlaneDict MaskPlaneDict
static int getNumPlanesUsed()
Reset the maskPlane dictionary.
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, ...)
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...
Mask< MaskPT > type
Return the desired type.
static int getMaskPlaneNoThrow(const std::string &name)
Return the mask plane number corresponding to a plane name, or -1 if not found.
static const std::string maskPlanePrefix
ImageBase< MaskPixelT >::PixelReference operator()(int x, int y)
get a reference to the specified pixel
An integer coordinate rectangle.
void operator^=(Mask const &rhs)
XOR a Mask into a Mask.
table::Key< table::Array< Kernel::Pixel > > image
Mask(unsigned int width, unsigned int height, MaskPlaneDict const &planeDefs=MaskPlaneDict())
Construct a Mask initialized to 0x0.
afw::table::PointKey< int > dimensions
static MaskPixelT getBitMask(int plane)
Return the bitmask corresponding to plane ID.
Represent a 2-dimensional array of bitmask pixels.
detail::Mask_tag image_category
Lifetime-management for memory that goes into FITS memory files.
_view_t _getRawView() const
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)
static MaskPlaneDict parseMaskPlaneMetadata(boost::shared_ptr< lsst::daf::base::PropertySet const >)
Given a PropertySet that contains the MaskPlane assignments, setup the MaskPlanes.
A class used to request that array accesses be checked.
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
std::shared_ptr< Mask > Ptr
static void removeMaskPlane(const std::string &name)
static void addMaskPlanesToMetadata(boost::shared_ptr< lsst::daf::base::PropertySet >)
Given a PropertySet, replace any existing MaskPlane assignments with the current ones.
static int getNumPlanesMax()
void checkMaskDictionaries(Mask const &other)
MaskPlaneDict const & getMaskPlaneDict() const
Class for storing generic metadata.
static Mask readFits(fits::MemFileManager &manager, int hdu=0)
Read a Mask from a FITS RAM file.
afw::table::Key< double > b
Interface for PropertySet class.
void conformMaskPlanes(const MaskPlaneDict &masterPlaneDict)
Adjust this mask to conform to the standard Mask class's mask plane dictionary, adding any new mask p...
static Mask readFits(std::string const &filename, int hdu=0)
Read a Mask from a regular FITS file.
A templated class to return this classes' type (present in Image/Mask/MaskedImage) ...
Include files required for standard LSST Exception handling.
boost::shared_ptr< detail::MaskDict > _maskDict
void clearMaskPlane(int plane)
Clear the specified bit in all pixels.
void printMaskPlanes() const
print the mask plane dictionary to std::cout
Definition of default types for Masks and Variance Images.
void clearAllMaskPlanes()
Clear all the pixels.
static int addMaskPlane(const std::string &name)
std::shared_ptr< const Mask > ConstPtr
static boost::shared_ptr< detail::MaskDict > _maskPlaneDict()