VectorKernel.h

Classes

VectorKernel -- Make a Vector smoothing kernel from a kernel specification (full description)

class VectorKernel

Types

enum KernelTypes

BOXCAR
Box-car smoothing kernel
GAUSSIAN
Gaussian smoothing kernel
HANNING
Hanning smoothing kernel
NKERNELS

Interface

Public Members
static Vector<Double> make(KernelTypes kernelType, Double width, uInt shape, Bool useShapeExactly, Bool peakIsUnity=False)
static Vector<Float> make(KernelTypes kernelType, Float width, uInt shape, Bool useShapeExactly, Bool peakIsUnity=False)
static Vector<Int> toKernelTypes (const String& kernels, const Regex& delimiter)
static Vector<Int> toKernelTypes (const Vector<String>& kernels)
static VectorKernel::KernelTypes toKernelType (const String& kernel)
static String fromKernelType (KernelTypes kernelType)

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Returns a vector from a smoothing kernel specification.

Synopsis

This class takes a smoothing kernel type and a width, and generates a Vector holding that kernel. It can be used in conjunction with the separable image convolver, SepImageConvolver

The kernels can be normalized so that the peak of the kernel is 1, or 1/area under the kernel. The latter ensures conservation of integrated pixel value (the usual jargon is conservation of flux for images) and is the default.

Example


 

Motivation

To Do

Member Description

enum KernelTypes

static Vector<Double> make(KernelTypes kernelType, Double width, uInt shape, Bool useShapeExactly, Bool peakIsUnity=False)
static Vector<Float> make(KernelTypes kernelType, Float width, uInt shape, Bool useShapeExactly, Bool peakIsUnity=False)

Create kernel vector for width in pixels. For Gaussian, width is FWHM, for Boxcar, width is full width. For Hanning width is ignored (always 3) If useShape is True, the proided shape is used exactly. If useShapeExactly is False, the kernel length will be the max of the provided shape and an autoestimate (e.g. from +/- 5sigma limits for a Gaussian). If it's True, that shape is used exactly. The output shape is always 3 for Hanning.

static Vector<Int> toKernelTypes (const String& kernels, const Regex& delimiter)

Helper function to convert a string containing a list of desired smoothed kernel types to the correct Vector<Int> required for the setSmooth function. This may be usful if your user interface involves strings rather than integers. A new value is added to the output vector (which is resized appropriately) if any of the substrings "boxcar", "gaussian" or "hanning" (actually "box", "gauss", and "hann" will do) is present.

static Vector<Int> toKernelTypes (const Vector<String>& kernels)

static VectorKernel::KernelTypes toKernelType (const String& kernel)

static String fromKernelType (KernelTypes kernelType)