LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Namespaces | Functions
lsst::coadd::utils Namespace Reference

Namespaces

 coadd
 
 coaddDataIdContainer
 
 makeBitMask
 
 version
 

Functions

template<typename CoaddPixelT , typename WeightPixelT >
lsst::afw::geom::Box2I addToCoadd (lsst::afw::image::Image< CoaddPixelT > &coadd, lsst::afw::image::Image< WeightPixelT > &weightMap, lsst::afw::image::Image< CoaddPixelT > const &image, WeightPixelT weight)
 add good pixels from an image to a coadd and associated weight map More...
 
template<typename CoaddPixelT , typename WeightPixelT >
lsst::afw::geom::Box2I addToCoadd (lsst::afw::image::MaskedImage< CoaddPixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > &coadd, lsst::afw::image::Image< WeightPixelT > &weightMap, lsst::afw::image::MaskedImage< CoaddPixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > const &maskedImage, lsst::afw::image::MaskPixel const badPixelMask, WeightPixelT weight)
 add good pixels from a masked image to a coadd image and associated weight map More...
 
template<typename ImagePixelT >
int copyGoodPixels (lsst::afw::image::Image< ImagePixelT > &destImage, lsst::afw::image::Image< ImagePixelT > const &srcImage)
 copy good pixels from one image to another More...
 
template<typename ImagePixelT >
int copyGoodPixels (lsst::afw::image::MaskedImage< ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > &destImage, lsst::afw::image::MaskedImage< ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > const &srcImage, lsst::afw::image::MaskPixel const badPixelMask)
 copy good pixels from one masked image to another More...
 
template<typename WeightPixelT >
void setCoaddEdgeBits (lsst::afw::image::Mask< lsst::afw::image::MaskPixel > &coaddMask, lsst::afw::image::Image< WeightPixelT > const &weightMap)
 set edge bits of coadd mask based on weight map More...
 

Function Documentation

template<typename CoaddPixelT , typename WeightPixelT >
lsst::afw::geom::Box2I lsst::coadd::utils::addToCoadd ( lsst::afw::image::Image< CoaddPixelT > &  coadd,
lsst::afw::image::Image< WeightPixelT > &  weightMap,
lsst::afw::image::Image< CoaddPixelT > const &  image,
WeightPixelT  weight 
)

add good pixels from an image to a coadd and associated weight map

The images are assumed to be registered to the same wcs and parent origin, thus: coadd[i+coadd.x0, j+coadd.y0] += image[i+image.x0, j+image.y0] weightMap[i+weightMap.x0, j+weightMap.y0] += weight for all good image pixels that overlap a coadd pixel. Good pixels are those that are not NaN (thus they do include +/- inf).

Returns
overlapBBox: overlapping bounding box, relative to parent image (hence xy0 is taken into account)
Exceptions
pexExcept::InvalidParameterErrorif coadd and weightMap dimensions or xy0 do not match.
Parameters
[in,out]coaddcoadd to be modified
[in,out]weightMapweight map to be modified; this is the sum of weights of all images contributing each pixel of the coadd
imageimage to add to coadd
weightrelative weight of this image

Definition at line 126 of file addToCoadd.cc.

132  {
134  return addToCoaddImpl<Image, WeightPixelT, CheckKnownValue>(coadd, weightMap, image, 0x0, weight);
135 }
tbl::Key< double > weight
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
A class to represent a 2-dimensional array of pixels.
Definition: PSF.h:43
template<typename CoaddPixelT , typename WeightPixelT >
lsst::afw::geom::Box2I lsst::coadd::utils::addToCoadd ( lsst::afw::image::MaskedImage< CoaddPixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > &  coadd,
lsst::afw::image::Image< WeightPixelT > &  weightMap,
lsst::afw::image::MaskedImage< CoaddPixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > const &  maskedImage,
lsst::afw::image::MaskPixel const  badPixelMask,
WeightPixelT  weight 
)

add good pixels from a masked image to a coadd image and associated weight map

The images are assumed to be registered to the same wcs and parent origin, thus: coadd[i+coadd.x0, j+coadd.y0] += image[i+image.x0, j+image.y0] weightMap[i+weightMap.x0, j+weightMap.y0] += weight for all good image pixels that overlap a coadd pixel. Good pixels are those for which mask & badPixelMask == 0.

Returns
overlapBBox: overlapping bounding box, relative to parent image (hence xy0 is taken into account)
Exceptions
pexExcept::InvalidParameterErrorif coadd and weightMap dimensions or xy0 do not match.
Parameters
[in,out]coaddcoadd to be modified
[in,out]weightMapweight map to be modified; this is the sum of weights of all images contributing each pixel of the coadd
maskedImagemasked image to add to coadd
badPixelMaskskip input pixel if input mask & badPixelMask !=0
weightrelative weight of this image

