lsst.afw  14.0-59-g0c7cc230b
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/afw/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  geom::Extent2I const getDimensions() const { return 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::afw::geom::Point2I getCtr() const { return lsst::afw::geom::Point2I(_ctrX, _ctrY); }
251 
257  inline int getCtrX() const { return _ctrX; }
258 
264  inline int getCtrY() const { return _ctrY; }
265 
270  return lsst::afw::geom::Box2I(lsst::afw::geom::Point2I(-_ctrX, -_ctrY),
271  lsst::afw::geom::Extent2I(_width, _height));
272  }
273 
277  inline unsigned int getNKernelParameters() const { return _nKernelParams; }
278 
282  inline int getNSpatialParameters() const {
283  return this->isSpatiallyVarying() ? _spatialFunctionList[0]->getNParameters() : 0;
284  }
285 
296  SpatialFunctionPtr getSpatialFunction(unsigned int index) const;
297 
304  std::vector<SpatialFunctionPtr> getSpatialFunctionList() const;
305 
308  virtual double getKernelParameter(unsigned int i) const { return getKernelParameters()[i]; }
309 
317  virtual std::vector<double> getKernelParameters() const;
318 
326  lsst::afw::geom::Box2I growBBox(lsst::afw::geom::Box2I const &bbox) const;
327 
338  lsst::afw::geom::Box2I shrinkBBox(lsst::afw::geom::Box2I const &bbox) const;
339 
343  inline void setCtr(lsst::afw::geom::Point2I ctr) {
344  _ctrX = ctr.getX();
345  _ctrY = ctr.getY();
346  _setKernelXY();
347  }
348 
354  inline void setCtrX(int ctrX) {
355  _ctrX = ctrX;
356  _setKernelXY();
357  }
358 
364  inline void setCtrY(int ctrY) {
365  _ctrY = ctrY;
366  _setKernelXY();
367  }
368 
373  std::vector<std::vector<double>> spatialParams;
374  std::vector<SpatialFunctionPtr>::const_iterator spFuncIter = _spatialFunctionList.begin();
375  for (; spFuncIter != _spatialFunctionList.end(); ++spFuncIter) {
376  spatialParams.push_back((*spFuncIter)->getParameters());
377  }
378  return spatialParams;
379  }
380 
384  inline bool isSpatiallyVarying() const { return _spatialFunctionList.size() != 0; }
385 
392  inline void setKernelParameters(std::vector<double> const &params) {
393  if (this->isSpatiallyVarying()) {
394  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Kernel is spatially varying");
395  }
396  const unsigned int nParams = this->getNKernelParameters();
397  if (nParams != params.size()) {
399  (boost::format("Number of parameters is wrong, saw %d expected %d") % nParams %
400  params.size())
401  .str());
402  }
403  for (unsigned int ii = 0; ii < nParams; ++ii) {
404  this->setKernelParameter(ii, params[ii]);
405  }
406  }
407 
414  inline void setKernelParameters(std::pair<double, double> const &params) {
415  this->setKernelParameter(0, params.first);
416  this->setKernelParameter(1, params.second);
417  }
418 
427  void setSpatialParameters(const std::vector<std::vector<double>> params);
428 
435  void computeKernelParametersFromSpatialModel(std::vector<double> &kernelParams, double x, double y) const;
436 
440  virtual std::string toString(std::string const &prefix = "") const;
441 
448  virtual void computeCache(int const
449  ) {}
450 
454  virtual int getCacheSize() const { return 0; };
455 
456 #if 0 // fails to compile with icc; is it actually used?
457  virtual void toFile(std::string fileName) const;
458 #endif
459 
460  struct PersistenceHelper;
461 
462 protected:
463  virtual std::string getPythonModule() const;
464 
475  virtual void setKernelParameter(unsigned int ind, double value) const;
476 
485  void setKernelParametersFromSpatialModel(double x, double y) const;
486 
498  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const = 0;
499 
501 
502 private:
504 
505  int _width;
506  int _height;
507  int _ctrX;
508  int _ctrY;
509  unsigned int _nKernelParams;
510 
511  // Set the Kernel's ideas about the x- and y- coordinates
512  virtual void _setKernelXY() {}
513 };
514 
516 
524 class FixedKernel : public afw::table::io::PersistableFacade<FixedKernel>, public Kernel {
525 public:
529  explicit FixedKernel();
530 
535  );
536 
540  explicit FixedKernel(lsst::afw::math::Kernel const &kernel,
541  lsst::afw::geom::Point2D const &pos
542  );
543 
544  FixedKernel(const FixedKernel &) = delete;
545  FixedKernel(FixedKernel &&) = delete;
546  FixedKernel &operator=(const FixedKernel &) = delete;
547  FixedKernel &operator=(FixedKernel &&) = delete;
548 
549  virtual ~FixedKernel() = default;
550 
551  virtual std::shared_ptr<Kernel> clone() const;
552 
553  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
554 
555  virtual std::string toString(std::string const &prefix = "") const;
556 
557  virtual Pixel getSum() const { return _sum; }
558 
559  virtual bool isPersistable() const { return true; }
560 
561  class Factory;
562 
563 protected:
564  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
565 
566  virtual std::string getPersistenceName() const;
567 
568  virtual void write(OutputArchiveHandle &handle) const;
569 
570 private:
572  Pixel _sum;
573 
574  friend class boost::serialization::access;
575  template <class Archive>
576  void serialize(Archive &ar, unsigned int const version) {
577  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
578  ar &make_nvp("img", _image);
579  ar &make_nvp("sum", _sum);
580  }
581 };
582 
596 class AnalyticKernel : public afw::table::io::PersistableFacade<AnalyticKernel>, public Kernel {
597 public:
600 
604  explicit AnalyticKernel();
605 
618  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
619  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
620 
634  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
635  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
636 
637  AnalyticKernel(const AnalyticKernel &) = delete;
638  AnalyticKernel(AnalyticKernel &&) = delete;
639  AnalyticKernel &operator=(const AnalyticKernel &) = delete;
640  AnalyticKernel &operator=(AnalyticKernel &&) = delete;
641 
642  virtual ~AnalyticKernel() = default;
643 
644  virtual std::shared_ptr<Kernel> clone() const;
645 
646  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
647 
668  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
669  double y = 0.0) const;
670 
671  virtual std::vector<double> getKernelParameters() const;
672 
676  virtual KernelFunctionPtr getKernelFunction() const;
677 
678  virtual std::string toString(std::string const &prefix = "") const;
679 
680  virtual bool isPersistable() const { return true; }
681 
682  class Factory;
683 
684 protected:
685  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
686 
687  virtual std::string getPersistenceName() const;
688 
689  virtual void write(OutputArchiveHandle &handle) const;
690 
691 protected:
692  virtual void setKernelParameter(unsigned int ind, double value) const;
693 
694  KernelFunctionPtr _kernelFunctionPtr;
695 
696  friend class boost::serialization::access;
697  template <class Archive>
698  void serialize(Archive &ar, unsigned int const version) {
699  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
700  ar &make_nvp("fn", _kernelFunctionPtr);
701  }
702 };
703 
711 class DeltaFunctionKernel : public afw::table::io::PersistableFacade<DeltaFunctionKernel>, public Kernel {
712 public:
713  // Traits values for this class of Kernel
715 
725  explicit DeltaFunctionKernel(int width, int height, lsst::afw::geom::Point2I const &point);
726 
727  DeltaFunctionKernel(const DeltaFunctionKernel &) = delete;
729  DeltaFunctionKernel &operator=(const DeltaFunctionKernel &) = delete;
730  DeltaFunctionKernel &operator=(DeltaFunctionKernel &&) = delete;
731 
732  virtual ~DeltaFunctionKernel() = default;
733 
734  virtual std::shared_ptr<Kernel> clone() const;
735 
736  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
737 
738  lsst::afw::geom::Point2I getPixel() const { return _pixel; }
739 
740  virtual std::string toString(std::string const &prefix = "") const;
741 
742  virtual bool isPersistable() const { return true; }
743 
744  class Factory;
745 
746 protected:
747  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
748 
749  virtual std::string getPersistenceName() const;
750 
751  virtual void write(OutputArchiveHandle &handle) const;
752 
753 private:
755 
756  friend class boost::serialization::access;
757  template <class Archive>
758  void serialize(Archive &ar, unsigned int const version) {
759  boost::serialization::void_cast_register<DeltaFunctionKernel, Kernel>(
760  static_cast<DeltaFunctionKernel *>(0), static_cast<Kernel *>(0));
761  }
762 };
763 
778 class LinearCombinationKernel : public afw::table::io::PersistableFacade<LinearCombinationKernel>,
779  public Kernel {
780 public:
784  explicit LinearCombinationKernel();
785 
792  explicit LinearCombinationKernel(KernelList const &kernelList,
793  std::vector<double> const &kernelParameters);
794 
802  explicit LinearCombinationKernel(KernelList const &kernelList,
803  Kernel::SpatialFunction const &spatialFunction);
804 
814  explicit LinearCombinationKernel(KernelList const &kernelList,
815  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
816 
819  LinearCombinationKernel &operator=(const LinearCombinationKernel &) = delete;
820  LinearCombinationKernel &operator=(LinearCombinationKernel &&) = delete;
821 
822  virtual ~LinearCombinationKernel() = default;
823 
824  virtual std::shared_ptr<Kernel> clone() const;
825 
826  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
827 
828  virtual std::vector<double> getKernelParameters() const;
829 
833  virtual KernelList const &getKernelList() const;
834 
838  std::vector<double> getKernelSumList() const;
839 
843  int getNBasisKernels() const { return static_cast<int>(_kernelList.size()); };
844 
850  void checkKernelList(const KernelList &kernelList) const;
851 
855  bool isDeltaFunctionBasis() const { return _isDeltaFunctionBasis; };
856 
891  std::shared_ptr<Kernel> refactor() const;
892 
893  virtual std::string toString(std::string const &prefix = "") const;
894 
895  virtual bool isPersistable() const { return true; }
896 
897  class Factory;
898 
899 protected:
900  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
901 
902  virtual std::string getPersistenceName() const;
903 
904  virtual void write(OutputArchiveHandle &handle) const;
905 
906  virtual void setKernelParameter(unsigned int ind, double value) const;
907 
908 private:
912  void _setKernelList(KernelList const &kernelList);
913 
914  KernelList _kernelList;
917  std::vector<double> _kernelSumList;
918  mutable std::vector<double> _kernelParams;
919  bool _isDeltaFunctionBasis;
920 
921  friend class boost::serialization::access;
922  template <class Archive>
923  void serialize(Archive &ar, unsigned int const version) {
924  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
925  ar &make_nvp("klist", _kernelList);
926  ar &make_nvp("kimglist", _kernelImagePtrList);
927  ar &make_nvp("ksumlist", _kernelSumList);
928  ar &make_nvp("params", _kernelParams);
929  if (version > 0) {
930  ar &make_nvp("deltaBasis", _isDeltaFunctionBasis);
931  } else if (Archive::is_loading::value) {
932  _isDeltaFunctionBasis = false;
933  }
934  }
935 };
936 
950 class SeparableKernel : public afw::table::io::PersistableFacade<SeparableKernel>, public Kernel {
951 public:
954 
958  explicit SeparableKernel();
959 
972  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
973  KernelFunction const &kernelRowFunction,
974  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
975 
989  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
990  KernelFunction const &kernelRowFunction,
991  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
992 
993  SeparableKernel(const SeparableKernel &) = delete;
994  SeparableKernel(SeparableKernel &&) = delete;
995  SeparableKernel &operator=(const SeparableKernel &) = delete;
996  SeparableKernel &operator=(SeparableKernel &&) = delete;
997 
998  virtual ~SeparableKernel() = default;
999 
1000  virtual std::shared_ptr<Kernel> clone() const;
1001 
1002  virtual std::shared_ptr<Kernel> resized(int width, int height) const;
1003 
1020  double computeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList, bool doNormalize,
1021  double x = 0.0, double y = 0.0) const;
1022 
1023  virtual double getKernelParameter(unsigned int i) const {
1024  unsigned int const ncol = _kernelColFunctionPtr->getNParameters();
1025  if (i < ncol) {
1026  return _kernelColFunctionPtr->getParameter(i);
1027  } else {
1028  i -= ncol;
1029  return _kernelRowFunctionPtr->getParameter(i);
1030  }
1031  }
1032  virtual std::vector<double> getKernelParameters() const;
1033 
1037  KernelFunctionPtr getKernelColFunction() const;
1038 
1042  KernelFunctionPtr getKernelRowFunction() const;
1043 
1044  virtual std::string toString(std::string const &prefix = "") const;
1045 
1046  /***
1047  * Compute a cache of values for the x and y kernel functions
1048  *
1049  * A value of 0 disables the cache for maximum accuracy.
1050  * 10,000 typically results in a warping error of a fraction of a count.
1051  * 100,000 typically results in a warping error of less than 0.01 count.
1052  *
1053  * @param cacheSize cache size (number of double precision array elements in the x and y caches)
1054  */
1055  virtual void computeCache(int const cacheSize);
1056 
1060  virtual int getCacheSize() const;
1061 
1062 protected:
1063  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const;
1064 
1065  virtual void setKernelParameter(unsigned int ind, double value) const;
1066 
1067 private:
1081  double basicComputeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList,
1082  bool doNormalize) const;
1083 
1084  KernelFunctionPtr _kernelColFunctionPtr;
1085  KernelFunctionPtr _kernelRowFunctionPtr;
1086  mutable std::vector<Pixel> _localColList; // used by doComputeImage
1087  mutable std::vector<Pixel> _localRowList;
1088  mutable std::vector<double> _kernelX; // used by SeparableKernel::basicComputeVectors
1089  mutable std::vector<double> _kernelY;
1090  //
1091  // Cached values of the row- and column- kernels
1092  //
1093  mutable std::vector<std::vector<double>> _kernelRowCache;
1094  mutable std::vector<std::vector<double>> _kernelColCache;
1095 
1096  friend class boost::serialization::access;
1097  template <class Archive>
1098  void serialize(Archive &ar, unsigned int const version) {
1099  ar &make_nvp("k", boost::serialization::base_object<Kernel>(*this));
1100  ar &make_nvp("colfn", _kernelColFunctionPtr);
1101  ar &make_nvp("rowfn", _kernelRowFunctionPtr);
1102  ar &make_nvp("cols", _localColList);
1103  ar &make_nvp("rows", _localRowList);
1104  ar &make_nvp("kernelX", _kernelX);
1105  ar &make_nvp("kernelY", _kernelY);
1106  }
1107 
1108  virtual void _setKernelXY() {
1109  lsst::afw::geom::Extent2I const dim = getDimensions();
1110  lsst::afw::geom::Point2I const ctr = getCtr();
1111 
1112  assert(dim[0] == static_cast<int>(_kernelX.size()));
1113  for (int i = 0; i != dim.getX(); ++i) {
1114  _kernelX[i] = i - ctr.getX();
1115  }
1116 
1117  assert(dim[1] == static_cast<int>(_kernelY.size()));
1118  for (int i = 0; i != dim.getY(); ++i) {
1119  _kernelY[i] = i - ctr.getY();
1120  }
1121  }
1122 };
1123 }
1124 }
1125 } // lsst:afw::math
1126 
1127 namespace boost {
1128 namespace serialization {
1129 
1130 template <class Archive>
1132  unsigned int const file_version) {
1133  int width = k->getWidth();
1134  int height = k->getHeight();
1135  int x = k->getPixel().getX();
1136  int y = k->getPixel().getY();
1137  ar << make_nvp("width", width);
1138  ar << make_nvp("height", height);
1139  ar << make_nvp("pixX", x);
1140  ar << make_nvp("pixY", y);
1141 }
1142 
1143 template <class Archive>
1145  unsigned int const file_version) {
1146  int width;
1147  int height;
1148  int x;
1149  int y;
1150  ar >> make_nvp("width", width);
1151  ar >> make_nvp("height", height);
1152  ar >> make_nvp("pixX", x);
1153  ar >> make_nvp("pixY", y);
1154  ::new (k) lsst::afw::math::DeltaFunctionKernel(width, height, lsst::afw::geom::Point2I(x, y));
1155 }
1156 }
1157 }
1158 
1159 BOOST_CLASS_VERSION(lsst::afw::math::LinearCombinationKernel, 1)
1160 
1161 #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:454
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:680
std::shared_ptr< KernelFunction > KernelFunctionPtr
Definition: Kernel.h:953
virtual Pixel getSum() const
Definition: Kernel.h:557
void setDimensions(geom::Extent2I dims)
Definition: Kernel.h:230
virtual void computeCache(int const)
Compute a cache of Kernel values, if desired.
Definition: Kernel.h:448
void setWidth(int width)
Definition: Kernel.h:234
An object passed to Persistable::write to allow it to persist itself.
lsst::afw::geom::Box2I getBBox() const
return parent bounding box, with XY0 = -center
Definition: Kernel.h:269
virtual bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:895
lsst::afw::math::Function1< Pixel > KernelFunction
Definition: Kernel.h:952
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:308
void setKernelParameters(std::vector< double > const &params)
Set the kernel parameters of a spatially invariant kernel.
Definition: Kernel.h:392
lsst::afw::geom::Point2I getCtr() const
Return index of kernel&#39;s center.
Definition: Kernel.h:250
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:1023
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Definition: Kernel.h:950
void serialize(Archive &ar, unsigned int const version)
Definition: Kernel.h:698
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:742
void setHeight(int height)
Definition: Kernel.h:235
bool isDeltaFunctionBasis() const
Return true if all basis kernels are instances of DeltaFunctionKernel.
Definition: Kernel.h:855
T end(T... args)
lsst::afw::math::NullFunction2< double > NullSpatialFunction
Definition: Kernel.h:131
Extent< int, 2 > Extent2I
Definition: Extent.h:380
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:559
A Function taking two arguments.
Definition: Function.h:277
int getNBasisKernels() const
Get the number of basis kernels.
Definition: Kernel.h:843
An integer coordinate rectangle.
Definition: Box.h:55
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:497
T push_back(T... args)
bool isSpatiallyVarying() const
Return true iff the kernel is spatially varying (has a spatial function)
Definition: Kernel.h:384
void setCtrY(int ctrY)
Set y index of kernel&#39;s center.
Definition: Kernel.h:364
KernelFunctionPtr _kernelFunctionPtr
Definition: Kernel.h:694
A base class for image defects.
void setCtrX(int ctrX)
Set x index of kernel&#39;s center.
Definition: Kernel.h:354
A kernel that is a linear combination of fixed basis kernels.
Definition: Kernel.h:778
void setKernelParameters(std::pair< double, double > const &params)
Set the kernel parameters of a 2-component spatially invariant kernel.
Definition: Kernel.h:414
void load_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel *k, unsigned int const file_version)
Definition: Kernel.h:1144
A Function taking one argument.
Definition: Function.h:213
double x
generic_kernel_tag kernel_fill_factor
Definition: Kernel.h:134
void setCtr(lsst::afw::geom::Point2I ctr)
Set index of kernel&#39;s center.
Definition: Kernel.h:343
lsst::afw::geom::Point2I getPixel() const
Definition: Kernel.h:738
Formatter for persistence of Kernel instances.
int getWidth() const
Return the Kernel&#39;s width.
Definition: Kernel.h:240
unsigned int getNKernelParameters() const
Return the number of kernel parameters (0 if none)
Definition: Kernel.h:277
T size(T... args)
#define LSST_EXCEPT(type,...)
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:515
std::vector< SpatialFunctionPtr > _spatialFunctionList
Definition: Kernel.h:500
lsst::afw::math::Function2< Pixel > KernelFunction
Definition: Kernel.h:598
int getNSpatialParameters() const
Return the number of spatial parameters (0 if not spatially varying)
Definition: Kernel.h:282
#define LSST_PERSIST_FORMATTER(formatter...)
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:372
Point< int, 2 > Point2I
Definition: Point.h:297
deltafunction_kernel_tag kernel_fill_factor
Definition: Kernel.h:714
A kernel described by a function.
Definition: Kernel.h:596
std::shared_ptr< lsst::afw::math::Function2< Pixel > > KernelFunctionPtr
Definition: Kernel.h:599
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:1131
geom::Extent2I const getDimensions() const
Return the Kernel&#39;s dimensions (width, height)
Definition: Kernel.h:228
A kernel that has only one non-zero pixel (of value 1)
Definition: Kernel.h:711
Tags carrying information about Kernels Kernel with no special properties.
Definition: traits.h:53
A kernel created from an Image.
Definition: Kernel.h:524