LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Namespaces | Classes | Typedefs | Functions
lsst::afw::detection Namespace Reference

Namespaces

 utils
 

Classes

class  Footprint
 A set of pixels in an Image. More...
 
class  FootprintControl
 A Control Object for Footprints, controlling e.g. how they are grown. More...
 
class  HeavyFootprintCtrl
 A control object for HeavyFootprints. More...
 
class  FootprintFunctor
 A functor class to allow users to process all the pixels in a Footprint. More...
 
class  FootprintMergeList
 List of Merged Footprints. More...
 
class  FootprintSet
 A set of Footprints, associated with a MaskedImage. More...
 
class  GaussianPsf
 A circularly symmetric Gaussian Psf class with no spatial variation, intended mostly for testing purposes. More...
 
class  HeavyFootprint
 A set of pixels in an Image, including those pixels' actual values. More...
 
class  PeakRecord
 Record class that represents a peak in a Footprint. More...
 
class  PeakTable
 Table class for Peaks in Footprints. More...
 
class  Psf
 A polymorphic base class for representing an image's Point Spread Function. More...
 
class  PsfFormatter
 Formatter for persistence of Psf instances. More...
 
class  Threshold
 A Threshold is used to pass a threshold value to detection algorithms. More...
 
class  FootprintMerge
 
class  IdSpan
 
struct  IdSpanCompar
 

Typedefs

typedef boost::uint64_t FootprintIdPixel
 
typedef
afw::table::ColumnViewT
< PeakRecord
PeakColumnView
 
typedef afw::table::CatalogT
< PeakRecord
PeakCatalog
 
typedef afw::table::CatalogT
< PeakRecord const > 
ConstPeakCatalog
 

Functions

void nearestFootprint (std::vector< boost::shared_ptr< Footprint >> const &foots, lsst::afw::image::Image< boost::uint16_t >::Ptr argmin, lsst::afw::image::Image< boost::uint16_t >::Ptr dist)
 
boost::shared_ptr< FootprintmergeFootprints (Footprint const &foot1, Footprint const &foot2)
 
boost::shared_ptr< FootprintmergeFootprints (Footprint &foot1, Footprint &foot2)
 
boost::shared_ptr< FootprintshrinkFootprint (Footprint const &foot, int nGrow, bool isotropic)
 
boost::shared_ptr< FootprintgrowFootprint (Footprint const &foot, int nGrow, bool isotropic=true)
 
boost::shared_ptr< FootprintgrowFootprint (boost::shared_ptr< Footprint > const &foot, int nGrow, bool isotropic=true)
 
boost::shared_ptr< FootprintgrowFootprint (Footprint const &foot, int nGrow, bool left, bool right, bool up, bool down)
 Grow a Footprint in at least one of the cardinal directions, returning a new Footprint. More...
 
std::vector
< lsst::afw::geom::Box2I
footprintToBBoxList (Footprint const &foot)
 
template<typename ImageT >
ImageT::Pixel setImageFromFootprint (ImageT *image, Footprint const &footprint, typename ImageT::Pixel const value)
 Set all image pixels in a Footprint to a given value. More...
 
template<typename ImageT >
ImageT::Pixel setImageFromFootprintList (ImageT *image, boost::shared_ptr< std::vector< boost::shared_ptr< Footprint >> const > footprints, typename ImageT::Pixel const value)
 Set all image pixels in a set of Footprints to a given value. More...
 
template<typename ImageT >
ImageT::Pixel setImageFromFootprintList (ImageT *image, std::vector< boost::shared_ptr< Footprint >> const &footprints, typename ImageT::Pixel const value)
 Set all image pixels in a set of Footprints to a given value. More...
 
template<typename MaskT >
MaskT setMaskFromFootprint (lsst::afw::image::Mask< MaskT > *mask, Footprint const &footprint, MaskT const bitmask)
 OR bitmask into all the Mask's pixels that are in the Footprint. More...
 
template<typename MaskT >
MaskT clearMaskFromFootprint (lsst::afw::image::Mask< MaskT > *mask, Footprint const &footprint, MaskT const bitmask)
 (AND ~bitmask) all the Mask's pixels that are in the Footprint; that is, set to zero in the Mask-intersecting-Footprint all bits that are 1 in then bitmask. More...
 
template<typename ImageOrMaskedImageT >
void copyWithinFootprint (Footprint const &foot, boost::shared_ptr< ImageOrMaskedImageT > const input, boost::shared_ptr< ImageOrMaskedImageT > output)
 
