LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Attributes | List of all members
lsst.afw.detection::FootprintSet Class Reference

A set of Footprints, associated with a MaskedImage. More...

#include <FootprintSet.h>

Inheritance diagram for lsst.afw.detection::FootprintSet:
lsst.daf.base::Citizen

Public Types

typedef std::vector
< Footprint::Ptr
FootprintList
 The FootprintSet's set of Footprints. More...
 
- Public Types inherited from lsst.daf.base::Citizen
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

template<typename ImagePixelT >
 FootprintSet (image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
 
template<typename MaskPixelT >
 FootprintSet (image::Mask< MaskPixelT > const &img, Threshold const &threshold, int const npixMin=1)
 
template<typename ImagePixelT , typename MaskPixelT >
 FootprintSet (image::MaskedImage< ImagePixelT, MaskPixelT > const &img, Threshold const &threshold, std::string const &planeName="", int const npixMin=1, bool const setPeaks=true)
 Find a FootprintSet given a MaskedImage and a threshold. More...
 
template<typename ImagePixelT , typename MaskPixelT >
 FootprintSet (image::MaskedImage< ImagePixelT, MaskPixelT > const &img, Threshold const &threshold, int x, int y, std::vector< boost::shared_ptr< Peak >> const *peaks=NULL)
 
 FootprintSet (geom::Box2I region)
 
 FootprintSet (FootprintSet const &)
 
 FootprintSet (FootprintSet const &set, int rGrow, FootprintControl const &ctrl)
 
 FootprintSet (FootprintSet const &set, int rGrow, bool isotropic=true)
 
 FootprintSet (FootprintSet const &footprints1, FootprintSet const &footprints2, bool const includePeaks)
 
FootprintSetoperator= (FootprintSet const &rhs)
 Assignment operator. More...
 
void swap (FootprintSet &rhs)
 
boost::shared_ptr< FootprintListgetFootprints ()
 
void setFootprints (boost::shared_ptr< FootprintList > footprints)
 
boost::shared_ptr
< FootprintList const > const 
getFootprints () const
 
void makeSources (afw::table::SourceCatalog &catalog) const
 Add a new record corresponding to each footprint to a SourceCatalog. More...
 
void setRegion (geom::Box2I const &region)
 
geom::Box2I const getRegion () const
 
boost::shared_ptr
< image::Image
< FootprintIdPixel > > 
insertIntoImage (const bool relativeIDs) const
 
template<typename MaskPixelT >
void setMask (image::Mask< MaskPixelT > *mask, std::string const &planeName)
 
template<typename MaskPixelT >
void setMask (boost::shared_ptr< image::Mask< MaskPixelT > > mask, std::string const &planeName)
 
void merge (FootprintSet const &rhs, int tGrow=0, int rGrow=0, bool isotropic=true)
 
template<typename ImagePixelT , typename MaskPixelT >
void makeHeavy (image::MaskedImage< ImagePixelT, MaskPixelT > const &mimg, HeavyFootprintCtrl const *ctrl=NULL)
 
- Public Member Functions inherited from lsst.daf.base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (Citizen const &)
 
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...
 

Private Attributes

boost::shared_ptr< FootprintList_footprints
 the Footprints of detected objects More...
 
geom::Box2I _region
 The corners of the MaskedImage that the detections live in. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from lsst.daf.base::Citizen
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...
 
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...
 
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...
 
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

A set of Footprints, associated with a MaskedImage.

Examples:
footprintFunctor.cc, and spatialCellExample.cc.

Definition at line 53 of file FootprintSet.h.

Member Typedef Documentation

The FootprintSet's set of Footprints.

Examples:
footprintFunctor.cc.

Definition at line 57 of file FootprintSet.h.

Constructor & Destructor Documentation

template<typename ImagePixelT >
lsst.afw.detection::FootprintSet::FootprintSet ( image::Image< ImagePixelT > const &  img,
Threshold const &  threshold,
int const  npixMin = 1,
bool const  setPeaks = true 
)
Parameters
imgImage to search for objects
thresholdthreshold to find objects
npixMinminimum number of pixels in an object
setPeaksshould I set the Peaks list?

Definition at line 741 of file FootprintSet.cc.

746  : lsst::daf::base::Citizen(typeid(this)),
747  _footprints(new FootprintList()),
748  _region(img.getBBox())
749 {
750  typedef float VariancePixelT;
751 
752  findFootprints<ImagePixelT, afw::image::MaskPixel, VariancePixelT, ThresholdLevel_traits>(
753  _footprints.get(),
754  _region,
755  img,
756  NULL,
757  threshold.getValue(img), threshold.getIncludeMultiplier(), threshold.getPolarity(),
758  npixMin,
759  setPeaks
760  );
761 }
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
geom::Box2I getBBox(ImageOrigin origin=PARENT) const
Definition: Image.h:377
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
int const npixMin
Definition: saturated.cc:72
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
template<typename MaskPixelT >
lsst.afw.detection::FootprintSet::FootprintSet ( image::Mask< MaskPixelT > const &  msk,
Threshold const &  threshold,
int const  npixMin = 1 
)
Parameters
mskImage to search for objects
thresholdthreshold to find objects
npixMinminimum number of pixels in an object

Definition at line 769 of file FootprintSet.cc.

773  : lsst::daf::base::Citizen(typeid(this)),
774  _footprints(new FootprintList()),
775  _region(msk.getBBox())
776 {
777  switch (threshold.getType()) {
778  case Threshold::BITMASK:
779  findFootprints<MaskPixelT, MaskPixelT, float, ThresholdBitmask_traits>(
780  _footprints.get(), _region, msk, NULL, threshold.getValue(), threshold.getIncludeMultiplier(),
781  threshold.getPolarity(), npixMin, false);
782  break;
783 
784  case Threshold::VALUE:
785  findFootprints<MaskPixelT, MaskPixelT, float, ThresholdLevel_traits>(
786  _footprints.get(), _region, msk, NULL, threshold.getValue(), threshold.getIncludeMultiplier(),
787  threshold.getPolarity(), npixMin, false);
788  break;
789 
790  default:
791  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
792  "You must specify a numerical threshold value with a Mask");
793  }
794 }
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
Use (pixels &amp; (given mask))
Definition: Threshold.h:49
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
geom::Box2I getBBox(ImageOrigin origin=PARENT) const
Definition: Image.h:377
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
int const npixMin
Definition: saturated.cc:72
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
template<typename ImagePixelT , typename MaskPixelT >
lsst.afw.detection::FootprintSet::FootprintSet ( image::MaskedImage< ImagePixelT, MaskPixelT > const &  img,
Threshold const &  threshold,
std::string const &  planeName = "",
int const  npixMin = 1,
bool const  setPeaks = true 
)

