Class SeparableKernel¶
Defined in File Kernel.h
Inheritance Relationships¶
Base Types¶
public lsst::afw::table::io::PersistableFacade< SeparableKernel >
(Template Class PersistableFacade)public lsst::afw::math::Kernel
(Class Kernel)
Derived Types¶
public lsst::afw::math::BilinearWarpingKernel
(Class BilinearWarpingKernel)public lsst::afw::math::LanczosWarpingKernel
(Class LanczosWarpingKernel)public lsst::afw::math::NearestWarpingKernel
(Class NearestWarpingKernel)
Class Documentation¶
-
class
SeparableKernel
: public lsst::afw::table::io::PersistableFacade<SeparableKernel>, public lsst::afw::math::Kernel¶ A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
The function’s x, y arguments are as follows:
-getCtr() for the lower left corner pixel
0, 0 for the center pixel
(getDimensions() - 1) - getCtr() for the upper right pixel
Note: each pixel is set to the value of the kernel function at the center of the pixel (rather than averaging the function over the area of the pixel).
Subclassed by lsst::afw::math::BilinearWarpingKernel, lsst::afw::math::LanczosWarpingKernel, lsst::afw::math::NearestWarpingKernel
Public Types
-
typedef std::shared_ptr<KernelFunction>
KernelFunctionPtr
¶
Public Functions
-
SeparableKernel
()¶ Construct an empty spatially invariant SeparableKernel of size 0x0
-
SeparableKernel
(int width, int height, KernelFunction const &kernelColFunction, KernelFunction const &kernelRowFunction, Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction())¶ Construct a spatially invariant SeparableKernel, or a spatially varying SeparableKernel that uses the same functional form to model each function parameter.
- Parameters
width
: width of kernelheight
: height of kernelkernelColFunction
: kernel column functionkernelRowFunction
: kernel row functionspatialFunction
: spatial function; one deep copy is made for each kernel column and row function parameter; if omitted or set to Kernel::NullSpatialFunction then the kernel is spatially invariant
-
SeparableKernel
(int width, int height, KernelFunction const &kernelColFunction, KernelFunction const &kernelRowFunction, std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList)¶ Construct a spatially varying SeparableKernel
- Parameters
width
: width of kernelheight
: height of kernelkernelColFunction
: kernel column functionkernelRowFunction
: kernel row functionspatialFunctionList
: list of spatial funcs, one per kernel column and row function parameter; a deep copy is made of each function
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if the length of spatialFunctionList != # kernel function parameters.
-
SeparableKernel
(const SeparableKernel&)¶
-
SeparableKernel
(SeparableKernel&&)¶
-
SeparableKernel &
operator=
(const SeparableKernel&)¶
-
SeparableKernel &
operator=
(SeparableKernel&&)¶
-
~SeparableKernel
()¶
-
std::shared_ptr<Kernel>
clone
() const¶ Return a pointer to a deep copy of this kernel
This kernel exists instead of a copy constructor so one can obtain a copy of an actual kernel instead of a useless copy of the base class.
Every kernel subclass must override this method.
- Return
a pointer to a deep copy of the kernel
-
std::shared_ptr<Kernel>
resized
(int width, int height) const¶ Return a pointer to a clone with specified kernel dimensions
Must be implemented by derived classes.
- Return
a pointer to a clone with new dimensions.
- Parameters
width
: Number of columns in pixelsheight
: Number of rows in pixels
-
double
computeVectors
(std::vector<Pixel> &colList, std::vector<Pixel> &rowList, bool doNormalize, double x = 0.0, double y = 0.0) const¶ Compute the column and row arrays in place, where kernel(col, row) = colList(col) * rowList(row)
x, y are ignored if there is no spatial function.
- Return
the kernel sum (1.0 if doNormalize true)
- Parameters
colList
: column vectorrowList
: row vectordoNormalize
: normalize the image (so sum of each is 1)?x
: x (column position) at which to compute spatial functiony
: y (row position) at which to compute spatial function
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if colList or rowList is the wrong sizelsst::pex::exceptions::OverflowError
: if doNormalize is true and the kernel sum is exactly 0
-
double
getKernelParameter
(unsigned int i) const¶ Return a particular Kernel Parameter (no bounds checking). This version is slow, but specialisations may be faster
-
std::vector<double>
getKernelParameters
() const¶ Return the current kernel parameters
If the kernel is spatially varying then the parameters are those last computed. See also computeKernelParametersFromSpatialModel. If there are no kernel parameters then returns an empty vector.
-
KernelFunctionPtr
getKernelColFunction
() const¶ Get a deep copy of the col kernel function
-
KernelFunctionPtr
getKernelRowFunction
() const¶ Get a deep copy of the row kernel function
-
std::string
toString
(std::string const &prefix = "") const¶ Return a string representation of the kernel
-
void
computeCache
(int const const)¶ Compute a cache of Kernel values, if desired
- Warning
: few kernel classes actually support this, in which case this is a no-op and getCacheSize always returns 0.
-
int
getCacheSize
() const¶ Get the current cache size (0 if none)
Protected Functions
-
double
doComputeImage
(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const¶ Low-level version of computeImage
Before this is called the image dimensions are checked, the image’s xy0 is set and the kernel’s parameters are set. This routine sets the pixels, including normalization if requested.
- Return
The kernel sum
- Parameters
image
: image whose pixels are to be set (output)doNormalize
: normalize the image (so sum is 1)?
-
void
setKernelParameter
(unsigned int ind, double value) const¶ Set one kernel parameter
Classes that have kernel parameters must subclass this function.
This function is marked “const”, despite modifying unimportant internals, so that computeImage can be const.
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: always (unless subclassed)