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
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 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 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
#define PTR(...)
Definition: base.h:41
Represent a set of pixels of an arbitrary shape and size.
boost::uint16_t MaskPixel
static const int STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY
Definition: Baseline.h:63
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:1087
Represent a set of pixels of an arbitrary shape and size, including values for those pixels; a HeavyF...
boost::shared_ptr< lsst::afw::detection::Footprint > FootprintPtrT
Definition: Baseline.h:33
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
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > MaskedImageT
Definition: Baseline.h:25
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 boost::shared_ptr< lsst::afw::detection::Footprint > symmetrizeFootprint(lsst::afw::detection::Footprint const &foot, int cx, int cy)
Definition: Baseline.cc:872
A set of pixels in an Image, including those pixels&#39; actual values.
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
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:588
static const int STRAYFLUX_NEAREST_FOOTPRINT
Definition: Baseline.h:68
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:93
boost::shared_ptr< lsst::afw::image::Mask< MaskPixelT > > MaskPtrT
Definition: Baseline.h:30
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
static bool hasSignificantFluxAtEdge(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Definition: Baseline.cc:1292
Support for 2-D images.
static const int ASSIGN_STRAYFLUX
Definition: Baseline.h:62
A set of pixels in an Image.
Definition: Footprint.h:73
static void _sum_templates(std::vector< MaskedImagePtrT > timgs, ImagePtrT tsum)
Definition: Baseline.cc:504
Support for peaks in images.
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:293
static boost::shared_ptr< lsst::afw::detection::Footprint > getSignificantEdgePixels(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Definition: Baseline.cc:1350
afw::table::Key< double > sigma1
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:40
lsst::afw::detection::Footprint Footprint
Definition: Source.h:61
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
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 > > > & strays
Definition: Baseline.h:76
static const int STRAYFLUX_TO_POINT_SOURCES_ALWAYS
Definition: Baseline.h:64
float VariancePixel
! default type for Masks and MaskedImage Masks
static void makeMonotonic(MaskedImageT &img, lsst::afw::detection::Peak const &pk)
Definition: Baseline.cc:120
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 std::vector< bool > const std::vector< int > const & pkx
Definition: Baseline.h:76
static const int STRAYFLUX_R_TO_FOOTPRINT
Definition: Baseline.h:67
boost::shared_ptr< lsst::afw::detection::HeavyFootprint< ImagePixelT > MaskPixelT, VariancePixelT > HeavyFootprintPtrT
Definition: Baseline.h:36
boost::shared_ptr< lsst::afw::image::Image< ImagePixelT > > ImagePtrT
Definition: Baseline.h:28