template<typename MaskT >
MaskT setMaskFromFootprintList (lsst::afw::image::Mask< MaskT > *mask, std::vector< boost::shared_ptr< Footprint >> const &footprints, MaskT const bitmask)
 OR bitmask into all the Mask's pixels which are in the set of Footprints. More...
 
template<typename MaskT >
MaskT setMaskFromFootprintList (lsst::afw::image::Mask< MaskT > *mask, boost::shared_ptr< std::vector< boost::shared_ptr< Footprint >> const > const &footprints, MaskT const bitmask)
 OR bitmask into all the Mask's pixels which are in the set of Footprints. More...
 
template<typename MaskT >
boost::shared_ptr< FootprintfootprintAndMask (boost::shared_ptr< Footprint > const &foot, typename image::Mask< MaskT >::Ptr const &mask, MaskT const bitmask)
 Return a Footprint that's the intersection of a Footprint with a Mask. More...
 
template<typename T , typename U , int N, int C, int D>
void flattenArray (Footprint const &fp, ndarray::Array< T, N, C > const &src, ndarray::Array< U, N-1, D > const &dest, lsst::afw::geom::Point2I const &xy0=lsst::afw::geom::Point2I())
 Flatten the first two dimensions of an array. More...
 
template<typename T , typename U , int N, int C, int D, typename PixelOpT >
void flattenArray (Footprint const &fp, ndarray::Array< T, N, C > const &src, ndarray::Array< U, N-1, D > const &dest, PixelOpT const &pixelOp, lsst::afw::geom::Point2I const &xy0=lsst::afw::geom::Point2I())
 Flatten the first two dimensions of an array. More...
 
template<typename T , int N, int C>
ndarray::Array< typename
boost::remove_const< T >::type,
N-1, N-1 > 
flattenArray (Footprint const &fp, ndarray::Array< T, N, C > const &src, lsst::afw::geom::Point2I const &xy0=lsst::afw::geom::Point2I())
 Flatten the first two dimensions of an array Use this footprint to map 2-D points in the source to 1-D locations in the destination. This forces a deep copy of some of the relevant parts of source. More...
 
template<typename T , typename U , int N, int C, int D>
void expandArray (Footprint const &fp, ndarray::Array< T, N, C > const &src, ndarray::Array< U, N+1, D > const &dest, lsst::afw::geom::Point2I const &xy0=lsst::afw::geom::Point2I())
 expand the first dimension of an array More...
 
template<typename T , typename U , int N, int C, int D, typename PixelOpT >
void expandArray (Footprint const &fp, ndarray::Array< T, N, C > const &src, ndarray::Array< U, N+1, D > const &dest, PixelOpT const &pixelOp, lsst::afw::geom::Point2I const &xy0=lsst::afw::geom::Point2I())
 expand the first dimension of an array, applying a functor to each pixel More...
 
template<typename T , int N, int C>
ndarray::Array< typename
boost::remove_const< T >::type,
N+1, N+1 > 
expandArray (Footprint const &fp, ndarray::Array< T, N, C > const &src, lsst::afw::geom::Box2I const &bbox=lsst::afw::geom::Box2I())
 expand the first dimension of an array More...
 
template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
HeavyFootprint< ImagePixelT,
MaskPixelT, VariancePixelT > 
makeHeavyFootprint (Footprint const &foot, lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &img, HeavyFootprintCtrl const *ctrl=NULL)
 
template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
boost::shared_ptr
< HeavyFootprint< ImagePixelT,
MaskPixelT, VariancePixelT > > 
mergeHeavyFootprints (HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &h1, HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &h2)
 
std::ostream & operator<< (std::ostream &os, PeakRecord const &record)
 
Threshold createThreshold (double const value, std::string const typeStr, bool const polarity)
 Factory method for creating Threshold objects. More...
 
int resolve_alias (const std::vector< int > &aliases, int id)
 

Typedef Documentation

Definition at line 226 of file Peak.h.

typedef boost::uint64_t lsst::afw::detection::FootprintIdPixel

Pixel type for FootprintSet::insertIntoImage()

This is independent of the template parameters for FootprintSet, and including it within FootprintSet makes it difficult for SWIG to interpret the type.

Definition at line 46 of file FootprintSet.h.

Definition at line 225 of file Peak.h.

Definition at line 224 of file Peak.h.

Function Documentation

template<typename MaskT >
MaskT lsst::afw::detection::clearMaskFromFootprint ( lsst::afw::image::Mask< MaskT > *  mask,
Footprint const &  footprint,
MaskT const  bitmask 
)

