LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
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 }
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
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
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
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 }
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:229
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
#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
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 }
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:78
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
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:228
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
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
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:699
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 getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:903
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
#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 getWidth() const
Return the number of columns in the image.
Definition: MaskedImage.h:901
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 ( geom::Box2I  region)

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

Parameters
regionthe desired region

Definition at line 1318 of file FootprintSet.cc.

1319  :
1320  lsst::daf::base::Citizen(typeid(this)),
1322 }
#define PTR(...)
Definition: base.h:41
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
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 1327 of file FootprintSet.cc.

1329  :
1330  lsst::daf::base::Citizen(typeid(this)),
1331  _footprints(new FootprintList), _region(rhs._region)
1332 {
1333  _footprints->reserve(rhs._footprints->size());
1334  for (FootprintSet::FootprintList::const_iterator ptr = rhs._footprints->begin(),
1335  end = rhs._footprints->end(); ptr != end; ++ptr) {
1336  _footprints->push_back(PTR(Footprint)(new Footprint(**ptr)));
1337  }
1338 }
#define PTR(...)
Definition: base.h:41
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
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 1410 of file FootprintSet.cc.

1413  : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1414 {
1415  if (ngrow == 0) {
1416  FootprintSet fs = rhs;
1417  swap(fs); // Swap the new FootprintSet into place
1418  return;
1419  } else if (ngrow < 0) {
1420  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1421  str(boost::format("I cannot grow by negative numbers: %d") % ngrow));
1422  }
1423 
1424  detection::FootprintSet fs = mergeFootprintSets(FootprintSet(rhs.getRegion()), 0, rhs, ngrow, ctrl);
1425  swap(fs); // Swap the new FootprintSet into place
1426 }
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)
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
#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:157
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 1386 of file FootprintSet.cc.

1392  : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1393 {
1394  if (r == 0) {
1395  FootprintSet fs = rhs;
1396  swap(fs); // Swap the new FootprintSet into place
1397  return;
1398  } else if (r < 0) {
1399  throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1400  (boost::format("I cannot grow by negative numbers: %d") % r).str());
1401  }
1402 
1403  detection::FootprintControl const ctrl(true, isotropic);
1404  detection::FootprintSet fs = mergeFootprintSets(FootprintSet(rhs.getRegion()), 0, rhs, r, ctrl);
1405  swap(fs); // Swap the new FootprintSet into place
1406 }
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:229
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:228
#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:157
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 1434 of file FootprintSet.cc.

1439  : lsst::daf::base::Citizen(typeid(this)),
1440  _footprints(new FootprintList()),
1441  _region(fs1._region)
1442 {
1443  _region.include(fs2._region);
1444  throw LSST_EXCEPT(lsst::pex::exceptions::LogicError, "NOT IMPLEMENTED");
1445 }
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:229
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
#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 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 1454 of file FootprintSet.cc.

1456  {
1458  new image::Image<detection::FootprintIdPixel>(_region)
1459  );
1460  *im = 0;
1461 
1462  detection::FootprintIdPixel id = 0;
1463  for (FootprintList::const_iterator fiter = _footprints->begin();
1464  fiter != _footprints->end(); fiter++
1465  ) {
1466  Footprint::Ptr const foot = *fiter;
1467 
1468  if (relativeIDs) {
1469  id++;
1470  } else {
1471  id = foot->getId();
1472  }
1473 
1474  foot->insertIntoImage(*im.get(), id);
1475  }
1476 
1477  return im;
1478 }
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:78
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:229
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
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 1486 of file FootprintSet.cc.

1490 {
1491  HeavyFootprintCtrl ctrl_s = HeavyFootprintCtrl();
1492 
1493  if (!ctrl) {
1494  ctrl = &ctrl_s;
1495  }
1496 
1497  for (FootprintList::iterator ptr = _footprints->begin(),
1498  end = _footprints->end(); ptr != end; ++ptr) {
1499  ptr->reset(new detection::HeavyFootprint<ImagePixelT, MaskPixelT>(**ptr, mimg, ctrl));
1500  }
1501 }
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 1503 of file FootprintSet.cc.

1505  {
1506  for (FootprintList::const_iterator i = _footprints->begin(); i != _footprints->end(); ++i) {
1507  PTR(afw::table::SourceRecord) r = cat.addNew();
1508  r->setFootprint(*i);
1509  }
1510 }
#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 1352 of file FootprintSet.cc.

1358 {
1359  detection::FootprintControl const ctrl(true, isotropic);
1360  detection::FootprintSet fs = mergeFootprintSets(*this, tGrow, rhs, rGrow, ctrl);
1361  swap(fs); // Swap the new FootprintSet into place
1362 }
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 1342 of file FootprintSet.cc.

1342  {
1343  FootprintSet tmp(rhs);
1344  swap(tmp); // See Meyers, Effective C++, Item 11
1345  return *this;
1346 }
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 1368 of file FootprintSet.cc.

1370  {
1371  _region = region;
1372 
1373  for (FootprintSet::FootprintList::iterator ptr = _footprints->begin(),
1374  end = _footprints->end(); ptr != end; ++ptr
1375  ) {
1376  (*ptr)->setRegion(region);
1377  }
1378 }
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 setRegion(geom::Box2I const &region)
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:287
An integer coordinate rectangle.
Definition: Box.h:53
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
geom::Box2I const getRegion() const
Definition: FootprintSet.h:195
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:157

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: