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
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<ImagePtrT, FootprintPtrT>
46  lsst::afw::detection::Footprint const& foot,
47  lsst::afw::detection::PeakRecord const& pk,
48  double sigma1,
49  bool minZero,
50  bool patchEdges,
51  bool* patchedEdges);
52 
53  static void
54  medianFilter(ImageT const& img,
55  ImageT & outimg,
56  int halfsize);
57 
58  static void
59  makeMonotonic(ImageT & img,
60  lsst::afw::detection::PeakRecord 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  static const int STRAYFLUX_TRIM = 0x20;
70 
71  // swig doesn't seem to understand std::vector<MaskedImagePtrT>...
72  static
73  std::vector<typename PTR(lsst::afw::image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>)>
74  apportionFlux(MaskedImageT const& img,
75  lsst::afw::detection::Footprint const& foot,
76  std::vector<typename PTR(lsst::afw::image::Image<ImagePixelT>)> templates,
77  std::vector<boost::shared_ptr<lsst::afw::detection::Footprint> > templ_footprints,
78  //
79  ImagePtrT templ_sum,
80  std::vector<bool> const& ispsf,
81  std::vector<int> const& pkx,
82  std::vector<int> const& pky,
83  std::vector<boost::shared_ptr<typename lsst::afw::detection::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays,
84  int strayFluxOptions,
85  double clipStrayFluxFraction
86  );
87 
88  static
89  bool
90  hasSignificantFluxAtEdge(ImagePtrT,
91  boost::shared_ptr<lsst::afw::detection::Footprint>,
92  ImagePixelT threshold);
93 
94  static
95  boost::shared_ptr<lsst::afw::detection::Footprint>
96  getSignificantEdgePixels(ImagePtrT,
97  boost::shared_ptr<lsst::afw::detection::Footprint>,
98  ImagePixelT threshold);
99 
100 
101  static
102  void
103  _sum_templates(std::vector<ImagePtrT> timgs,
104  ImagePtrT tsum);
105 
106  static
107  void
108  _find_stray_flux(lsst::afw::detection::Footprint const& foot,
109  ImagePtrT tsum,
110  MaskedImageT const& img,
111  int strayFluxOptions,
112  std::vector<boost::shared_ptr<lsst::afw::detection::Footprint> > tfoots,
113  std::vector<bool> const& ispsf,
114  std::vector<int> const& pkx,
115  std::vector<int> const& pky,
116  double clipStrayFluxFraction,
117  std::vector<boost::shared_ptr<typename lsst::afw::detection::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays);
118 
119  };
120  }
121  }
122 }
123 
124 #endif
boost::uint16_t MaskPixel
#define PTR(...)
Definition: base.h:41
Represent a set of pixels of an arbitrary shape and size.
static const int STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY
Definition: Baseline.h:63
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...
boost::shared_ptr< lsst::afw::detection::Footprint > FootprintPtrT
Definition: Baseline.h:33
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > MaskedImageT
Definition: Baseline.h:25
static boost::shared_ptr< lsst::afw::detection::Footprint > symmetrizeFootprint(lsst::afw::detection::Footprint const &foot, int cx, int cy)
Definition: Baseline.cc:867
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 const int STRAYFLUX_NEAREST_FOOTPRINT
Definition: Baseline.h:68
static void medianFilter(ImageT const &img, ImageT &outimg, int halfsize)
Definition: Baseline.cc:39
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:1281
Support for 2-D images.
static const int ASSIGN_STRAYFLUX
Definition: Baseline.h:62
float VariancePixel
! default type for Masks and MaskedImage Masks
A set of pixels in an Image.
Definition: Footprint.h:62
static void makeMonotonic(ImageT &img, lsst::afw::detection::PeakRecord const &pk)
Definition: Baseline.cc:117
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:289
static boost::shared_ptr< lsst::afw::detection::Footprint > getSignificantEdgePixels(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Definition: Baseline.cc:1317
afw::table::Key< double > sigma1
static void _sum_templates(std::vector< ImagePtrT > timgs, ImagePtrT tsum)
Definition: Baseline.cc:500
Implementation of the Class MaskedImage.
static std::pair< ImagePtrT, FootprintPtrT > buildSymmetricTemplate(MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, lsst::afw::detection::PeakRecord const &pk, double sigma1, bool minZero, bool patchEdges, bool *patchedEdges)
Definition: Baseline.cc:1084
static const int STRAYFLUX_TO_POINT_SOURCES_ALWAYS
Definition: Baseline.h:64
boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT > MaskedImagePtrT
Definition: Baseline.h:26
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
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::Image< ImagePixelT > >> templates, std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > templ_footprints, ImagePtrT templ_sum, std::vector< bool > const &ispsf, std::vector< int > const &pkx, std::vector< int > const &pky, std::vector< boost::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays, int strayFluxOptions, double clipStrayFluxFraction)
Definition: Baseline.cc:583
boost::shared_ptr< lsst::afw::image::Image< ImagePixelT > > ImagePtrT
Definition: Baseline.h:28