(AND ~bitmask) all the Mask's pixels that are in the Footprint; that is, set to zero in the Mask-intersecting-Footprint all bits that are 1 in then bitmask.

Returns
bitmask
template<typename ImageOrMaskedImageT >
void lsst::afw::detection::copyWithinFootprint ( Footprint const &  foot,
boost::shared_ptr< ImageOrMaskedImageT > const  input,
boost::shared_ptr< ImageOrMaskedImageT >  output 
)

Copies pixels from input image to output image within the Footprint's area.

The input and output image must be the same type – either Image or MaskedImage.

Respects image xy0, so the footprints should be defined in the "PARENT" frame.

Pixels that are in the footprint but do not overlap with both images are not copied.

Threshold lsst::afw::detection::createThreshold ( double const  value,
std::string const  typeStr,
bool const  polarity 
)

Factory method for creating Threshold objects.

Parameters
valuevalue of threshold
typeStrstring representation of a ThresholdType. This parameter is optional. Allowed values are: "variance", "value", "stdev", "pixel_stdev"
polarityIf true detect positive objects, false for negative
Returns
desired Threshold

Definition at line 138 of file Threshold.cc.

142  {
143  return Threshold(value, Threshold::parseTypeString(typeStr), polarity);
144 }
template<typename T , typename U , int N, int C, int D>
void lsst::afw::detection::expandArray ( Footprint const &  fp,
ndarray::Array< T, N, C > const &  src,
ndarray::Array< U, N+1, D > const &  dest,
lsst::afw::geom::Point2I const &  xy0 = lsst::afw::geom::Point2I() 
)

expand the first dimension of an array

Use this footprint to map 1-D positions in the source to 2-D points in the destination. This forces a deep copy of the relevant parts of the source.

Parameters
[in]fpfootprint to operate on
[in]srcarray to copy from. The size of the outer dimension must match the area of the footprint.
[out]destarray to copy to. The dimensions of the array must be height, width, inner N-1 dimensions of the source.
[in]xy0xy0 of the src array in the footprint's coordinate system

For example,

expandArray(foot, array, image.getArray(), image.getXY0());
template<typename T , typename U , int N, int C, int D, typename PixelOpT >
void lsst::afw::detection::expandArray ( Footprint const &  fp,
ndarray::Array< T, N, C > const &  src,
ndarray::Array< U, N+1, D > const &  dest,
PixelOpT const &  pixelOp,
lsst::afw::geom::Point2I const &  xy0 = lsst::afw::geom::Point2I() 
)

expand the first dimension of an array, applying a functor to each pixel

Use this footprint to map 1-D positions in the source to 2-D points in the destination. This forces a deep copy of the relevant parts of the source.

Parameters
[in]fpfootprint to operate on
[in]srcarray to copy from. The size of the outer dimension must match the area of the footprint.
[out]destarray to copy to. The dimensions of the array must be height, width, inner N-1 dimensions of the source.
[in]pixelOpFunctor taking src's pixel value, and returning the value of dest
[in]xy0xy0 of the src array in the footprint's coordinate system
template<typename T , int N, int C>
ndarray::Array<typename boost::remove_const<T>::type, N+1, N+1> lsst::afw::detection::expandArray ( Footprint const &  fp,
ndarray::Array< T, N, C > const &  src,
lsst::afw::geom::Box2I const &  bbox = lsst::afw::geom::Box2I() 
)

expand the first dimension of an array

Use this footprint to map 1-D positions in the source to 2-D points in the destination. This whose first two dimension are determined by the bounds of this footprint, and whose remaming dimensions are determined by the inner N-1 dimensions of the source. the forces a deep copy of the source

Parameters
[in]fpfootprint to operate on
[in]srcarray to copy from. The size of the outer dimension must match the area of the footprint.
[in]bboxbounding box of the returned array.
template<typename T , typename U , int N, int C, int D>
void lsst::afw::detection::flattenArray ( Footprint const &  fp,
ndarray::Array< T, N, C > const &  src,
ndarray::Array< U, N-1, D > const &  dest,
lsst::afw::geom::Point2I const &  xy0 = lsst::afw::geom::Point2I() 
)

Flatten the first two dimensions of an array.

Use this footprint to map 2-D points in the source to 1-D position in the destination. This forces a deep copy of the relevant parts of the source.

