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
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...
 
 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)
 
void swapFootprintList (FootprintList &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 749 of file FootprintSet.cc.

754  : lsst::daf::base::Citizen(typeid(this)),
755  _footprints(new FootprintList()),
756  _region(img.getBBox())
757 {
758  typedef float VariancePixelT;
759 
760  findFootprints<ImagePixelT, afw::image::MaskPixel, VariancePixelT, ThresholdLevel_traits>(
761  _footprints.get(),
762  _region,
763  img,
764  NULL,
765  threshold.getValue(img), threshold.getIncludeMultiplier(), threshold.getPolarity(),
766  npixMin,
767  setPeaks
768  );
769 }
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:207
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
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
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 777 of file FootprintSet.cc.

781  : lsst::daf::base::Citizen(typeid(this)),
782  _footprints(new FootprintList()),
783  _region(msk.getBBox())
784 {
785  switch (threshold.getType()) {
786  case Threshold::BITMASK:
787  findFootprints<MaskPixelT, MaskPixelT, float, ThresholdBitmask_traits>(
788  _footprints.get(), _region, msk, NULL, threshold.getValue(), threshold.getIncludeMultiplier(),
789  threshold.getPolarity(), npixMin, false);
790  break;
791 
792  case Threshold::VALUE:
793  findFootprints<MaskPixelT, MaskPixelT, float, ThresholdLevel_traits>(
794  _footprints.get(), _region, msk, NULL, threshold.getValue(), threshold.getIncludeMultiplier(),
795  threshold.getPolarity(), npixMin, false);
796  break;
797 
798  default:
799  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
800  "You must specify a numerical threshold value with a Mask");
801  }
802 }
Use (pixels &amp; (given mask))
Definition: Threshold.h:49
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:207
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
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
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 818 of file FootprintSet.cc.

824  : lsst::daf::base::Citizen(typeid(this)),
825  _footprints(new FootprintList()),
826  _region(
827  geom::Point2I(maskedImg.getX0(), maskedImg.getY0()),
828  geom::Extent2I(maskedImg.getWidth(), maskedImg.getHeight())
829  )
830 {
831  typedef typename image::MaskedImage<ImagePixelT, MaskPixelT>::Variance::Pixel VariancePixelT;
832  // Find the Footprints
833  switch (threshold.getType()) {
835  findFootprints<ImagePixelT, MaskPixelT, VariancePixelT, ThresholdPixelLevel_traits>(
836  _footprints.get(),
837  _region,
838  *maskedImg.getImage(),
839  maskedImg.getVariance().get(),
840  threshold.getValue(maskedImg),
841  threshold.getIncludeMultiplier(),
842  threshold.getPolarity(),
843  npixMin,
844  setPeaks
845  );
846  break;
847  default:
848  findFootprints<ImagePixelT, MaskPixelT, VariancePixelT, ThresholdLevel_traits>(
849  _footprints.get(),
850  _region,
851  *maskedImg.getImage(),
852  maskedImg.getVariance().get(),
853  threshold.getValue(maskedImg),
854  threshold.getIncludeMultiplier(),
855  threshold.getPolarity(),
856  npixMin,
857  setPeaks
858  );
859  break;
860  }
861  // Set Mask if requested
862  if (planeName == "") {
863  return;
864  }
865  //
866  // Define the maskPlane
867  //
868  const typename image::Mask<MaskPixelT>::Ptr mask = maskedImg.getMask();
869  mask->addMaskPlane(planeName);
870 
871  MaskPixelT const bitPlane = mask->getPlaneBitMask(planeName);
872  //
873  // Set the bits where objects are detected
874  //
875  typedef image::Mask<MaskPixelT> MaskT;
876 
877  class MaskFootprint : public detection::FootprintFunctor<MaskT> {
878  public:
879  MaskFootprint(MaskT const& mimage,
880  MaskPixelT bit) : detection::FootprintFunctor<MaskT>(mimage), _bit(bit) {}
881 
882  void operator()(typename MaskT::xy_locator loc, int, int) {
883  *loc |= _bit;
884  }
885  private:
886  MaskPixelT _bit;
887  };
888 
889  MaskFootprint maskit(*maskedImg.getMask(), bitPlane);
890  for (FootprintList::const_iterator fiter = _footprints->begin();
891  fiter != _footprints->end(); ++fiter
892  ) {
893  Footprint::Ptr const foot = *fiter;
894 
895  maskit.apply(*foot);
896  }
897 }
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:67
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
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
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
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
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
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
Use number of sigma given per-pixel s.d.
Definition: Threshold.h:52
A functor class to allow users to process all the pixels in a Footprint.
static int addMaskPlane(const std::string &name)
Definition: Mask.cc:700
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 1302 of file FootprintSet.cc.

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