Definition at line 138 of file addToCoadd.cc.

147  {
149  return addToCoaddImpl<Image,WeightPixelT,CheckMask>(coadd, weightMap, maskedImage, badPixelMask, weight);
150 }
tbl::Key< double > weight
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
template<typename ImagePixelT >
int lsst::coadd::utils::copyGoodPixels ( lsst::afw::image::Image< ImagePixelT > &  destImage,
lsst::afw::image::Image< ImagePixelT > const &  srcImage 
)

copy good pixels from one image to another

Good pixels are those that are not NaN (thus they do include +/- inf).

Only the overlapping pixels (relative to the parent) are copied; thus the images do not have to be the same size.

Returns
number of pixels copied
Parameters
[in,out]destImageimage to be modified
srcImageimage to copy

Definition at line 115 of file copyGoodPixels.cc.

119  {
121  return copyGoodPixelsImpl<Image, CheckKnownValue>(destImage, srcImage, 0x0);
122 }
template<typename ImagePixelT >
int lsst::coadd::utils::copyGoodPixels ( lsst::afw::image::MaskedImage< ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > &  destImage,
lsst::afw::image::MaskedImage< ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > const &  srcImage,
lsst::afw::image::MaskPixel const  badPixelMask 
)

copy good pixels from one masked image to another

Good pixels are those for which mask & badPixelMask == 0.

Only the overlapping pixels (relative to the parent) are copied; thus the images do not have to be the same size.

Returns
number of pixels copied
Parameters
[in,out]destImageimage to be modified
srcImageimage to copy
badPixelMaskskip input pixel if src mask & badPixelMask != 0

Definition at line 125 of file copyGoodPixels.cc.

132  {
134  return copyGoodPixelsImpl<Image, CheckMask>(destImage, srcImage, badPixelMask);
135 }
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
template<typename WeightPixelT >
void lsst::coadd::utils::setCoaddEdgeBits ( lsst::afw::image::Mask< lsst::afw::image::MaskPixel > &  coaddMask,
lsst::afw::image::Image< WeightPixelT > const &  weightMap 
)

set edge bits of coadd mask based on weight map

Set pixels in the image to the edge pixel when the corresponding pixel in the weight map is zero. The edge pixel is image=nan, variance=inf, mask=NO_DATA for masked images and image=nan for plain images.

Exceptions
pexExcept::InvalidParameterErrorif the dimensions of coaddMask and weightMap do not match.
Parameters
[in,out]coaddMaskmask of coadd
weightMapweight map

Definition at line 40 of file setCoaddEdgeBits.cc.

44  {
46  typedef typename afwImage::Image<WeightPixelT>::const_x_iterator WeightMapConstXIter;
47 
48  if (coaddMask.getDimensions() != weightMap.getDimensions()) {
49  throw LSST_EXCEPT(pexExcept::InvalidParameterError,
50  (boost::format("coaddMask and weightMap dimensions differ: %dx%d != %dx%d") %
51  coaddMask.getWidth() % coaddMask.getHeight() % weightMap.getWidth() % weightMap.getHeight()
52  ).str());
53  }
54 
56 
57  // Set the pixels row by row, to avoid repeated checks for end-of-row
58  for (int y = 0, endY = weightMap.getHeight(); y != endY; ++y) {
59  WeightMapConstXIter weightMapPtr = weightMap.row_begin(y);
60  WeightMapConstXIter const weightMapEndPtr = weightMap.row_end(y);
61  MaskXIter coaddMaskPtr = coaddMask.row_begin(y);
62  for (; weightMapPtr != weightMapEndPtr; ++weightMapPtr, ++coaddMaskPtr) {
63  if (*weightMapPtr == 0) {
64  (*coaddMaskPtr) = (*coaddMaskPtr) | edgeMask;
65  }
66  }
67  }
68 }
int y
boost::uint16_t MaskPixel
x_iterator row_begin(int y) const
Definition: Image.h:319
x_iterator row_end(int y) const
Return an x_iterator to the end of the y&#39;th row.
Definition: Image.h:324
int getWidth() const
Return the number of columns in the image.
Definition: Image.h:237
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR&#39;d together.
Definition: Mask.cc:860
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:93
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
int getHeight() const
Return the number of rows in the image.
Definition: Image.h:239
geom::Extent2I getDimensions() const
Return the image&#39;s size; useful for passing to constructors.
Definition: Image.h:298
A class to represent a 2-dimensional array of pixels.
Definition: PSF.h:43