Parameters
[in]fpfootprint to operate on
[in]srcarray to copy from. The first two dimensions are (height, width).
[out]destarray to copy to. The dimensions of the dest must be area of the footprint, inner N-1 dimensions of the source
[in]xy0xy0 of the src array in the footprint's coordinate system

For example,

flattenArray(foot, image.getArray(), array, image.getXY0());
template<typename T , typename U , int N, int C, int D, typename PixelOpT >
void lsst::afw::detection::flattenArray ( Footprint const &  fp,
ndarray::Array< T, N, C > const &  src,
ndarray::Array< U, N-1, D > const &  dest,
PixelOpT const &  pixelOp,
lsst::afw::geom::Point2I const &  xy0 = lsst::afw::geom::Point2I() 
)

Flatten the first two dimensions of an array.

Use this footprint to map 2-D points in the source to 1-D position in the destination. This forces a deep copy of the relevant parts of the source.

Parameters
[in]fpfootprint to operate on
[in]srcarray to copy from. The first two dimensions are (height, width).
[out]destarray to copy to. The dimensions of the dest must be area of the footprint, inner N-1 dimensions of the source
[in]pixelOpFunctor taking src's pixel value, and returning the value of dest
[in]xy0xy0 of the src array in the footprint's coordinate system

For example,

flattenArray(foot, image.getArray(), array, pixelOp(), image.getXY0());
template<typename T , int N, int C>
ndarray::Array<typename boost::remove_const<T>::type, N-1, N-1> lsst::afw::detection::flattenArray ( Footprint const &  fp,
ndarray::Array< T, N, C > const &  src,
lsst::afw::geom::Point2I const &  xy0 = lsst::afw::geom::Point2I() 
)

Flatten the first two dimensions of an array Use this footprint to map 2-D points in the source to 1-D locations in the destination. This forces a deep copy of some of the relevant parts of source.

Parameters
[in]fpfootprint to operate on
[in]srcarray to copy from. The first two dimensions are (height, width); the remainder are copied exactly.
[in]xy0xy0 of the src array in the footprint's coordinate system

For example,

array = flattenArray(foot, image.getArray(), image.getXY0());
template<typename MaskT >
boost::shared_ptr< Footprint > lsst::afw::detection::footprintAndMask ( boost::shared_ptr< Footprint > const &  foot,
typename image::Mask< MaskT >::Ptr const &  mask,
MaskT const  bitmask 
)

Return a Footprint that's the intersection of a Footprint with a Mask.

The resulting Footprint contains only pixels for which (mask & bitMask) != 0; it may have disjoint pieces

Note
This isn't a member of Footprint as Footprint isn't templated over MaskT

foot: The initial Footprint mask: The mask to & with foot bitmask: Only consider these bits

Returns
Returns the new Footprint
std::vector<lsst::afw::geom::Box2I> lsst::afw::detection::footprintToBBoxList ( Footprint const &  foot)

Return a list of BBoxs, whose union contains exactly the pixels in foot, neither more nor less

Useful in generating sets of meas::algorithms::Defects for the ISR

boost::shared_ptr< Footprint > lsst::afw::detection::growFootprint ( Footprint const &  foot,
int  nGrow,
bool  isotropic = true 
)

Grow a Footprint by nGrow pixels, returning a new Footprint.

boost::shared_ptr< Footprint > lsst::afw::detection::growFootprint ( boost::shared_ptr< Footprint > const &  foot,
int  nGrow,
bool  isotropic = true 
)
Note
Deprecated interface; use the Footprint const& version.
boost::shared_ptr< Footprint > lsst::afw::detection::growFootprint ( Footprint const &  foot,
int  nGrow,
bool  left,
bool  right,
bool  up,
bool  down 
)

Grow a Footprint in at least one of the cardinal directions, returning a new Footprint.

