lsst.ip.diffim  13.0-22-g3839dbb+2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AssessSpatialKernelVisitor.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
12 #ifndef LSST_IP_DIFFIM_ASSESSSPATIALKERNELVISITOR_H
13 #define LSST_IP_DIFFIM_ASSESSSPATIALKERNELVISITOR_H
14 
15 #include "lsst/afw/math.h"
16 #include "lsst/afw/image.h"
17 #include "lsst/ip/diffim.h"
18 #include "lsst/pex/policy/Policy.h"
19 
20 namespace lsst {
21 namespace ip {
22 namespace diffim {
23 namespace detail {
24 
25  template<typename PixelT>
26  class AssessSpatialKernelVisitor : public lsst::afw::math::CandidateVisitor {
27  typedef lsst::afw::image::MaskedImage<PixelT> MaskedImageT;
28  public:
29  typedef std::shared_ptr<AssessSpatialKernelVisitor<PixelT> > Ptr;
30 
32  std::shared_ptr<lsst::afw::math::LinearCombinationKernel> spatialKernel,
33  lsst::afw::math::Kernel::SpatialFunctionPtr spatialBackground,
34  lsst::pex::policy::Policy const& policy
35  );
37 
38  void reset() {_nGood = 0; _nRejected = 0; _nProcessed = 0;}
39 
40  int getNGood() {return _nGood;}
41  int getNRejected() {return _nRejected;}
42  int getNProcessed() {return _nProcessed;}
43  void processCandidate(lsst::afw::math::SpatialCellCandidate *candidate);
44 
45  private:
46  std::shared_ptr<lsst::afw::math::LinearCombinationKernel> _spatialKernel;
47  lsst::afw::math::Kernel::SpatialFunctionPtr _spatialBackground;
48  lsst::pex::policy::Policy _policy;
50  int _nGood;
51  int _nRejected;
53 
56  };
57 
58  template<typename PixelT>
59  std::shared_ptr<AssessSpatialKernelVisitor<PixelT> >
61  std::shared_ptr<lsst::afw::math::LinearCombinationKernel> spatialKernel,
62  lsst::afw::math::Kernel::SpatialFunctionPtr spatialBackground,
63  lsst::pex::policy::Policy const& policy
64  ) {
65 
66  return std::shared_ptr<AssessSpatialKernelVisitor<PixelT>>(
67  new AssessSpatialKernelVisitor<PixelT>(spatialKernel, spatialBackground, policy)
68  );
69  }
70 
71 }}}} // end of namespace lsst::ip::diffim::detail
72 
73 #endif
std::shared_ptr< AssessSpatialKernelVisitor< PixelT > > Ptr
An include file to include the header files for lsst::ip::diffim.
int _nProcessed
Number of candidates processed during processCandidate()
Asseses the quality of a candidate given a spatial kernel and background model.
AssessSpatialKernelVisitor(std::shared_ptr< lsst::afw::math::LinearCombinationKernel > spatialKernel, lsst::afw::math::Kernel::SpatialFunctionPtr spatialBackground, lsst::pex::policy::Policy const &policy)
std::shared_ptr< AssessSpatialKernelVisitor< PixelT > > makeAssessSpatialKernelVisitor(std::shared_ptr< lsst::afw::math::LinearCombinationKernel > spatialKernel, lsst::afw::math::Kernel::SpatialFunctionPtr spatialBackground, lsst::pex::policy::Policy const &policy)
int _nRejected
Number of candidates rejected during processCandidate()
std::shared_ptr< lsst::afw::math::LinearCombinationKernel > _spatialKernel
Spatial kernel function.
ImageStatistics< PixelT > _imstats
To calculate statistics of difference image.
Class to calculate difference image statistics.
lsst::afw::math::Kernel::SpatialFunctionPtr _spatialBackground
Spatial background function.
void processCandidate(lsst::afw::math::SpatialCellCandidate *candidate)
lsst::pex::policy::Policy _policy
Policy controlling behavior.