Copy constructor

Parameters
rhsthe input FootprintSet

Definition at line 1311 of file FootprintSet.cc.

1313  :
1314  lsst::daf::base::Citizen(typeid(this)),
1315  _footprints(new FootprintList), _region(rhs._region)
1316 {
1317  _footprints->reserve(rhs._footprints->size());
1318  for (FootprintSet::FootprintList::const_iterator ptr = rhs._footprints->begin(),
1319  end = rhs._footprints->end(); ptr != end; ++ptr) {
1320  _footprints->push_back(PTR(Footprint)(new Footprint(**ptr)));
1321  }
1322 }
#define PTR(...)
Definition: base.h:41
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
lsst::afw::detection::Footprint Footprint
Definition: Source.h:61
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
lsst::afw::detection::FootprintSet::FootprintSet ( detection::FootprintSet const &  rhs,
int  rGrow,
detection::FootprintControl const &  ctrl 
)

Definition at line 1394 of file FootprintSet.cc.

1397  : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1398 {
1399  if (ngrow == 0) {
1400  FootprintSet fs = rhs;
1401  swap(fs); // Swap the new FootprintSet into place
1402  return;
1403  } else if (ngrow < 0) {
1404  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1405  str(boost::format("I cannot grow by negative numbers: %d") % ngrow));
1406  }
1407 
1408  detection::FootprintSet fs = mergeFootprintSets(FootprintSet(rhs.getRegion()), 0, rhs, ngrow, ctrl);
1409  swap(fs); // Swap the new FootprintSet into place
1410 }
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
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:130
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 1370 of file FootprintSet.cc.

1376  : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1377 {
1378  if (r == 0) {
1379  FootprintSet fs = rhs;
1380  swap(fs); // Swap the new FootprintSet into place
1381  return;
1382  } else if (r < 0) {
1383  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1384  (boost::format("I cannot grow by negative numbers: %d") % r).str());
1385  }
1386 
1387  detection::FootprintControl const ctrl(true, isotropic);
1388  detection::FootprintSet fs = mergeFootprintSets(FootprintSet(rhs.getRegion()), 0, rhs, r, ctrl);
1389  swap(fs); // Swap the new FootprintSet into place
1390 }
A Control Object for Footprints, controlling e.g. how they are grown.
Definition: FootprintCtrl.h:36
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
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:130
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 1418 of file FootprintSet.cc.

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

Member Function Documentation

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

: Return the Footprints of detected objects

Definition at line 146 of file FootprintSet.h.

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

Retun the Footprints of detected objects

Definition at line 156 of file FootprintSet.h.

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

Return the corners of the MaskedImage

Definition at line 173 of file FootprintSet.h.

173 { return _region; }
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
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 1438 of file FootprintSet.cc.

1440  {
1442  new image::Image<detection::FootprintIdPixel>(_region)
1443  );
1444  *im = 0;
1445 
1446  detection::FootprintIdPixel id = 0;
1447  for (FootprintList::const_iterator fiter = _footprints->begin();
1448  fiter != _footprints->end(); fiter++
1449  ) {
1450  Footprint::Ptr const foot = *fiter;
1451 
1452  if (relativeIDs) {
1453  id++;
1454  } else {
1455  id = foot->getId();
1456  }
1457 
1458  foot->insertIntoImage(*im.get(), id);
1459  }
1460 
1461  return im;
1462 }
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
Definition: saturated.cc:82
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:67
#define PTR(...)
Definition: base.h:41
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
int id
Definition: CR.cc:151
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:415
boost::uint64_t FootprintIdPixel
Definition: FootprintSet.h:46
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 1470 of file FootprintSet.cc.

1474 {
1475  HeavyFootprintCtrl ctrl_s = HeavyFootprintCtrl();
1476 
1477  if (!ctrl) {
1478  ctrl = &ctrl_s;
1479  }
1480 
1481  for (FootprintList::iterator ptr = _footprints->begin(),
1482  end = _footprints->end(); ptr != end; ++ptr) {
1483  ptr->reset(new detection::HeavyFootprint<ImagePixelT, MaskPixelT>(**ptr, mimg, ctrl));
1484  }
1485 }
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:206
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 1487 of file FootprintSet.cc.

1489  {
1490  for (FootprintList::const_iterator i = _footprints->begin(); i != _footprints->end(); ++i) {
1491  PTR(afw::table::SourceRecord) r = cat.addNew();
1492  r->setFootprint(*i);
1493  }
1494 }
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
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 1336 of file FootprintSet.cc.

1342 {
1343  detection::FootprintControl const ctrl(true, isotropic);
1344  detection::FootprintSet fs = mergeFootprintSets(*this, tGrow, rhs, rGrow, ctrl);
1345  swap(fs); // Swap the new FootprintSet into place
1346 }
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:130
detection::FootprintSet & lsst::afw::detection::FootprintSet::operator= ( FootprintSet const &  rhs)

Assignment operator.

Definition at line 1326 of file FootprintSet.cc.

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

: Set the Footprints of detected objects

Definition at line 151 of file FootprintSet.h.

151 { _footprints = footprints; }
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
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 180 of file FootprintSet.h.

183  {
185  mask,
186  _footprints, // calling getFootprints() confuses clang++ 3.0 and leaks memory
188  );
189  }
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:206
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 192 of file FootprintSet.h.

195  {
196  setMask(mask.get(), planeName);
197  }
void setMask(image::Mask< MaskPixelT > *mask, std::string const &planeName)
Definition: FootprintSet.h:180
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 1352 of file FootprintSet.cc.

1354  {
1355  _region = region;
1356 
1357  for (FootprintSet::FootprintList::iterator ptr = _footprints->begin(),
1358  end = _footprints->end(); ptr != end; ++ptr
1359  ) {
1360  (*ptr)->setRegion(region);
1361  }
1362 }
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:207
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
void lsst::afw::detection::FootprintSet::swap ( FootprintSet rhs)
inline

Definition at line 130 of file FootprintSet.h.

130  {
131  using std::swap; // See Meyers, Effective C++, Item 25
132  swap(*_footprints, *rhs.getFootprints());
133  geom::Box2I rhsRegion = rhs.getRegion();
134  rhs.setRegion(getRegion());
135  setRegion(rhsRegion);
136  }
void setRegion(geom::Box2I const &region)
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291
An integer coordinate rectangle.
Definition: Box.h:53
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
geom::Box2I const getRegion() const
Definition: FootprintSet.h:173
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:130
void lsst::afw::detection::FootprintSet::swapFootprintList ( FootprintList rhs)
inline

Definition at line 138 of file FootprintSet.h.

138  {
139  using std::swap;
140  swap(*_footprints, rhs);
141  }
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:130

Member Data Documentation

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

the Footprints of detected objects

Definition at line 206 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 207 of file FootprintSet.h.


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