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
Baseline.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #if !defined(LSST_DEBLENDER_BASELINE_H)
3 #define LSST_DEBLENDER_BASELINE_H
4 
6 #include <vector>
7 #include <utility>
8 
9 #include "lsst/afw/image/Image.h"
14 
15 namespace lsst {
16  namespace meas {
17  namespace deblender {
18 
19  template <typename ImagePixelT,
20  typename MaskPixelT=lsst::afw::image::MaskPixel,
21  typename VariancePixelT=lsst::afw::image::VariancePixel>
22  class BaselineUtils {
23 
24  public:
27  typedef typename lsst::afw::image::Image<ImagePixelT> ImageT;
28  typedef typename PTR(lsst::afw::image::Image<ImagePixelT>) ImagePtrT;
29  typedef typename lsst::afw::image::Mask<MaskPixelT> MaskT;
30  typedef typename PTR(lsst::afw::image::Mask<MaskPixelT>) MaskPtrT;
31 
32  typedef typename lsst::afw::detection::Footprint FootprintT;
33  typedef typename PTR(lsst::afw::detection::Footprint) FootprintPtrT;
34  typedef typename lsst::afw::detection::HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> HeavyFootprintT;
35 
36  typedef typename PTR(lsst::afw::detection::HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>) HeavyFootprintPtrT;
37 
38  static
39  PTR(lsst::afw::detection::Footprint)
40  symmetrizeFootprint(lsst::afw::detection::Footprint const& foot,
41  int cx, int cy);
42 
43  static
44  std::pair<MaskedImagePtrT, FootprintPtrT>
46  lsst::afw::detection::Footprint const& foot,
47  lsst::afw::detection::Peak const& pk,
48  double sigma1,
49  bool minZero,
50  bool patchEdges,
51  bool* patchedEdges);
52 
53  static void
54  medianFilter(MaskedImageT const& img,
55  MaskedImageT & outimg,
56  int halfsize);
57 
58  static void
60  lsst::afw::detection::Peak const& pk);
61 
62  static const int ASSIGN_STRAYFLUX = 0x1;
64  static const int STRAYFLUX_TO_POINT_SOURCES_ALWAYS = 0x4;
65  // split flux according to the closest distance to the template?
66  // (default is according to distance to the peak)
67  static const int STRAYFLUX_R_TO_FOOTPRINT = 0x8;
68  static const int STRAYFLUX_NEAREST_FOOTPRINT = 0x10;
69 
70  // swig doesn't seem to understand std::vector<MaskedImagePtrT>...
71  static
72  std::vector<typename PTR(lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>)>
73  apportionFlux(MaskedImageT const& img,
74  lsst::afw::detection::Footprint const& foot,
75  std::vector<typename PTR(lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>)> templates,
76  std::vector<boost::shared_ptr<lsst::afw::detection::Footprint> > templ_footprints,
77  //
78  ImagePtrT templ_sum,
79  std::vector<bool> const& ispsf,
80  std::vector<int> const& pkx,
81  std::vector<int> const& pky,
82  std::vector<boost::shared_ptr<typename lsst::afw::detection::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays,
83  int strayFluxOptions,
85  );
86 
87  static
88  bool
89  hasSignificantFluxAtEdge(ImagePtrT,
90  boost::shared_ptr<lsst::afw::detection::Footprint>,
91  ImagePixelT threshold);
92 
93  static
94  boost::shared_ptr<lsst::afw::detection::Footprint>
95  getSignificantEdgePixels(ImagePtrT,
96  boost::shared_ptr<lsst::afw::detection::Footprint>,
97  ImagePixelT threshold);
98 
99 
100  static
101  void
102  _sum_templates(std::vector<MaskedImagePtrT> timgs,
103  ImagePtrT tsum);
104 
105  static
106  void
107  _find_stray_flux(lsst::afw::detection::Footprint const& foot,
108  ImagePtrT tsum,
109  MaskedImageT const& img,
110  int strayFluxOptions,
111  std::vector<boost::shared_ptr<lsst::afw::detection::Footprint> > tfoots,
112  std::vector<bool> const& ispsf,
113  std::vector<int> const& pkx,
114  std::vector<int> const& pky,
115  double clipStrayFluxFraction,
116  std::vector<boost::shared_ptr<typename lsst::afw::detection::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays);
117 
118  };
119  }
120  }
121 }
122 
123 #endif
static boost::shared_ptr< lsst::afw::detection::Footprint > getSignificantEdgePixels(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Definition: Baseline.cc:1348
boost::uint16_t MaskPixel
static void _find_stray_flux(lsst::afw::detection::Footprint const &foot, ImagePtrT tsum, MaskedImageT const &img, int strayFluxOptions, std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > tfoots, std::vector< bool > const &ispsf, std::vector< int > const &pkx, std::vector< int > const &pky, double clipStrayFluxFraction, std::vector< boost::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays)
Definition: Baseline.cc:291
Represent a set of pixels of an arbitrary shape and size.
static void makeMonotonic(MaskedImageT &img, lsst::afw::detection::Peak const &pk)
Definition: Baseline.cc:118
static const int ASSIGN_STRAYFLUX
Definition: Baseline.h:62
static bool hasSignificantFluxAtEdge(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Definition: Baseline.cc:1290
lsst::afw::detection::Footprint Footprint
Definition: Source.h:61
Represent a set of pixels of an arbitrary shape and size, including values for those pixels; a HeavyF...
static const int STRAYFLUX_NEAREST_FOOTPRINT
Definition: Baseline.h:68
boost::shared_ptr< lsst::afw::detection::Footprint > FootprintPtrT
Definition: Baseline.h:33
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< lsst::afw::image::Mask< MaskPixelT > > MaskPtrT
Definition: Baseline.h:30
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT std::vector< bool > const std::vector< int > const std::vector< int > const std::vector< boost::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > int strayFluxOptions
Definition: Baseline.h:76
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > MaskedImageT
Definition: Baseline.h:25
A set of pixels in an Image, including those pixels&#39; actual values.
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
boost::shared_ptr< lsst::afw::image::Image< ImagePixelT > > ImagePtrT
Definition: Baseline.h:28
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT std::vector< bool > const std::vector< int > const std::vector< int > const & pky
Definition: Baseline.h:76
static void medianFilter(MaskedImageT const &img, MaskedImageT &outimg, int halfsize)
Definition: Baseline.cc:38
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:93
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > templ_footprints
Definition: Baseline.h:76
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> apportionFlux(MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> templates
Definition: Baseline.cc:586
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
boost::shared_ptr< lsst::afw::detection::HeavyFootprint< ImagePixelT > MaskPixelT, VariancePixelT > HeavyFootprintPtrT
Definition: Baseline.h:36
Support for 2-D images.
float VariancePixel
! default type for Masks and MaskedImage Masks
A set of pixels in an Image.
Definition: Footprint.h:70
Support for peaks in images.
static std::pair< MaskedImagePtrT, FootprintPtrT > buildSymmetricTemplate(MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, lsst::afw::detection::Peak const &pk, double sigma1, bool minZero, bool patchEdges, bool *patchedEdges)
Definition: Baseline.cc:1085
static const int STRAYFLUX_R_TO_FOOTPRINT
Definition: Baseline.h:67
afw::table::Key< double > sigma1
static boost::shared_ptr< lsst::afw::detection::Footprint > symmetrizeFootprint(lsst::afw::detection::Footprint const &foot, int cx, int cy)
Definition: Baseline.cc:870
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT std::vector< bool > const std::vector< int > const & pkx
Definition: Baseline.h:76
boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT > MaskedImagePtrT
Definition: Baseline.h:26
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT templ_sum
Definition: Baseline.h:76
static const int STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY
Definition: Baseline.h:63
Implementation of the Class MaskedImage.
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT std::vector< bool > const std::vector< int > const std::vector< int > const std::vector< boost::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > int double clipStrayFluxFraction
Definition: Baseline.h:76
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT std::vector< bool > const std::vector< int > const std::vector< int > const std::vector< boost::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > & strays
Definition: Baseline.h:76
static std::vector< typename boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT >)> std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > ImagePtrT std::vector< bool > const & ispsf
Definition: Baseline.h:76
static void _sum_templates(std::vector< MaskedImagePtrT > timgs, ImagePtrT tsum)
Definition: Baseline.cc:502
static const int STRAYFLUX_TO_POINT_SOURCES_ALWAYS
Definition: Baseline.h:64