LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > Class Template Reference

A class to manipulate images, masks, and variance as a single object. More...

#include <MaskedImage.h>

Inheritance diagram for lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >:
lsst::daf::base::Citizen

Classes

class  const_MaskedImageIterator
 An const iterator to the MaskedImage. More...
 
class  const_MaskedImageLocator
 A const locator for the MaskedImage. More...
 
struct  ImageTypeFactory
 A templated class to return this classes' type (present in Image/Mask/MaskedImage) More...
 
class  MaskedImageIterator
 An iterator to the MaskedImage. More...
 
class  MaskedImageIteratorBase
 The base class for MaskedImageIterators (const and non-const) More...
 
class  MaskedImageLocator
 A locator for the MaskedImage. More...
 
class  MaskedImageLocatorBase
 The base class for MaskedImageLocators (const and non-const) More...
 

Public Types

typedef std::shared_ptr< image::Image< ImagePixelT > > ImagePtr
 shared pointer to the Image More...
 
typedef std::shared_ptr< image::Mask< MaskPixelT > > MaskPtr
 shared pointer to the Mask More...
 
typedef std::shared_ptr< image::Image< VariancePixelT > > VariancePtr
 shared pointer to the variance Image More...
 
typedef Mask< MaskPixelT >::MaskPlaneDict MaskPlaneDict
 The Mask's MaskPlaneDict. More...
 
typedef lsst::afw::image::Image< VariancePixelT > Variance
 
typedef lsst::afw::image::Image< ImagePixelT > Image
 
typedef lsst::afw::image::Mask< MaskPixelT > Mask
 
typedef detail::MaskedImage_tag image_category
 
typedef lsst::afw::image::pixel::Pixel< ImagePixelT, MaskPixelT, VariancePixelT > Pixel
 A Pixel in the MaskedImage. More...
 
typedef lsst::afw::image::pixel::SinglePixel< ImagePixelT, MaskPixelT, VariancePixelT > SinglePixel
 A single Pixel of the same type as those in the MaskedImage. More...
 
typedef MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iteratoriterator
 
typedef const_MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iteratorconst_iterator
 
typedef MaskedImageIterator< typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iteratorreverse_iterator
 
typedef MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iteratorx_iterator
 An iterator to a row of a MaskedImage. More...
 
typedef const_MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iteratorconst_x_iterator
 A const_iterator to a row of a MaskedImage. More...
 
typedef x_iterator fast_iterator
 A fast STL compliant iterator for contiguous images N.b. More...
 
typedef MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iteratory_iterator
 An iterator to a column of a MaskedImage. More...
 
typedef const_MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iteratorconst_y_iterator
 A const_iterator to a column of a MaskedImage. More...
 
typedef MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locatorxy_locator
 A locator for a MaskedImage. More...
 
typedef const_MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locatorconst_xy_locator
 A const_locator for a MaskedImage. More...
 
typedef MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator >::x_iterator xy_x_iterator
 an x_iterator associated with an xy_locator More...
 
typedef MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator >::y_iterator xy_y_iterator
 an y_iterator associated with an xy_locator 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

 MaskedImage (unsigned int width, unsigned int height, MaskPlaneDict const &planeDict=MaskPlaneDict())
 Construct from a supplied dimensions. More...
 
 MaskedImage (lsst::geom::Extent2I const &dimensions=lsst::geom::Extent2I(), MaskPlaneDict const &planeDict=MaskPlaneDict())
 Construct from a supplied dimensions. More...
 
 MaskedImage (ImagePtr image, MaskPtr mask=MaskPtr(), VariancePtr variance=VariancePtr())
 Construct from a supplied Image and optional Mask and Variance. More...
 
 MaskedImage (lsst::geom::Box2I const &bbox, MaskPlaneDict const &planeDict=MaskPlaneDict())
 Create an MaskedImage of the specified size. More...
 
 MaskedImage (std::string const &fileName, std::shared_ptr< daf::base::PropertySet > metadata=std::shared_ptr< daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool needAllHdus=false, std::shared_ptr< daf::base::PropertySet > imageMetadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< daf::base::PropertySet > maskMetadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< daf::base::PropertySet > varianceMetadata=std::shared_ptr< daf::base::PropertySet >(), bool allowUnsafe=false)
 Construct a MaskedImage by reading a regular FITS file. More...
 
 MaskedImage (fits::MemFileManager &manager, std::shared_ptr< daf::base::PropertySet > metadata=std::shared_ptr< daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool needAllHdus=false, std::shared_ptr< daf::base::PropertySet > imageMetadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< daf::base::PropertySet > maskMetadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< daf::base::PropertySet > varianceMetadata=std::shared_ptr< daf::base::PropertySet >(), bool allowUnsafe=false)
 Construct a MaskedImage by reading a FITS image in memory. More...
 
 MaskedImage (fits::Fits &fitsfile, std::shared_ptr< daf::base::PropertySet > metadata=std::shared_ptr< daf::base::PropertySet >(), lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT, bool conformMasks=false, bool needAllHdus=false, std::shared_ptr< daf::base::PropertySet > imageMetadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< daf::base::PropertySet > maskMetadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< daf::base::PropertySet > varianceMetadata=std::shared_ptr< daf::base::PropertySet >(), bool allowUnsafe=false)
 Construct a MaskedImage from an already-open FITS object. More...
 
 MaskedImage (MaskedImage const &rhs, bool const deep=false)
 Copy constructor; shallow, unless deep is true. More...
 
 MaskedImage (MaskedImage &&rhs)
 
 MaskedImage (MaskedImage const &rhs, lsst::geom::Box2I const &bbox, ImageOrigin const origin=PARENT, bool const deep=false)
 Copy constructor of the pixels specified by bbox; shallow, unless deep is true. More...
 
template<typename OtherPixelT >
 MaskedImage (MaskedImage< OtherPixelT, MaskPixelT, VariancePixelT > const &rhs, const bool deep)
 generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/2 conversions between N ImageBase types. More...
 
MaskedImageoperator= (MaskedImage const &rhs)
 Make the lhs use the rhs's pixels. More...
 
MaskedImageoperator= (MaskedImage &&rhs)
 
virtual ~MaskedImage ()=default
 
void swap (MaskedImage &rhs)
 
MaskedImageoperator= (Pixel const &rhs)
 Set the pixels in the MaskedImage to the rhs. More...
 
MaskedImageoperator= (SinglePixel const &rhs)
 Set the pixels in the MaskedImage to the rhs. More...
 
