LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
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 #else // workaround for https://github.com/swig/swig/issues/245
77  // if that bug is fixed then you may update footprintset.i by uncommenting two lines
78  // and removing this section. However, you must continue to provide SWIG
79  // the alternate version of the template <typename MaskPixelT> constructor, because
80  // SWIG cannot disambiguate that from the template <typename ImagePixelT> constructor.
81 
83  Threshold const& threshold,
84  int const npixMin=1);
85 
87  Threshold const& threshold,
88  int const npixMin=1, bool const setPeaks=true);
90  Threshold const& threshold,
91  std::string const& planeName = "",
92  int const npixMin=1, bool const setPeaks=true);
93 
95  Threshold const& threshold,
96  int const npixMin=1, bool const setPeaks=true);
98  Threshold const& threshold,
99  std::string const& planeName = "",
100  int const npixMin=1, bool const setPeaks=true);
101 
103  Threshold const& threshold,
104  int const npixMin=1, bool const setPeaks=true);
106  Threshold const& threshold,
107  std::string const& planeName = "",
108  int const npixMin=1, bool const setPeaks=true);
109 
111  Threshold const& threshold,
112  int const npixMin=1, bool const setPeaks=true);
114  Threshold const& threshold,
115  std::string const& planeName = "",
116  int const npixMin=1, bool const setPeaks=true);
117 
118 #endif
119 
120  FootprintSet(geom::Box2I region);
121  FootprintSet(FootprintSet const&);
122  FootprintSet(FootprintSet const& set, int rGrow, FootprintControl const& ctrl);
123  FootprintSet(FootprintSet const& set, int rGrow, bool isotropic=true);
124  FootprintSet(FootprintSet const& footprints1,
125  FootprintSet const& footprints2,
126  bool const includePeaks);
127 
128  FootprintSet& operator=(FootprintSet const& rhs);
129 
130  void swap(FootprintSet& rhs) {
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  }
137 
139  using std::swap;
140  swap(*_footprints, rhs);
141  }
142 
147 
151  void setFootprints(PTR(FootprintList) footprints) { _footprints = footprints; }
152 
157 
166  void makeSources(afw::table::SourceCatalog & catalog) const;
167 
168  void setRegion(geom::Box2I const& region);
169 
173  geom::Box2I const getRegion() const { return _region; }
174 
176  const bool relativeIDs
177  ) const;
178 
179  template <typename MaskPixelT>
180  void setMask(
181  image::Mask<MaskPixelT> *mask,
182  std::string const& planeName
183  ) {
185  mask,
186  _footprints, // calling getFootprints() confuses clang++ 3.0 and leaks memory
188  );
189  }
190 
191  template <typename MaskPixelT>
192  void setMask(
194  std::string const& planeName
195  ) {
196  setMask(mask.get(), planeName);
197  }
198 
199  void merge(FootprintSet const& rhs, int tGrow=0, int rGrow=0, bool isotropic=true);
200 
201  template <typename ImagePixelT, typename MaskPixelT>
203  HeavyFootprintCtrl const* ctrl=NULL
204  );
205 private:
206  boost::shared_ptr<FootprintList> _footprints;
208 };
209 
210 }}}
211 
212 #endif
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
#define PTR(...)
Definition: base.h:41
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:173
boost::shared_ptr< image::Image< FootprintIdPixel > > insertIntoImage(const bool relativeIDs) const
#define CONST_PTR(...)
Definition: base.h:47
void swapFootprintList(FootprintList &rhs)
Definition: FootprintSet.h:138
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
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
void setFootprints(boost::shared_ptr< FootprintList > footprints)
Definition: FootprintSet.h:151
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:180
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)
void setMask(boost::shared_ptr< image::Mask< MaskPixelT > > mask, std::string const &planeName)
Definition: FootprintSet.h:192
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:207
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:130
FootprintSet & operator=(FootprintSet const &rhs)
Assignment operator.
boost::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:206
boost::shared_ptr< FootprintList > getFootprints()
Definition: FootprintSet.h:146
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.