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
FootprintSet.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008, 2009, 2010 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #if !defined(LSST_DETECTION_FOOTPRINT_SET_H)
25 #define LSST_DETECTION_FOOTPRINT_SET_H
26 
30 #include "lsst/afw/geom.h"
35 #include "lsst/afw/table/Source.h"
36 
37 namespace lsst {
38 namespace afw {
39 namespace detection {
40 
46 typedef boost::uint64_t FootprintIdPixel;
47 
48 /************************************************************************************************************/
54 public:
55 
57  typedef std::vector<Footprint::Ptr> FootprintList;
58 
59 #ifndef SWIG
60  template <typename ImagePixelT>
62  Threshold const& threshold,
63  int const npixMin=1, bool const setPeaks=true);
64 
65  template <typename MaskPixelT>
67  Threshold const& threshold,
68  int const npixMin=1);
69 
70  template <typename ImagePixelT, typename MaskPixelT>
72  Threshold const& threshold,
73  std::string const& planeName = "",
74  int const npixMin=1, bool const setPeaks=true);
75 
76  template <typename ImagePixelT, typename MaskPixelT>
78  Threshold const& threshold,
79  int x,
80  int y,
81  std::vector<PTR(Peak)> const* peaks = NULL);
82 
83 #else // workaround for https://github.com/swig/swig/issues/245
84  // if that bug is fixed then you may update footprintset.i by uncommenting two lines
85  // and removing this section. However, you must continue to provide SWIG
86  // the alternate version of the template <typename MaskPixelT> constructor, because
87  // SWIG cannot disambiguate that from the template <typename ImagePixelT> constructor.
88 
90  Threshold const& threshold,
91  int const npixMin=1);
92 
94  Threshold const& threshold,
95  int const npixMin=1, bool const setPeaks=true);
97  Threshold const& threshold,
98  std::string const& planeName = "",
99  int const npixMin=1, bool const setPeaks=true);
101  Threshold const& threshold,
102  int x,
103  int y,
104  std::vector<PTR(Peak)> const* peaks = NULL);
105 
106  FootprintSet(image::Image<int> const& img,
107  Threshold const& threshold,
108  int const npixMin=1, bool const setPeaks=true);
110  Threshold const& threshold,
111  std::string const& planeName = "",
112  int const npixMin=1, bool const setPeaks=true);
114  Threshold const& threshold,
115  int x,
116  int y,
117  std::vector<PTR(Peak)> const* peaks = NULL);
118 
120  Threshold const& threshold,
121  int const npixMin=1, bool const setPeaks=true);
123  Threshold const& threshold,
124  std::string const& planeName = "",
125  int const npixMin=1, bool const setPeaks=true);
127  Threshold const& threshold,
128  int x,
129  int y,
130  std::vector<PTR(Peak)> const* peaks = NULL);
131 
133  Threshold const& threshold,
134  int const npixMin=1, bool const setPeaks=true);
136  Threshold const& threshold,
137  std::string const& planeName = "",
138  int const npixMin=1, bool const setPeaks=true);
140  Threshold const& threshold,
141  int x,
142  int y,
143  std::vector<PTR(Peak)> const* peaks = NULL);
144 
145 #endif
146 
147  FootprintSet(geom::Box2I region);
148  FootprintSet(FootprintSet const&);
149  FootprintSet(FootprintSet const& set, int rGrow, FootprintControl const& ctrl);
150  FootprintSet(FootprintSet const& set, int rGrow, bool isotropic=true);
151  FootprintSet(FootprintSet const& footprints1,
152  FootprintSet const& footprints2,
153  bool const includePeaks);
154 
155  FootprintSet& operator=(FootprintSet const& rhs);
156 
157  void swap(FootprintSet& rhs) {
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  }
164 
169 
173  void setFootprints(PTR(FootprintList) footprints) { _footprints = footprints; }
174 
179 
188  void makeSources(afw::table::SourceCatalog & catalog) const;
189 
190  void setRegion(geom::Box2I const& region);
191 
195  geom::Box2I const getRegion() const { return _region; }
196 
198  const bool relativeIDs
199  ) const;
200 
201  template <typename MaskPixelT>
202  void setMask(
203  image::Mask<MaskPixelT> *mask,
204  std::string const& planeName
205  ) {
207  mask,
208  _footprints, // calling getFootprints() confuses clang++ 3.0 and leaks memory
210  );
211  }
212 
213  template <typename MaskPixelT>
214  void setMask(
216  std::string const& planeName
217  ) {
218  setMask(mask.get(), planeName);
219  }
220 
221  void merge(FootprintSet const& rhs, int tGrow=0, int rGrow=0, bool isotropic=true);
222 
223  template <typename ImagePixelT, typename MaskPixelT>
225  HeavyFootprintCtrl const* ctrl=NULL
226  );
227 private:
228  boost::shared_ptr<FootprintList> _footprints;
230 };
231 
232 }}}
233 
234 #endif
int y
#define CONST_PTR(...)
Definition: base.h:47
An include file to include the header files for lsst::afw::geom.
A Control Object for Footprints, controlling e.g. how they are grown.
Definition: FootprintCtrl.h:36
Represent a set of pixels of an arbitrary shape and size.
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Definition: Image.cc:291
A control object for HeavyFootprints.
Definition: FootprintCtrl.h:91
geom::Box2I const getRegion() const
Definition: FootprintSet.h:195
boost::shared_ptr< image::Image< FootprintIdPixel > > insertIntoImage(const bool relativeIDs) const
std::vector< Footprint::Ptr > FootprintList
The FootprintSet&#39;s set of Footprints.
Definition: FootprintSet.h:57
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:44
#define PTR(...)
Definition: base.h:41
An integer coordinate rectangle.
Definition: Box.h:53
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
void merge(FootprintSet const &rhs, int tGrow=0, int rGrow=0, bool isotropic=true)
boost::uint64_t FootprintIdPixel
Definition: FootprintSet.h:46
A peak in an image.
Definition: Peak.h:51
void setFootprints(boost::shared_ptr< FootprintList > footprints)
Definition: FootprintSet.h:173
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:55
void setMask(image::Mask< MaskPixelT > *mask, std::string const &planeName)
Definition: FootprintSet.h:202
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
Represent a detection threshold.
void setRegion(geom::Box2I const &region)
int x
void setMask(boost::shared_ptr< image::Mask< MaskPixelT > > mask, std::string const &planeName)
Definition: FootprintSet.h:214
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:53
Control Footprint-related algorithms.
geom::Box2I _region
The corners of the MaskedImage that the detections live in.
Definition: FootprintSet.h:229
void makeSources(afw::table::SourceCatalog &catalog) const
Add a new record corresponding to each footprint to a SourceCatalog.
Implementation of the Class MaskedImage.
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
int const npixMin
Definition: saturated.cc:72
void makeHeavy(image::MaskedImage< ImagePixelT, MaskPixelT > const &mimg, HeavyFootprintCtrl const *ctrl=NULL)
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
FootprintSet & operator=(FootprintSet const &rhs)
Assignment operator.
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:228
boost::shared_ptr< FootprintList > getFootprints()
Definition: FootprintSet.h:168
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.