MaskedImage subset (lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
 Return a subimage corresponding to the given box. More...
 
MaskedImage operator[] (lsst::geom::Box2I const &bbox) const
 Return a subimage corresponding to the given box (interpreted as PARENT coordinates). More...
 
MaskedImageoperator<<= (MaskedImage const &rhs)
 Copy the pixels from the rhs to the lhs. More...
 
void assign (MaskedImage const &rhs, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
 Copy pixels from another masked image to a specified subregion of this masked image. More...
 
MaskedImageoperator+= (ImagePixelT const rhs)
 Add a scalar rhs to a MaskedImage. More...
 
MaskedImageoperator+= (MaskedImage const &rhs)
 Add a MaskedImage rhs to a MaskedImage. More...
 
MaskedImageoperator+= (lsst::afw::image::Image< ImagePixelT > const &rhs)
 
MaskedImageoperator+= (lsst::afw::math::Function2< double > const &function)
 
void scaledPlus (double const c, MaskedImage const &rhs)
 Add a scaled MaskedImage c*rhs to a MaskedImage. More...
 
MaskedImageoperator-= (ImagePixelT const rhs)
 Subtract a scalar rhs from a MaskedImage. More...
 
MaskedImageoperator-= (MaskedImage const &rhs)
 Subtract a MaskedImage rhs from a MaskedImage. More...
 
MaskedImageoperator-= (lsst::afw::image::Image< ImagePixelT > const &rhs)
 
MaskedImageoperator-= (lsst::afw::math::Function2< double > const &function)
 
void scaledMinus (double const c, MaskedImage const &rhs)
 Subtract a scaled MaskedImage c*rhs from a MaskedImage. More...
 
MaskedImageoperator*= (ImagePixelT const rhs)
 
MaskedImageoperator*= (MaskedImage const &rhs)
 
MaskedImageoperator*= (lsst::afw::image::Image< ImagePixelT > const &rhs)
 
void scaledMultiplies (double const c, MaskedImage const &rhs)
 
MaskedImageoperator/= (ImagePixelT const rhs)
 
MaskedImageoperator/= (MaskedImage const &rhs)
 
MaskedImageoperator/= (lsst::afw::image::Image< ImagePixelT > const &rhs)
 
void scaledDivides (double const c, MaskedImage const &rhs)
 
void writeFits (std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
 Write a MaskedImage to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
 Write a MaskedImage to a FITS RAM file. More...
 
void writeFits (fits::Fits &fitsfile, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
 Write a MaskedImage to a FITS file. More...
 
void writeFits (std::string const &fileName, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions, std::shared_ptr< daf::base::PropertySet const > metadata=nullptr, std::shared_ptr< daf::base::PropertySet const > imageMetadata=nullptr, std::shared_ptr< daf::base::PropertySet const > maskMetadata=nullptr, std::shared_ptr< daf::base::PropertySet const > varianceMetadata=nullptr) const
 Write a MaskedImage to a FITS file. More...
 
void writeFits (fits::MemFileManager &manager, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions, std::shared_ptr< daf::base::PropertySet const > metadata=nullptr, std::shared_ptr< daf::base::PropertySet const > imageMetadata=nullptr, std::shared_ptr< daf::base::PropertySet const > maskMetadata=nullptr, std::shared_ptr< daf::base::PropertySet const > varianceMetadata=nullptr) const
 Write a MaskedImage to a FITS file. More...
 
void writeFits (fits::Fits &fitsfile, fits::ImageWriteOptions const &imageOptions, fits::ImageWriteOptions const &maskOptions, fits::ImageWriteOptions const &varianceOptions, std::shared_ptr< daf::base::PropertySet const > metadata=nullptr, std::shared_ptr< daf::base::PropertySet const > imageMetadata=nullptr, std::shared_ptr< daf::base::PropertySet const > maskMetadata=nullptr, std::shared_ptr< daf::base::PropertySet const > varianceMetadata=nullptr) const
 Write a MaskedImage to a FITS file. More...
 
ImagePtr getImage () const
 Return a (shared_ptr to) the MaskedImage's image. More...
 
void setImage (Image const &other)
 Set the image plane's pixel values to those of another Image. More...
 
MaskPtr getMask () const
 Return a (shared_ptr to) the MaskedImage's mask. More...
 
void setMask (Mask const &other)
 Set the mask plane's pixel values to those of another Mask. More...
 
void setVariance (Variance const &other)
 Set the variance plane's pixel values to those of another Image. More...
 
VariancePtr getVariance () const
 Return a (shared_ptr to) the MaskedImage's variance. 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...
 
lsst::geom::Extent2I getDimensions () const
 
lsst::geom::Box2I getBBox (ImageOrigin const origin=PARENT) const
 
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...
 
void setXY0 (int const x0, int const y0)
 Set the MaskedImage's origin. More...
 
void setXY0 (lsst::geom::Point2I const origin)
 Set the MaskedImage's origin. More...
 
double indexToPosition (double ind, lsst::afw::image::xOrY const xy) const
 Convert image index to image position (see Image::indexToPosition) More...
 
std::pair< int, double > positionToIndex (double const pos, lsst::afw::image::xOrY const xy) const
 Convert image position to index (see Image::positionToIndex) More...
 
iterator begin () const
 Return an iterator to the start of the image. More...
 
iterator end () const
 Return an iterator to the end of the image. More...
 
iterator at (int const x, int const y) const
 Return an iterator at the point (x, y) More...
 
reverse_iterator rbegin () const
 Return a reverse_iterator to the start of the image. More...
 
reverse_iterator rend () const
 Return a reverse_iterator to the end of the image. More...
 
fast_iterator begin (bool contiguous) const
 Fast iterators to contiguous images. More...
 
fast_iterator end (bool contiguous) const
 Return a fast iterator to the end of the image, which must be contiguous Note that the order in which pixels are visited is undefined. More...
 
x_iterator row_begin (int y) const
 Return an x_iterator to the start of the image. More...
 
x_iterator row_end (int y) const
 Return an x_iterator to the end of the image. More...
 
x_iterator x_at (int x, int y) const
 Return an x_iterator at the point (x, y) More...
 
y_iterator col_begin (int x) const
 Return an y_iterator to the start of the image. More...
 
y_iterator col_end (int x) const
 Return an y_iterator to the end of the image. More...
 
y_iterator y_at (int x, int y) const
 Return an y_iterator at the point (x, y) More...
 
xy_locator xy_at (int x, int y) const
 Return an xy_locator at the point (x, y) More...
 
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...
 

Static Public Member Functions

static MaskedImage readFits (std::string const &filename)
 Read a MaskedImage from a regular FITS file. More...
 
static MaskedImage readFits (fits::MemFileManager &manager)
 Read a MaskedImage from a FITS RAM file. 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...
 

Detailed Description

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
class lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >

A class to manipulate images, masks, and variance as a single object.

Examples:
imageStatistics.cc, maskedImage1.cc, and maskedImage2.cc.

Definition at line 74 of file MaskedImage.h.

Member Typedef Documentation

◆ const_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef const_MaskedImageIterator<typename Image::iterator, typename Mask::iterator, typename Variance::iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::const_iterator

Definition at line 544 of file MaskedImage.h.

◆ const_x_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef const_MaskedImageIterator<typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::const_x_iterator

A const_iterator to a row of a MaskedImage.

Definition at line 561 of file MaskedImage.h.

◆ const_xy_locator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef const_MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::const_xy_locator

A const_locator for a MaskedImage.

Definition at line 582 of file MaskedImage.h.

◆ const_y_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef const_MaskedImageIterator<typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::const_y_iterator

A const_iterator to a column of a MaskedImage.

Definition at line 573 of file MaskedImage.h.

◆ fast_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef x_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::fast_iterator

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

The order of pixel access is undefined

Definition at line 565 of file MaskedImage.h.

◆ Image

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef lsst::afw::image::Image<ImagePixelT> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::Image

Definition at line 86 of file MaskedImage.h.

◆ image_category

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef detail::MaskedImage_tag lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::image_category

Definition at line 89 of file MaskedImage.h.

◆ ImagePtr

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef std::shared_ptr<image::Image<ImagePixelT> > lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::ImagePtr

shared pointer to the Image

Definition at line 77 of file MaskedImage.h.

◆ iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageIterator<typename Image::iterator, typename Mask::iterator, typename Variance::iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::iterator

Definition at line 540 of file MaskedImage.h.

◆ Mask

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef lsst::afw::image::Mask<MaskPixelT> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::Mask

Definition at line 87 of file MaskedImage.h.

◆ MaskPlaneDict

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef Mask<MaskPixelT>::MaskPlaneDict lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskPlaneDict

The Mask's MaskPlaneDict.

Definition at line 83 of file MaskedImage.h.

◆ MaskPtr

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef std::shared_ptr<image::Mask<MaskPixelT> > lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskPtr

shared pointer to the Mask

Definition at line 79 of file MaskedImage.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

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef lsst::afw::image::pixel::Pixel<ImagePixelT, MaskPixelT, VariancePixelT> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::Pixel

A Pixel in the MaskedImage.

Definition at line 109 of file MaskedImage.h.

◆ reverse_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageIterator<typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::reverse_iterator

Definition at line 548 of file MaskedImage.h.

◆ SinglePixel

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef lsst::afw::image::pixel::SinglePixel<ImagePixelT, MaskPixelT, VariancePixelT> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::SinglePixel

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

Definition at line 114 of file MaskedImage.h.

◆ Variance

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef lsst::afw::image::Image<VariancePixelT> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::Variance

Definition at line 85 of file MaskedImage.h.

◆ VariancePtr

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef std::shared_ptr<image::Image<VariancePixelT> > lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::VariancePtr

shared pointer to the variance Image

Definition at line 81 of file MaskedImage.h.

◆ x_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageIterator<typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::x_iterator

An iterator to a row of a MaskedImage.

Definition at line 557 of file MaskedImage.h.

◆ xy_locator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::xy_locator

A locator for a MaskedImage.

Definition at line 578 of file MaskedImage.h.

◆ xy_x_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator>::x_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::xy_x_iterator

an x_iterator associated with an xy_locator

Definition at line 586 of file MaskedImage.h.

◆ xy_y_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageLocator<typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator>::y_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::xy_y_iterator

an y_iterator associated with an xy_locator

Definition at line 589 of file MaskedImage.h.

◆ y_iterator

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
typedef MaskedImageIterator<typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::y_iterator

An iterator to a column of a MaskedImage.

Definition at line 569 of file MaskedImage.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
magicSentinel 

Definition at line 88 of file Citizen.h.

Constructor & Destructor Documentation

◆ MaskedImage() [1/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( unsigned int  width,
unsigned int  height,
MaskPlaneDict const &  planeDict = MaskPlaneDict() 
)
explicit

Construct from a supplied dimensions.

The Image, Mask, and Variance will be set to zero

Parameters
widthnumber of columns
heightnumber of rows
planeDictMake Mask conform to this mask layout (ignore if empty)

Definition at line 48 of file MaskedImage.cc.

50  : daf::base::Citizen(typeid(this)),
51  _image(new Image(width, height)),
52  _mask(new Mask(width, height, planeDict)),
53  _variance(new Variance(width, height)) {
54  *_image = 0;
55  *_mask = 0x0;
56  *_variance = 0;
57 }
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86

◆ MaskedImage() [2/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( lsst::geom::Extent2I const &  dimensions = lsst::geom::Extent2I(),
MaskPlaneDict const &  planeDict = MaskPlaneDict() 
)
explicit

Construct from a supplied dimensions.

The Image, Mask, and Variance will be set to zero

Parameters
dimensionsNumber of columns, rows in image
planeDictMake Mask conform to this mask layout (ignore if empty)

Definition at line 60 of file MaskedImage.cc.

62  : daf::base::Citizen(typeid(this)),
63  _image(new Image(dimensions)),
64  _mask(new Mask(dimensions, planeDict)),
65  _variance(new Variance(dimensions)) {
66  *_image = 0;
67  *_mask = 0x0;
68  *_variance = 0;
69 }
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86

◆ MaskedImage() [3/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( ImagePtr  image,
MaskPtr  mask = MaskPtr(),
VariancePtr  variance = VariancePtr() 
)
explicit

Construct from a supplied Image and optional Mask and Variance.

The Mask and Variance will be set to zero if omitted

Parameters
imageImage
maskMask
varianceVariance Mask

Definition at line 161 of file MaskedImage.cc.

163  : daf::base::Citizen(typeid(this)), _image(image), _mask(mask), _variance(variance) {
164  conformSizes();
165 }
afw::table::Key< afw::table::Array< VariancePixelT > > variance
afw::table::Key< afw::table::Array< MaskPixelT > > mask
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...

◆ MaskedImage() [4/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( lsst::geom::Box2I const &  bbox,
MaskPlaneDict const &  planeDict = MaskPlaneDict() 
)
explicit

Create an MaskedImage of the specified size.

The Image, Mask, and Variance will be set to zero

Parameters
bboxdimensions of image: width x height
planeDictMake Mask conform to this mask layout (ignore if empty)
Note
Many lsst::afw::image and lsst::afw::math objects define a dimensions member which may be conveniently used to make objects of an appropriate size

Definition at line 72 of file MaskedImage.cc.

74  : daf::base::Citizen(typeid(this)),
75  _image(new Image(bbox)),
76  _mask(new Mask(bbox, planeDict)),
77  _variance(new Variance(bbox)) {
78  *_image = 0;
79  *_mask = 0x0;
80  *_variance = 0;
81 }
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
table::Box2IKey bbox
Definition: Detector.cc:169
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86

◆ MaskedImage() [5/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( std::string const &  fileName,
std::shared_ptr< daf::base::PropertySet metadata = std::shared_ptr<daf::base::PropertySet>(),
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  needAllHdus = false,
std::shared_ptr< daf::base::PropertySet imageMetadata = std::shared_ptr<daf::base::PropertySet>(),
std::shared_ptr< daf::base::PropertySet maskMetadata = std::shared_ptr<daf::base::PropertySet>(),
std::shared_ptr< daf::base::PropertySet varianceMetadata = std::shared_ptr<daf::base::PropertySet>(),
bool  allowUnsafe = false 
)
explicit

Construct a MaskedImage by reading a regular FITS file.

Parameters
[in]fileNameFile to read.
[in,out]metadataMetadata read from the primary HDU header.
[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]needAllHdusIf true, throw fits::FitsError if the mask and/or variance plane is missing. If false, silently initialize them to zero.
[in,out]imageMetadataMetadata read from the image HDU header.
[in,out]maskMetadataMetadata read from the mask HDU header.
[in,out]varianceMetadataMetadata read from the variance HDU header.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 84 of file MaskedImage.cc.

90  : daf::base::Citizen(typeid(this)), _image(), _mask(), _variance() {
91  MaskedImageFitsReader reader(fileName);
92  *this = reader.read<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks, needAllHdus,
93  allowUnsafe);
94  if (metadata) {
95  metadata->combine(reader.readPrimaryMetadata());
96  }
97  if (imageMetadata) {
98  imageMetadata->combine(reader.readImageMetadata());
99  }
100  if (maskMetadata) {
101  maskMetadata->combine(reader.readMaskMetadata());
102  }
103  if (varianceMetadata) {
104  varianceMetadata->combine(reader.readVarianceMetadata());
105  }
106 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ MaskedImage() [6/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( fits::MemFileManager manager,
std::shared_ptr< daf::base::PropertySet metadata = std::shared_ptr<daf::base::PropertySet>(),
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  needAllHdus = false,
std::shared_ptr< daf::base::PropertySet imageMetadata = std::shared_ptr<daf::base::PropertySet>(),
std::shared_ptr< daf::base::PropertySet maskMetadata = std::shared_ptr<daf::base::PropertySet>(),
std::shared_ptr< daf::base::PropertySet varianceMetadata = std::shared_ptr<daf::base::PropertySet>(),
bool  allowUnsafe = false 
)
explicit

Construct a MaskedImage by reading a FITS image in memory.

Parameters
[in]managerAn object that manages the memory buffer to read.
[in,out]metadataMetadata read from the primary HDU header.
[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]needAllHdusIf true, throw fits::FitsError if the mask and/or variance plane is missing. If false, silently initialize them to zero.
[in,out]imageMetadataMetadata read from the image HDU header.
[in,out]maskMetadataMetadata read from the mask HDU header.
[in,out]varianceMetadataMetadata read from the variance HDU header.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 109 of file MaskedImage.cc.

116  : daf::base::Citizen(typeid(this)), _image(), _mask(), _variance() {
117  MaskedImageFitsReader reader(manager);
118  *this = reader.read<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks, needAllHdus,
119  allowUnsafe);
120  if (metadata) {
121  metadata->combine(reader.readPrimaryMetadata());
122  }
123  if (imageMetadata) {
124  imageMetadata->combine(reader.readImageMetadata());
125  }
126  if (maskMetadata) {
127  maskMetadata->combine(reader.readMaskMetadata());
128  }
129  if (varianceMetadata) {
130  varianceMetadata->combine(reader.readVarianceMetadata());
131  }
132 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ MaskedImage() [7/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( fits::Fits fitsfile,
std::shared_ptr< daf::base::PropertySet metadata = std::shared_ptr<daf::base::PropertySet>(),
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT,
bool  conformMasks = false,
bool  needAllHdus = false,
std::shared_ptr< daf::base::PropertySet imageMetadata = std::shared_ptr<daf::base::PropertySet>(),
std::shared_ptr< daf::base::PropertySet maskMetadata = std::shared_ptr<daf::base::PropertySet>(),
std::shared_ptr< daf::base::PropertySet varianceMetadata = std::shared_ptr<daf::base::PropertySet>(),
bool  allowUnsafe = false 
)
explicit

Construct a MaskedImage from an already-open FITS object.

Parameters
[in]fitsfileA FITS object to read from. Current HDU is ignored.
[in,out]metadataMetadata read from the primary HDU header.
[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]needAllHdusIf true, throw fits::FitsError if the mask and/or variance plane is missing. If false, silently initialize them to zero.
[in,out]imageMetadataMetadata read from the image HDU header.
[in,out]maskMetadataMetadata read from the mask HDU header.
[in,out]varianceMetadataMetadata read from the variance HDU header.
[in]allowUnsafePermit reading into the requested pixel type even when on-disk values may overflow or truncate.

Definition at line 135 of file MaskedImage.cc.

142  : daf::base::Citizen(typeid(this)), _image(), _mask(), _variance() {
143  MaskedImageFitsReader reader(&fitsFile);
144  *this = reader.read<ImagePixelT, MaskPixelT, VariancePixelT>(bbox, origin, conformMasks, needAllHdus,
145  allowUnsafe);
146  if (metadata) {
147  metadata->combine(reader.readPrimaryMetadata());
148  }
149  if (imageMetadata) {
150  imageMetadata->combine(reader.readImageMetadata());
151  }
152  if (maskMetadata) {
153  maskMetadata->combine(reader.readMaskMetadata());
154  }
155  if (varianceMetadata) {
156  varianceMetadata->combine(reader.readVarianceMetadata());
157  }
158 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ MaskedImage() [8/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs,
bool const  deep = false 
)

Copy constructor; shallow, unless deep is true.

Parameters
rhsImage to copy
deepMake deep copy?

Definition at line 168 of file MaskedImage.cc.

169  : daf::base::Citizen(typeid(this)), _image(rhs._image), _mask(rhs._mask), _variance(rhs._variance) {
170  if (deep) {
171  _image = std::shared_ptr<Image>(new Image(*rhs.getImage(), deep));
172  _mask = std::shared_ptr<Mask>(new Mask(*rhs.getMask(), deep));
173  _variance = std::shared_ptr<Variance>(new Variance(*rhs.getVariance(), deep));
174  }
175  conformSizes();
176 }
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86

◆ MaskedImage() [9/11]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::MaskedImage ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &&  rhs)

Definition at line 180 of file MaskedImage.cc.

181  : MaskedImage(rhs, false) {}
MaskedImage(unsigned int width, unsigned int height, MaskPlaneDict const &planeDict=MaskPlaneDict())
Construct from a supplied dimensions.
Definition: MaskedImage.cc:48

◆ MaskedImage() [10/11]

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

Copy constructor of the pixels specified by bbox; shallow, unless deep is true.

Parameters
rhsMaskedImage to copy
bboxSpecify desired region
originSpecify the coordinate system of the bbox
deepIf false, new ImageBase shares storage with rhs; if true make a new, standalone, MaskedImage

Definition at line 184 of file MaskedImage.cc.

189  : daf::base::Citizen(typeid(this)),
190  _image(new Image(*rhs.getImage(), bbox, origin, deep)),
191  _mask(rhs._mask ? new Mask(*rhs.getMask(), bbox, origin, deep) : static_cast<Mask*>(NULL)),
192  _variance(rhs._variance ? new Variance(*rhs.getVariance(), bbox, origin, deep)
193  : static_cast<Variance*>(NULL)) {
194  conformSizes();
195 }
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
table::Box2IKey bbox
Definition: Detector.cc:169
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86

◆ MaskedImage() [11/11]

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

generalised copy constructor; defined here in the header so that the compiler can instantiate N(N-1)/2 conversions between N ImageBase types.

We only support converting the Image part

Parameters
rhsInput image
deepMust be true; needed to disambiguate

Definition at line 741 of file MaskedImage.h.

745  : lsst::daf::base::Citizen(typeid(this)), _image(), _mask(), _variance() {
746  if (!deep) {
748  "Only deep copies are permitted for MaskedImages with different pixel types");
749  }
750 
751  _image = ImagePtr(new Image(*rhs.getImage(), deep));
752  _mask = MaskPtr(new Mask(*rhs.getMask(), deep));
753  _variance = VariancePtr(new Variance(*rhs.getVariance(), deep));
754  }
std::shared_ptr< image::Mask< MaskPixelT > > MaskPtr
shared pointer to the Mask
Definition: MaskedImage.h:79
std::shared_ptr< image::Image< VariancePixelT > > VariancePtr
shared pointer to the variance Image
Definition: MaskedImage.h:81
lsst::afw::image::Mask< MaskPixelT > Mask
Definition: MaskedImage.h:87
std::shared_ptr< image::Image< ImagePixelT > > ImagePtr
shared pointer to the Image
Definition: MaskedImage.h:77
lsst::afw::image::Image< VariancePixelT > Variance
Definition: MaskedImage.h:85
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Reports invalid arguments.
Definition: Runtime.h:66
lsst::afw::image::Image< ImagePixelT > Image
Definition: MaskedImage.h:86
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:55

◆ ~MaskedImage()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
virtual lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::~MaskedImage ( )
virtualdefault

Member Function Documentation

◆ assign()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::assign ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs,
lsst::geom::Box2I const &  bbox = lsst::geom::Box2I(),
ImageOrigin  origin = PARENT 
)

Copy pixels from another masked image to a specified subregion of this masked 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 243 of file MaskedImage.cc.

245  {
246  _image->assign(*rhs.getImage(), bbox, origin);
247  _mask->assign(*rhs.getMask(), bbox, origin);
248  _variance->assign(*rhs.getVariance(), bbox, origin);
249 }
table::Box2IKey bbox
Definition: Detector.cc:169

◆ at()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::at ( int const  x,
int const  y 
) const

Return an iterator at the point (x, y)

Definition at line 590 of file MaskedImage.cc.

590  {
591  typename Image::iterator imageEnd = getImage()->at(x, y);
592  typename Mask::iterator maskEnd = getMask()->at(x, y);
593  typename Variance::iterator varianceEnd = getVariance()->at(x, y);
594 
595  return iterator(imageEnd, maskEnd, varianceEnd);
596 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
int y
Definition: SpanSet.cc:49
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:540
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
_view_t::iterator iterator
An STL compliant iterator.
Definition: ImageBase.h:126
double x
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ begin() [1/2]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::begin ( ) const

Return an iterator to the start of the image.

Definition at line 566 of file MaskedImage.cc.

566  {
567 #if 0 // this doesn't compile; why?
568  return iterator(_image->begin(), _mask->begin(), _variance->begin());
569 #else
570  typename Image::iterator imageBegin = _image->begin();
571  typename Mask::iterator maskBegin = _mask->begin();
572  typename Variance::iterator varianceBegin = _variance->begin();
573 
574  return iterator(imageBegin, maskBegin, varianceBegin);
575 #endif
576 }
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:540
_view_t::iterator iterator
An STL compliant iterator.
Definition: ImageBase.h:126

◆ begin() [2/2]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::fast_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::begin ( bool  contiguous) const

Fast iterators to contiguous images.

Return a fast iterator to the start of the image, which must be contiguous Note that the order in which pixels are visited is undefined.

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 660 of file MaskedImage.cc.

660  {
661  typename Image::fast_iterator imageBegin = _image->begin(contiguous);
662  typename Mask::fast_iterator maskBegin = _mask->begin(contiguous);
663  typename Variance::fast_iterator varianceBegin = _variance->begin(contiguous);
664 
665  return fast_iterator(imageBegin, maskBegin, varianceBegin);
666 }
x_iterator fast_iterator
A fast STL compliant iterator for contiguous images N.b.
Definition: ImageBase.h:138
x_iterator fast_iterator
A fast STL compliant iterator for contiguous images N.b.
Definition: MaskedImage.h:565

◆ 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)

◆ col_begin()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::y_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::col_begin ( int  x) const

Return an y_iterator to the start of the image.

Definition at line 640 of file MaskedImage.cc.

640  {
641  typename Image::y_iterator imageBegin = _image->col_begin(x);
642  typename Mask::y_iterator maskBegin = _mask->col_begin(x);
643  typename Variance::y_iterator varianceBegin = _variance->col_begin(x);
644 
645  return y_iterator(imageBegin, maskBegin, varianceBegin);
646 }
MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator > y_iterator
An iterator to a column of a MaskedImage.
Definition: MaskedImage.h:569
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: ImageBase.h:144
double x

◆ col_end()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::y_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::col_end ( int  x) const

Return an y_iterator to the end of the image.

Definition at line 650 of file MaskedImage.cc.

650  {
651  typename Image::y_iterator imageEnd = getImage()->col_end(x);
652  typename Mask::y_iterator maskEnd = getMask()->col_end(x);
653  typename Variance::y_iterator varianceEnd = getVariance()->col_end(x);
654 
655  return y_iterator(imageEnd, maskEnd, varianceEnd);
656 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator > y_iterator
An iterator to a column of a MaskedImage.
Definition: MaskedImage.h:569
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: ImageBase.h:144
double x
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ end() [1/2]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::end ( ) const

Return an iterator to the end of the image.

Definition at line 580 of file MaskedImage.cc.

580  {
581  typename Image::iterator imageEnd = getImage()->end();
582  typename Mask::iterator maskEnd = getMask()->end();
583  typename Variance::iterator varianceEnd = getVariance()->end();
584 
585  return iterator(imageEnd, maskEnd, varianceEnd);
586 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
MaskedImageIterator< typename Image::iterator, typename Mask::iterator, typename Variance::iterator > iterator
Definition: MaskedImage.h:540
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
_view_t::iterator iterator
An STL compliant iterator.
Definition: ImageBase.h:126
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ end() [2/2]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::fast_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::end ( bool  contiguous) const

Return a fast iterator to the end of the image, which must be contiguous Note that the order in which pixels are visited is undefined.

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 670 of file MaskedImage.cc.

670  {
671  typename Image::fast_iterator imageEnd = getImage()->end(contiguous);
672  typename Mask::fast_iterator maskEnd = getMask()->end(contiguous);
673  typename Variance::fast_iterator varianceEnd = getVariance()->end(contiguous);
674 
675  return fast_iterator(imageEnd, maskEnd, varianceEnd);
676 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
x_iterator fast_iterator
A fast STL compliant iterator for contiguous images N.b.
Definition: ImageBase.h:138
x_iterator fast_iterator
A fast STL compliant iterator for contiguous images N.b.
Definition: MaskedImage.h:565
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ getBBox()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::geom::Box2I lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getBBox ( ImageOrigin const  origin = PARENT) const
inline

Definition at line 1098 of file MaskedImage.h.

1098 { return _image->getBBox(origin); }

◆ getDimensions()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::geom::Extent2I lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getDimensions ( ) const
inline

Definition at line 1097 of file MaskedImage.h.

1097 { return _image->getDimensions(); }

◆ getHeight()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
int lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getHeight ( ) const
inline

Return the number of rows in the image.

Definition at line 1096 of file MaskedImage.h.

1096 { return _image->getHeight(); }

◆ 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; }

◆ getImage()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
ImagePtr lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getImage ( ) const
inline

Return a (shared_ptr to) the MaskedImage's image.

Definition at line 1058 of file MaskedImage.h.

1058 { return _image; }

◆ getMask()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskPtr lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getMask ( ) const
inline

Return a (shared_ptr to) the MaskedImage's mask.

Definition at line 1070 of file MaskedImage.h.

1070 { return _mask; }

◆ 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(); }

◆ getVariance()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
VariancePtr lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getVariance ( ) const
inline

Return a (shared_ptr to) the MaskedImage's variance.

Definition at line 1091 of file MaskedImage.h.

1091 { return _variance; }

◆ getWidth()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
int lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getWidth ( ) const
inline

Return the number of columns in the image.

Definition at line 1094 of file MaskedImage.h.

1094 { return _image->getWidth(); }

◆ getX0()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
int lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getX0 ( ) const
inline

Return the image's column-origin.

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

Definition at line 1106 of file MaskedImage.h.

1106 { return _image->getX0(); }

◆ getXY0()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::geom::Point2I lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getXY0 ( ) const
inline

Return the image's origin.

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

Definition at line 1122 of file MaskedImage.h.

1122 { return _image->getXY0(); }

◆ getY0()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
int lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::getY0 ( ) const
inline

Return the image's row-origin.

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

Definition at line 1114 of file MaskedImage.h.

1114 { return _image->getY0(); }

◆ 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()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
double lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::indexToPosition ( double  ind,
lsst::afw::image::xOrY const  xy 
) const
inline

Convert image index to image position (see Image::indexToPosition)

Returns
image position
Parameters
indimage index
xyIs this a column or row coordinate?

Definition at line 1161 of file MaskedImage.h.

1163  {
1164  return getImage()->indexToPosition(ind, xy);
1165  }
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058

◆ 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 }

◆ 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/3]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator*= ( ImagePixelT const  rhs)

Definition at line 353 of file MaskedImage.cc.

353  {
354  *_image *= rhs;
355  *_variance *= rhs * rhs;
356  return *this;
357 }

◆ operator*=() [2/3]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator*= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs)

Definition at line 322 of file MaskedImage.cc.

322  {
323  // Must do variance before we modify the image values
324  transform_pixels(_image->_getRawView(), // lhs
325  rhs._image->_getRawView(), // rhs,
326  _variance->_getRawView(), // Var(lhs),
327  rhs._variance->_getRawView(), // Var(rhs)
328  _variance->_getRawView(), // result
329  productVariance<ImagePixelT, VariancePixelT>());
330 
331  *_image *= *rhs.getImage();
332  *_mask |= *rhs.getMask();
333  return *this;
334 }

◆ operator*=() [3/3]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage& lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator*= ( lsst::afw::image::Image< ImagePixelT > const &  rhs)
inline

Definition at line 880 of file MaskedImage.h.

880  {
881  *_image *= rhs;
882  *_variance *= rhs; // yes, multiply twice
883  *_variance *= rhs;
884  return *this;
885  }

◆ operator+=() [1/4]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator+= ( ImagePixelT const  rhs)

Add a scalar rhs to a MaskedImage.

Definition at line 270 of file MaskedImage.cc.

270  {
271  *_image += rhs;
272  return *this;
273 }

◆ operator+=() [2/4]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator+= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs)

Add a MaskedImage rhs to a MaskedImage.

The image and variances are added; the masks are ORd together

Note
The pixels in the two images are taken to be independent. There is a Pixel operation (plus) which models the covariance, but this is not (yet?) available as full-MaskedImage operators

Definition at line 253 of file MaskedImage.cc.

253  {
254  *_image += *rhs.getImage();
255  *_mask |= *rhs.getMask();
256  *_variance += *rhs.getVariance();
257  return *this;
258 }

◆ operator+=() [3/4]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage& lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator+= ( lsst::afw::image::Image< ImagePixelT > const &  rhs)
inline

Definition at line 835 of file MaskedImage.h.

835  {
836  *_image += rhs;
837  return *this;
838  }

◆ operator+=() [4/4]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage& lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator+= ( lsst::afw::math::Function2< double > const &  function)
inline

Definition at line 839 of file MaskedImage.h.

839  {
840  *_image += function;
841  return *this;
842  }

◆ operator-=() [1/4]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator-= ( ImagePixelT const  rhs)

Subtract a scalar rhs from a MaskedImage.

Definition at line 294 of file MaskedImage.cc.

294  {
295  *_image -= rhs;
296  return *this;
297 }

◆ operator-=() [2/4]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator-= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs)

Subtract a MaskedImage rhs from a MaskedImage.

The images are subtracted; the masks are ORd together; and the variances are added

Note
the pixels in the two images are taken to be independent

Definition at line 277 of file MaskedImage.cc.

277  {
278  *_image -= *rhs.getImage();
279  *_mask |= *rhs.getMask();
280  *_variance += *rhs.getVariance();
281  return *this;
282 }

◆ operator-=() [3/4]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage& lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator-= ( lsst::afw::image::Image< ImagePixelT > const &  rhs)
inline

Definition at line 862 of file MaskedImage.h.

862  {
863  *_image -= rhs;
864  return *this;
865  }

◆ operator-=() [4/4]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage& lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator-= ( lsst::afw::math::Function2< double > const &  function)
inline

Definition at line 866 of file MaskedImage.h.

866  {
867  *_image -= function;
868  return *this;
869  }

◆ operator/=() [1/3]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator/= ( ImagePixelT const  rhs)

Definition at line 414 of file MaskedImage.cc.

414  {
415  *_image /= rhs;
416  *_variance /= rhs * rhs;
417  return *this;
418 }

◆ operator/=() [2/3]

template<typename ImagePixelT, typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator/= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs)

Definition at line 383 of file MaskedImage.cc.

383  {
384  // Must do variance before we modify the image values
385  transform_pixels(_image->_getRawView(), // lhs
386  rhs._image->_getRawView(), // rhs,
387  _variance->_getRawView(), // Var(lhs),
388  rhs._variance->_getRawView(), // Var(rhs)
389  _variance->_getRawView(), // result
390  quotientVariance<ImagePixelT, VariancePixelT>());
391 
392  *_image /= *rhs.getImage();
393  *_mask |= *rhs.getMask();
394  return *this;
395 }

◆ operator/=() [3/3]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage& lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator/= ( lsst::afw::image::Image< ImagePixelT > const &  rhs)
inline

Definition at line 890 of file MaskedImage.h.

890  {
891  *_image /= rhs;
892  *_variance /= rhs; // yes, divide twice
893  *_variance /= rhs;
894  return *this;
895  }

◆ operator<<=()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator<<= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs)

Copy the pixels from the rhs to the lhs.

Deprecated:
use assign(rhs) instead
Note
operator=() is not equivalent to this command

Definition at line 237 of file MaskedImage.cc.

237  {
238  assign(rhs);
239  return *this;
240 }
void assign(MaskedImage const &rhs, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
Copy pixels from another masked image to a specified subregion of this masked image.
Definition: MaskedImage.cc:243

◆ operator=() [1/4]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs)
default

Make the lhs use the rhs's pixels.

If you are copying a scalar value, a simple lhs = scalar; is OK, but this is probably not the function that you want to use with an image. To copy pixel values from the rhs use assign(rhs)

Parameters
rhsRight hand side

◆ operator=() [2/4]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &&  rhs)
default

◆ operator=() [3/4]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::Pixel const &  rhs)

Set the pixels in the MaskedImage to the rhs.

Definition at line 217 of file MaskedImage.cc.

217  {
218  *_image = rhs.image();
219  *_mask = rhs.mask();
220  *_variance = rhs.variance();
221 
222  return *this;
223 }

◆ operator=() [4/4]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > & lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator= ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::SinglePixel const &  rhs)

Set the pixels in the MaskedImage to the rhs.

Definition at line 227 of file MaskedImage.cc.

227  {
228  *_image = rhs.image();
229  *_mask = rhs.mask();
230  *_variance = rhs.variance();
231 
232  return *this;
233 }

◆ operator[]()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::operator[] ( lsst::geom::Box2I const &  bbox) const
inline

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

Definition at line 796 of file MaskedImage.h.

796  {
797  return subset(bbox);
798  }
table::Box2IKey bbox
Definition: Detector.cc:169
MaskedImage subset(lsst::geom::Box2I const &bbox, ImageOrigin origin=PARENT) const
Return a subimage corresponding to the given box.
Definition: MaskedImage.h:791

◆ positionToIndex()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
std::pair<int, double> lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::positionToIndex ( double const  pos,
lsst::afw::image::xOrY const  xy 
) const
inline

Convert image position to index (see Image::positionToIndex)

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

Definition at line 1172 of file MaskedImage.h.

1175  {
1176  return getImage()->positionToIndex(pos, xy);
1177  }
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058

◆ rbegin()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::reverse_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::rbegin ( ) const

Return a reverse_iterator to the start of the image.

Definition at line 600 of file MaskedImage.cc.

600  {
601  typename Image::reverse_iterator imageBegin = _image->rbegin();
602  typename Mask::reverse_iterator maskBegin = _mask->rbegin();
603  typename Variance::reverse_iterator varianceBegin = _variance->rbegin();
604 
605  return reverse_iterator(imageBegin, maskBegin, varianceBegin);
606 }
_view_t::reverse_iterator reverse_iterator
An STL compliant reverse iterator.
Definition: ImageBase.h:130
MaskedImageIterator< typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator > reverse_iterator
Definition: MaskedImage.h:548

