lsst.afw  15.0-33-g5c41f601f+4
Kernel.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2016 AURA/LSST.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #ifndef LSST_AFW_MATH_KERNEL_H
26 #define LSST_AFW_MATH_KERNEL_H
27 /*
28  * Declare the Kernel class and subclasses.
29  */
30 #include <memory>
31 #include <type_traits>
32 #include <utility>
33 #include <vector>
34 
35 #include "boost/mpl/or.hpp"
36 
37 #include "boost/serialization/shared_ptr.hpp"
38 #include "boost/serialization/vector.hpp"
39 #include "boost/serialization/export.hpp"
40 
42 #include "lsst/daf/base/Citizen.h"
43 #include "lsst/geom.h"
44 #include "lsst/afw/image/Image.h"
45 #include "lsst/afw/image/Utils.h"
46 #include "lsst/afw/math/Function.h"
47 #include "lsst/afw/math/traits.h"
48 
50 
51 namespace lsst {
52 namespace afw {
53 
54 namespace formatters {
55 class KernelFormatter;
56 }
57 
58 namespace math {
59 
60 using boost::serialization::make_nvp;
61 
125  public afw::table::io::PersistableFacade<Kernel>,
127 public:
128  typedef double Pixel;
132 
133  // Traits values for this class of Kernel
135 
141  explicit Kernel();
142 
156  explicit Kernel(int width, int height, unsigned int nKernelParams,
157  SpatialFunction const &spatialFunction = NullSpatialFunction());
158 
170  explicit Kernel(int width, int height, const std::vector<SpatialFunctionPtr> spatialFunctionList);
171 
172  // prevent copying and assignment (to avoid problems from type slicing)
173  Kernel(const Kernel &) = delete;
174  Kernel(Kernel &&) = delete;
175  Kernel &operator=(const Kernel &) = delete;
176  Kernel &operator=(Kernel &&) = delete;
177 
178  virtual ~Kernel() = default;
179 
191  virtual std::shared_ptr<Kernel> clone() const = 0;
192 
203  virtual std::shared_ptr<Kernel> resized(int width, int height) const = 0;
204 
222  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
223  double y = 0.0) const;
224 
228  lsst::geom::Extent2I const getDimensions() const { return lsst::geom::Extent2I(_width, _height); }
229 
231  _width = dims.getX();
232  _height = dims.getY();
233  }
234  inline void setWidth(int width) { _width = width; }
235  inline void setHeight(int height) { _height = height; }
236 
240  inline int getWidth() const { return _width; }
241 
245  inline int getHeight() const { return _height; }
246 
250  inline lsst::geom::Point2I getCtr() const { return lsst::geom::Point2I(_ctrX, _ctrY); }
251 
257  inline int getCtrX() const { return _ctrX; }
258 
264  inline int getCtrY() const { return _ctrY; }
265 
269  inline lsst::geom::Box2I getBBox() const {
270  return lsst::geom::Box2I(lsst::geom::Point2I(-_ctrX, -_ctrY), lsst::geom::Extent2I(_width, _height));
271  }
272 
276  inline unsigned int getNKernelParameters() const { return _nKernelParams; }
277 
281  inline int getNSpatialParameters() const {
282  return this->isSpatiallyVarying() ? _spatialFunctionList[0]->getNParameters() : 0;
283  }
284 
295  SpatialFunctionPtr getSpatialFunction(unsigned int index) const;
296 
303  std::vector<SpatialFunctionPtr> getSpatialFunctionList() const;
304 
307  virtual double getKernelParameter(unsigned int i) const { return getKernelParameters()[i]; }
308 
316  virtual std::vector<double> getKernelParameters() const;
317 
325  lsst::geom::Box2I growBBox(lsst::geom::Box2I const &bbox) const;
326 
337  lsst::geom::Box2I shrinkBBox(lsst::geom::Box2I const &bbox) const;
338 
342  inline void setCtr(lsst::geom::Point2I ctr) {
343  _ctrX = ctr.getX();
344  _ctrY = ctr.getY();
345  _setKernelXY();
346  }
347 
353  inline void setCtrX(int ctrX) {
354  _ctrX = ctrX;
355  _setKernelXY();
356  }
357 
363  inline void setCtrY(int ctrY) {
364  _ctrY = ctrY;
365  _setKernelXY();
366  }
367 
372  std::vector<std::vector<double>> spatialParams;
373  std::vector<SpatialFunctionPtr>::const_iterator spFuncIter = _spatialFunctionList.begin();
374  for (; spFuncIter != _spatialFunctionList.end(); ++spFuncIter) {
375  spatialParams.push_back((*spFuncIter)->getParameters());
376  }
377  return spatialParams;
378  }
379 
383  inline bool isSpatiallyVarying() const { return _spatialFunctionList.size() != 0; }
384 
391  inline void setKernelParameters(std::vector<double> const &params) {
392  if (this->isSpatiallyVarying()) {
393  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Kernel is spatially varying");
394  }
395  const unsigned int nParams = this->getNKernelParameters();
396  if (nParams != params.size()) {
398  (boost::format("Number of parameters is wrong, saw %d expected %d") % nParams %
399  params.size())
400  .str());
401  }
402  for (unsigned int ii = 0; ii < nParams; ++ii) {
403  this->setKernelParameter(ii, params[ii]);
404  }
405  }
406 
413  inline void setKernelParameters(std::pair<double, double> const &params) {
414  this->setKernelParameter(0, params.first);
415  this->setKernelParameter(1, params.second);
416  }
417 
426  void setSpatialParameters(const std::vector<std::vector<double>> params);
427 
434  void computeKernelParametersFromSpatialModel(std::vector<double> &kernelParams, double x, double y) const;
435 
439  virtual std::string toString(std::string const &prefix = "") const;
440 
447  virtual void computeCache(int const
448  ) {}
449 
453  virtual int getCacheSize() const { return 0; };
454 
455 #if 0 // fails to compile with icc; is it actually used?
456  virtual void toFile(std::string fileName) const;
457 #endif
458 
459  struct PersistenceHelper;
460 
461 protected:
462  virtual std::string getPythonModule() const;
463 
474  virtual void setKernelParameter(unsigned int ind, double value) const;
475 
484  void setKernelParametersFromSpatialModel(double x, double y) const;
485 
497  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const = 0;
498 
500 
501 private:
503 
504  int _width;
505  int _height;
506  int _ctrX;
507  int _ctrY;
508  unsigned int _nKernelParams;
509 
510  // Set the Kernel's ideas about the x- and y- coordinates
511  virtual void _setKernelXY() {}
512 };
513 
515 
523 class FixedKernel : public afw::table::io::PersistableFacade<FixedKernel>, public Kernel {
524 public:
528  explicit FixedKernel();
529 
534  );
535 
539  explicit FixedKernel(lsst::afw::math::Kernel const &kernel,
540  lsst::geom::Point2D const &pos
541  );
542 
543  FixedKernel(const FixedKernel &) = delete;
544  FixedKernel(FixedKernel &&) = delete;
545  FixedKernel &operator=(const FixedKernel &) = delete;
546  FixedKernel &operator=(FixedKernel &&) = delete;
547 
548  virtual ~FixedKernel() = default;
549 
550  virtual std::shared_ptr<Kernel> clone() const;
551 
552  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
553 
554  virtual std::string toString(std::string const &prefix = "") const;
555 
556  virtual Pixel getSum() const { return _sum; }
557 
558  virtual bool isPersistable() const { return true; }
559 
560  class Factory;
561 
562 protected:
563  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
564 
565  virtual std::string getPersistenceName() const;
566 
567  virtual void write(OutputArchiveHandle &handle) const;
568 
569 private:
571  Pixel _sum;
572 
573  friend class boost::serialization::access;
574  template <class Archive>
575  void serialize(Archive &ar, unsigned int const version) {
576  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
577  ar &make_nvp("img", _image);
578  ar &make_nvp("sum", _sum);
579  }
580 };
581 
595 class AnalyticKernel : public afw::table::io::PersistableFacade<AnalyticKernel>, public Kernel {
596 public:
599 
603  explicit AnalyticKernel();
604 
617  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
618  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
619 
633  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
634  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
635 
636  AnalyticKernel(const AnalyticKernel &) = delete;
637  AnalyticKernel(AnalyticKernel &&) = delete;
638  AnalyticKernel &operator=(const AnalyticKernel &) = delete;
639  AnalyticKernel &operator=(AnalyticKernel &&) = delete;
640 
641  virtual ~AnalyticKernel() = default;
642 
643  virtual std::shared_ptr<Kernel> clone() const;
644 
645  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
646 
667  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
668  double y = 0.0) const;
669 
670  virtual std::vector<double> getKernelParameters() const;
671 
675  virtual KernelFunctionPtr getKernelFunction() const;
676 
677  virtual std::string toString(std::string const &prefix = "") const;
678 
679  virtual bool isPersistable() const { return true; }
680 
681  class Factory;
682 
683 protected:
684  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
685 
686  virtual std::string getPersistenceName() const;
687 
688  virtual void write(OutputArchiveHandle &handle) const;
689 
690 protected:
691  virtual void setKernelParameter(unsigned int ind, double value) const;
692 
693  KernelFunctionPtr _kernelFunctionPtr;
694 
695  friend class boost::serialization::access;
696  template <class Archive>
697  void serialize(Archive &ar, unsigned int const version) {
698  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
699  ar &make_nvp("fn", _kernelFunctionPtr);
700  }
701 };
702 
710 class DeltaFunctionKernel : public afw::table::io::PersistableFacade<DeltaFunctionKernel>, public Kernel {
711 public:
712  // Traits values for this class of Kernel
714 
724  explicit DeltaFunctionKernel(int width, int height, lsst::geom::Point2I const &point);
725 
726  DeltaFunctionKernel(const DeltaFunctionKernel &) = delete;
728  DeltaFunctionKernel &operator=(const DeltaFunctionKernel &) = delete;
729  DeltaFunctionKernel &operator=(DeltaFunctionKernel &&) = delete;
730 
731  virtual ~DeltaFunctionKernel() = default;
732 
733  virtual std::shared_ptr<Kernel> clone() const;
734 
735  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
736 
737  lsst::geom::Point2I getPixel() const { return _pixel; }
738 
739  virtual std::string toString(std::string const &prefix = "") const;
740 
741  virtual bool isPersistable() const { return true; }
742 
743  class Factory;
744 
745 protected:
746  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
747 
748  virtual std::string getPersistenceName() const;
749 
750  virtual void write(OutputArchiveHandle &handle) const;
751 
752 private:
753  lsst::geom::Point2I _pixel;
754 
755  friend class boost::serialization::access;
756  template <class Archive>
757  void serialize(Archive &ar, unsigned int const version) {
758  boost::serialization::void_cast_register<DeltaFunctionKernel, Kernel>(
759  static_cast<DeltaFunctionKernel *>(0), static_cast<Kernel *>(0));
760  }
761 };
762 
777 class LinearCombinationKernel : public afw::table::io::PersistableFacade<LinearCombinationKernel>,
778  public Kernel {
779 public:
783  explicit LinearCombinationKernel();
784 
791  explicit LinearCombinationKernel(KernelList const &kernelList,
792  std::vector<double> const &kernelParameters);
793 
801  explicit LinearCombinationKernel(KernelList const &kernelList,
802  Kernel::SpatialFunction const &spatialFunction);
803 
813  explicit LinearCombinationKernel(KernelList const &kernelList,
814  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
815 
818  LinearCombinationKernel &operator=(const LinearCombinationKernel &) = delete;
819  LinearCombinationKernel &operator=(LinearCombinationKernel &&) = delete;
820 
821  virtual ~LinearCombinationKernel() = default;
822 
823  virtual std::shared_ptr<Kernel> clone() const;
824 
825  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
826 
827  virtual std::vector<double> getKernelParameters() const;
828 
832  virtual KernelList const &getKernelList() const;
833 
837  std::vector<double> getKernelSumList() const;
838 
842  int getNBasisKernels() const { return static_cast<int>(_kernelList.size()); };
843 
849  void checkKernelList(const KernelList &kernelList) const;
850 
854  bool isDeltaFunctionBasis() const { return _isDeltaFunctionBasis; };
855 
890  std::shared_ptr<Kernel> refactor() const;
891 
892  virtual std::string toString(std::string const &prefix = "") const;
893 
894  virtual bool isPersistable() const { return true; }
895 
896  class Factory;
897 
898 protected:
899  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
900 
901  virtual std::string getPersistenceName() const;
902 
903  virtual void write(OutputArchiveHandle &handle) const;
904 
905  virtual void setKernelParameter(unsigned int ind, double value) const;
906 
907 private:
911  void _setKernelList(KernelList const &kernelList);
912 
913  KernelList _kernelList;
916  std::vector<double> _kernelSumList;
917  mutable std::vector<double> _kernelParams;
918  bool _isDeltaFunctionBasis;
919 
920  friend class boost::serialization::access;
921  template <class Archive>
922  void serialize(Archive &ar, unsigned int const version) {
923  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
924  ar &make_nvp("klist", _kernelList);
925  ar &make_nvp("kimglist", _kernelImagePtrList);
926  ar &make_nvp("ksumlist", _kernelSumList);
927  ar &make_nvp("params", _kernelParams);
928  if (version > 0) {
929  ar &make_nvp("deltaBasis", _isDeltaFunctionBasis);
930  } else if (Archive::is_loading::value) {
931  _isDeltaFunctionBasis = false;
932  }
933  }
934 };
935 
949 class SeparableKernel : public afw::table::io::PersistableFacade<SeparableKernel>, public Kernel {
950 public:
953 
957  explicit SeparableKernel();
958 
971  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
972  KernelFunction const &kernelRowFunction,
973  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
974 
988  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
989  KernelFunction const &kernelRowFunction,
990  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
991 
992  SeparableKernel(const SeparableKernel &) = delete;
993  SeparableKernel(SeparableKernel &&) = delete;
994  SeparableKernel &operator=(const SeparableKernel &) = delete;
995  SeparableKernel &operator=(SeparableKernel &&) = delete;
996 
997  virtual ~SeparableKernel() = default;
998 
999  virtual std::shared_ptr<Kernel> clone() const;
1000 
1001  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
1002 
1019  double computeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList, bool doNormalize,
1020  double x = 0.0, double y = 0.0) const;
1021 
1022  virtual double getKernelParameter(unsigned int i) const {
1023  unsigned int const ncol = _kernelColFunctionPtr->getNParameters();
1024  if (i < ncol) {
1025  return _kernelColFunctionPtr->getParameter(i);
1026  } else {
1027  i -= ncol;
1028  return _kernelRowFunctionPtr->getParameter(i);
1029  }
1030  }
1031  virtual std::vector<double> getKernelParameters() const;
1032 
1036  KernelFunctionPtr getKernelColFunction() const;
1037 
1041  KernelFunctionPtr getKernelRowFunction() const;
1042 
1043  virtual std::string toString(std::string const &prefix = "") const;
1044 
1045  /***
1046  * Compute a cache of values for the x and y kernel functions
1047  *
1048  * A value of 0 disables the cache for maximum accuracy.
1049  * 10,000 typically results in a warping error of a fraction of a count.
1050  * 100,000 typically results in a warping error of less than 0.01 count.
1051  *
1052  * @param cacheSize cache size (number of double precision array elements in the x and y caches)
1053  */
1054  virtual void computeCache(int const cacheSize);
1055 
1059  virtual int getCacheSize() const;
1060 
1061 protected:
1062  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
1063 
1064  virtual void setKernelParameter(unsigned int ind, double value) const;
1065 
1066 private:
1080  double basicComputeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList,
1081  bool doNormalize) const;
1082 
1083  KernelFunctionPtr _kernelColFunctionPtr;
1084  KernelFunctionPtr _kernelRowFunctionPtr;
1085  mutable std::vector<Pixel> _localColList; // used by doComputeImage
1086  mutable std::vector<Pixel> _localRowList;
1087  mutable std::vector<double> _kernelX; // used by SeparableKernel::basicComputeVectors
1088  mutable std::vector<double> _kernelY;
1089  //
1090  // Cached values of the row- and column- kernels
1091  //
1092  mutable std::vector<std::vector<double>> _kernelRowCache;
1093  mutable std::vector<std::vector<double>> _kernelColCache;
1094 
1095  friend class boost::serialization::access;
1096  template <class Archive>
1097  void serialize(Archive &ar, unsigned int const version) {
1098  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
1099  ar &make_nvp("colfn", _kernelColFunctionPtr);
1100  ar &make_nvp("rowfn", _kernelRowFunctionPtr);
1101  ar &make_nvp("cols", _localColList);
1102  ar &make_nvp("rows", _localRowList);
1103  ar &make_nvp("kernelX", _kernelX);
1104  ar &make_nvp("kernelY", _kernelY);
1105  }
1106 
1107  virtual void _setKernelXY() {
1108  lsst::geom::Extent2I const dim = getDimensions();
1109  lsst::geom::Point2I const ctr = getCtr();
1110 
1111  assert(dim[0] == static_cast<int>(_kernelX.size()));
1112  for (int i = 0; i != dim.getX(); ++i) {
1113  _kernelX[i] = i - ctr.getX();
1114  }
1115 
1116  assert(dim[1] == static_cast<int>(_kernelY.size()));
1117  for (int i = 0; i != dim.getY(); ++i) {
1118  _kernelY[i] = i - ctr.getY();
1119  }
1120  }
1121 };
1122 } // namespace math
1123 } // namespace afw
1124 } // namespace lsst
1125 
1126 namespace boost {
1127 namespace serialization {
1128 
1129 template <class Archive>
1131  unsigned int const file_version) {
1132  int width = k->getWidth();
1133  int height = k->getHeight();
1134  int x = k->getPixel().getX();
1135  int y = k->getPixel().getY();
1136  ar << make_nvp("width", width);
1137  ar << make_nvp("height", height);
1138  ar << make_nvp("pixX", x);
1139  ar << make_nvp("pixY", y);
1140 }
1141 
1142 template <class Archive>
1144  unsigned int const file_version) {
1145  int width;
1146  int height;
1147  int x;
1148  int y;
1149  ar >> make_nvp("width", width);
1150  ar >> make_nvp("height", height);
1151  ar >> make_nvp("pixX", x);
1152  ar >> make_nvp("pixY", y);
1153  ::new (k) lsst::afw::math::DeltaFunctionKernel(width, height, lsst::geom::Point2I(x, y));
1154 }
1155 } // namespace serialization
1156 } // namespace boost
1157 
1158 BOOST_CLASS_VERSION(lsst::afw::math::LinearCombinationKernel, 1)
1159 
1160 #endif // !defined(LSST_AFW_MATH_KERNEL_H)
virtual int getCacheSize() const
Get the current size of the kernel cache (0 if none or if caches not supported)
Definition: Kernel.h:453
int getHeight() const
Return the Kernel&#39;s height.
Definition: Kernel.h:245
int getCtrX() const
Return x index of kernel&#39;s center.
Definition: Kernel.h:257
int getCtrY() const
Return y index of kernel&#39;s center.
Definition: Kernel.h:264
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:679
std::shared_ptr< KernelFunction > KernelFunctionPtr
Definition: Kernel.h:952
virtual Pixel getSum() const
Definition: Kernel.h:556
virtual void computeCache(int const)
Compute a cache of Kernel values, if desired.
Definition: Kernel.h:447
void setWidth(int width)
Definition: Kernel.h:234
An object passed to Persistable::write to allow it to persist itself.
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:894
lsst::afw::math::Function1< Pixel > KernelFunction
Definition: Kernel.h:951
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:307
void setKernelParameters(std::vector< double > const &params)
Set the kernel parameters of a spatially invariant kernel.
Definition: Kernel.h:391
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:1022
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Definition: Kernel.h:949
void serialize(Archive &ar, unsigned int const version)
Definition: Kernel.h:697
std::shared_ptr< lsst::afw::math::Function2< double > > SpatialFunctionPtr
Definition: Kernel.h:129
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:741
void setHeight(int height)
Definition: Kernel.h:235
bool isDeltaFunctionBasis() const
Return true if all basis kernels are instances of DeltaFunctionKernel.
Definition: Kernel.h:854
T end(T... args)
lsst::afw::math::NullFunction2< double > NullSpatialFunction
Definition: Kernel.h:131
lsst::afw::math::Function2< double > SpatialFunction
Definition: Kernel.h:130
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:558
A Function taking two arguments.
Definition: Function.h:273
int getNBasisKernels() const
Get the number of basis kernels.
Definition: Kernel.h:842
STL class.
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
a class used in function calls to indicate that no Function2 is being provided
Definition: Function.h:492
T push_back(T... args)
bool isSpatiallyVarying() const
Return true iff the kernel is spatially varying (has a spatial function)
Definition: Kernel.h:383
void setCtrY(int ctrY)
Set y index of kernel&#39;s center.
Definition: Kernel.h:363
KernelFunctionPtr _kernelFunctionPtr
Definition: Kernel.h:693
A base class for image defects.
lsst::geom::Box2I getBBox() const
return parent bounding box, with XY0 = -center
Definition: Kernel.h:269
void setCtrX(int ctrX)
Set x index of kernel&#39;s center.
Definition: Kernel.h:353
A kernel that is a linear combination of fixed basis kernels.
Definition: Kernel.h:777
void setKernelParameters(std::pair< double, double > const &params)
Set the kernel parameters of a 2-component spatially invariant kernel.
Definition: Kernel.h:413
void load_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel *k, unsigned int const file_version)
Definition: Kernel.h:1143
A Function taking one argument.
Definition: Function.h:209
lsst::geom::Point2I getCtr() const
Return index of kernel&#39;s center.
Definition: Kernel.h:250
void setDimensions(lsst::geom::Extent2I dims)
Definition: Kernel.h:230
double x
void setCtr(lsst::geom::Point2I ctr)
Set index of kernel&#39;s center.
Definition: Kernel.h:342
Point< int, 2 > Point2I
generic_kernel_tag kernel_fill_factor
Definition: Kernel.h:134
Formatter for persistence of Kernel instances.
int getWidth() const
Return the Kernel&#39;s width.
Definition: Kernel.h:240
lsst::geom::Extent2I const getDimensions() const
Return the Kernel&#39;s dimensions (width, height)
Definition: Kernel.h:228
unsigned int getNKernelParameters() const
Return the number of kernel parameters (0 if none)
Definition: Kernel.h:276
T size(T... args)
#define LSST_EXCEPT(type,...)
Extent< int, 2 > Extent2I
STL class.
Kernel has only one non-zero pixel.
Definition: traits.h:56
table::Key< int > kernelFunction
T begin(T... args)
std::vector< std::shared_ptr< Kernel > > KernelList
Definition: Kernel.h:514
std::vector< SpatialFunctionPtr > _spatialFunctionList
Definition: Kernel.h:499
lsst::afw::math::Function2< Pixel > KernelFunction
Definition: Kernel.h:597
int getNSpatialParameters() const
Return the number of spatial parameters (0 if not spatially varying)
Definition: Kernel.h:281
#define LSST_PERSIST_FORMATTER(formatter...)
std::string prefix
Definition: SchemaMapper.cc:79
table::Box2IKey bbox
std::vector< std::vector< double > > getSpatialParameters() const
Return the spatial parameters parameters (an empty vector if not spatially varying) ...
Definition: Kernel.h:371
lsst::geom::Point2I getPixel() const
Definition: Kernel.h:737
deltafunction_kernel_tag kernel_fill_factor
Definition: Kernel.h:713
A kernel described by a function.
Definition: Kernel.h:595
std::shared_ptr< lsst::afw::math::Function2< Pixel > > KernelFunctionPtr
Definition: Kernel.h:598
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:123
void save_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel const *k, unsigned int const file_version)
Definition: Kernel.h:1130
int y
Definition: SpanSet.cc:44
A kernel that has only one non-zero pixel (of value 1)
Definition: Kernel.h:710
Tags carrying information about Kernels Kernel with no special properties.
Definition: traits.h:53
A kernel created from an Image.
Definition: Kernel.h:523