Find a FootprintSet given a MaskedImage and a threshold.

Go through an image, finding sets of connected pixels above threshold and assembling them into Footprints; the resulting set of objects is returned as an array<Footprint::Ptr>

If threshold.getPolarity() is true, pixels above the Threshold are assembled into Footprints; if it's false, then pixels below Threshold are processed (Threshold will probably have to be below the background level for this to make sense, e.g. for difference imaging)

Parameters
imgMaskedImage to search for objects
thresholdthreshold for footprints (controls size)
planeNamemask plane to set (if != "")
npixMinminimum number of pixels in an object
setPeaksshould I set the Peaks list?

Definition at line 810 of file FootprintSet.cc.

816  : lsst::daf::base::Citizen(typeid(this)),
817  _footprints(new FootprintList()),
818  _region(
819  geom::Point2I(maskedImg.getX0(), maskedImg.getY0()),
820  geom::Extent2I(maskedImg.getWidth(), maskedImg.getHeight())
821  )
822 {
823  typedef typename image::MaskedImage<ImagePixelT, MaskPixelT>::Variance::Pixel VariancePixelT;
824  // Find the Footprints
825  switch (threshold.getType()) {
827  findFootprints<ImagePixelT, MaskPixelT, VariancePixelT, ThresholdPixelLevel_traits>(
828  _footprints.get(),
829  _region,
830  *maskedImg.getImage(),
831  maskedImg.getVariance().get(),
832  threshold.getValue(maskedImg),
833  threshold.getIncludeMultiplier(),
834  threshold.getPolarity(),
835  npixMin,
836  setPeaks
837  );
838  break;
839  default:
840  findFootprints<ImagePixelT, MaskPixelT, VariancePixelT, ThresholdLevel_traits>(
841  _footprints.get(),
842  _region,
843  *maskedImg.getImage(),
844  maskedImg.getVariance().get(),
845  threshold.getValue(maskedImg),
846  threshold.getIncludeMultiplier(),
847  threshold.getPolarity(),
848  npixMin,
849  setPeaks
850  );
851  break;
852  }
853  // Set Mask if requested
854  if (planeName == "") {
855  return;
856  }
857  //
858  // Define the maskPlane
859  //
860  const typename image::Mask<MaskPixelT>::Ptr mask = maskedImg.getMask();
861  mask->addMaskPlane(planeName);
862 
863  MaskPixelT const bitPlane = mask->getPlaneBitMask(planeName);
864  //
865  // Set the bits where objects are detected
866  //
867  typedef image::Mask<MaskPixelT> MaskT;
868 
869  class MaskFootprint : public detection::FootprintFunctor<MaskT> {
870  public:
871  MaskFootprint(MaskT const& mimage,
872  MaskPixelT bit) : detection::FootprintFunctor<MaskT>(mimage), _bit(bit) {}
873 
874  void operator()(typename MaskT::xy_locator loc, int, int) {
875  *loc |= _bit;
876  }
877  private:
878  MaskPixelT _bit;
879  };
880 
881  MaskFootprint maskit(*maskedImg.getMask(), bitPlane);
882  for (FootprintList::const_iterator fiter = _footprints->begin();
883  fiter != _footprints->end(); ++fiter
884  ) {
885  Footprint::Ptr const foot = *fiter;
886 
887  maskit.apply(*foot);
888  }
889 }
Use number of sigma given per-pixel s.d.
Definition: Threshold.h:52
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:75
static int addMaskPlane(const std::string &name)
Definition: Mask.cc:699
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:859
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:93
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
int const npixMin
Definition: saturated.cc:72
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
A functor class to allow users to process all the pixels in a Footprint.
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
template<typename ImagePixelT , typename MaskPixelT >
lsst.afw.detection::FootprintSet::FootprintSet ( image::MaskedImage< ImagePixelT, MaskPixelT > const &  img,
Threshold const &  threshold,
int  x,
int  y,
std::vector< boost::shared_ptr< Peak >> const *  peaks = NULL 
)

