LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
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 <cstdint>
31 
32 #include "lsst/afw/geom.h"
37 #include "lsst/afw/table/Source.h"
38 
39 namespace lsst {
40 namespace afw {
41 namespace detection {
42 
48 typedef std::uint64_t FootprintIdPixel;
49 
50 /************************************************************************************************************/
56 public:
57 
59  typedef std::vector<Footprint::Ptr> FootprintList;
60 
61 #ifndef SWIG
62  template <typename ImagePixelT>
64  Threshold const& threshold,
65  int const npixMin=1, bool const setPeaks=true);
66 
67  template <typename MaskPixelT>
69  Threshold const& threshold,
70  int const npixMin=1);
71 
72  template <typename ImagePixelT, typename MaskPixelT>
74  Threshold const& threshold,
75  std::string const& planeName = "",
76  int const npixMin=1, bool const setPeaks=true);
77 
78 #else // workaround for https://github.com/swig/swig/issues/245
79  // if that bug is fixed then you may update footprintset.i by uncommenting two lines
80  // and removing this section. However, you must continue to provide SWIG
81  // the alternate version of the template <typename MaskPixelT> constructor, because
82  // SWIG cannot disambiguate that from the template <typename ImagePixelT> constructor.
83 
85  Threshold const& threshold,
86  int const npixMin=1);
87 
89  Threshold const& threshold,
90  int const npixMin=1, bool const setPeaks=true);
92  Threshold const& threshold,
93  std::string const& planeName = "",
94  int const npixMin=1, bool const setPeaks=true);
95 
97  Threshold const& threshold,
98  int const npixMin=1, bool const setPeaks=true);
100  Threshold const& threshold,
101  std::string const& planeName = "",
102  int const npixMin=1, bool const setPeaks=true);
103 
105  Threshold const& threshold,
106  int const npixMin=1, bool const setPeaks=true);
108  Threshold const& threshold,
109  std::string const& planeName = "",
110  int const npixMin=1, bool const setPeaks=true);
111 
113  Threshold const& threshold,
114  int const npixMin=1, bool const setPeaks=true);
116  Threshold const& threshold,
117  std::string const& planeName = "",
118  int const npixMin=1, bool const setPeaks=true);
119 
120 #endif
121 
122  FootprintSet(geom::Box2I region);
123  FootprintSet(FootprintSet const&);
124  FootprintSet(FootprintSet const& set, int rGrow, FootprintControl const& ctrl);
125  FootprintSet(FootprintSet const& set, int rGrow, bool isotropic=true);
126  FootprintSet(FootprintSet const& footprints1,
127  FootprintSet const& footprints2,
128  bool const includePeaks);
129 
130  FootprintSet& operator=(FootprintSet const& rhs);
131 
132  void swap(FootprintSet& rhs) {
133  using std::swap; // See Meyers, Effective C++, Item 25
134  swap(*_footprints, *rhs.getFootprints());
135  geom::Box2I rhsRegion = rhs.getRegion();
136  rhs.setRegion(getRegion());
137  setRegion(rhsRegion);
138  }
139 
141  using std::swap;
142  swap(*_footprints, rhs);
143  }
144 
149 
153  void setFootprints(PTR(FootprintList) footprints) { _footprints = footprints; }
154 
159 
168  void makeSources(afw::table::SourceCatalog & catalog) const;
169 
170  void setRegion(geom::Box2I const& region);
171 
175  geom::Box2I const getRegion() const { return _region; }
176 
178  const bool relativeIDs
179  ) const;
180 
181  template <typename MaskPixelT>
182  void setMask(
183  image::Mask<MaskPixelT> *mask,
184  std::string const& planeName
185  ) {
187  mask,
188  _footprints, // calling getFootprints() confuses clang++ 3.0 and leaks memory
190  );
191  }
192 
193  template <typename MaskPixelT>
194  void setMask(
196  std::string const& planeName
197  ) {
198  setMask(mask.get(), planeName);
199  }
200 
201  void merge(FootprintSet const& rhs, int tGrow=0, int rGrow=0, bool isotropic=true);
202 
203  template <typename ImagePixelT, typename MaskPixelT>
205  HeavyFootprintCtrl const* ctrl=NULL
206  );
207 private:
208  std::shared_ptr<FootprintList> _footprints;
210 };
211 
212 }}}
213 
214 #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
void setRegion(geom::Box2I const &region)
Represent a set of pixels of an arbitrary shape and size.
void setFootprints(boost::shared_ptr< FootprintList > footprints)
Definition: FootprintSet.h:153
A control object for HeavyFootprints.
Definition: FootprintCtrl.h:91
boost::shared_ptr< FootprintList > getFootprints()
Definition: FootprintSet.h:148
void makeHeavy(image::MaskedImage< ImagePixelT, MaskPixelT > const &mimg, HeavyFootprintCtrl const *ctrl=NULL)
A Threshold is used to pass a threshold value to detection algorithms.
Definition: Threshold.h:44
void swap(Mask< PixelT > &a, Mask< PixelT > &b)
Definition: Mask.cc:524
void setMask(image::Mask< MaskPixelT > *mask, std::string const &planeName)
Definition: FootprintSet.h:182
#define CONST_PTR(...)
Definition: base.h:47
An integer coordinate rectangle.
Definition: Box.h:53
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:209
FootprintSet(image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
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
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:92
void swapFootprintList(FootprintList &rhs)
Definition: FootprintSet.h:140
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:78
FootprintSet & operator=(FootprintSet const &rhs)
Assignment operator.
Represent a detection threshold.
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:59
A set of Footprints, associated with a MaskedImage.
Definition: FootprintSet.h:55
Control Footprint-related algorithms.
#define PTR(...)
Definition: base.h:41
std::shared_ptr< FootprintList > _footprints
the Footprints of detected objects
Definition: FootprintSet.h:208
geom::Box2I const getRegion() const
Definition: FootprintSet.h:175
Implementation of the Class MaskedImage.
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:53
void makeSources(afw::table::SourceCatalog &catalog) const
Add a new record corresponding to each footprint to a SourceCatalog.
void setMask(boost::shared_ptr< image::Mask< MaskPixelT > > mask, std::string const &planeName)
Definition: FootprintSet.h:194
void merge(FootprintSet const &rhs, int tGrow=0, int rGrow=0, bool isotropic=true)
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.
void swap(FootprintSet &rhs)
Definition: FootprintSet.h:132
std::uint64_t FootprintIdPixel
Definition: FootprintSet.h:48