casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
VectorKernel.h
Go to the documentation of this file.
00001 //# VectorKernel.h: generate Vector kernels
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: VectorKernel.h 19880 2007-02-15 04:10:07Z Malte.Marquarding $
00027 
00028 #ifndef SCIMATH_VECTORKERNEL_H
00029 #define SCIMATH_VECTORKERNEL_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <casa/Arrays/Vector.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 //# Forward Declarations
00039 class Regex;
00040 class String;
00041 
00042 // <summary>
00043 // Make a Vector smoothing kernel from a kernel specification
00044 // </summary>
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 //   <li> <linkto class="Vector">Vector</linkto>
00053 //   <li> <linkto class="SepImageConvolver">SepImageConvolver</linkto>
00054 // </prerequisite>
00055 
00056 // <etymology>
00057 // Returns a vector from a smoothing kernel specification.
00058 // </etymology>
00059 
00060 // <synopsis>
00061 // This class takes a smoothing kernel type and a width, and
00062 // generates  a Vector holding that kernel.  It can be used
00063 // in conjunction with the separable image convolver,
00064 // SepImageConvolver
00065 //
00066 // The kernels can be normalized so that the peak of the
00067 // kernel is 1, or 1/area under the kernel. The latter ensures
00068 // conservation of integrated pixel value (the usual jargon
00069 // is conservation of flux for images) and is the default.
00070 // </synopsis>
00071 
00072 // <example>
00073 // <srcBlock>
00074 // </srcBlock>
00075 // </example>
00076 
00077 // <motivation>
00078 // </motivation>
00079 
00080 // <todo asof="1990/03/31">
00081 //   <li> 
00082 // </todo>
00083  
00084 
00085 class VectorKernel
00086 {
00087 public:
00088 
00089 enum KernelTypes {
00090 
00091 // Box-car smoothing kernel
00092    BOXCAR,
00093 
00094 // Gaussian smoothing kernel
00095    GAUSSIAN,
00096 
00097 // Hanning smoothing kernel
00098    HANNING,
00099 
00100    NKERNELS};
00101 
00102 // Create kernel vector for width in pixels.  For Gaussian, width is FWHM,
00103 // for Boxcar, width is full width.  For Hanning width is ignored (always 3)
00104 // If useShapeExactly is True, the provided shape is used exactly. 
00105 // If useShapeExactly is False,
00106 // the kernel length will be the max of the provided shape and an
00107 // autoestimate (e.g. from +/- 5sigma limits for a Gaussian).  
00108 // The output shape is always 3 for Hanning.
00109 // <group>   
00110    static Vector<Double> make(KernelTypes kernelType, Double width, 
00111                               uInt shape, Bool useShapeExactly, Bool peakIsUnity=False);
00112    static Vector<Float> make(KernelTypes kernelType, Float width, 
00113                              uInt shape, Bool useShapeExactly, Bool peakIsUnity=False);
00114 // </group>   
00115 
00116 
00117 // Helper function to convert a string containing a list of desired smoothed kernel types
00118 // to the correct <src>Vector<Int></src> required for the <src>setSmooth</src> function.
00119 // This may be usful if your user interface involves strings rather than integers.
00120 // A new value is added to the output vector (which is resized appropriately) if any of the 
00121 // substrings "boxcar", "gaussian" or "hanning" (actually "box", "gauss", and "hann"
00122 // will do) is present.
00123    static Vector<Int> toKernelTypes (const String& kernels,
00124                                      const Regex& delimiter);
00125    static Vector<Int> toKernelTypes (const Vector<String>& kernels);
00126    static VectorKernel::KernelTypes toKernelType (const String& kernel);
00127    static String fromKernelType (KernelTypes kernelType);
00128 };
00129 
00130 
00131 } //# NAMESPACE CASA - END
00132 
00133 #endif
00134