Return a FootprintSet consisting a Footprint containing the point (x, y) (if above threshold)

Todo:
Implement this. There's RHL Pan-STARRS code to do it, but it isn't yet converted to LSST C++
Parameters
imgImage to search for objects
thresholdthreshold to find objects
xFootprint should include this pixel (column)
yFootprint should include this pixel (row)
peaksFootprint should include at most one of these peaks

Definition at line 898 of file FootprintSet.cc.

904  : lsst::daf::base::Citizen(typeid(this)),
905  _footprints(new FootprintList()),
906  _region(geom::Point2I(img.getX0(), img.getY0()),
907  geom::Extent2I(img.getWidth(), img.getHeight()))
908 {
909  throw LSST_EXCEPT(lsst::pex::exceptions::LogicError, "NOT IMPLEMENTED");
910 }
int getWidth() const
Return the number of columns in the image.
Definition: MaskedImage.h:901
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:903
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
lsst.afw.detection::FootprintSet::FootprintSet ( geom::Box2I  region)

Construct an empty FootprintSet given a region that its footprints would have lived in

Parameters
regionthe desired region

Definition at line 1315 of file FootprintSet.cc.

1316  :
1317  lsst::daf::base::Citizen(typeid(this)),
1319 }
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
#define PTR(...)
Definition: base.h:41
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
lsst.afw.detection::FootprintSet::FootprintSet ( FootprintSet const &  rhs)

