LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
BaselineUtils.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #if !defined(LSST_DEBLENDER_BASELINE_H)
3 #define LSST_DEBLENDER_BASELINE_H
5 
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:
31 
35 
37 
38  static
41  int cx, int cy);
42 
43  static
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,
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
74  apportionFlux(MaskedImageT const& img,
78  //
79  ImagePtrT templ_sum,
80  std::vector<bool> const& ispsf,
81  std::vector<int> const& pkx,
82  std::vector<int> const& pky,
84  int strayFluxOptions,
85  double clipStrayFluxFraction
86  );
87 
88  static
89  bool
92  ImagePixelT threshold);
93 
94  static
98  ImagePixelT threshold);
99 
100 
101  static
102  void
104  ImagePtrT tsum);
105 
106  static
107  void
109  ImagePtrT tsum,
110  MaskedImageT const& img,
111  int strayFluxOptions,
113  std::vector<bool> const& ispsf,
114  std::vector<int> const& pkx,
115  std::vector<int> const& pky,
116  double clipStrayFluxFraction,
118 
119  };
120  }
121  }
122 }
123 
124 #endif
table::Key< double > sigma1
#define PTR(...)
Definition: base.h:41
Class to describe the properties of a detected object from an image.
Definition: Footprint.h:63
A set of pixels in an Image, including those pixels' actual values.
Record class that represents a peak in a Footprint.
Definition: Peak.h:42
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:58
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
boost::shared_ptr< lsst::afw::image::Mask< MaskPixelT > > MaskPtrT
Definition: BaselineUtils.h:30
static void medianFilter(ImageT const &img, ImageT &outimg, int halfsize)
Run a spatial median filter over the given input img, writing the results to out.
static const int STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY
Definition: BaselineUtils.h:63
static const int STRAYFLUX_NEAREST_FOOTPRINT
Definition: BaselineUtils.h:68
boost::shared_ptr< lsst::afw::detection::Footprint > FootprintPtrT
Definition: BaselineUtils.h:33
static void _find_stray_flux(lsst::afw::detection::Footprint const &foot, ImagePtrT tsum, MaskedImageT const &img, int strayFluxOptions, std::vector< std::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< std::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays)
boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT > MaskedImagePtrT
Definition: BaselineUtils.h:26
lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > MaskedImageT
Definition: BaselineUtils.h:25
static std::shared_ptr< lsst::afw::detection::Footprint > getSignificantEdgePixels(ImagePtrT, std::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Returns a list of pixels that are on the edge of the given Footprint sfoot* in image img,...
static void makeMonotonic(ImageT &img, lsst::afw::detection::PeakRecord const &pk)
Given an image mimg and Peak location peak, overwrite mimg so that pixels further from the peak have ...
boost::shared_ptr< lsst::afw::image::Image< ImagePixelT > > ImagePtrT
Definition: BaselineUtils.h:28
boost::shared_ptr< lsst::afw::detection::HeavyFootprint< ImagePixelT > MaskPixelT, VariancePixelT > HeavyFootprintPtrT
Definition: BaselineUtils.h:36
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > HeavyFootprintT
Definition: BaselineUtils.h:34
lsst::afw::image::Image< ImagePixelT > ImageT
Definition: BaselineUtils.h:27
lsst::afw::image::Mask< MaskPixelT > MaskT
Definition: BaselineUtils.h:29
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)
Given an img, footprint foot, and peak, creates a symmetric template around the peak; produce a Maske...
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< std::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< std::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays, int strayFluxOptions, double clipStrayFluxFraction)
Splits flux in a given image img, within a given footprint foot, among a number of templates timgs,...
static void _sum_templates(std::vector< ImagePtrT > timgs, ImagePtrT tsum)
static bool hasSignificantFluxAtEdge(ImagePtrT, std::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Returns true if the given Footprint sfoot in image img has flux above value thresh at its edge.
static boost::shared_ptr< lsst::afw::detection::Footprint > symmetrizeFootprint(lsst::afw::detection::Footprint const &foot, int cx, int cy)
Given a Footprint foot and peak cx,cy, returns a Footprint that is symmetric around the peak (with tw...
lsst::afw::detection::Footprint FootprintT
Definition: BaselineUtils.h:32
static const int STRAYFLUX_TO_POINT_SOURCES_ALWAYS
Definition: BaselineUtils.h:64
std::int32_t MaskPixel
default type for Masks and MaskedImage Masks
float VariancePixel
default type for MaskedImage variance images
A base class for image defects.