casacore
VectorKernel.h
Go to the documentation of this file.
1 //# VectorKernel.h: generate Vector kernels
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef SCIMATH_VECTORKERNEL_H
29 #define SCIMATH_VECTORKERNEL_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/Vector.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 class Regex;
40 class String;
41 
42 // <summary>
43 // Make a Vector smoothing kernel from a kernel specification
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class="Vector">Vector</linkto>
53 // </prerequisite>
54 
55 // <etymology>
56 // Returns a vector from a smoothing kernel specification.
57 // </etymology>
58 
59 // <synopsis>
60 // This class takes a smoothing kernel type and a width, and
61 // generates a Vector holding that kernel. It can be used
62 // in conjunction with the separable image convolver,
63 // SepImageConvolver
64 //
65 // The kernels can be normalized so that the peak of the
66 // kernel is 1, or 1/area under the kernel. The latter ensures
67 // conservation of integrated pixel value (the usual jargon
68 // is conservation of flux for images) and is the default.
69 // </synopsis>
70 
71 // <example>
72 // <srcBlock>
73 // </srcBlock>
74 // </example>
75 
76 // <motivation>
77 // </motivation>
78 
79 // <todo asof="1990/03/31">
80 // <li>
81 // </todo>
82 
83 
85 {
86 public:
87 
89 
90 // Box-car smoothing kernel
92 
93 // Gaussian smoothing kernel
95 
96 // Hanning smoothing kernel
98 
100 
101 // Create kernel vector for width in pixels. For Gaussian, width is FWHM,
102 // for Boxcar, width is full width. For Hanning width is ignored.
103 // If useShapeExactly is True, the provided shape is used exactly.
104 // If useShapeExactly is False,
105 // the kernel length will be the max of the provided shape and an
106 // autoestimate (e.g. from +/- 5sigma limits for a Gaussian).
107 // <group>
108  static Vector<Double> make(KernelTypes kernelType, Double width,
109  uInt shape, Bool useShapeExactly, Bool peakIsUnity=False);
110  static Vector<Float> make(KernelTypes kernelType, Float width,
111  uInt shape, Bool useShapeExactly, Bool peakIsUnity=False);
112 // </group>
113 
114 
115 // Helper function to convert a string containing a list of desired smoothed kernel types
116 // to the correct <src>Vector<Int></src> required for the <src>setSmooth</src> function.
117 // This may be usful if your user interface involves strings rather than integers.
118 // A new value is added to the output vector (which is resized appropriately) if any of the
119 // substrings "boxcar", "gaussian" or "hanning" (actually "box", "gauss", and "hann"
120 // will do) is present.
121  static Vector<Int> toKernelTypes (const String& kernels,
122  const std::regex& delimiter);
123  static Vector<Int> toKernelTypes (const Vector<String>& kernels);
125  static String fromKernelType (KernelTypes kernelType);
126 };
127 
128 
129 } //# NAMESPACE CASACORE - END
130 
131 #endif
132 
String: the storage and methods of handling collections of characters.
Definition: String.h:225
@ HANNING
Hanning smoothing kernel.
Definition: VectorKernel.h:97
@ GAUSSIAN
Gaussian smoothing kernel.
Definition: VectorKernel.h:94
@ BOXCAR
Box-car smoothing kernel.
Definition: VectorKernel.h:91
static Vector< Int > toKernelTypes(const Vector< String > &kernels)
static Vector< Double > make(KernelTypes kernelType, Double width, uInt shape, Bool useShapeExactly, Bool peakIsUnity=False)
Create kernel vector for width in pixels.
static VectorKernel::KernelTypes toKernelType(const String &kernel)
static Vector< Int > toKernelTypes(const String &kernels, const std::regex &delimiter)
Helper function to convert a string containing a list of desired smoothed kernel types to the correct...
static String fromKernelType(KernelTypes kernelType)
static Vector< Float > make(KernelTypes kernelType, Float width, uInt shape, Bool useShapeExactly, Bool peakIsUnity=False)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
unsigned int uInt
Definition: aipstype.h:51
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Definition: ExprNode.h:1987
float Float
Definition: aipstype.h:54
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition: ExprNode.h:1483
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55