Note that any left/right grow is done prior to the up/down grow, so any left/right grown pixels are subject to a further up/down grow (i.e. an initial single pixel Footprint will end up as a square, not a cross.

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> lsst::afw::detection::makeHeavyFootprint ( Footprint const &  foot,
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &  img,
HeavyFootprintCtrl const *  ctrl = NULL 
)

Create a HeavyFootprint with footprint defined by the given Footprint and pixel values from the given MaskedImage.

Definition at line 139 of file HeavyFootprint.h.

144 {
145  return HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>(foot, img, ctrl);
146 }
boost::shared_ptr< Footprint > lsst::afw::detection::mergeFootprints ( Footprint const &  foot1,
Footprint const &  foot2 
)

Merges two Footprints – appends their peaks, and unions their spans, returning a new Footprint.

This const version requires that both input footprints are normalized (and will raise an exception if not).

boost::shared_ptr< Footprint > lsst::afw::detection::mergeFootprints ( Footprint &  foot1,
Footprint &  foot2 
)

Merges two Footprints – appends their peaks, and unions their spans, returning a new Footprint.

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
boost::shared_ptr<HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> > lsst::afw::detection::mergeHeavyFootprints ( HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &  h1,
HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > const &  h2 
)

Sum the two given HeavyFootprints h1 and h2, returning a HeavyFootprint with the union footprint, and summed pixels where they overlap. The peak list is the union of the two inputs.

void lsst::afw::detection::nearestFootprint ( std::vector< boost::shared_ptr< Footprint >> const &  foots,
lsst::afw::image::Image< boost::uint16_t >::Ptr  argmin,
lsst::afw::image::Image< boost::uint16_t >::Ptr  dist 
)

Given a vector of Footprints, fills the output "argmin" and "dist" images to contain the Manhattan distance to the nearest footprint (in "dist") and the identity of the nearest footprint (in "argmin").

For example, if there are two footprints at y=0 covering x=[1,2] and [7,7],

Index : 0 1 2 3 4 5 6 7

Footprints: . 0 0 . . . . 1

Argmin : 0 0 0 0 0 1 1 1

Dist : 1 0 0 1 2 2 1 0

"argmin" gives the index of the nearest footprint, and "dist" its Manhattan (L_1 norm) distance. The pixel at index 4 is closest to footprint 0, and its distance is 2.

std::ostream & lsst::afw::detection::operator<< ( std::ostream &  os,
PeakRecord const &  record 
)

Definition at line 147 of file Peak.cc.

147  {
148  return os << (boost::format("%d: (%d,%d) (%.3f,%.3f)")
149  % record.getId()
150  % record.getIx() % record.getIy()
151  % record.getFx() % record.getFy());
152 }
int lsst::afw::detection::resolve_alias ( const std::vector< int > &  aliases,
int  id 
)

Follow a chain of aliases, returning the final resolved value.

Definition at line 92 of file CR.cc.

93  { /* alias to look up */
94  int resolved = id; /* resolved alias */
95 
96  while (id != aliases[id]) {
97  resolved = id = aliases[id];
98  }
99 
100  return(resolved);
101 }
int id
Definition: CR.cc:151
template<typename ImageT >
ImageT::Pixel lsst::afw::detection::setImageFromFootprint ( ImageT *  image,
Footprint const &  footprint,
typename ImageT::Pixel const  value 
)

Set all image pixels in a Footprint to a given value.

Returns
value
template<typename ImageT >
ImageT::Pixel lsst::afw::detection::setImageFromFootprintList ( ImageT *  image,
boost::shared_ptr< std::vector< boost::shared_ptr< Footprint >> const >  footprints,
typename ImageT::Pixel const  value 
)

Set all image pixels in a set of Footprints to a given value.

Returns
value
template<typename ImageT >
ImageT::Pixel lsst::afw::detection::setImageFromFootprintList ( ImageT *  image,
std::vector< boost::shared_ptr< Footprint >> const &  footprints,
typename ImageT::Pixel const  value 
)

Set all image pixels in a set of Footprints to a given value.

Returns
value
template<typename MaskT >
MaskT lsst::afw::detection::setMaskFromFootprint ( lsst::afw::image::Mask< MaskT > *  mask,
Footprint const &  footprint,
MaskT const  bitmask 
)

OR bitmask into all the Mask's pixels that are in the Footprint.

Returns
bitmask
template<typename MaskT >
MaskT lsst::afw::detection::setMaskFromFootprintList ( lsst::afw::image::Mask< MaskT > *  mask,
std::vector< boost::shared_ptr< Footprint >> const &  footprints,
MaskT const  bitmask 
)

OR bitmask into all the Mask's pixels which are in the set of Footprints.

Returns
bitmask
template<typename MaskT >
MaskT lsst::afw::detection::setMaskFromFootprintList ( lsst::afw::image::Mask< MaskT > *  mask,
boost::shared_ptr< std::vector< boost::shared_ptr< Footprint >> const > const &  footprints,
MaskT const  bitmask 
)

OR bitmask into all the Mask's pixels which are in the set of Footprints.

Returns
bitmask
boost::shared_ptr< Footprint > lsst::afw::detection::shrinkFootprint ( Footprint const &  foot,
int  nGrow,
bool  isotropic 
)

Shrink a footprint isotropically by nGrow pixels, returning a new Footprint.