Copy constructor

Parameters
rhsthe input FootprintSet

Definition at line 1324 of file FootprintSet.cc.

1326  :
1327  lsst::daf::base::Citizen(typeid(this)),
1328  _footprints(new FootprintList), _region(rhs._region)
1329 {
1330  _footprints->reserve(rhs._footprints->size());
1331  for (FootprintSet::FootprintList::const_iterator ptr = rhs._footprints->begin(),
1332  end = rhs._footprints->end(); ptr != end; ++ptr) {
1333  _footprints->push_back(PTR(Footprint)(new Footprint(**ptr)));
1334  }
1335 }
lsst::afw::detection::Footprint Footprint
Definition: Source.h:61
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
#define PTR(...)
Definition: base.h:41
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
lsst.afw.detection::FootprintSet::FootprintSet ( detection::FootprintSet const &  rhs,
int  rGrow,
detection::FootprintControl const &  ctrl 
)

Definition at line 1407 of file FootprintSet.cc.

1410  : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1411 {
1412  if (ngrow == 0) {
1413  FootprintSet fs = rhs;
1414  swap(fs); // Swap the new FootprintSet into place
1415  return;
1416  } else if (ngrow < 0) {
1417  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1418  str(boost::format("I cannot grow by negative numbers: %d") % ngrow));
1419  }
1420 
1421  detection::FootprintSet fs = mergeFootprintSets(FootprintSet(rhs.getRegion()), 0, rhs, ngrow, ctrl);
1422  swap(fs); // Swap the new FootprintSet into place
1423 }
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:157
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
lsst.afw.detection::FootprintSet::FootprintSet ( FootprintSet const &  rhs,
int  r,
bool  isotropic = true 
)

Grow all the Footprints in the input FootprintSet, returning a new FootprintSet

The output FootprintSet may contain fewer Footprints, as some may well have been merged

Parameters
rhsthe input FootprintSet
rGrow Footprints by r pixels
isotropicGrow isotropically (as opposed to a Manhattan metric)
Note
Isotropic grows are significantly slower

Definition at line 1383 of file FootprintSet.cc.

1389  : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1390 {
1391  if (r == 0) {
1392  FootprintSet fs = rhs;
1393  swap(fs); // Swap the new FootprintSet into place
1394  return;
1395  } else if (r < 0) {
1396  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1397  (boost::format("I cannot grow by negative numbers: %d") % r).str());
1398  }
1399 
1400  detection::FootprintControl const ctrl(true, isotropic);
1401  detection::FootprintSet fs = mergeFootprintSets(FootprintSet(rhs.getRegion()), 0, rhs, r, ctrl);
1402  swap(fs); // Swap the new FootprintSet into place
1403 }
A Control Object for Footprints, controlling e.g. how they are grown.
Definition: FootprintCtrl.h:36
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:157
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
lsst.afw.detection::FootprintSet::FootprintSet ( FootprintSet const &  fs1,
FootprintSet const &  fs2,
bool const  includePeaks 
)

Return the FootprintSet corresponding to the merge of two input FootprintSets

Todo:
Implement this. There's RHL Pan-STARRS code to do it, but it isn't yet converted to LSST C++

Definition at line 1431 of file FootprintSet.cc.

1436  : lsst::daf::base::Citizen(typeid(this)),
1437  _footprints(new FootprintList()),
1438  _region(fs1._region)
1439 {
1440  _region.include(fs2._region);
1441  throw LSST_EXCEPT(lsst::pex::exceptions::LogicError, "NOT IMPLEMENTED");
1442 }
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
void include(Point2I const &point)
Expand this to ensure that this-&gt;contains(point).
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228