◆ readFits() [1/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
static MaskedImage lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::readFits ( std::string const &  filename)
inlinestatic

Read a MaskedImage from a regular FITS file.

Parameters
[in]filenameName of the file to read.

Definition at line 1042 of file MaskedImage.h.

1042  {
1043  return MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>(filename);
1044  }

◆ readFits() [2/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
static MaskedImage lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::readFits ( fits::MemFileManager manager)
inlinestatic

Read a MaskedImage from a FITS RAM file.

Parameters
[in]managerObject that manages the memory to be read.

Definition at line 1051 of file MaskedImage.h.

1051  {
1052  return MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>(manager);
1053  }

◆ rend()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::reverse_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::rend ( ) const

Return a reverse_iterator to the end of the image.

Definition at line 610 of file MaskedImage.cc.

610  {
611  typename Image::reverse_iterator imageEnd = getImage()->rend();
612  typename Mask::reverse_iterator maskEnd = getMask()->rend();
613  typename Variance::reverse_iterator varianceEnd = getVariance()->rend();
614 
615  return reverse_iterator(imageEnd, maskEnd, varianceEnd);
616 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
_view_t::reverse_iterator reverse_iterator
An STL compliant reverse iterator.
Definition: ImageBase.h:130
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskedImageIterator< typename Image::reverse_iterator, typename Mask::reverse_iterator, typename Variance::reverse_iterator > reverse_iterator
Definition: MaskedImage.h:548
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ 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()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::x_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::row_begin ( int  y) const

Return an x_iterator to the start of the image.

Definition at line 620 of file MaskedImage.cc.

620  {
621  typename Image::x_iterator imageBegin = _image->row_begin(y);
622  typename Mask::x_iterator maskBegin = _mask->row_begin(y);
623  typename Variance::x_iterator varianceBegin = _variance->row_begin(y);
624 
625  return x_iterator(imageBegin, maskBegin, varianceBegin);
626 }
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:134
int y
Definition: SpanSet.cc:49
MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator > x_iterator
An iterator to a row of a MaskedImage.
Definition: MaskedImage.h:557

◆ row_end()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::x_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::row_end ( int  y) const

Return an x_iterator to the end of the image.

Definition at line 630 of file MaskedImage.cc.

630  {
631  typename Image::x_iterator imageEnd = getImage()->row_end(y);
632  typename Mask::x_iterator maskEnd = getMask()->row_end(y);
633  typename Variance::x_iterator varianceEnd = getVariance()->row_end(y);
634 
635  return x_iterator(imageEnd, maskEnd, varianceEnd);
636 }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:134
int y
Definition: SpanSet.cc:49
MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator > x_iterator
An iterator to a row of a MaskedImage.
Definition: MaskedImage.h:557
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ scaledDivides()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::scaledDivides ( double const  c,
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs 
)

Definition at line 398 of file MaskedImage.cc.

399  {
400  // Must do variance before we modify the image values
401  transform_pixels(_image->_getRawView(), // lhs
402  rhs._image->_getRawView(), // rhs,
403  _variance->_getRawView(), // Var(lhs),
404  rhs._variance->_getRawView(), // Var(rhs)
405  _variance->_getRawView(), // result
406  scaledQuotientVariance<ImagePixelT, VariancePixelT>(c));
407 
408  (*_image).scaledDivides(c, *rhs.getImage());
409  *_mask |= *rhs._mask;
410 }

◆ scaledMinus()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::scaledMinus ( double const  c,
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs 
)

Subtract a scaled MaskedImage c*rhs from a MaskedImage.

The images are subtracted; the masks are ORd together; and the variances are added

Note
the pixels in the two images are taken to be independent

Definition at line 285 of file MaskedImage.cc.

286  {
287  (*_image).scaledMinus(c, *rhs.getImage());
288  *_mask |= *rhs.getMask();
289  (*_variance).scaledPlus(c * c, *rhs.getVariance());
290 }

◆ scaledMultiplies()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::scaledMultiplies ( double const  c,
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs 
)

Definition at line 337 of file MaskedImage.cc.

338  {
339  // Must do variance before we modify the image values
340  transform_pixels(_image->_getRawView(), // lhs
341  rhs._image->_getRawView(), // rhs,
342  _variance->_getRawView(), // Var(lhs),
343  rhs._variance->_getRawView(), // Var(rhs)
344  _variance->_getRawView(), // result
345  scaledProductVariance<ImagePixelT, VariancePixelT>(c));
346 
347  (*_image).scaledMultiplies(c, *rhs.getImage());
348  *_mask |= *rhs.getMask();
349 }

◆ scaledPlus()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::scaledPlus ( double const  c,
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  rhs 
)

Add a scaled MaskedImage c*rhs to a MaskedImage.

The image and variances are added; the masks are ORd together

Note
The pixels in the two images are taken to be independent. There is a Pixel operation (plus) which models the covariance, but this is not (yet?) available as full-MaskedImage operators

Definition at line 261 of file MaskedImage.cc.

262  {
263  (*_image).scaledPlus(c, *rhs.getImage());
264  *_mask |= *rhs.getMask();
265  (*_variance).scaledPlus(c * c, *rhs.getVariance());
266 }

◆ 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

◆ setImage()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::setImage ( Image const &  other)
inline

Set the image plane's pixel values to those of another Image.

This copies pixel values, not pointers.

Exceptions
pex::exceptions::LengthErrorif dimensions do not match.

Definition at line 1067 of file MaskedImage.h.

1067 { _image->assign(other); }
ItemVariant const * other
Definition: Schema.cc:56

◆ setMask()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::setMask ( Mask const &  other)
inline

Set the mask plane's pixel values to those of another Mask.

This copies pixel values, not pointers.

Exceptions
pex::exceptions::LengthErrorif dimensions do not match.

Definition at line 1079 of file MaskedImage.h.

1079 { _mask->assign(other); }
ItemVariant const * other
Definition: Schema.cc:56

◆ 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

◆ setVariance()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::setVariance ( Variance const &  other)
inline

Set the variance plane's pixel values to those of another Image.

This copies pixel values, not pointers.

Exceptions
pex::exceptions::LengthErrorif dimensions do not match.

Definition at line 1088 of file MaskedImage.h.

1088 { _variance->assign(other); }
ItemVariant const * other
Definition: Schema.cc:56

◆ setXY0() [1/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::setXY0 ( int const  x0,
int const  y0 
)
inline

Set the MaskedImage'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 1132 of file MaskedImage.h.

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

◆ setXY0() [2/2]

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::setXY0 ( lsst::geom::Point2I const  origin)
inline

Set the MaskedImage'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 1142 of file MaskedImage.h.

1142  {
1143  if (_image) {
1144  _image->setXY0(origin);
1145  }
1146 
1147  if (_mask) {
1148  _mask->setXY0(origin);
1149  }
1150 
1151  if (_variance) {
1152  _variance->setXY0(origin);
1153  }
1154  }

◆ subset()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
MaskedImage lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::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 791 of file MaskedImage.h.

791  {
792  return MaskedImage(*this, bbox, origin, false);
793  }
MaskedImage(unsigned int width, unsigned int height, MaskPlaneDict const &planeDict=MaskPlaneDict())
Construct from a supplied dimensions.
Definition: MaskedImage.cc:48
table::Box2IKey bbox
Definition: Detector.cc:169

◆ swap()

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::swap ( MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &  rhs)

Definition at line 206 of file MaskedImage.cc.

206  {
207  using std::swap; // See Meyers, Effective C++, Item 25
208 
209  _image.swap(rhs._image);
210  _mask.swap(rhs._mask);
211  _variance.swap(rhs._variance);
212 }
T swap(T... args)

◆ writeFits() [1/6]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::writeFits ( std::string const &  fileName,
std::shared_ptr< daf::base::PropertySet const >  metadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  imageMetadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  maskMetadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  varianceMetadata = std::shared_ptr<daf::base::PropertySet const>() 
) const

Write a MaskedImage to a regular FITS file.

Parameters
[in]fileNameName of the file to write. When writing separate files, this is the "base" of the filename (e.g. foo reads foo_{img.msk.var}.fits).
[in]metadataAdditional values to write to the primary HDU header (may be null).
[in]imageMetadataMetadata to be written to the image header.
[in]maskMetadataMetadata to be written to the mask header.
[in]varianceMetadataMetadata to be written to the variance header.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the "INHERIT='T'" convention to indicate that the primary metadata applies to those HDUs as well.

Definition at line 421 of file MaskedImage.cc.

425  {
426  fits::Fits fitsfile(fileName, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
427  writeFits(fitsfile, metadata, imageMetadata, maskMetadata, varianceMetadata);
428 }
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421

◆ writeFits() [2/6]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::writeFits ( fits::MemFileManager manager,
std::shared_ptr< daf::base::PropertySet const >  metadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  imageMetadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  maskMetadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  varianceMetadata = std::shared_ptr<daf::base::PropertySet const>() 
) const

Write a MaskedImage to a FITS RAM file.

Parameters
[in]managerManager object for the memory block to write to.
[in]metadataAdditional values to write to the primary HDU header (may be null).
[in]imageMetadataMetadata to be written to the image header.
[in]maskMetadataMetadata to be written to the mask header.
[in]varianceMetadataMetadata to be written to the variance header.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the "INHERIT='T'" convention to indicate that the primary metadata applies to those HDUs as well.

Definition at line 431 of file MaskedImage.cc.

435  {
436  fits::Fits fitsfile(manager, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
437  writeFits(fitsfile, metadata, imageMetadata, maskMetadata, varianceMetadata);
438 }
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421

◆ writeFits() [3/6]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::writeFits ( fits::Fits fitsfile,
std::shared_ptr< daf::base::PropertySet const >  metadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  imageMetadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  maskMetadata = std::shared_ptr<daf::base::PropertySet const>(),
std::shared_ptr< daf::base::PropertySet const >  varianceMetadata = std::shared_ptr<daf::base::PropertySet const>() 
) const

Write a MaskedImage to a FITS file.

Parameters
[in]fitsfileAn empty FITS file object.
[in]metadataAdditional values to write to the primary HDU header (may be null).
[in]imageMetadataMetadata to be written to the image header.
[in]maskMetadataMetadata to be written to the mask header.
[in]varianceMetadataMetadata to be written to the variance header.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the "INHERIT='T'" convention to indicate that the primary metadata applies to those HDUs as well.

Definition at line 456 of file MaskedImage.cc.

460  {
461  writeFits(fitsfile, fits::ImageWriteOptions(*_image), fits::ImageWriteOptions(*_mask),
462  fits::ImageWriteOptions(*_variance), metadata, imageMetadata, maskMetadata, varianceMetadata);
463 }
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421

◆ writeFits() [4/6]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::writeFits ( std::string const &  fileName,
fits::ImageWriteOptions const &  imageOptions,
fits::ImageWriteOptions const &  maskOptions,
fits::ImageWriteOptions const &  varianceOptions,
std::shared_ptr< daf::base::PropertySet const >  metadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  imageMetadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  maskMetadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  varianceMetadata = nullptr 
) const

Write a MaskedImage to a FITS file.

Parameters
[in]fileNameName of the file to write.
[in]imageOptionsOptions controlling writing of image as FITS.
[in]maskOptionsOptions controlling writing of mask as FITS.
[in]varianceOptionsOptions controlling writing of variance as FITS.
[in]metadataAdditional values to write to the primary HDU header (may be null).
[in]imageMetadataMetadata to be written to the image header.
[in]maskMetadataMetadata to be written to the mask header.
[in]varianceMetadataMetadata to be written to the variance header.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the "INHERIT='T'" convention to indicate that the primary metadata applies to those HDUs as well.

Definition at line 466 of file MaskedImage.cc.

472  {
473  fits::Fits fitsfile(fileName, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
474  writeFits(fitsfile, imageOptions, maskOptions, varianceOptions, metadata, imageMetadata, maskMetadata,
475  varianceMetadata);
476 }
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421

◆ writeFits() [5/6]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::writeFits ( fits::MemFileManager manager,
fits::ImageWriteOptions const &  imageOptions,
fits::ImageWriteOptions const &  maskOptions,
fits::ImageWriteOptions const &  varianceOptions,
std::shared_ptr< daf::base::PropertySet const >  metadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  imageMetadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  maskMetadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  varianceMetadata = nullptr 
) const

Write a MaskedImage to a FITS file.

Parameters
[in]managerManager object for the memory block to write to.
[in]imageOptionsOptions controlling writing of image as FITS.
[in]maskOptionsOptions controlling writing of mask as FITS.
[in]varianceOptionsOptions controlling writing of variance as FITS.
[in]metadataAdditional values to write to the primary HDU header (may be null).
[in]imageMetadataMetadata to be written to the image header.
[in]maskMetadataMetadata to be written to the mask header.
[in]varianceMetadataMetadata to be written to the variance header.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the "INHERIT='T'" convention to indicate that the primary metadata applies to those HDUs as well.

Definition at line 479 of file MaskedImage.cc.

485  {
486  fits::Fits fitsfile(manager, "w", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
487  writeFits(fitsfile, imageOptions, maskOptions, varianceOptions, metadata, imageMetadata, maskMetadata,
488  varianceMetadata);
489 }
void writeFits(std::string const &fileName, std::shared_ptr< daf::base::PropertySet const > metadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > imageMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > maskMetadata=std::shared_ptr< daf::base::PropertySet const >(), std::shared_ptr< daf::base::PropertySet const > varianceMetadata=std::shared_ptr< daf::base::PropertySet const >()) const
Write a MaskedImage to a regular FITS file.
Definition: MaskedImage.cc:421

◆ writeFits() [6/6]

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
void lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::writeFits ( fits::Fits fitsfile,
fits::ImageWriteOptions const &  imageOptions,
fits::ImageWriteOptions const &  maskOptions,
fits::ImageWriteOptions const &  varianceOptions,
std::shared_ptr< daf::base::PropertySet const >  metadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  imageMetadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  maskMetadata = nullptr,
std::shared_ptr< daf::base::PropertySet const >  varianceMetadata = nullptr 
) const

Write a MaskedImage to a FITS file.

Parameters
[in]fitsfileAn empty FITS file object.
[in]imageOptionsOptions controlling writing of image as FITS.
[in]maskOptionsOptions controlling writing of mask as FITS.
[in]varianceOptionsOptions controlling writing of variance as FITS.
[in]metadataAdditional values to write to the primary HDU header (may be null).
[in]imageMetadataMetadata to be written to the image header.
[in]maskMetadataMetadata to be written to the mask header.
[in]varianceMetadataMetadata to be written to the variance header.

The FITS file will have four HDUs; the primary HDU will contain only metadata, while the image, mask, and variance HDU headers will use the "INHERIT='T'" convention to indicate that the primary metadata applies to those HDUs as well.

Definition at line 492 of file MaskedImage.cc.

498  {
500  if (metadata) {
501  header = metadata->deepCopy();
502  } else {
503  header = std::make_shared<daf::base::PropertyList>();
504  }
505 
506  if (fitsfile.countHdus() != 0) {
507  throw LSST_EXCEPT(pex::exceptions::LogicError,
508  "MaskedImage::writeFits can only write to an empty file");
509  }
510  if (fitsfile.getHdu() < 1) {
511  // Don't ever write images to primary; instead we make an empty primary.
512  fitsfile.createEmpty();
513  } else {
514  fitsfile.setHdu(0);
515  }
516  fitsfile.writeMetadata(*header);
517 
518  processPlaneMetadata(imageMetadata, header, "IMAGE");
519  _image->writeFits(fitsfile, imageOptions, header, _mask);
520 
521  processPlaneMetadata(maskMetadata, header, "MASK");
522  _mask->writeFits(fitsfile, maskOptions, header);
523 
524  processPlaneMetadata(varianceMetadata, header, "VARIANCE");
525  _variance->writeFits(fitsfile, varianceOptions, header, _mask);
526 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ x_at()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
x_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::x_at ( int  x,
int  y 
) const
inline

Return an x_iterator at the point (x, y)

Definition at line 1220 of file MaskedImage.h.

1220  {
1221 #if 0
1222  typename Image::x_iterator imageEnd = getImage()->x_at(x, y);
1223  typename Mask::x_iterator maskEnd = getMask()->x_at(x, y);
1224  typename Variance::x_iterator varianceEnd = getVariance()->x_at(x, y);
1225 #else // bypass checks for non-NULL pointers
1226  typename Image::x_iterator imageEnd = _image->x_at(x, y);
1227  typename Mask::x_iterator maskEnd = _mask->x_at(x, y);
1228  typename Variance::x_iterator varianceEnd = _variance->x_at(x, y);
1229 #endif
1230 
1231  return x_iterator(imageEnd, maskEnd, varianceEnd);
1232  }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:134
int y
Definition: SpanSet.cc:49
MaskedImageIterator< typename Image::x_iterator, typename Mask::x_iterator, typename Variance::x_iterator > x_iterator
An iterator to a row of a MaskedImage.
Definition: MaskedImage.h:557
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
double x
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

◆ xy_at()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
xy_locator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::xy_at ( int  x,
int  y 
) const
inline

Return an xy_locator at the point (x, y)

Definition at line 1254 of file MaskedImage.h.

1254  {
1255 #if 0
1256  typename Image::xy_locator imageEnd = getImage()->xy_at(x, y);
1257  typename Mask::xy_locator maskEnd = getMask()->xy_at(x, y);
1258  typename Variance::xy_locator varianceEnd = getVariance()->xy_at(x, y);
1259 #else // bypass checks for non-NULL pointers
1260  typename Image::xy_locator imageEnd = _image->xy_at(x, y);
1261  typename Mask::xy_locator maskEnd = _mask->xy_at(x, y);
1262  typename Variance::xy_locator varianceEnd = _variance->xy_at(x, y);
1263 #endif
1264 
1265  return xy_locator(imageEnd, maskEnd, varianceEnd);
1266  }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
int y
Definition: SpanSet.cc:49
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
double x
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070
MaskedImageLocator< typename Image::xy_locator, typename Mask::xy_locator, typename Variance::xy_locator > xy_locator
A locator for a MaskedImage.
Definition: MaskedImage.h:578
_view_t::xy_locator xy_locator
An xy_locator.
Definition: ImageBase.h:122

◆ y_at()

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
y_iterator lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT >::y_at ( int  x,
int  y 
) const
inline

Return an y_iterator at the point (x, y)

Definition at line 1240 of file MaskedImage.h.

1240  {
1241 #if 0
1242  typename Image::y_iterator imageEnd = getImage()->y_at(x, y);
1243  typename Mask::y_iterator maskEnd = getMask()->y_at(x, y);
1244  typename Variance::y_iterator varianceEnd = getVariance()->y_at(x, y);
1245 #else // bypass checks for non-NULL pointers
1246  typename Image::y_iterator imageEnd = _image->y_at(x, y);
1247  typename Mask::y_iterator maskEnd = _mask->y_at(x, y);
1248  typename Variance::y_iterator varianceEnd = _variance->y_at(x, y);
1249 #endif
1250  return y_iterator(imageEnd, maskEnd, varianceEnd);
1251  }
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
int y
Definition: SpanSet.cc:49
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
MaskedImageIterator< typename Image::y_iterator, typename Mask::y_iterator, typename Variance::y_iterator > y_iterator
An iterator to a column of a MaskedImage.
Definition: MaskedImage.h:569
_view_t::y_iterator y_iterator
An iterator for traversing the pixels in a column.
Definition: ImageBase.h:144
double x
MaskPtr getMask() const
Return a (shared_ptr to) the MaskedImage&#39;s mask.
Definition: MaskedImage.h:1070

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