Member Function Documentation

boost::shared_ptr< FootprintList > lsst.afw.detection::FootprintSet::getFootprints ( )
inline

: Return the Footprints of detected objects

Definition at line 168 of file FootprintSet.h.

168 { return _footprints; }
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
boost::shared_ptr< FootprintList const> const lsst.afw.detection::FootprintSet::getFootprints ( ) const
inline

Retun the Footprints of detected objects

Definition at line 178 of file FootprintSet.h.

178 { return _footprints; }
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
geom::Box2I const lsst.afw.detection::FootprintSet::getRegion ( ) const
inline

Return the corners of the MaskedImage

Definition at line 195 of file FootprintSet.h.

195 { return _region; }
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
boost::shared_ptr< image::Image< detection::FootprintIdPixel > > lsst.afw.detection::FootprintSet::insertIntoImage ( const bool  relativeIDs) const

Return an Image with pixels set to the Footprints in the FootprintSet

Returns
an image::Image::Ptr
Parameters
relativeIDsUse IDs starting at 0 (rather than the ones in the Footprints)

Definition at line 1451 of file FootprintSet.cc.

1453  {
1455  new image::Image<detection::FootprintIdPixel>(_region)
1456  );
1457  *im = 0;
1458 
1459  detection::FootprintIdPixel id = 0;
1460  for (FootprintList::const_iterator fiter = _footprints->begin();
1461  fiter != _footprints->end(); fiter++
1462  ) {
1463  Footprint::Ptr const foot = *fiter;
1464 
1465  if (relativeIDs) {
1466  id++;
1467  } else {
1468  id = foot->getId();
1469  }
1470 
1471  foot->insertIntoImage(*im.get(), id);
1472  }
1473 
1474  return im;
1475 }
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
Definition: saturated.cc:82
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:75
#define PTR(...)
Definition: base.h:41
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
boost::uint64_t FootprintIdPixel
Definition: FootprintSet.h:46
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
int id
Definition: CR.cc:151
A class to represent a 2-dimensional array of pixels.
Definition: PSF.h:43
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
template<typename ImagePixelT , typename MaskPixelT >
void lsst.afw.detection::FootprintSet::makeHeavy ( image::MaskedImage< ImagePixelT, MaskPixelT > const &  mimg,
HeavyFootprintCtrl const *  ctrl = NULL 
)

Convert all the Footprints in the FootprintSet to be HeavyFootprints

Parameters
mimgthe image providing pixel values
ctrlControl how we manipulate HeavyFootprints

Definition at line 1483 of file FootprintSet.cc.

1487 {
1488  HeavyFootprintCtrl ctrl_s = HeavyFootprintCtrl();
1489 
1490  if (!ctrl) {
1491  ctrl = &ctrl_s;
1492  }
1493 
1494  for (FootprintList::iterator ptr = _footprints->begin(),
1495  end = _footprints->end(); ptr != end; ++ptr) {
1496  ptr->reset(new detection::HeavyFootprint<ImagePixelT, MaskPixelT>(**ptr, mimg, ctrl));
1497  }
1498 }
A set of pixels in an Image, including those pixels&#39; actual values.
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
void lsst.afw.detection::FootprintSet::makeSources ( afw::table::SourceCatalog catalog) const

Add a new record corresponding to each footprint to a SourceCatalog.

Parameters
[in,out]catalogCatalog to append new sources to.

The new sources will have their footprints set to point to the footprints in the footprint set; they will not be deep-copied.

Definition at line 1500 of file FootprintSet.cc.

1502  {
1503  for (FootprintList::const_iterator i = _footprints->begin(); i != _footprints->end(); ++i) {
1504  PTR(afw::table::SourceRecord) r = cat.addNew();
1505  r->setFootprint(*i);
1506  }
1507 }
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
void lsst.afw.detection::FootprintSet::merge ( detection::FootprintSet const &  rhs,
int  tGrow = 0,
int  rGrow = 0,
bool  isotropic = true 
)

Merge a FootprintSet into *this

Parameters
rhsthe Footprints to merge
tGrowNo. of pixels to grow this Footprints
rGrowNo. of pixels to grow rhs Footprints
isotropicUse (expensive) isotropic grow

Definition at line 1349 of file FootprintSet.cc.

1355 {
1356  detection::FootprintControl const ctrl(true, isotropic);
1357  detection::FootprintSet fs = mergeFootprintSets(*this, tGrow, rhs, rGrow, ctrl);
1358  swap(fs); // Swap the new FootprintSet into place
1359 }
A Control Object for Footprints, controlling e.g. how they are grown.
Definition: FootprintCtrl.h:36
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:157
detection::FootprintSet & lsst.afw.detection::FootprintSet::operator= ( FootprintSet const &  rhs)

Assignment operator.

Definition at line 1339 of file FootprintSet.cc.

1339  {
1340  FootprintSet tmp(rhs);
1341  swap(tmp); // See Meyers, Effective C++, Item 11
1342  return *this;
1343 }
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:157
void lsst.afw.detection::FootprintSet::setFootprints ( boost::shared_ptr< FootprintList footprints)
inline

: Set the Footprints of detected objects

Definition at line 173 of file FootprintSet.h.

173 { _footprints = footprints; }
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
template<typename MaskPixelT >
void lsst.afw.detection::FootprintSet::setMask ( image::Mask< MaskPixelT > *  mask,
std::string const &  planeName 
)
inline
Parameters
maskSet bits in the mask
planeNameHere's the name of the mask plane to fit

Definition at line 202 of file FootprintSet.h.

205  {
207  mask,
208  _footprints, // calling getFootprints() confuses clang++ 3.0 and leaks memory
210  );
211  }
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:93
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
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&#39;s pixels which are in the set of Footprints.
template<typename MaskPixelT >
void lsst.afw.detection::FootprintSet::setMask ( boost::shared_ptr< image::Mask< MaskPixelT > >  mask,
std::string const &  planeName 
)
inline
Parameters
maskSet bits in the mask
planeNameHere's the name of the mask plane to fit

Definition at line 214 of file FootprintSet.h.

217  {
218  setMask(mask.get(), planeName);
219  }
void setMask(image::Mask< MaskPixelT > *mask, std::string const &planeName)
Definition: FootprintSet.h:202
void lsst.afw.detection::FootprintSet::setRegion ( geom::Box2I const &  region)

Set the corners of the FootprintSet's MaskedImage to region

N.b. updates all the Footprints' regions too

Parameters
regiondesired region

Definition at line 1365 of file FootprintSet.cc.

1367  {
1368  _region = region;
1369 
1370  for (FootprintSet::FootprintList::iterator ptr = _footprints->begin(),
1371  end = _footprints->end(); ptr != end; ++ptr
1372  ) {
1373  (*ptr)->setRegion(region);
1374  }
1375 }
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
void lsst.afw.detection::FootprintSet::swap ( FootprintSet rhs)
inline

Definition at line 157 of file FootprintSet.h.

157  {
158  using std::swap; // See Meyers, Effective C++, Item 25
159  swap(*_footprints, *rhs.getFootprints());
160  geom::Box2I rhsRegion = rhs.getRegion();
161  rhs.setRegion(getRegion());
162  setRegion(rhsRegion);
163  }
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291
geom::Box2I const getRegion() const
Definition: FootprintSet.h:195
An integer coordinate rectangle.
Definition: Box.h:53
void setRegion(geom::Box2I const &region)
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:157
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228

Member Data Documentation

boost::shared_ptr<FootprintList> lsst.afw.detection::FootprintSet::_footprints
private

the Footprints of detected objects

Definition at line 228 of file FootprintSet.h.

geom::Box2I lsst.afw.detection::FootprintSet::_region
private

The corners of the MaskedImage that the detections live in.

Definition at line 229 of file FootprintSet.h.


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